From 6a37e93d913dc94a0904552c8da6ada9c96cc200 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Tue, 16 Feb 2021 21:48:19 +0100 Subject: [PATCH 001/923] Use numpy and scipy to speed up pileupCalc.py Tested with a calcMode='true' and a calcMode='observed' example, for the former identical results, for the latter there are some differences the level of 1.e-12 --- RecoLuminosity/LumiDB/scripts/pileupCalc.py | 165 ++++++++------------ 1 file changed, 61 insertions(+), 104 deletions(-) diff --git a/RecoLuminosity/LumiDB/scripts/pileupCalc.py b/RecoLuminosity/LumiDB/scripts/pileupCalc.py index 4b77369b54c73..a434265f681c5 100755 --- a/RecoLuminosity/LumiDB/scripts/pileupCalc.py +++ b/RecoLuminosity/LumiDB/scripts/pileupCalc.py @@ -6,8 +6,8 @@ import argparse from RecoLuminosity.LumiDB import pileupParser from RecoLuminosity.LumiDB import selectionParser -from math import exp -from math import sqrt +import numpy as np +from scipy.special import loggamma import six def parseInputFile(inputfilename): @@ -22,10 +22,9 @@ def parseInputFile(inputfilename): runlsbyfile=p.runsandls() return runlsbyfile -def MyErf(input): - +def MyErf(xInput): # Abramowitz and Stegun approximations for Erf (equations 7.1.25-28) - X = abs(input) + X = np.abs(xInput) p = 0.47047 b1 = 0.3480242 @@ -33,12 +32,9 @@ def MyErf(input): b3 = 0.7478556 T = 1.0/(1.0+p*X) - cErf = 1.0 - (b1*T + b2*T*T + b3*T*T*T)*exp(-1.0*X*X) - if input<0: - cErf = -1.0*cErf + cErf = 1.0 - (b1*T + b2*T*T + b3*T*T*T)*np.exp(-1.0*X*X) # Alternate Erf approximation: - #A1 = 0.278393 #A2 = 0.230389 #A3 = 0.000972 @@ -48,13 +44,30 @@ def MyErf(input): #denom = term*term*term*term #dErf = 1.0 - 1.0/denom - #if input<0: - # dErf = -1.0*dErf - - return cErf - -def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls): + return np.where(xInput < 0, -cErf, cErf) + +def poisson(x, par): + ## equivalent to TMath::Poisson (without x<0 and par<0 checks) + return np.where(x == 0., np.exp(-par), + np.exp(x*np.log(par)-loggamma(x+1)-par)) + +class EquidistantBinning(object): + def __init__(self, num, xMin, xMax): + self.num = num + self.xMin = xMin + self.xMax = xMax + self.edges = np.linspace(xMin, xMax, num=num+1) + self.centers = .5*(self.edges[:-1] + self.edges[1:]) + @property + def width(self): + return (self.xMax-self.xMin)/self.num + def find(self, x): + return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(np.int) + +Sqrt2 = np.sqrt(2) + +def fillPileupHistogram(lumiInfo, calcOption, binning, hContents, minbXsec, run, ls): ''' lumiinfo:[intlumi per LS, mean interactions ] @@ -65,96 +78,39 @@ def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls): RMSInt = lumiInfo[1]*minbXsec AveNumInt = lumiInfo[2]*minbXsec - #coeff = 0 - - #if RMSInt > 0: - # coeff = 1.0/RMSInt/sqrt(6.283185) - - #expon = 2.0*RMSInt*RMSInt - - Sqrt2 = sqrt(2) - - ##Nbins = hist.GetXaxis().GetNbins() - - ProbFromRMS = [] - BinWidth = hist.GetBinWidth(1) - # First, re-constitute lumi distribution for this LS from RMS: if RMSInt > 0: - - AreaLnew = -10. - AreaL = 0 - - for obs in range (Nbins): - #Old Gaussian normalization; inaccurate for small rms and large bins - #val = hist.GetBinCenter(obs+1) - #prob = coeff*exp(-1.0*(val-AveNumInt)*(val-AveNumInt)/expon) - #ProbFromRMS.append(prob) - - left = hist.GetBinLowEdge(obs+1) - right = left+BinWidth - - argR = (AveNumInt-right)/Sqrt2/RMSInt - AreaR = MyErf(argR) - - if AreaLnew<-5.: - argL = (AveNumInt-left)/Sqrt2/RMSInt - AreaL = MyErf(argL) - else: - AreaL = AreaLnew - AreaLnew = AreaR # save R bin value for L next time - - NewProb = (AreaL-AreaR)*0.5 - - ProbFromRMS.append(NewProb) - - #print left, right, argL, argR, AreaL, AreaR, NewProb - + areaAbove = MyErf((AveNumInt-binning.edges)/Sqrt2/RMSInt) + ## area above edge, so areaAbove[i]-areaAbove[i+1] = area in bin + ProbFromRMS = .5*(areaAbove[:-1]-areaAbove[1:]) else: - obs = hist.FindBin(AveNumInt) - for bin in range (Nbins): - ProbFromRMS.append(0.0) - if obs= 1.0E-5 ): # just ignore zero values ProbFromRMS[obs] = 1.0 - if AveNumInt < 1.0E-5: - ProbFromRMS[obs] = 0. # just ignore zero values if calcOption == 'true': # Just put distribution into histogram if RMSInt > 0: - totalProb = 0 - for obs in range (Nbins): - prob = ProbFromRMS[obs] - val = hist.GetBinCenter(obs+1) - #print obs, val, RMSInt,coeff,expon,prob - totalProb += prob - hist.Fill (val, prob * LSintLumi) - + hContents += ProbFromRMS*LSintLumi + totalProb = np.sum(ProbFromRMS) + if 1.0-totalProb > 0.01: print("Run %d, LS %d: Significant probability density outside of your histogram (mean %.2f," % (run, ls, AveNumInt)) print("rms %.2f, integrated probability %.3f). Consider using a higher value of --maxPileupBin." % (RMSInt, totalProb)) else: - hist.Fill(AveNumInt,LSintLumi) + hContents[obs] += LSintLumi ## obs = FindBin(AveNumInt), -1 because hContents has no overflows else: # have to convolute with a poisson distribution to get observed Nint - totalProb = 0 - Peak = 0 - BinWidth = hist.GetBinWidth(1) - for obs in range (Nbins): - Peak = hist.GetBinCenter(obs+1) - RMSWeight = ProbFromRMS[obs] - for bin in range (Nbins): - val = hist.GetBinCenter(bin+1)-0.5*BinWidth - prob = ROOT.TMath.Poisson (val, Peak) - totalProb += prob - hist.Fill (val, prob * LSintLumi * RMSWeight) - - if 1.0-totalProb > 0.01: - print("Run %d, LS %d: significant probability density outside of your histogram" % (run, ls)) - print("Consider using a higher value of --maxPileupBin") - - - return hist - - + if not hasattr(binning, "poissConv"): ## only depends on binning, cache + ## poissConv[i,j] = TMath.Poisson(e[i], c[j]) + binning.poissConv = poisson( + binning.edges[:-1,np.newaxis], ## e'[i,] = e[i] + binning.centers[np.newaxis,:]) ## c'[,j] = c[j] + # prob[i] = sum_j ProbFromRMS[j]*TMath.Poisson(e[i], c[j]) + prob = np.sum(binning.poissConv * ProbFromRMS[np.newaxis,:], axis=1) + hContents += prob*LSintLumi + #if ( not np.all(ProbFromRMS == 0) ) and 1.0-np.sum(prob) > 0.01: + # print("Run %d, LS %d: significant probability density outside of your histogram, %f" % (run, ls, np.sum(prob))) + # print("Consider using a higher value of --maxPileupBin") ############################## ## ######################## ## @@ -205,13 +161,8 @@ def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls): print('\tmaxPileupBin:', options.maxPileupBin) print('\tnumPileupBins:', options.numPileupBins) - import ROOT - pileupHist = ROOT.TH1D (options.pileupHistName,options.pileupHistName, - options.numPileupBins, - 0., options.maxPileupBin) - - nbins = options.numPileupBins - upper = options.maxPileupBin + binning = EquidistantBinning(options.numPileupBins, 0., options.maxPileupBin) + hContents = np.zeros(binning.centers.shape) inpf = open(options.inputfile, 'r') inputfilecontent = inpf.read() @@ -236,8 +187,9 @@ def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls): #print "found LS %d" % (LSnumber) lumiInfo = LSPUlist[LSnumber] # print lumiInfo - fillPileupHistogram(lumiInfo, options.calcMode, pileupHist, - options.minBiasXsec, nbins, run, LSnumber) + fillPileupHistogram(lumiInfo, options.calcMode, + binning, hContents, + options.minBiasXsec, run, LSnumber) else: # trouble print("Run %d, LumiSection %d not found in Lumi/Pileup input file. Check your files!" \ % (run,LSnumber)) @@ -248,11 +200,16 @@ def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls): # print run # print lslist + ## convert hContents to TH1F + import ROOT + pileupHist = ROOT.TH1D(options.pileupHistName, options.pileupHistName, + options.numPileupBins, 0., options.maxPileupBin) + for i,ct in enumerate(hContents): + pileupHist.SetBinContent(i+1, ct) + histFile = ROOT.TFile.Open(output, 'recreate') if not histFile: raise RuntimeError("Could not open '%s' as an output root file" % output) pileupHist.Write() - #for hist in histList: - # hist.Write() histFile.Close() print("Wrote output histogram to", output) From 927b11aacb7acea75b4d024fc595f207263efa28 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 18 Jul 2021 21:03:19 +0200 Subject: [PATCH 002/923] Merge plugin source files in RecoLocalCalo/CaloTowers and CastorReco --- .../src/CaloTowerCandidateCreator.cc | 49 ++++++++-- .../src/CaloTowerCandidateCreator.h | 40 -------- .../src/CaloTowersCreationAlgo.cc | 4 +- .../CaloTowersCreationAlgo.h | 0 .../src/CaloTowersCreator.cc | 92 +++++++++++++++++-- .../CaloTowersCreator/src/CaloTowersCreator.h | 87 ------------------ .../CaloTowersCreator/src/CaloTowersMerger.cc | 14 +-- .../src/CaloTowersReCreator.cc | 39 +++++++- .../src/CaloTowersReCreator.h | 41 --------- .../{interface => src}/EScales.h | 0 .../CaloTowersCreator/src/HcalMaterials.cc | 4 +- .../{interface => src}/HcalMaterials.h | 0 .../CaloTowersCreator/src/SealModule.cc | 11 --- .../plugins/CastorSimpleReconstructor.cc | 54 +++++++++-- .../plugins/CastorSimpleReconstructor.h | 45 --------- .../CastorReco/plugins/SealModule.cc | 7 -- 16 files changed, 222 insertions(+), 265 deletions(-) delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h rename RecoLocalCalo/CaloTowersCreator/{interface => src}/CaloTowersCreationAlgo.h (100%) delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h rename RecoLocalCalo/CaloTowersCreator/{interface => src}/EScales.h (100%) rename RecoLocalCalo/CaloTowersCreator/{interface => src}/HcalMaterials.h (100%) delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/SealModule.cc delete mode 100644 RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h delete mode 100644 RecoLocalCalo/CastorReco/plugins/SealModule.cc diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc index e2cf0b846cb83..5699153e67f6e 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc @@ -1,12 +1,49 @@ -// makes CaloTowerCandidates from CaloTowers -// original author: L.Lista INFN -// modifyed by: F.Ratnikov UMd -#include -#include "DataFormats/RecoCandidate/interface/RecoCaloTowerCandidate.h" +/** \class CaloTowerCandidateCreator + * + * Framework module that produces a collection + * of candidates with a CaloTowerCandidate compoment + * + * \author Luca Lista, INFN + * modifyed by: F.Ratnikov UMd + * + * + */ +#include "DataFormats/CaloTowers/interface/CaloTower.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/RecoCandidate/interface/RecoCaloTowerCandidate.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h" + +#include +#include + +class CaloTowerCandidateCreator : public edm::stream::EDProducer<> { +public: + /// constructor from parameter set + CaloTowerCandidateCreator(const edm::ParameterSet&); + /// destructor + ~CaloTowerCandidateCreator() override; + +private: + /// process one event + void produce(edm::Event& e, const edm::EventSetup&) override; + /// verbosity + int mVerbose; + /// token of source collection + edm::EDGetTokenT tok_src_; + /// ET threshold + double mEtThreshold; + /// E threshold + double mEThreshold; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +// remove following line after Jet/Met move to using +// exclusively CaloTowers +DEFINE_FWK_MODULE(CaloTowerCandidateCreator); + using namespace edm; using namespace reco; using namespace std; diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h deleted file mode 100644 index e8df2c32d546b..0000000000000 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef CaloTowersCreator_CaloTowerCandidateCreator_h -#define CaloTowersCreator_CaloTowerCandidateCreator_h - -/** \class CaloTowerCandidateCreator - * - * Framework module that produces a collection - * of candidates with a CaloTowerCandidate compoment - * - * \author Luca Lista, INFN - * - * - * - */ -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/CaloTowers/interface/CaloTower.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include - -class CaloTowerCandidateCreator : public edm::stream::EDProducer<> { -public: - /// constructor from parameter set - CaloTowerCandidateCreator(const edm::ParameterSet&); - /// destructor - ~CaloTowerCandidateCreator() override; - -private: - /// process one event - void produce(edm::Event& e, const edm::EventSetup&) override; - /// verbosity - int mVerbose; - /// token of source collection - edm::EDGetTokenT tok_src_; - /// ET threshold - double mEtThreshold; - /// E threshold - double mEThreshold; -}; - -#endif diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc index e2d65314ecc31..6dd974d999d64 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc @@ -1,4 +1,5 @@ -#include "RecoLocalCalo/CaloTowersCreator/interface/CaloTowersCreationAlgo.h" +#include "CaloTowersCreationAlgo.h" + #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "Geometry/CaloTopology/interface/CaloTowerTopology.h" #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" @@ -7,6 +8,7 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Math/Interpolator.h" + #include //#define EDM_ML_DEBUG diff --git a/RecoLocalCalo/CaloTowersCreator/interface/CaloTowersCreationAlgo.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.h similarity index 100% rename from RecoLocalCalo/CaloTowersCreator/interface/CaloTowersCreationAlgo.h rename to RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.h diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc index cf0201635843c..25a7e9c48a207 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc @@ -1,13 +1,93 @@ -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +/** \class CaloTowersCreator + * + * Original author: J. Mans - Minnesota + */ + +// Now we allow for the creation of towers from +// rejected hists as well: requested by the MET group +// for studies of the effect of noise clean up. + +#include "CaloTowersCreationAlgo.h" +#include "EScales.h" + +#include "CommonTools/Utils/interface/StringToEnumValue.h" +#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/CaloTowerTopology.h" -// severity level for ECAL +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" -#include "CommonTools/Utils/interface/StringToEnumValue.h" -//#define EDM_ML_DEBUG +class CaloTowersCreator : public edm::stream::EDProducer<> { +public: + explicit CaloTowersCreator(const edm::ParameterSet& ps); + ~CaloTowersCreator() override {} + void produce(edm::Event& e, const edm::EventSetup& c) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + double EBEScale, EEEScale, HBEScale, HESEScale; + double HEDEScale, HOEScale, HF1EScale, HF2EScale; + +private: + static const std::vector& getGridValues(); + + CaloTowersCreationAlgo algo_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + std::vector ecalLabels_; + std::vector > toks_ecal_; + bool allowMissingInputs_; + + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_topo_; + edm::ESGetToken tok_cttopo_; + edm::ESGetToken tok_ctmap_; + edm::ESGetToken tok_ecalChStatus_; + edm::ESGetToken tok_hcalChStatus_; + edm::ESGetToken tok_hcalSevComputer_; + edm::ESGetToken tok_ecalSevAlgo_; + + // more compact flags: all HCAL are combined + + unsigned int theHcalAcceptSeverityLevel_; + std::vector theEcalSeveritiesToBeExcluded_; + + // flag to use recovered hits + bool theRecoveredHcalHitsAreUsed_; + bool theRecoveredEcalHitsAreUsed_; + + // paramaters for creating towers from rejected hits + + bool useRejectedHitsOnly_; + unsigned int theHcalAcceptSeverityLevelForRejectedHit_; + // for ECAL we have a list of problem flags + std::vector theEcalSeveritiesToBeUsedInBadTowers_; + + // Flags wheteher to use recovered hits for production of + // "bad towers". + // If the recoverd hits were already used for good towers, + // these flags have no effect. + // Note: These flags have no effect on the default tower reconstruction. + bool useRejectedRecoveredHcalHits_; + bool useRejectedRecoveredEcalHits_; + + edm::ESWatcher hcalSevLevelWatcher_; + edm::ESWatcher hcalChStatusWatcher_; + edm::ESWatcher caloTowerConstituentsWatcher_; + edm::ESWatcher ecalSevLevelWatcher_; + EScales eScales_; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CaloTowersCreator); CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf) : algo_(conf.getParameter("EBThreshold"), diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h deleted file mode 100644 index eff642e8166f4..0000000000000 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef RECOLOCALCALO_CALOTOWERSCREATOR_CALOTOWERSCREATOR_H -#define RECOLOCALCALO_CALOTOWERSCREATOR_CALOTOWERSCREATOR_H 1 - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESWatcher.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" -#include "RecoLocalCalo/CaloTowersCreator/interface/CaloTowersCreationAlgo.h" -#include "RecoLocalCalo/CaloTowersCreator/interface/EScales.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -/** \class CaloTowersCreator - * - * Original author: J. Mans - Minnesota - */ - -// Now we allow for the creation of towers from -// rejected hists as well: requested by the MET group -// for studies of the effect of noise clean up. - -class CaloTowersCreator : public edm::stream::EDProducer<> { -public: - explicit CaloTowersCreator(const edm::ParameterSet& ps); - ~CaloTowersCreator() override {} - void produce(edm::Event& e, const edm::EventSetup& c) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - double EBEScale, EEEScale, HBEScale, HESEScale; - double HEDEScale, HOEScale, HF1EScale, HF2EScale; - -private: - static const std::vector& getGridValues(); - - CaloTowersCreationAlgo algo_; - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - std::vector ecalLabels_; - std::vector > toks_ecal_; - bool allowMissingInputs_; - - edm::ESGetToken tok_geom_; - edm::ESGetToken tok_topo_; - edm::ESGetToken tok_cttopo_; - edm::ESGetToken tok_ctmap_; - edm::ESGetToken tok_ecalChStatus_; - edm::ESGetToken tok_hcalChStatus_; - edm::ESGetToken tok_hcalSevComputer_; - edm::ESGetToken tok_ecalSevAlgo_; - - // more compact flags: all HCAL are combined - - unsigned int theHcalAcceptSeverityLevel_; - std::vector theEcalSeveritiesToBeExcluded_; - - // flag to use recovered hits - bool theRecoveredHcalHitsAreUsed_; - bool theRecoveredEcalHitsAreUsed_; - - // paramaters for creating towers from rejected hits - - bool useRejectedHitsOnly_; - unsigned int theHcalAcceptSeverityLevelForRejectedHit_; - // for ECAL we have a list of problem flags - std::vector theEcalSeveritiesToBeUsedInBadTowers_; - - // Flags wheteher to use recovered hits for production of - // "bad towers". - // If the recoverd hits were already used for good towers, - // these flags have no effect. - // Note: These flags have no effect on the default tower reconstruction. - bool useRejectedRecoveredHcalHits_; - bool useRejectedRecoveredEcalHits_; - - edm::ESWatcher hcalSevLevelWatcher_; - edm::ESWatcher hcalChStatusWatcher_; - edm::ESWatcher caloTowerConstituentsWatcher_; - edm::ESWatcher ecalSevLevelWatcher_; - EScales eScales_; -}; - -#endif diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc index 401b6e6f525b3..10182757fbcac 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc @@ -22,20 +22,14 @@ // This functionality is subject to some restrictions // (see notes below) -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" - +#include "DataFormats/CaloTowers/interface/CaloTower.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h" -#include "DataFormats/CaloTowers/interface/CaloTower.h" +#include // // class declaration diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc index 521abe5c9a9db..7300963904774 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc @@ -1,5 +1,42 @@ -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h" +/** \class CaloTowersReCreator + * + */ + +#include "CaloTowersCreationAlgo.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/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloTopology/interface/CaloTowerTopology.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + +class CaloTowersReCreator : public edm::stream::EDProducer<> { +public: + explicit CaloTowersReCreator(const edm::ParameterSet& ps); + ~CaloTowersReCreator() override {} + void produce(edm::Event& e, const edm::EventSetup& c) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + double EBEScale, EEEScale, HBEScale, HESEScale; + double HEDEScale, HOEScale, HF1EScale, HF2EScale; + +private: + CaloTowersCreationAlgo algo_; + edm::EDGetTokenT tok_calo_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_topo_; + edm::ESGetToken tok_cttopo_; + edm::ESGetToken tok_ctmap_; + bool allowMissingInputs_; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CaloTowersReCreator); CaloTowersReCreator::CaloTowersReCreator(const edm::ParameterSet& conf) : algo_(0., diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h deleted file mode 100644 index f822bc082717d..0000000000000 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef RECOLOCALCALO_CALOTOWERSCREATOR_CALOTOWERSRECREATOR_H -#define RECOLOCALCALO_CALOTOWERSCREATOR_CALOTOWERSRECREATOR_H 1 - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "Geometry/CaloTopology/interface/HcalTopology.h" -#include "Geometry/CaloTopology/interface/CaloTowerTopology.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "RecoLocalCalo/CaloTowersCreator/interface/CaloTowersCreationAlgo.h" - -/** \class CaloTowersReCreator - * - */ -class CaloTowersReCreator : public edm::stream::EDProducer<> { -public: - explicit CaloTowersReCreator(const edm::ParameterSet& ps); - ~CaloTowersReCreator() override {} - void produce(edm::Event& e, const edm::EventSetup& c) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - double EBEScale, EEEScale, HBEScale, HESEScale; - double HEDEScale, HOEScale, HF1EScale, HF2EScale; - -private: - CaloTowersCreationAlgo algo_; - edm::EDGetTokenT tok_calo_; - edm::ESGetToken tok_geom_; - edm::ESGetToken tok_topo_; - edm::ESGetToken tok_cttopo_; - edm::ESGetToken tok_ctmap_; - bool allowMissingInputs_; -}; - -#endif diff --git a/RecoLocalCalo/CaloTowersCreator/interface/EScales.h b/RecoLocalCalo/CaloTowersCreator/src/EScales.h similarity index 100% rename from RecoLocalCalo/CaloTowersCreator/interface/EScales.h rename to RecoLocalCalo/CaloTowersCreator/src/EScales.h diff --git a/RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.cc b/RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.cc index 204c33c863282..e4b59a84c34bd 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.cc @@ -1,6 +1,6 @@ -#include +#include "HcalMaterials.h" -#include "RecoLocalCalo/CaloTowersCreator/interface/HcalMaterials.h" +#include HcalMaterials::HcalMaterials() {} diff --git a/RecoLocalCalo/CaloTowersCreator/interface/HcalMaterials.h b/RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.h similarity index 100% rename from RecoLocalCalo/CaloTowersCreator/interface/HcalMaterials.h rename to RecoLocalCalo/CaloTowersCreator/src/HcalMaterials.h diff --git a/RecoLocalCalo/CaloTowersCreator/src/SealModule.cc b/RecoLocalCalo/CaloTowersCreator/src/SealModule.cc deleted file mode 100644 index 83a313d30272a..0000000000000 --- a/RecoLocalCalo/CaloTowersCreator/src/SealModule.cc +++ /dev/null @@ -1,11 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h" -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h" -#include "RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h" - -DEFINE_FWK_MODULE(CaloTowersCreator); -DEFINE_FWK_MODULE(CaloTowersReCreator); -// remove following line after Jet/Met move to using -// exclusively CaloTowers -DEFINE_FWK_MODULE(CaloTowerCandidateCreator); diff --git a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc index 3e89d3190948c..4e9f49ed47461 100644 --- a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc +++ b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc @@ -1,19 +1,57 @@ -#include "CastorSimpleReconstructor.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/Common/interface/EDCollection.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "CalibFormats/CastorObjects/interface/CastorCoderDb.h" #include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" +#include "CalibFormats/CastorObjects/interface/CastorCoderDb.h" +#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" +#include "CalibFormats/CastorObjects/interface/CastorDbService.h" #include "CondFormats/CastorObjects/interface/CastorChannelQuality.h" #include "CondFormats/CastorObjects/interface/CastorChannelStatus.h" +#include "CondFormats/CastorObjects/interface/CastorRecoParams.h" +#include "CondFormats/CastorObjects/interface/CastorSaturationCorrs.h" #include "CondFormats/DataRecord/interface/CastorChannelQualityRcd.h" +#include "CondFormats/DataRecord/interface/CastorRecoParamsRcd.h" +#include "CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h" +#include "DataFormats/Common/interface/EDCollection.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/METReco/interface/HcalCaloFlagLabels.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" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "RecoLocalCalo/CastorReco/interface/CastorSimpleRecAlgo.h" + #include +class CastorSimpleReconstructor : public edm::stream::EDProducer<> { +public: + explicit CastorSimpleReconstructor(const edm::ParameterSet& ps); + ~CastorSimpleReconstructor() override; + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + CastorSimpleRecAlgo reco_; + DetId::Detector det_; + int subdet_; + // HcalOtherSubdetector subdetOther_; + edm::EDGetTokenT tok_input_; + edm::ESGetToken tok_conditions_; + edm::ESGetToken tok_recoParams_; + edm::ESGetToken tok_satCorr_; + + int firstSample_; + int samplesToAdd_; + int maxADCvalue_; + bool tsFromDB_; + bool setSaturationFlag_; + bool doSaturationCorr_; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CastorSimpleReconstructor); + using namespace std; CastorSimpleReconstructor::CastorSimpleReconstructor(edm::ParameterSet const& conf) diff --git a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h deleted file mode 100644 index 92d71c58f67fd..0000000000000 --- a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CASTORSIMPLERECONSTRUCTOR_H -#define CASTORSIMPLERECONSTRUCTOR_H 1 - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "RecoLocalCalo/CastorReco/interface/CastorSimpleRecAlgo.h" -#include "CalibFormats/CastorObjects/interface/CastorDbService.h" -#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" -#include "CondFormats/DataRecord/interface/CastorRecoParamsRcd.h" -#include "CondFormats/CastorObjects/interface/CastorRecoParams.h" -#include "CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h" -#include "CondFormats/CastorObjects/interface/CastorSaturationCorrs.h" - -class CastorSimpleReconstructor : public edm::stream::EDProducer<> { -public: - explicit CastorSimpleReconstructor(const edm::ParameterSet& ps); - ~CastorSimpleReconstructor() override; - void produce(edm::Event& e, const edm::EventSetup& c) override; - -private: - CastorSimpleRecAlgo reco_; - DetId::Detector det_; - int subdet_; - // HcalOtherSubdetector subdetOther_; - edm::EDGetTokenT tok_input_; - edm::ESGetToken tok_conditions_; - edm::ESGetToken tok_recoParams_; - edm::ESGetToken tok_satCorr_; - - int firstSample_; - int samplesToAdd_; - int maxADCvalue_; - bool tsFromDB_; - bool setSaturationFlag_; - bool doSaturationCorr_; -}; - -#endif diff --git a/RecoLocalCalo/CastorReco/plugins/SealModule.cc b/RecoLocalCalo/CastorReco/plugins/SealModule.cc deleted file mode 100644 index c33a2f826bf5a..0000000000000 --- a/RecoLocalCalo/CastorReco/plugins/SealModule.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "CastorSimpleReconstructor.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" - -DEFINE_FWK_MODULE(CastorSimpleReconstructor); From 2e9cf7f71adf880b2774fbc286b1e475aaa672e6 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 24 Jul 2021 23:41:17 +0900 Subject: [PATCH 003/923] reduce GEMDigiSimLink size --- .../GEMDigiSimLink/interface/GEMDigiSimLink.h | 65 ++++++------------- .../GEMDigiSimLink/src/classes_def.xml | 6 +- 2 files changed, 24 insertions(+), 47 deletions(-) diff --git a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h index e28c0eb1d2c79..96c066fd1e146 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h @@ -8,57 +8,32 @@ class GEMDigiSimLink { public: - GEMDigiSimLink(std::pair digi, - Local3DPoint entryPoint, - LocalVector momentumAtEntry, - float timeOfFlight, - float energyLoss, - int particleType, - unsigned int detUnitId, - unsigned int trackId, - EncodedEventId eventId, - unsigned short processType) { - _entryPoint = entryPoint; - _momentumAtEntry = momentumAtEntry; - _timeOfFlight = timeOfFlight; - _energyLoss = energyLoss; - _particleType = particleType; - _detUnitId = detUnitId; - _trackId = trackId; - _eventId = eventId; - _processType = processType; - _digi = digi; + GEMDigiSimLink(uint16_t strip, int8_t bx, uint32_t detUnitId, + uint32_t trackId, EncodedEventId eventId) + { + strip_ = strip; + bx_ = bx; + detUnitId_ = detUnitId; + trackId_ = trackId; + eventId_ = eventId; } - GEMDigiSimLink() { ; } + GEMDigiSimLink() { } + ~GEMDigiSimLink() { } - ~GEMDigiSimLink() { ; } - - unsigned int getStrip() const { return _digi.first; } - int getBx() const { return _digi.second; } - Local3DPoint getEntryPoint() const { return _entryPoint; } - LocalVector getMomentumAtEntry() const { return _momentumAtEntry; } - float getTimeOfFlight() const { return _timeOfFlight; } - float getEnergyLoss() const { return _energyLoss; } - int getParticleType() const { return _particleType; } - unsigned int getDetUnitId() const { return _detUnitId; } - unsigned int getTrackId() const { return _trackId; } - EncodedEventId getEventId() const { return _eventId; } - unsigned short getProcessType() const { return _processType; } + unsigned int getStrip() const { return strip_; } + int getBx() const { return bx_; } + unsigned int getDetUnitId() const { return detUnitId_; } + unsigned int getTrackId() const { return trackId_; } + EncodedEventId getEventId() const { return eventId_; } inline bool operator<(const GEMDigiSimLink& other) const { return getStrip() < other.getStrip(); } private: - std::pair _digi; - - Local3DPoint _entryPoint; - LocalVector _momentumAtEntry; - float _timeOfFlight; - float _energyLoss; - int _particleType; - unsigned int _detUnitId; - unsigned int _trackId; - EncodedEventId _eventId; - unsigned short _processType; + uint16_t strip_; + int8_t bx_; + uint32_t detUnitId_; + uint32_t trackId_; + EncodedEventId eventId_; }; #endif diff --git a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml index 7dccd998c58bb..b687a72601143 100644 --- a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml @@ -1,6 +1,7 @@ - + + @@ -11,7 +12,8 @@ - + + From e442b5862fbe7617d9fcf4184afdc00bbf597b10 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Wed, 28 Jul 2021 11:20:41 +0200 Subject: [PATCH 004/923] PayloadInspector moved to pybind11 --- CondCore/Utilities/BuildFile.xml | 1 - .../Utilities/interface/PayloadInspector.h | 39 ++++++++++--------- .../interface/PayloadInspectorModule.h | 23 ++++++----- .../plugins/BasicP_PayloadInspector.cc | 6 +-- CondCore/Utilities/plugins/BuildFile.xml | 3 +- .../plugins/Module_PayloadInspector.cc | 12 +++--- CondCore/Utilities/src/PayloadInspector.cc | 32 +++++++-------- 7 files changed, 61 insertions(+), 55 deletions(-) diff --git a/CondCore/Utilities/BuildFile.xml b/CondCore/Utilities/BuildFile.xml index eca5755e41a15..c107dfe203abb 100644 --- a/CondCore/Utilities/BuildFile.xml +++ b/CondCore/Utilities/BuildFile.xml @@ -2,7 +2,6 @@ - diff --git a/CondCore/Utilities/interface/PayloadInspector.h b/CondCore/Utilities/interface/PayloadInspector.h index 11d873675082d..a682206067076 100644 --- a/CondCore/Utilities/interface/PayloadInspector.h +++ b/CondCore/Utilities/interface/PayloadInspector.h @@ -14,25 +14,27 @@ #include "FWCore/Utilities/interface/GlobalIdentifier.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include -#include +#include +#include +namespace py = pybind11; namespace PI { - inline boost::python::list mk_input(const std::string& tagName, cond::Time_t start, cond::Time_t end) { - boost::python::list ret; - ret.append(boost::python::make_tuple(tagName, std::to_string(start), std::to_string(end))); + __attribute__((visibility("default"))) inline py::list mk_input(const std::string& tagName, + cond::Time_t start, + cond::Time_t end) { + py::list ret; + ret.append(py::make_tuple(tagName, std::to_string(start), std::to_string(end))); return ret; } - inline boost::python::list mk_input(const std::string& tagName0, - cond::Time_t start0, - cond::Time_t end0, - const std::string& tagName1, - cond::Time_t start1, - cond::Time_t end1) { - boost::python::list ret; - ret.append(boost::python::make_tuple(tagName0, std::to_string(start0), std::to_string(end0))); - ret.append(boost::python::make_tuple(tagName1, std::to_string(start1), std::to_string(end1))); + __attribute__((visibility("default"))) inline py::list mk_input(const std::string& tagName0, + cond::Time_t start0, + cond::Time_t end0, + const std::string& tagName1, + cond::Time_t start1, + cond::Time_t end1) { + py::list ret; + ret.append(py::make_tuple(tagName0, std::to_string(start0), std::to_string(end0))); + ret.append(py::make_tuple(tagName1, std::to_string(start1), std::to_string(end1))); return ret; } } // namespace PI @@ -228,16 +230,17 @@ namespace cond { bool isSingleIov() const; // required in the browser - boost::python::list inputParams() const; + __attribute__((visibility("default"))) py::list inputParams() const; // required in the browser - void setInputParamValues(const boost::python::dict& values); + __attribute__((visibility("default"))) void setInputParamValues(const py::dict& values); // returns the json file with the plot data std::string data() const; // triggers the processing producing the plot - bool process(const std::string& connectionString, const boost::python::list& tagsWithTimeBoundaries); + __attribute__((visibility("default"))) bool process(const std::string& connectionString, + const py::list& tagsWithTimeBoundaries); // called by the above method - to be used in C++ unit tests... bool exec_process(const std::string& connectionString, diff --git a/CondCore/Utilities/interface/PayloadInspectorModule.h b/CondCore/Utilities/interface/PayloadInspectorModule.h index 2dfa41c534671..a2f71dfbfa3f6 100644 --- a/CondCore/Utilities/interface/PayloadInspectorModule.h +++ b/CondCore/Utilities/interface/PayloadInspectorModule.h @@ -1,18 +1,21 @@ -#include +#include +namespace py = pybind11; #define PPCAT_NX(A, B) A##B #define PPCAT(A, B) PPCAT_NX(A, B) #define STRINGIZE_NX(A) #A #define STRINGIZE(A) STRINGIZE_NX(A) -#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) BOOST_PYTHON_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector) +#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME) PYBIND11_MODULE(plugin##PAYLOAD_TYPENAME##_PayloadInspector, m) -#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ - boost::python::class_ >( \ - STRINGIZE(PPCAT(plot_, CLASS_NAME)), boost::python::init<>()) \ - .def("process", &cond::payloadInspector::PlotBase::process) \ - .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) \ - .def("title", &cond::payloadInspector::PlotBase::title) \ - .def("isSingleIov", &cond::payloadInspector::PlotBase::isSingleIov) \ - .def("isTwoTags", &cond::payloadInspector::PlotBase::isTwoTags) \ +#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME) \ + py::class_( \ + m, \ + STRINGIZE(PPCAT(plot_, CLASS_NAME))) \ + .def(py::init<>()) \ + .def("process", &cond::payloadInspector::PlotBase::process) \ + .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) \ + .def("title", &cond::payloadInspector::PlotBase::title) \ + .def("isSingleIov", &cond::payloadInspector::PlotBase::isSingleIov) \ + .def("isTwoTags", &cond::payloadInspector::PlotBase::isTwoTags) \ .def("data", &cond::payloadInspector::PlotBase::data); diff --git a/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc b/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc index 35a4a52429b79..fbcd8389f8b9d 100644 --- a/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc +++ b/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc @@ -34,15 +34,15 @@ namespace { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("Factor"); if (ip != paramValues.end()) { - v = v * boost::lexical_cast(ip->second); + v = v * std::stof(ip->second); } ip = paramValues.find("Offset"); if (ip != paramValues.end()) { - v = v + boost::lexical_cast(ip->second); + v = v + std::stof(ip->second); } ip = paramValues.find("Scale"); if (ip != paramValues.end()) { - v = v * boost::lexical_cast(ip->second); + v = v * std::stof(ip->second); } return v; } diff --git a/CondCore/Utilities/plugins/BuildFile.xml b/CondCore/Utilities/plugins/BuildFile.xml index a102433193fa1..122db196be4f8 100644 --- a/CondCore/Utilities/plugins/BuildFile.xml +++ b/CondCore/Utilities/plugins/BuildFile.xml @@ -12,12 +12,13 @@ - + + diff --git a/CondCore/Utilities/plugins/Module_PayloadInspector.cc b/CondCore/Utilities/plugins/Module_PayloadInspector.cc index 7b7817534709b..6d8d82f732f46 100644 --- a/CondCore/Utilities/plugins/Module_PayloadInspector.cc +++ b/CondCore/Utilities/plugins/Module_PayloadInspector.cc @@ -1,11 +1,11 @@ #include "CondCore/Utilities/interface/PayloadInspector.h" -#include -#include +#include +namespace py = pybind11; -BOOST_PYTHON_MODULE(pluginModule_PayloadInspector) { - boost::python::class_("ModuleVersion") - .def_readonly("label", &cond::payloadInspector::ModuleVersion::label); - boost::python::class_("PlotBase") +PYBIND11_MODULE(pluginModule_PayloadInspector, m) { + py::class_(m, "ModuleVersion") + .def_readonly_static("label", &cond::payloadInspector::ModuleVersion::label); + py::class_(m, "PlotBase") .def("process", &cond::payloadInspector::PlotBase::process) .def("payloadType", &cond::payloadInspector::PlotBase::payloadType) .def("type", &cond::payloadInspector::PlotBase::type) diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index 15a0f80b4b6f3..82116f7501f79 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -5,7 +5,6 @@ #include #include -#include namespace cond { @@ -49,38 +48,39 @@ namespace cond { bool PlotBase::isTwoTags() const { return m_plotAnnotations.ntags == 2; } - boost::python::list PlotBase::inputParams() const { - boost::python::list tmp; + py::list PlotBase::inputParams() const { + py::list tmp; for (const auto& ip : m_inputParams) { tmp.append(ip); } return tmp; } - void PlotBase::setInputParamValues(const boost::python::dict& values) { - for (const auto& ip : m_inputParams) { - if (values.has_key(ip)) { - std::string val = boost::python::extract(values.get(ip)); - m_inputParamValues.insert(std::make_pair(ip, val)); + void PlotBase::setInputParamValues(const py::dict& values) { + for (auto item : values) { + std::string k = item.first.cast(); + std::string v = item.second.cast(); + if (m_inputParams.find(k) != m_inputParams.end()) { + m_inputParamValues.insert(std::make_pair(k, v)); } } } std::string PlotBase::data() const { return m_data; } - bool PlotBase::process(const std::string& connectionString, const boost::python::list& tagsWithTimeBoundaries) { - size_t nt = boost::python::len(tagsWithTimeBoundaries); + bool PlotBase::process(const std::string& connectionString, const py::list& tagsWithTimeBoundaries) { + size_t nt = py::len(tagsWithTimeBoundaries); bool ret = false; if (nt) { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - boost::python::tuple entry = boost::python::extract(tagsWithTimeBoundaries[i]); - std::string tagName = boost::python::extract(entry[0]); - std::string time0s = boost::python::extract(entry[1]); - std::string time1s = boost::python::extract(entry[2]); - cond::Time_t time0 = boost::lexical_cast(time0s); - cond::Time_t time1 = boost::lexical_cast(time1s); + py::tuple entry = tagsWithTimeBoundaries[i].cast(); + std::string tagName = entry[0].cast(); + std::string time0s = entry[1].cast(); + std::string time1s = entry[2].cast(); + cond::Time_t time0 = std::stoull(time0s); + cond::Time_t time1 = std::stoull(time1s); tags[i] = std::make_tuple(tagName, time0, time1); } ret = exec_process(connectionString, tags); From 8a52739c0deb2e1461f89a8a539c709cfdf9687f Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Wed, 28 Jul 2021 11:21:25 +0200 Subject: [PATCH 005/923] Fixed dependencies --- CondCore/EcalPlugins/plugins/EcalPyUtils.cc | 27 ++++++++++--------- .../test/testSiPixelPayloadInspector.cpp | 2 +- .../test/testSiStripPayloadInspector.cpp | 5 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CondCore/EcalPlugins/plugins/EcalPyUtils.cc b/CondCore/EcalPlugins/plugins/EcalPyUtils.cc index 27b0513b3ecd6..0922829b8164f 100644 --- a/CondCore/EcalPlugins/plugins/EcalPyUtils.cc +++ b/CondCore/EcalPlugins/plugins/EcalPyUtils.cc @@ -8,10 +8,13 @@ #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" -#include -#include +#include +namespace py = pybind11; -using namespace boost::python; +//#include +//#include + +//using namespace boost::python; namespace ecalpyutils { @@ -59,7 +62,7 @@ namespace ecalpyutils { } } // namespace ecalpyutils -BOOST_PYTHON_MODULE(pluginEcalPyUtils) { +PYBIND11_MODULE(pluginEcalPyUtils, m) { // looks like these are already defined somewhere // python access to stl integer vectors @@ -71,12 +74,12 @@ BOOST_PYTHON_MODULE(pluginEcalPyUtils) { // .def(vector_indexing_suite >()) // ; - def("hashedIndexToEtaPhi", &ecalpyutils::hashedIndexToEtaPhi); - def("hashedIndexToXY", &ecalpyutils::hashedIndexToXY); - def("hashedIndex", &ecalpyutils::hashedIndex); - def("hashedIndexEE", &ecalpyutils::hashedIndexEE); - def("ism", &ecalpyutils::ism); - def("barrelfromXML", &EcalFloatCondObjectContainerXMLTranslator::barrelfromXML); - def("endcapfromXML", &EcalFloatCondObjectContainerXMLTranslator::endcapfromXML); - def("arraystoXML", &ecalpyutils::arraystoXML); + m.def("hashedIndexToEtaPhi", &ecalpyutils::hashedIndexToEtaPhi); + m.def("hashedIndexToXY", &ecalpyutils::hashedIndexToXY); + m.def("hashedIndex", &ecalpyutils::hashedIndex); + m.def("hashedIndexEE", &ecalpyutils::hashedIndexEE); + m.def("ism", &ecalpyutils::ism); + m.def("barrelfromXML", &EcalFloatCondObjectContainerXMLTranslator::barrelfromXML); + m.def("endcapfromXML", &EcalFloatCondObjectContainerXMLTranslator::endcapfromXML); + m.def("arraystoXML", &ecalpyutils::arraystoXML); } diff --git a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp index 34b6ad1d50ed0..8a79edc14d72a 100644 --- a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp +++ b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp @@ -132,7 +132,7 @@ int main(int argc, char** argv) { histo16.process(connectionString, PI::mk_input(tag, end, end)); edm::LogPrint("testSiPixelPayloadInspector") << histo16.data() << std::endl; - boost::python::dict inputs; + py::dict inputs; inputs["SetLog"] = "True"; // sets to true, 1,True,Yes will work SiPixelGainCalibrationOfflineGainsValuesBarrel histo17; diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 285202ed5293c..ec3e2f0715e65 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) { std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline"; cond::Time_t start = boost::lexical_cast(132440); cond::Time_t end = boost::lexical_cast(285368); - boost::python::dict inputs; + py::dict inputs; edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl; @@ -112,7 +112,8 @@ int main(int argc, char** argv) { edm::LogPrint("testSiStripPayloadInspector") << histo11.data() << std::endl; SiStripPedestalPerDetId histoPedestalForDetId; - inputs["DetIds"] += ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds + inputs["DetIds"] = py::cast(inputs["DetIds"]) + + ",470065830,369121594,369124670,470177668"; // add a bunch of other DetIds histoPedestalForDetId.setInputParamValues(inputs); histoPedestalForDetId.process(connectionString, PI::mk_input(tag, start, start)); edm::LogPrint("testSiStripPayloadInspector") << histoPedestalForDetId.data() << std::endl; From 6b59c291d8259cce0de906688ad20497eadab201 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Wed, 28 Jul 2021 15:57:51 +0200 Subject: [PATCH 006/923] Removed obsolete commented code --- CondCore/EcalPlugins/plugins/EcalPyUtils.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CondCore/EcalPlugins/plugins/EcalPyUtils.cc b/CondCore/EcalPlugins/plugins/EcalPyUtils.cc index 0922829b8164f..a4e7a12f024fb 100644 --- a/CondCore/EcalPlugins/plugins/EcalPyUtils.cc +++ b/CondCore/EcalPlugins/plugins/EcalPyUtils.cc @@ -11,11 +11,6 @@ #include namespace py = pybind11; -//#include -//#include - -//using namespace boost::python; - namespace ecalpyutils { std::vector hashedIndexToEtaPhi(int hashedindex) { From 94b50fbfc92c4280189b321c366cb0f7b90ef3d0 Mon Sep 17 00:00:00 2001 From: Mariana Date: Wed, 28 Jul 2021 17:56:09 +0200 Subject: [PATCH 007/923] added HLT filter for PPS calibration --- HLTrigger/special/plugins/HLTPPSCalFilter.cc | 186 +++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 HLTrigger/special/plugins/HLTPPSCalFilter.cc diff --git a/HLTrigger/special/plugins/HLTPPSCalFilter.cc b/HLTrigger/special/plugins/HLTPPSCalFilter.cc new file mode 100644 index 0000000000000..406f56d0843ac --- /dev/null +++ b/HLTrigger/special/plugins/HLTPPSCalFilter.cc @@ -0,0 +1,186 @@ +// Mariana Araujo +// mariana.araujo@cern.ch +// 2020-12-30 +// +// HLT filter module to select events with min and max multiplicity +// in each tracker of the PPS for PCL +// Adapted from a preexisting filter code by Laurent Forthomme +// + +#include "FWCore/Framework/interface/global/EDFilter.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" + +#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" // pixel +#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" // strip +#include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h" // diamond + +#include + +class HLTPPSCalFilter : public edm::global::EDFilter<> { +public: + explicit HLTPPSCalFilter(const edm::ParameterSet&); + ~HLTPPSCalFilter() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions&); + bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + +private: + edm::InputTag pixelLocalTrackInputTag_; // Input tag identifying the pixel detector + edm::EDGetTokenT> pixelLocalTrackToken_; + + edm::InputTag stripLocalTrackInputTag_; // Input tag identifying the strip detector + edm::EDGetTokenT> stripLocalTrackToken_; + + edm::InputTag diamondLocalTrackInputTag_; // Input tag identifying the diamond detector + edm::EDGetTokenT> diamondLocalTrackToken_; + + int minTracks_; + int maxTracks_; + + bool do_express_; +}; + +void HLTPPSCalFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("pixelLocalTrackInputTag", edm::InputTag("ctppsPixelLocalTracks")) + ->setComment("input tag of the pixel local track collection"); + desc.add("stripLocalTrackInputTag", edm::InputTag("totemRPLocalTrackFitter")) + ->setComment("input tag of the strip local track collection"); + desc.add("diamondLocalTrackInputTag", edm::InputTag("ctppsDiamondLocalTracks")) + ->setComment("input tag of the diamond local track collection"); + + desc.add("minTracks", 1)->setComment("minimum number of tracks in pot"); + desc.add("maxTracks", -1)->setComment("maximum number of tracks in pot"); + + desc.add("do_express", true)->setComment("toggle on filter type; true for Express, false for Prompt"); + + desc.add("triggerType", trigger::TriggerTrack); + + descriptions.add("hltPPSCalFilter", desc); +} + +HLTPPSCalFilter::HLTPPSCalFilter(const edm::ParameterSet& iConfig) + : pixelLocalTrackInputTag_(iConfig.getParameter("pixelLocalTrackInputTag")), + pixelLocalTrackToken_(consumes>(pixelLocalTrackInputTag_)), + + stripLocalTrackInputTag_(iConfig.getParameter("stripLocalTrackInputTag")), + stripLocalTrackToken_(consumes>(stripLocalTrackInputTag_)), + + diamondLocalTrackInputTag_(iConfig.getParameter("diamondLocalTrackInputTag")), + diamondLocalTrackToken_(consumes>(diamondLocalTrackInputTag_)), + + minTracks_(iConfig.getParameter("minTracks")), + maxTracks_(iConfig.getParameter("maxTracks")), + + do_express_(iConfig.getParameter("do_express")) +{ +} + +bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + // Helper tool to count valid tracks + const auto valid_trks = [](const auto& trk) { return trk.isValid(); }; + + // maps for assigning filter pass / fail + std::unordered_map pixel_filter_; + std::unordered_map strip_filter_; + std::unordered_map diam_filter_; + + // pixel map definition + pixel_filter_[CTPPSPixelDetId(0, 0, 3)] = false; + pixel_filter_[CTPPSPixelDetId(0, 2, 3)] = false; + pixel_filter_[CTPPSPixelDetId(1, 0, 3)] = false; + pixel_filter_[CTPPSPixelDetId(1, 2, 3)] = false; + + // strip map definition + // diamond map definition + + // First filter on pixels (2017+) selection + if (!pixel_filter_.empty()) { + edm::Handle> pixelTracks; + iEvent.getByToken(pixelLocalTrackToken_, pixelTracks); + + for (const auto& rpv : *pixelTracks) { + if (pixel_filter_.count(rpv.id) == 0) { + continue; + } + auto& fltr = pixel_filter_.at(rpv.id); + fltr = true; + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); + if (minTracks_ > 0 && ntrks < minTracks_) + fltr = false; + if (maxTracks_ > 0 && ntrks > maxTracks_) + fltr = false; + + } + + // compilation of filter conditions + if(do_express_) { + return (pixel_filter_.at(CTPPSPixelDetId(0,0,3)) && pixel_filter_.at(CTPPSPixelDetId(0,2,3))) || (pixel_filter_.at(CTPPSPixelDetId(1,0,3)) && pixel_filter_.at(CTPPSPixelDetId(1,2,3))); + } + else { + return (pixel_filter_.at(CTPPSPixelDetId(0,0,3)) || pixel_filter_.at(CTPPSPixelDetId(0,2,3))) || (pixel_filter_.at(CTPPSPixelDetId(1,0,3)) || pixel_filter_.at(CTPPSPixelDetId(1,2,3))); + } + + } + + // Then filter on strips (2016-17) selection + if (!strip_filter_.empty()) { + edm::Handle> stripTracks; + iEvent.getByToken(stripLocalTrackToken_, stripTracks); + + for (const auto& rpv : *stripTracks) { + if (strip_filter_.count(rpv.id) == 0) + continue; + auto& fltr = strip_filter_.at(rpv.id); + fltr = true; + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); + if (minTracks_ > 0 && ntrks < minTracks_) + fltr = false; + if (maxTracks_ > 0 && ntrks > maxTracks_) + fltr = false; + } + } + + // Finally filter on diamond (2016+) selection + if (!diam_filter_.empty()) { + edm::Handle> diamondTracks; + iEvent.getByToken(diamondLocalTrackToken_, diamondTracks); + + for (const auto& rpv : *diamondTracks) { + if (diam_filter_.count(rpv.id) == 0) + continue; + auto& fltr = diam_filter_.at(rpv.id); + fltr = true; + + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); + if (minTracks_ > 0 && ntrks < minTracks_) + fltr = false; + if (maxTracks_ > 0 && ntrks > maxTracks_) + fltr = false; + } + } + + return false; +} + +// define as a framework module +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HLTPPSCalFilter); From b878f9c70ecb8664b61e6173ed2a8de393182edc Mon Sep 17 00:00:00 2001 From: Mariana Date: Mon, 2 Aug 2021 15:39:37 +0200 Subject: [PATCH 008/923] clang format --- HLTrigger/special/plugins/HLTPPSCalFilter.cc | 29 +++++++++----------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/HLTrigger/special/plugins/HLTPPSCalFilter.cc b/HLTrigger/special/plugins/HLTPPSCalFilter.cc index 406f56d0843ac..683f282778756 100644 --- a/HLTrigger/special/plugins/HLTPPSCalFilter.cc +++ b/HLTrigger/special/plugins/HLTPPSCalFilter.cc @@ -69,7 +69,7 @@ void HLTPPSCalFilter::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add("maxTracks", -1)->setComment("maximum number of tracks in pot"); desc.add("do_express", true)->setComment("toggle on filter type; true for Express, false for Prompt"); - + desc.add("triggerType", trigger::TriggerTrack); descriptions.add("hltPPSCalFilter", desc); @@ -84,13 +84,11 @@ HLTPPSCalFilter::HLTPPSCalFilter(const edm::ParameterSet& iConfig) diamondLocalTrackInputTag_(iConfig.getParameter("diamondLocalTrackInputTag")), diamondLocalTrackToken_(consumes>(diamondLocalTrackInputTag_)), - + minTracks_(iConfig.getParameter("minTracks")), maxTracks_(iConfig.getParameter("maxTracks")), - - do_express_(iConfig.getParameter("do_express")) -{ -} + + do_express_(iConfig.getParameter("do_express")) {} bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { // Helper tool to count valid tracks @@ -109,7 +107,7 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event // strip map definition // diamond map definition - + // First filter on pixels (2017+) selection if (!pixel_filter_.empty()) { edm::Handle> pixelTracks; @@ -127,17 +125,16 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event fltr = false; if (maxTracks_ > 0 && ntrks > maxTracks_) fltr = false; - } // compilation of filter conditions - if(do_express_) { - return (pixel_filter_.at(CTPPSPixelDetId(0,0,3)) && pixel_filter_.at(CTPPSPixelDetId(0,2,3))) || (pixel_filter_.at(CTPPSPixelDetId(1,0,3)) && pixel_filter_.at(CTPPSPixelDetId(1,2,3))); - } - else { - return (pixel_filter_.at(CTPPSPixelDetId(0,0,3)) || pixel_filter_.at(CTPPSPixelDetId(0,2,3))) || (pixel_filter_.at(CTPPSPixelDetId(1,0,3)) || pixel_filter_.at(CTPPSPixelDetId(1,2,3))); + if (do_express_) { + return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || + (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); + } else { + return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || + (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); } - } // Then filter on strips (2016-17) selection @@ -150,7 +147,7 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event continue; auto& fltr = strip_filter_.at(rpv.id); fltr = true; - + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); if (minTracks_ > 0 && ntrks < minTracks_) fltr = false; @@ -169,7 +166,7 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event continue; auto& fltr = diam_filter_.at(rpv.id); fltr = true; - + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); if (minTracks_ > 0 && ntrks < minTracks_) fltr = false; From a7208a66f931d1433ea9181047be0df5919ad6ee Mon Sep 17 00:00:00 2001 From: yeckang Date: Wed, 4 Aug 2021 18:08:31 +0200 Subject: [PATCH 009/923] Added bx0filter for Run3 condition --- SimMuon/GEMDigitizer/interface/GEMSignalModel.h | 1 + SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc | 1 + SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py | 6 +++--- SimMuon/GEMDigitizer/src/GEMSignalModel.cc | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SimMuon/GEMDigitizer/interface/GEMSignalModel.h b/SimMuon/GEMDigitizer/interface/GEMSignalModel.h index 001cd84d40283..9cdb6da1dbc00 100644 --- a/SimMuon/GEMDigitizer/interface/GEMSignalModel.h +++ b/SimMuon/GEMDigitizer/interface/GEMSignalModel.h @@ -43,6 +43,7 @@ class GEMSignalModel : public GEMDigiModel { double timeResolution_; double timeJitter_; double signalPropagationSpeed_; + bool bx0filter_; bool digitizeOnlyMuons_; double resolutionX_; diff --git a/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc b/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc index 0946fbc65017c..82e04937e5ce3 100644 --- a/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc +++ b/SimMuon/GEMDigitizer/plugins/GEMDigiProducer.cc @@ -105,6 +105,7 @@ void GEMDigiProducer::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add("simulateElectronBkg", true); // flase == simulate only neutral bkg desc.add("simulateIntrinsicNoise", false); + desc.add("bx0filter", false); desc.add("instLumi", 7.5); // in units of 1E34 cm^-2 s^-1. Internally the background is parmetrized from FLUKA+GEANT result at 5E+34 (PU 140). We are adding a 1.5 factor for PU 200 diff --git a/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py b/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py index 146dc34109ff7..6684b2aaf0c15 100644 --- a/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py +++ b/SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py @@ -7,10 +7,10 @@ premix_stage2.toModify(simMuonGEMDigis, mixLabel = "mixData") from Configuration.Eras.Modifier_run2_common_cff import run2_common -run2_common.toModify( simMuonGEMDigis, instLumi = 1.5) +run2_common.toModify( simMuonGEMDigis, instLumi = 1.5, bx0filter = True) from Configuration.Eras.Modifier_run3_common_cff import run3_common -run3_common.toModify( simMuonGEMDigis, instLumi = 2.0) +run3_common.toModify( simMuonGEMDigis, instLumi = 2.0, bx0filter = True) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common -phase2_common.toModify( simMuonGEMDigis, instLumi = 5) +phase2_common.toModify( simMuonGEMDigis, instLumi = 5, bx0filter = False) diff --git a/SimMuon/GEMDigitizer/src/GEMSignalModel.cc b/SimMuon/GEMDigitizer/src/GEMSignalModel.cc index 9b0657d0d4786..798837fcbbe27 100644 --- a/SimMuon/GEMDigitizer/src/GEMSignalModel.cc +++ b/SimMuon/GEMDigitizer/src/GEMSignalModel.cc @@ -20,6 +20,7 @@ GEMSignalModel::GEMSignalModel(const edm::ParameterSet& config) timeResolution_(config.getParameter("timeResolution")), timeJitter_(config.getParameter("timeJitter")), signalPropagationSpeed_(config.getParameter("signalPropagationSpeed")), + bx0filter_(config.getParameter("bx0filter")), digitizeOnlyMuons_(config.getParameter("digitizeOnlyMuons")), resolutionX_(config.getParameter("resolutionX")), muonPdgId(13), @@ -67,6 +68,7 @@ void GEMSignalModel::simulate(const GEMEtaPartition* roll, if (!(digiMuon || digiElec)) continue; const int bx(getSimHitBx(&hit, engine)); + if (bx != 0 and bx0filter_) continue; const std::vector >& cluster(simulateClustering(top, &hit, bx, engine)); for (const auto& digi : cluster) { detectorHitMap_.emplace(digi, &hit); From 7787a9bfb54795575bd207028142e77cc0401658 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 13:21:47 -0500 Subject: [PATCH 010/923] Put CSC and GEM-CSC local trigger lookup tables in ES objects --- .../plugins/CSCL1TPLookupTableEP.cc | 289 ++++++++++++++++ .../python/CSCL1TPLookupTableEP_cff.py | 122 +++++++ .../interface/CSCL1TPLookupTableCCLUT.h | 30 ++ .../interface/CSCL1TPLookupTableME11ILT.h | 156 +++++++++ .../interface/CSCL1TPLookupTableME21ILT.h | 85 +++++ .../CSCObjects/src/CSCL1TPLookupTableCCLUT.cc | 18 + .../src/CSCL1TPLookupTableME11ILT.cc | 321 ++++++++++++++++++ .../src/CSCL1TPLookupTableME21ILT.cc | 143 ++++++++ .../T_EventSetup_CSCL1TPLookupTableCCLUT.cc | 4 + .../T_EventSetup_CSCL1TPLookupTableME11ILT.cc | 4 + .../T_EventSetup_CSCL1TPLookupTableME21ILT.cc | 4 + CondFormats/CSCObjects/src/classes_def.xml | 13 +- CondFormats/CSCObjects/src/headers.h | 3 + .../test/testSerializationCSCObjects.cpp | 3 + .../interface/CSCL1TPLookupTableCCLUTRcd.h | 6 + .../interface/CSCL1TPLookupTableME11ILTRcd.h | 6 + .../interface/CSCL1TPLookupTableME21ILTRcd.h | 6 + .../src/CSCL1TPLookupTableCCLUTRcd.cc | 4 + .../src/CSCL1TPLookupTableME11ILTRcd.cc | 4 + .../src/CSCL1TPLookupTableME21ILTRcd.cc | 4 + .../python/L1TStage2Emulator_cff.py | 2 + .../interface/CSCALCTCrossCLCT.h | 39 +-- .../interface/CSCBaseboard.h | 3 +- .../interface/CSCCathodeLCTProcessor.h | 3 +- .../interface/CSCGEMMatcher.h | 52 +-- .../interface/CSCGEMMotherboard.h | 2 - .../interface/CSCLUTReader.h | 67 ---- .../interface/CSCMotherboard.h | 15 + .../interface/CSCTriggerPrimitivesBuilder.h | 6 + .../interface/ComparatorCodeLUT.h | 16 +- .../interface/GEMClusterProcessor.h | 56 +-- .../plugins/CSCTriggerPrimitivesProducer.cc | 156 +++++++-- .../plugins/CSCTriggerPrimitivesProducer.h | 95 ------ .../plugins/SealModule.cc | 5 - .../python/cscTriggerPrimitiveDigis_cfi.py | 4 - .../python/params/cclutParams.py | 26 -- .../python/params/gemcscParams.py | 108 ------ .../python/params/tmbParams.py | 29 +- .../src/CSCALCTCrossCLCT.cc | 87 ++--- .../src/CSCCathodeLCTProcessor.cc | 2 + .../CSCTriggerPrimitives/src/CSCGEMMatcher.cc | 100 ++---- .../src/CSCGEMMotherboard.cc | 15 + .../CSCTriggerPrimitives/src/CSCLUTReader.cc | 171 ---------- .../src/CSCMotherboard.cc | 28 +- .../src/CSCTriggerPrimitivesBuilder.cc | 48 +++ .../src/ComparatorCodeLUT.cc | 16 +- .../src/GEMClusterProcessor.cc | 182 ++++------ .../runCSCTriggerPrimitiveProducer_cfg.py | 1 + .../runL1CSCTPEmulatorConfigAnalyzer_cfg.py | 1 + .../python/L1MuonEmulator_cff.py | 2 +- .../Configuration/python/ValL1Emulator_cff.py | 19 +- .../Configuration/python/customiseReEmul.py | 4 +- L1Trigger/L1TMuon/python/simDigis_cff.py | 4 +- 53 files changed, 1649 insertions(+), 940 deletions(-) create mode 100644 CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc create mode 100644 CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc delete mode 100644 L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h delete mode 100644 L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h delete mode 100644 L1Trigger/CSCTriggerPrimitives/plugins/SealModule.cc delete mode 100644 L1Trigger/CSCTriggerPrimitives/python/params/cclutParams.py delete mode 100644 L1Trigger/CSCTriggerPrimitives/src/CSCLUTReader.cc diff --git a/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc new file mode 100644 index 0000000000000..ae9c79fcaa9d1 --- /dev/null +++ b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc @@ -0,0 +1,289 @@ +// system include files +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/Framework/interface/SourceFactory.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" + +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" + +// user include files +#include +#include +#include +#include + +class CSCL1TPLookupTableEP : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CSCL1TPLookupTableEP(const edm::ParameterSet&); + ~CSCL1TPLookupTableEP() override {} + + std::unique_ptr produceCCLUT(const CSCL1TPLookupTableCCLUTRcd&); + std::unique_ptr produceME11ILT(const CSCL1TPLookupTableME11ILTRcd&); + std::unique_ptr produceME21ILT(const CSCL1TPLookupTableME21ILTRcd&); + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + +private: + std::vector load(std::string fileName) const; + const edm::ParameterSet pset_; +}; + +CSCL1TPLookupTableEP::CSCL1TPLookupTableEP(const edm::ParameterSet& pset) : pset_(pset) { + setWhatProduced(this, &CSCL1TPLookupTableEP::produceCCLUT); + setWhatProduced(this, &CSCL1TPLookupTableEP::produceME11ILT); + setWhatProduced(this, &CSCL1TPLookupTableEP::produceME21ILT); + findingRecord(); + findingRecord(); + findingRecord(); +} + +void CSCL1TPLookupTableEP::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) { + edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); + oValidity = infinity; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceCCLUT(const CSCL1TPLookupTableCCLUTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector positionLUTFiles_ = pset_.getParameter>("positionLUTFiles"); + std::vector slopeLUTFiles_ = pset_.getParameter>("slopeLUTFiles"); + + std::unordered_map> cclutPosition; + std::unordered_map> cclutSlope; + + // read the text files and extract the data + for (int i = 0; i < 5; ++i) { + cclutPosition[i] = load(positionLUTFiles_[i]); + cclutSlope[i] = load(slopeLUTFiles_[i]); + } + + // set the data in the LUT object + lut->set_cclutPosition(std::move(cclutPosition)); + lut->set_cclutSlope(std::move(cclutSlope)); + + return lut; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceME11ILT(const CSCL1TPLookupTableME11ILTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector padToHsME1aFiles_ = pset_.getParameter>("padToHsME1aFiles"); + std::vector padToHsME1bFiles_ = pset_.getParameter>("padToHsME1bFiles"); + + std::vector padToEsME1aFiles_ = pset_.getParameter>("padToEsME1aFiles"); + std::vector padToEsME1bFiles_ = pset_.getParameter>("padToEsME1bFiles"); + + std::vector rollToMaxWgME11Files_ = pset_.getParameter>("rollToMaxWgME11Files"); + std::vector rollToMinWgME11Files_ = pset_.getParameter>("rollToMinWgME11Files"); + + std::vector gemCscSlopeCosiFiles_ = pset_.getParameter>("gemCscSlopeCosiFiles"); + std::vector gemCscSlopeCosiCorrectionFiles_ = + pset_.getParameter>("gemCscSlopeCosiCorrectionFiles"); + std::vector gemCscSlopeCorrectionFiles_ = + pset_.getParameter>("gemCscSlopeCorrectionFiles"); + + std::vector esDiffToSlopeME1aFiles_ = + pset_.getParameter>("esDiffToSlopeME1aFiles"); + std::vector esDiffToSlopeME1bFiles_ = + pset_.getParameter>("esDiffToSlopeME1bFiles"); + + // read the text files and extract the data + auto GEM_pad_CSC_hs_ME1a_even_ = load(padToHsME1aFiles_[0]); + auto GEM_pad_CSC_hs_ME1a_odd_ = load(padToHsME1aFiles_[1]); + auto GEM_pad_CSC_hs_ME1b_even_ = load(padToHsME1bFiles_[0]); + auto GEM_pad_CSC_hs_ME1b_odd_ = load(padToHsME1bFiles_[1]); + + auto GEM_pad_CSC_es_ME1a_even_ = load(padToEsME1aFiles_[0]); + auto GEM_pad_CSC_es_ME1a_odd_ = load(padToEsME1aFiles_[1]); + auto GEM_pad_CSC_es_ME1b_even_ = load(padToEsME1bFiles_[0]); + auto GEM_pad_CSC_es_ME1b_odd_ = load(padToEsME1bFiles_[1]); + + auto GEM_roll_L1_CSC_min_wg_ME11_even_ = load(rollToMinWgME11Files_[0]); + auto GEM_roll_L1_CSC_min_wg_ME11_odd_ = load(rollToMinWgME11Files_[1]); + auto GEM_roll_L2_CSC_min_wg_ME11_even_ = load(rollToMinWgME11Files_[2]); + auto GEM_roll_L2_CSC_min_wg_ME11_odd_ = load(rollToMinWgME11Files_[3]); + + auto GEM_roll_L1_CSC_max_wg_ME11_even_ = load(rollToMaxWgME11Files_[0]); + auto GEM_roll_L1_CSC_max_wg_ME11_odd_ = load(rollToMaxWgME11Files_[1]); + auto GEM_roll_L2_CSC_max_wg_ME11_even_ = load(rollToMaxWgME11Files_[2]); + auto GEM_roll_L2_CSC_max_wg_ME11_odd_ = load(rollToMaxWgME11Files_[3]); + + auto CSC_slope_cosi_2to1_L1_ME11_even_ = load(gemCscSlopeCosiFiles_[0]); + auto CSC_slope_cosi_2to1_L1_ME11_odd_ = load(gemCscSlopeCosiFiles_[1]); + auto CSC_slope_cosi_3to1_L1_ME11_even_ = load(gemCscSlopeCosiFiles_[2]); + auto CSC_slope_cosi_3to1_L1_ME11_odd_ = load(gemCscSlopeCosiFiles_[3]); + + auto CSC_slope_cosi_corr_L1_ME11_even_ = load(gemCscSlopeCosiCorrectionFiles_[0]); + auto CSC_slope_cosi_corr_L2_ME11_even_ = load(gemCscSlopeCosiCorrectionFiles_[1]); + auto CSC_slope_cosi_corr_L1_ME11_odd_ = load(gemCscSlopeCosiCorrectionFiles_[2]); + auto CSC_slope_cosi_corr_L2_ME11_odd_ = load(gemCscSlopeCosiCorrectionFiles_[3]); + + auto CSC_slope_corr_L1_ME11_even_ = load(gemCscSlopeCorrectionFiles_[0]); + auto CSC_slope_corr_L2_ME11_even_ = load(gemCscSlopeCorrectionFiles_[1]); + auto CSC_slope_corr_L1_ME11_odd_ = load(gemCscSlopeCorrectionFiles_[2]); + auto CSC_slope_corr_L2_ME11_odd_ = load(gemCscSlopeCorrectionFiles_[3]); + + auto es_diff_slope_L1_ME1a_even_ = load(esDiffToSlopeME1aFiles_[0]); + auto es_diff_slope_L1_ME1a_odd_ = load(esDiffToSlopeME1aFiles_[1]); + auto es_diff_slope_L2_ME1a_even_ = load(esDiffToSlopeME1aFiles_[2]); + auto es_diff_slope_L2_ME1a_odd_ = load(esDiffToSlopeME1aFiles_[3]); + + auto es_diff_slope_L1_ME1b_even_ = load(esDiffToSlopeME1bFiles_[0]); + auto es_diff_slope_L1_ME1b_odd_ = load(esDiffToSlopeME1bFiles_[1]); + auto es_diff_slope_L2_ME1b_even_ = load(esDiffToSlopeME1bFiles_[2]); + auto es_diff_slope_L2_ME1b_odd_ = load(esDiffToSlopeME1bFiles_[3]); + + // set the data in the LUT object + lut->set_GEM_pad_CSC_hs_ME1b_even(std::move(GEM_pad_CSC_hs_ME1b_even_)); + lut->set_GEM_pad_CSC_hs_ME1a_even(std::move(GEM_pad_CSC_hs_ME1a_even_)); + lut->set_GEM_pad_CSC_hs_ME1b_odd(std::move(GEM_pad_CSC_hs_ME1b_odd_)); + lut->set_GEM_pad_CSC_hs_ME1a_odd(std::move(GEM_pad_CSC_hs_ME1a_odd_)); + + lut->set_GEM_pad_CSC_es_ME1b_even(std::move(GEM_pad_CSC_es_ME1b_even_)); + lut->set_GEM_pad_CSC_es_ME1a_even(std::move(GEM_pad_CSC_es_ME1a_even_)); + lut->set_GEM_pad_CSC_es_ME1b_odd(std::move(GEM_pad_CSC_es_ME1b_odd_)); + lut->set_GEM_pad_CSC_es_ME1a_odd(std::move(GEM_pad_CSC_es_ME1a_odd_)); + + lut->set_GEM_roll_L1_CSC_min_wg_ME11_even(std::move(GEM_roll_L1_CSC_min_wg_ME11_even_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME11_even(std::move(GEM_roll_L1_CSC_max_wg_ME11_even_)); + lut->set_GEM_roll_L1_CSC_min_wg_ME11_odd(std::move(GEM_roll_L1_CSC_min_wg_ME11_odd_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME11_odd(std::move(GEM_roll_L1_CSC_max_wg_ME11_odd_)); + + lut->set_GEM_roll_L2_CSC_min_wg_ME11_even(std::move(GEM_roll_L2_CSC_min_wg_ME11_even_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME11_even(std::move(GEM_roll_L2_CSC_max_wg_ME11_even_)); + lut->set_GEM_roll_L2_CSC_min_wg_ME11_odd(std::move(GEM_roll_L2_CSC_min_wg_ME11_odd_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME11_odd(std::move(GEM_roll_L2_CSC_max_wg_ME11_odd_)); + + // GEM-CSC trigger: slope correction + lut->set_CSC_slope_cosi_2to1_L1_ME11_even(std::move(CSC_slope_cosi_2to1_L1_ME11_even_)); + lut->set_CSC_slope_cosi_2to1_L1_ME11_odd(std::move(CSC_slope_cosi_2to1_L1_ME11_odd_)); + lut->set_CSC_slope_cosi_3to1_L1_ME11_even(std::move(CSC_slope_cosi_3to1_L1_ME11_even_)); + lut->set_CSC_slope_cosi_3to1_L1_ME11_odd(std::move(CSC_slope_cosi_3to1_L1_ME11_odd_)); + + lut->set_CSC_slope_cosi_corr_L1_ME11_even(std::move(CSC_slope_cosi_corr_L1_ME11_even_)); + lut->set_CSC_slope_cosi_corr_L1_ME11_odd(std::move(CSC_slope_cosi_corr_L1_ME11_odd_)); + lut->set_CSC_slope_cosi_corr_L1_ME11_even(std::move(CSC_slope_cosi_corr_L1_ME11_even_)); + lut->set_CSC_slope_cosi_corr_L1_ME11_odd(std::move(CSC_slope_cosi_corr_L1_ME11_odd_)); + + lut->set_CSC_slope_corr_L1_ME11_even(std::move(CSC_slope_corr_L1_ME11_even_)); + lut->set_CSC_slope_corr_L1_ME11_odd(std::move(CSC_slope_corr_L1_ME11_odd_)); + lut->set_CSC_slope_corr_L1_ME11_even(std::move(CSC_slope_corr_L1_ME11_even_)); + lut->set_CSC_slope_corr_L1_ME11_odd(std::move(CSC_slope_corr_L1_ME11_odd_)); + + // GEM-CSC trigger: 1/8-strip difference to slope + lut->set_es_diff_slope_L1_ME1a_even(std::move(es_diff_slope_L1_ME1a_even_)); + lut->set_es_diff_slope_L2_ME1a_even(std::move(es_diff_slope_L2_ME1a_even_)); + lut->set_es_diff_slope_L1_ME1a_odd(std::move(es_diff_slope_L1_ME1a_odd_)); + lut->set_es_diff_slope_L2_ME1a_odd(std::move(es_diff_slope_L2_ME1a_odd_)); + + lut->set_es_diff_slope_L1_ME1b_even(std::move(es_diff_slope_L1_ME1b_even_)); + lut->set_es_diff_slope_L2_ME1b_even(std::move(es_diff_slope_L2_ME1b_even_)); + lut->set_es_diff_slope_L1_ME1b_odd(std::move(es_diff_slope_L1_ME1b_odd_)); + lut->set_es_diff_slope_L2_ME1b_odd(std::move(es_diff_slope_L2_ME1b_odd_)); + + return lut; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceME21ILT(const CSCL1TPLookupTableME21ILTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector padToHsME21Files_ = pset_.getParameter>("padToHsME21Files"); + std::vector padToEsME21Files_ = pset_.getParameter>("padToEsME21Files"); + + std::vector rollToMaxWgME21Files_ = pset_.getParameter>("rollToMaxWgME21Files"); + std::vector rollToMinWgME21Files_ = pset_.getParameter>("rollToMinWgME21Files"); + + std::vector esDiffToSlopeME21Files_ = + pset_.getParameter>("esDiffToSlopeME21Files"); + + // read the text files and extract the data + auto GEM_pad_CSC_hs_ME21_even_ = load(padToHsME21Files_[0]); + auto GEM_pad_CSC_hs_ME21_odd_ = load(padToHsME21Files_[1]); + + auto GEM_pad_CSC_es_ME21_even_ = load(padToEsME21Files_[0]); + auto GEM_pad_CSC_es_ME21_odd_ = load(padToEsME21Files_[1]); + + auto GEM_roll_L1_CSC_min_wg_ME21_even_ = load(rollToMinWgME21Files_[0]); + auto GEM_roll_L1_CSC_min_wg_ME21_odd_ = load(rollToMinWgME21Files_[1]); + auto GEM_roll_L2_CSC_min_wg_ME21_even_ = load(rollToMinWgME21Files_[2]); + auto GEM_roll_L2_CSC_min_wg_ME21_odd_ = load(rollToMinWgME21Files_[3]); + + auto GEM_roll_L1_CSC_max_wg_ME21_even_ = load(rollToMaxWgME21Files_[0]); + auto GEM_roll_L1_CSC_max_wg_ME21_odd_ = load(rollToMaxWgME21Files_[1]); + auto GEM_roll_L2_CSC_max_wg_ME21_even_ = load(rollToMaxWgME21Files_[2]); + auto GEM_roll_L2_CSC_max_wg_ME21_odd_ = load(rollToMaxWgME21Files_[3]); + + auto es_diff_slope_L1_ME21_even_ = load(esDiffToSlopeME21Files_[0]); + auto es_diff_slope_L1_ME21_odd_ = load(esDiffToSlopeME21Files_[1]); + auto es_diff_slope_L2_ME21_even_ = load(esDiffToSlopeME21Files_[2]); + auto es_diff_slope_L2_ME21_odd_ = load(esDiffToSlopeME21Files_[3]); + + // set the data in the LUT object + lut->set_GEM_pad_CSC_hs_ME21_even(std::move(GEM_pad_CSC_hs_ME21_even_)); + lut->set_GEM_pad_CSC_hs_ME21_odd(std::move(GEM_pad_CSC_hs_ME21_odd_)); + + lut->set_GEM_pad_CSC_es_ME21_even(std::move(GEM_pad_CSC_es_ME21_even_)); + lut->set_GEM_pad_CSC_es_ME21_odd(std::move(GEM_pad_CSC_es_ME21_odd_)); + + lut->set_GEM_roll_L1_CSC_min_wg_ME21_even(std::move(GEM_roll_L1_CSC_min_wg_ME21_even_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME21_even(std::move(GEM_roll_L1_CSC_max_wg_ME21_even_)); + lut->set_GEM_roll_L1_CSC_min_wg_ME21_odd(std::move(GEM_roll_L1_CSC_min_wg_ME21_odd_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME21_odd(std::move(GEM_roll_L1_CSC_max_wg_ME21_odd_)); + + lut->set_GEM_roll_L2_CSC_min_wg_ME21_even(std::move(GEM_roll_L2_CSC_min_wg_ME21_even_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME21_even(std::move(GEM_roll_L2_CSC_max_wg_ME21_even_)); + lut->set_GEM_roll_L2_CSC_min_wg_ME21_odd(std::move(GEM_roll_L2_CSC_min_wg_ME21_odd_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME21_odd(std::move(GEM_roll_L2_CSC_max_wg_ME21_odd_)); + + lut->set_es_diff_slope_L1_ME21_even(std::move(es_diff_slope_L1_ME21_even_)); + lut->set_es_diff_slope_L2_ME21_even(std::move(es_diff_slope_L2_ME21_even_)); + lut->set_es_diff_slope_L1_ME21_odd(std::move(es_diff_slope_L1_ME21_odd_)); + lut->set_es_diff_slope_L2_ME21_odd(std::move(es_diff_slope_L2_ME21_odd_)); + + return lut; +} + +std::vector CSCL1TPLookupTableEP::load(std::string fileName) const { + std::vector returnV; + std::ifstream fstream; + fstream.open(edm::FileInPath(fileName.c_str()).fullPath()); + // empty file, return empty lut + if (!fstream.good()) { + fstream.close(); + return returnV; + } + + std::string line; + + while (std::getline(fstream, line)) { + //ignore comments + line.erase(std::find(line.begin(), line.end(), '#'), line.end()); + std::istringstream lineStream(line); + std::pair entry; + while (lineStream >> entry.first >> entry.second) { + returnV.push_back(entry.second); + } + } + return returnV; +} + +DEFINE_FWK_EVENTSETUP_SOURCE(CSCL1TPLookupTableEP); diff --git a/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py b/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py new file mode 100644 index 0000000000000..0b9b4625c4072 --- /dev/null +++ b/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py @@ -0,0 +1,122 @@ +import FWCore.ParameterSet.Config as cms + +CSCL1TPLookupTableEP = cms.ESSource( + "CSCL1TPLookupTableEP", + ## CCLUT + positionLUTFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat0_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat1_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat2_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat3_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat4_v1.txt" + ), + slopeLUTFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat0_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat1_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat2_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat3_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat4_v1.txt" + ), + ## convert pad number to 1/2-strip in ME1a + padToHsME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_odd.txt", + ), + ## convert pad number to 1/2-strip in ME1b + padToHsME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_odd.txt", + ), + ## convert pad number to 1/2-strip in ME21 + padToHsME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_odd.txt", + ), + ## convert pad number to 1/8-strip in ME1a + padToEsME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_odd.txt", + ), + ## convert pad number to 1/8-strip in ME1b + padToEsME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_odd.txt", + ), + ## convert pad number to 1/8-strip in ME21 + padToEsME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_odd.txt", + ), + ## convert eta partition to minimum wiregroup in ME11 + rollToMinWgME11Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", + ), + ## convert eta partition to maximum wiregroup in ME11 + rollToMaxWgME11Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", + ), + ## convert eta partition to minimum wiregroup in ME21 + rollToMinWgME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", + ), + ## convert eta partition to maximum wiregroup in ME21 + rollToMaxWgME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCorrectionFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer2.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCosiFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer2.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCosiCorrectionFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer2.txt", + ), + # convert differences in 1/8-strip numbers between GEM and CSC to Run-3 slopes + esDiffToSlopeME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_odd.txt", + ), + esDiffToSlopeME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_odd.txt", + ), + esDiffToSlopeME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_odd.txt", + ), + ) diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h new file mode 100644 index 0000000000000..3afcb817c9abd --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h @@ -0,0 +1,30 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableCCLUT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableCCLUT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include +#include + +class CSCL1TPLookupTableCCLUT { +public: + CSCL1TPLookupTableCCLUT(); + ~CSCL1TPLookupTableCCLUT() {} + + typedef std::unordered_map > t_lut; + + // setters + void set_cclutPosition(t_lut lut); + void set_cclutSlope(t_lut lut); + + // getters + unsigned cclutPosition(unsigned pattern, unsigned code) const; + unsigned cclutSlope(unsigned pattern, unsigned code) const; + +private: + t_lut cclutPosition_; + t_lut cclutSlope_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h new file mode 100644 index 0000000000000..f6d530d30afe9 --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h @@ -0,0 +1,156 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableME11ILT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableME11ILT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include + +class CSCL1TPLookupTableME11ILT { +public: + CSCL1TPLookupTableME11ILT(); + + ~CSCL1TPLookupTableME11ILT() {} + + typedef std::vector t_lut; + + // setters + void set_GEM_pad_CSC_hs_ME1b_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME1a_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME1b_odd(t_lut lut); + void set_GEM_pad_CSC_hs_ME1a_odd(t_lut lut); + + void set_GEM_pad_CSC_es_ME1b_even(t_lut lut); + void set_GEM_pad_CSC_es_ME1a_even(t_lut lut); + void set_GEM_pad_CSC_es_ME1b_odd(t_lut lut); + void set_GEM_pad_CSC_es_ME1a_odd(t_lut lut); + + void set_GEM_roll_L1_CSC_min_wg_ME11_even(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME11_even(t_lut lut); + void set_GEM_roll_L1_CSC_min_wg_ME11_odd(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME11_odd(t_lut lut); + + void set_GEM_roll_L2_CSC_min_wg_ME11_even(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME11_even(t_lut lut); + void set_GEM_roll_L2_CSC_min_wg_ME11_odd(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME11_odd(t_lut lut); + + // GEM-CSC trigger: slope correction + void set_CSC_slope_cosi_2to1_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_2to1_L1_ME11_odd(t_lut lut); + void set_CSC_slope_cosi_3to1_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_3to1_L1_ME11_odd(t_lut lut); + + void set_CSC_slope_cosi_corr_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_corr_L2_ME11_even(t_lut lut); + void set_CSC_slope_cosi_corr_L1_ME11_odd(t_lut lut); + void set_CSC_slope_cosi_corr_L2_ME11_odd(t_lut lut); + + void set_CSC_slope_corr_L1_ME11_even(t_lut lut); + void set_CSC_slope_corr_L2_ME11_even(t_lut lut); + void set_CSC_slope_corr_L1_ME11_odd(t_lut lut); + void set_CSC_slope_corr_L2_ME11_odd(t_lut lut); + + void set_es_diff_slope_L1_ME1a_even(t_lut lut); + void set_es_diff_slope_L2_ME1a_even(t_lut lut); + void set_es_diff_slope_L1_ME1a_odd(t_lut lut); + void set_es_diff_slope_L2_ME1a_odd(t_lut lut); + void set_es_diff_slope_L1_ME1b_even(t_lut lut); + void set_es_diff_slope_L2_ME1b_even(t_lut lut); + void set_es_diff_slope_L1_ME1b_odd(t_lut lut); + void set_es_diff_slope_L2_ME1b_odd(t_lut lut); + + // getters + unsigned GEM_pad_CSC_hs_ME1b_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1a_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1b_odd(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1a_odd(unsigned pad) const; + + unsigned GEM_pad_CSC_es_ME1b_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1a_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1b_odd(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1a_odd(unsigned pad) const; + + unsigned GEM_roll_L1_CSC_min_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_min_wg_ME11_odd(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME11_odd(unsigned roll) const; + + unsigned GEM_roll_L2_CSC_min_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_min_wg_ME11_odd(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME11_odd(unsigned roll) const; + + // GEM-CSC trigger: slope correction + unsigned CSC_slope_cosi_2to1_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_2to1_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_cosi_3to1_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_3to1_L1_ME11_odd(unsigned channel) const; + + unsigned CSC_slope_cosi_corr_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L2_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L2_ME11_odd(unsigned channel) const; + + unsigned CSC_slope_corr_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_corr_L2_ME11_even(unsigned channel) const; + unsigned CSC_slope_corr_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_corr_L2_ME11_odd(unsigned channel) const; + + // GEM-CSC trigger: 1/8-strip difference to slope + unsigned es_diff_slope_L1_ME1a_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1a_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1a_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1a_odd(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1b_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1b_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1b_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1b_odd(unsigned es_diff) const; + +private: + t_lut GEM_pad_CSC_hs_ME1b_even_; + t_lut GEM_pad_CSC_hs_ME1a_even_; + t_lut GEM_pad_CSC_hs_ME1b_odd_; + t_lut GEM_pad_CSC_hs_ME1a_odd_; + + t_lut GEM_pad_CSC_es_ME1b_even_; + t_lut GEM_pad_CSC_es_ME1a_even_; + t_lut GEM_pad_CSC_es_ME1b_odd_; + t_lut GEM_pad_CSC_es_ME1a_odd_; + + t_lut GEM_roll_L1_CSC_min_wg_ME11_even_; + t_lut GEM_roll_L1_CSC_max_wg_ME11_even_; + t_lut GEM_roll_L1_CSC_min_wg_ME11_odd_; + t_lut GEM_roll_L1_CSC_max_wg_ME11_odd_; + + t_lut GEM_roll_L2_CSC_min_wg_ME11_even_; + t_lut GEM_roll_L2_CSC_max_wg_ME11_even_; + t_lut GEM_roll_L2_CSC_min_wg_ME11_odd_; + t_lut GEM_roll_L2_CSC_max_wg_ME11_odd_; + + t_lut CSC_slope_cosi_2to1_L1_ME11_even_; + t_lut CSC_slope_cosi_2to1_L1_ME11_odd_; + t_lut CSC_slope_cosi_3to1_L1_ME11_even_; + t_lut CSC_slope_cosi_3to1_L1_ME11_odd_; + + t_lut CSC_slope_cosi_corr_L1_ME11_even_; + t_lut CSC_slope_cosi_corr_L2_ME11_even_; + t_lut CSC_slope_cosi_corr_L1_ME11_odd_; + t_lut CSC_slope_cosi_corr_L2_ME11_odd_; + + t_lut CSC_slope_corr_L1_ME11_even_; + t_lut CSC_slope_corr_L2_ME11_even_; + t_lut CSC_slope_corr_L1_ME11_odd_; + t_lut CSC_slope_corr_L2_ME11_odd_; + + t_lut es_diff_slope_L1_ME1a_even_; + t_lut es_diff_slope_L2_ME1a_even_; + t_lut es_diff_slope_L1_ME1a_odd_; + t_lut es_diff_slope_L2_ME1a_odd_; + t_lut es_diff_slope_L1_ME1b_even_; + t_lut es_diff_slope_L2_ME1b_even_; + t_lut es_diff_slope_L1_ME1b_odd_; + t_lut es_diff_slope_L2_ME1b_odd_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h new file mode 100644 index 0000000000000..733581f13cf44 --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h @@ -0,0 +1,85 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableME21ILT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableME21ILT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include + +class CSCL1TPLookupTableME21ILT { +public: + CSCL1TPLookupTableME21ILT(); + + ~CSCL1TPLookupTableME21ILT() {} + + typedef std::vector t_lut; + + // setters + void set_GEM_pad_CSC_hs_ME21_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME21_odd(t_lut lut); + + void set_GEM_pad_CSC_es_ME21_even(t_lut lut); + void set_GEM_pad_CSC_es_ME21_odd(t_lut lut); + + void set_GEM_roll_L1_CSC_min_wg_ME21_even(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME21_even(t_lut lut); + void set_GEM_roll_L1_CSC_min_wg_ME21_odd(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME21_odd(t_lut lut); + + void set_GEM_roll_L2_CSC_min_wg_ME21_even(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME21_even(t_lut lut); + void set_GEM_roll_L2_CSC_min_wg_ME21_odd(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME21_odd(t_lut lut); + + void set_es_diff_slope_L1_ME21_even(t_lut lut); + void set_es_diff_slope_L2_ME21_even(t_lut lut); + void set_es_diff_slope_L1_ME21_odd(t_lut lut); + void set_es_diff_slope_L2_ME21_odd(t_lut lut); + + // getters + unsigned GEM_pad_CSC_hs_ME21_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME21_odd(unsigned pad) const; + + unsigned GEM_pad_CSC_es_ME21_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME21_odd(unsigned pad) const; + + unsigned GEM_roll_L1_CSC_min_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_min_wg_ME21_odd(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME21_odd(unsigned roll) const; + + unsigned GEM_roll_L2_CSC_min_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_min_wg_ME21_odd(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME21_odd(unsigned roll) const; + + // GEM-CSC trigger: 1/8-strip difference to slope + unsigned es_diff_slope_L1_ME21_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME21_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME21_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME21_odd(unsigned es_diff) const; + +private: + std::vector GEM_pad_CSC_hs_ME21_even_; + std::vector GEM_pad_CSC_hs_ME21_odd_; + + std::vector GEM_pad_CSC_es_ME21_even_; + std::vector GEM_pad_CSC_es_ME21_odd_; + + std::vector GEM_roll_L1_CSC_min_wg_ME21_even_; + std::vector GEM_roll_L1_CSC_max_wg_ME21_even_; + std::vector GEM_roll_L1_CSC_min_wg_ME21_odd_; + std::vector GEM_roll_L1_CSC_max_wg_ME21_odd_; + + std::vector GEM_roll_L2_CSC_min_wg_ME21_even_; + std::vector GEM_roll_L2_CSC_max_wg_ME21_even_; + std::vector GEM_roll_L2_CSC_min_wg_ME21_odd_; + std::vector GEM_roll_L2_CSC_max_wg_ME21_odd_; + + std::vector es_diff_slope_L1_ME21_even_; + std::vector es_diff_slope_L2_ME21_even_; + std::vector es_diff_slope_L1_ME21_odd_; + std::vector es_diff_slope_L2_ME21_odd_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc new file mode 100644 index 0000000000000..85db058d93587 --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc @@ -0,0 +1,18 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" + +CSCL1TPLookupTableCCLUT::CSCL1TPLookupTableCCLUT() { + cclutPosition_.reserve(5); + cclutSlope_.reserve(5); +} + +void CSCL1TPLookupTableCCLUT::set_cclutPosition(t_lut lut) { cclutPosition_ = std::move(lut); } + +void CSCL1TPLookupTableCCLUT::set_cclutSlope(t_lut lut) { cclutSlope_ = std::move(lut); } + +unsigned CSCL1TPLookupTableCCLUT::cclutPosition(unsigned pattern, unsigned code) const { + return cclutPosition_.at(pattern)[code]; +} + +unsigned CSCL1TPLookupTableCCLUT::cclutSlope(unsigned pattern, unsigned code) const { + return cclutSlope_.at(pattern)[code]; +} diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc new file mode 100644 index 0000000000000..c0dab08691faf --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc @@ -0,0 +1,321 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" + +CSCL1TPLookupTableME11ILT::CSCL1TPLookupTableME11ILT() + : GEM_pad_CSC_hs_ME1b_even_(0), + GEM_pad_CSC_hs_ME1a_even_(0), + GEM_pad_CSC_hs_ME1b_odd_(0), + GEM_pad_CSC_hs_ME1a_odd_(0), + + GEM_pad_CSC_es_ME1b_even_(0), + GEM_pad_CSC_es_ME1a_even_(0), + GEM_pad_CSC_es_ME1b_odd_(0), + GEM_pad_CSC_es_ME1a_odd_(0), + + GEM_roll_L1_CSC_min_wg_ME11_even_(0), + GEM_roll_L1_CSC_max_wg_ME11_even_(0), + GEM_roll_L1_CSC_min_wg_ME11_odd_(0), + GEM_roll_L1_CSC_max_wg_ME11_odd_(0), + + GEM_roll_L2_CSC_min_wg_ME11_even_(0), + GEM_roll_L2_CSC_max_wg_ME11_even_(0), + GEM_roll_L2_CSC_min_wg_ME11_odd_(0), + GEM_roll_L2_CSC_max_wg_ME11_odd_(0), + + CSC_slope_cosi_2to1_L1_ME11_even_(0), + CSC_slope_cosi_2to1_L1_ME11_odd_(0), + CSC_slope_cosi_3to1_L1_ME11_even_(0), + CSC_slope_cosi_3to1_L1_ME11_odd_(0), + + CSC_slope_cosi_corr_L1_ME11_even_(0), + CSC_slope_cosi_corr_L2_ME11_even_(0), + CSC_slope_cosi_corr_L1_ME11_odd_(0), + CSC_slope_cosi_corr_L2_ME11_odd_(0), + + CSC_slope_corr_L1_ME11_even_(0), + CSC_slope_corr_L2_ME11_even_(0), + CSC_slope_corr_L1_ME11_odd_(0), + CSC_slope_corr_L2_ME11_odd_(0), + + es_diff_slope_L1_ME1a_even_(0), + es_diff_slope_L2_ME1a_even_(0), + es_diff_slope_L1_ME1a_odd_(0), + es_diff_slope_L2_ME1a_odd_(0), + es_diff_slope_L1_ME1b_even_(0), + es_diff_slope_L2_ME1b_even_(0), + es_diff_slope_L1_ME1b_odd_(0), + es_diff_slope_L2_ME1b_odd_(0) {} + +// GEM-CSC trigger: coordinate conversion +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1b_even(t_lut lut) { GEM_pad_CSC_hs_ME1b_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1a_even(t_lut lut) { GEM_pad_CSC_hs_ME1a_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1b_odd(t_lut lut) { GEM_pad_CSC_hs_ME1b_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1a_odd(t_lut lut) { GEM_pad_CSC_hs_ME1a_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1b_even(t_lut lut) { GEM_pad_CSC_es_ME1b_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1a_even(t_lut lut) { GEM_pad_CSC_es_ME1a_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1b_odd(t_lut lut) { GEM_pad_CSC_es_ME1b_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1a_odd(t_lut lut) { GEM_pad_CSC_es_ME1a_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_min_wg_ME11_even(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_max_wg_ME11_even(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_min_wg_ME11_odd(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_max_wg_ME11_odd(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_min_wg_ME11_even(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_max_wg_ME11_even(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_min_wg_ME11_odd(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_max_wg_ME11_odd(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME11_odd_ = std::move(lut); +} + +// GEM-CSC trigger: slope correction +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_2to1_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_2to1_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_2to1_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_2to1_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_3to1_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_3to1_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_3to1_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_3to1_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_corr_L1_ME11_even_ = std::move(lut); +} +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L2_ME11_even(t_lut lut) { + CSC_slope_cosi_corr_L2_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_corr_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L2_ME11_odd(t_lut lut) { + CSC_slope_cosi_corr_L2_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L1_ME11_even(t_lut lut) { + CSC_slope_corr_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L2_ME11_even(t_lut lut) { + CSC_slope_corr_L2_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L1_ME11_odd(t_lut lut) { + CSC_slope_corr_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L2_ME11_odd(t_lut lut) { + CSC_slope_corr_L2_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1a_even(t_lut lut) { + es_diff_slope_L1_ME1a_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1a_even(t_lut lut) { + es_diff_slope_L2_ME1a_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1a_odd(t_lut lut) { + es_diff_slope_L1_ME1a_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1a_odd(t_lut lut) { + es_diff_slope_L2_ME1a_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1b_even(t_lut lut) { + es_diff_slope_L1_ME1b_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1b_even(t_lut lut) { + es_diff_slope_L2_ME1b_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1b_odd(t_lut lut) { + es_diff_slope_L1_ME1b_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1b_odd(t_lut lut) { + es_diff_slope_L2_ME1b_odd_ = std::move(lut); +} + +// GEM-CSC trigger: coordinate conversion +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1b_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME1b_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1a_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME1a_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1b_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME1b_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1a_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME1a_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1b_even(unsigned pad) const { + return GEM_pad_CSC_es_ME1b_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1a_even(unsigned pad) const { + return GEM_pad_CSC_es_ME1a_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1b_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME1b_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1a_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME1a_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_min_wg_ME11_even(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_max_wg_ME11_even(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_min_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_max_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_min_wg_ME11_even(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_max_wg_ME11_even(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_min_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_max_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME11_odd_[roll]; +} + +// GEM-CSC trigger: slope correction +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_2to1_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_2to1_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_3to1_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_3to1_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_corr_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_corr_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L2_ME11_even(unsigned slope) const { + return CSC_slope_cosi_corr_L2_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L2_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_corr_L2_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11_even(unsigned slope) const { + return CSC_slope_corr_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11_odd(unsigned slope) const { + return CSC_slope_corr_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11_even(unsigned slope) const { + return CSC_slope_corr_L2_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11_odd(unsigned slope) const { + return CSC_slope_corr_L2_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1a_even(unsigned es_diff) const { + return es_diff_slope_L1_ME1a_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1a_even(unsigned es_diff) const { + return es_diff_slope_L2_ME1a_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1a_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME1a_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1a_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME1a_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1b_even(unsigned es_diff) const { + return es_diff_slope_L1_ME1b_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1b_even(unsigned es_diff) const { + return es_diff_slope_L2_ME1b_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1b_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME1b_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1b_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME1b_odd_[es_diff]; +} diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc new file mode 100644 index 0000000000000..3ff567ca10645 --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc @@ -0,0 +1,143 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" + +CSCL1TPLookupTableME21ILT::CSCL1TPLookupTableME21ILT() + : GEM_pad_CSC_hs_ME21_even_(0), + GEM_pad_CSC_hs_ME21_odd_(0), + + GEM_pad_CSC_es_ME21_even_(0), + GEM_pad_CSC_es_ME21_odd_(0), + + GEM_roll_L1_CSC_min_wg_ME21_even_(0), + GEM_roll_L1_CSC_max_wg_ME21_even_(0), + GEM_roll_L1_CSC_min_wg_ME21_odd_(0), + GEM_roll_L1_CSC_max_wg_ME21_odd_(0), + + GEM_roll_L2_CSC_min_wg_ME21_even_(0), + GEM_roll_L2_CSC_max_wg_ME21_even_(0), + GEM_roll_L2_CSC_min_wg_ME21_odd_(0), + GEM_roll_L2_CSC_max_wg_ME21_odd_(0), + + es_diff_slope_L1_ME21_even_(0), + es_diff_slope_L2_ME21_even_(0), + es_diff_slope_L1_ME21_odd_(0), + es_diff_slope_L2_ME21_odd_(0) {} + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_hs_ME21_even(t_lut lut) { GEM_pad_CSC_hs_ME21_even_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_hs_ME21_odd(t_lut lut) { GEM_pad_CSC_hs_ME21_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_es_ME21_even(t_lut lut) { GEM_pad_CSC_es_ME21_even_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_es_ME21_odd(t_lut lut) { GEM_pad_CSC_es_ME21_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_min_wg_ME21_even(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_max_wg_ME21_even(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_min_wg_ME21_odd(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_max_wg_ME21_odd(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_min_wg_ME21_even(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_max_wg_ME21_even(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_min_wg_ME21_odd(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_max_wg_ME21_odd(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L1_ME21_even(t_lut lut) { + es_diff_slope_L1_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L2_ME21_even(t_lut lut) { + es_diff_slope_L2_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L1_ME21_odd(t_lut lut) { + es_diff_slope_L1_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L2_ME21_odd(t_lut lut) { + es_diff_slope_L2_ME21_odd_ = std::move(lut); +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_hs_ME21_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME21_even_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_hs_ME21_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME21_odd_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_es_ME21_even(unsigned pad) const { + return GEM_pad_CSC_es_ME21_even_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_es_ME21_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME21_odd_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_min_wg_ME21_even(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_max_wg_ME21_even(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_min_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_max_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_min_wg_ME21_even(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_max_wg_ME21_even(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_min_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_max_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_even(unsigned es_diff) const { + return es_diff_slope_L1_ME21_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_even(unsigned es_diff) const { + return es_diff_slope_L2_ME21_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME21_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME21_odd_[es_diff]; +} diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc new file mode 100644 index 0000000000000..9deec5db3b5cf --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableCCLUT); diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc new file mode 100644 index 0000000000000..69fd0f8efbed9 --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableME11ILT); diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc new file mode 100644 index 0000000000000..bb452ba805264 --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableME21ILT); diff --git a/CondFormats/CSCObjects/src/classes_def.xml b/CondFormats/CSCObjects/src/classes_def.xml index 5355aff34ee2c..4ec72ea55e9ea 100644 --- a/CondFormats/CSCObjects/src/classes_def.xml +++ b/CondFormats/CSCObjects/src/classes_def.xml @@ -15,13 +15,13 @@ - + - + @@ -99,9 +99,13 @@ - + + + + + @@ -134,5 +138,4 @@ - - + diff --git a/CondFormats/CSCObjects/src/headers.h b/CondFormats/CSCObjects/src/headers.h index 29296e98f17c6..496bc998f6f8a 100644 --- a/CondFormats/CSCObjects/src/headers.h +++ b/CondFormats/CSCObjects/src/headers.h @@ -26,3 +26,6 @@ #include "CondFormats/CSCObjects/interface/CSCTriggerMapping.h" #include "CondFormats/CSCObjects/interface/CSCL1TPParameters.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" diff --git a/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp b/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp index d36fbf5e1e22a..49d8d6fb57ddb 100644 --- a/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp +++ b/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp @@ -34,6 +34,9 @@ int main() { testSerialization(); testSerialization(); testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); testSerialization(); testSerialization(); testSerialization(); diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h new file mode 100644 index 0000000000000..e64928d8daf25 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableCCLUTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableCCLUTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableCCLUTRcd : public edm::eventsetup::EventSetupRecordImplementation { +}; +#endif diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h new file mode 100644 index 0000000000000..96fdacb936c58 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableME11ILTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableME11ILTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableME11ILTRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; +#endif diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h new file mode 100644 index 0000000000000..c9930715a9534 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableME21ILTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableME21ILTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableME21ILTRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; +#endif diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc new file mode 100644 index 0000000000000..cf8d9849d459e --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableCCLUTRcd); diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc new file mode 100644 index 0000000000000..5b634bee1ed4f --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableME11ILTRcd); diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc new file mode 100644 index 0000000000000..2bb72edae143d --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableME21ILTRcd); diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index f22f2b69497c3..1e88818c06ab6 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -55,6 +55,8 @@ valMuonGEMPadDigis = simMuonGEMPadDigis.clone(InputCollection = "muonGEMDigis") valMuonGEMPadDigiClusters = simMuonGEMPadDigiClusters.clone(InputCollection = "valMuonGEMPadDigis") +# Lookup tables for the CSC TP emulator +from CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff import * # CSC TPG from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * valCscStage2Digis = cscTriggerPrimitiveDigis.clone( diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h index 9d5f4bfb6dac5..ffda90b035446 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h @@ -24,9 +24,8 @@ this feature into the CSC trigger firmware #include "FWCore/ParameterSet/interface/ParameterSet.h" #include -#include +#include -class CSCLUTReader; class CSCALCTDigi; class CSCCLCTDigi; @@ -35,25 +34,6 @@ class CSCALCTCrossCLCT { CSCALCTCrossCLCT( unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet& conf); - /* - Calculate the 4-bit code for the best LCT and second LCT. Each code corresponds - to a unique combination for best and second best. Not each combation is valid. - Valid best LCT codes are: 11, 12, 21, 22, and 0 - Valid second LCT codes are: 12, 21, 22, and 0 - When a code is nonzero, the first index is the ALCT. The second index is the CLCT. - - This feature was originally added by Vadim Khotilovich in LS1 to potentially improve the - quality of the LCTs sent to the track-finder. Generally the track-finders - request all information to be sent. Even if the resulting LCT is potentially - unphysical. Therefore, this function is not used. - */ - void calculateLCTCodes(const CSCALCTDigi& a1, - const CSCCLCTDigi& c1, - const CSCALCTDigi& a2, - const CSCCLCTDigi& c2, - unsigned& bestLCTCode, - unsigned& secondLCTCode) const; - /* Check if an ALCT can cross a CLCT. Most of the time it can. Only in ME1/1 there are special cases when they do not. This function is typically not used though, as the @@ -70,22 +50,5 @@ class CSCALCTCrossCLCT { unsigned ring_; bool gangedME1a_; bool ignoreAlctCrossClct_; - - // strings to paths of LUTs - std::vector wgCrossHsME1aFiles_; - std::vector wgCrossHsME1aGangedFiles_; - std::vector wgCrossHsME1bFiles_; - std::vector lctCombinationCodeFiles_; - - // unique pointers to the luts - std::unique_ptr wg_cross_min_hs_ME1a_; - std::unique_ptr wg_cross_max_hs_ME1a_; - std::unique_ptr wg_cross_min_hs_ME1a_ganged_; - std::unique_ptr wg_cross_max_hs_ME1a_ganged_; - std::unique_ptr wg_cross_min_hs_ME1b_; - std::unique_ptr wg_cross_max_hs_ME1b_; - std::unique_ptr code_to_best_lct_; - std::unique_ptr code_to_second_lct_; }; - #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index 8f8bec666d091..76df7a6588439 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -8,7 +8,6 @@ #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" class CSCBaseboard { @@ -31,6 +30,8 @@ class CSCBaseboard { std::string getCSCName() const { return theCSCName_; } + CSCDetId id() const { return cscId_; } + protected: void checkConfigParameters(unsigned int& var, const unsigned int var_max, diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 5607f048e4427..2beaf9cc0c074 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -34,7 +34,6 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h" #include "L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h" #include "L1Trigger/CSCTriggerPrimitives/interface/PulseArray.h" @@ -57,6 +56,8 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /** Sets configuration parameters obtained via EventSetup mechanism. */ void setConfigParameters(const CSCDBL1TPParameters* conf); + void setESLookupTables(const CSCL1TPLookupTableCCLUT* conf); + /** Clears the LCT containers. */ void clear(); diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h index 80c2116b27cc6..d141242367bb4 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h @@ -11,11 +11,12 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" #include #include -class CSCLUTReader; class CSCALCTDigi; class CSCCLCTDigi; class GEMInternalCluster; @@ -30,6 +31,9 @@ class CSCGEMMatcher { const edm::ParameterSet& tmbParams, const edm::ParameterSet& luts); + void setESLookupTables(const CSCL1TPLookupTableME11ILT* conf); + void setESLookupTables(const CSCL1TPLookupTableME21ILT* conf); + // calculate the bending angle unsigned calculateGEMCSCBending(const CSCCLCTDigi& clct, const GEMInternalCluster& cluster) const; @@ -106,6 +110,10 @@ class CSCGEMMatcher { GEMInternalCluster& best) const; private: + // access to lookup tables via eventsetup + const CSCL1TPLookupTableME11ILT* lookupTableME11ILT_; + const CSCL1TPLookupTableME21ILT* lookupTableME21ILT_; + //mitigate slope by consistency of slope indicator, if necessary uint16_t mitigatedSlopeByConsistency(const CSCCLCTDigi& clct) const; @@ -130,48 +138,6 @@ class CSCGEMMatcher { bool assign_gem_csc_bending_; bool mitigateSlopeByCosi_; - - // strings to paths of LUTs - std::vector gemCscSlopeCorrectionFiles_; - std::vector gemCscSlopeCosiFiles_; - std::vector gemCscSlopeCosiCorrectionFiles_; - std::vector esDiffToSlopeME1aFiles_; - std::vector esDiffToSlopeME1bFiles_; - std::vector esDiffToSlopeME21Files_; - - // unique pointers to the luts - std::unique_ptr gem_csc_slope_cosi_2to1_L1_ME11_even_; - std::unique_ptr gem_csc_slope_cosi_3to1_L1_ME11_even_; - std::unique_ptr gem_csc_slope_cosi_2to1_L1_ME11_odd_; - std::unique_ptr gem_csc_slope_cosi_3to1_L1_ME11_odd_; - - std::unique_ptr gem_csc_slope_corr_L1_ME11_even_; - std::unique_ptr gem_csc_slope_corr_L2_ME11_even_; - std::unique_ptr gem_csc_slope_corr_L1_ME11_odd_; - std::unique_ptr gem_csc_slope_corr_L2_ME11_odd_; - - std::unique_ptr gem_csc_slope_cosi_corr_L1_ME11_even_; - std::unique_ptr gem_csc_slope_cosi_corr_L2_ME11_even_; - std::unique_ptr gem_csc_slope_cosi_corr_L1_ME11_odd_; - std::unique_ptr gem_csc_slope_cosi_corr_L2_ME11_odd_; - - std::unique_ptr es_diff_slope_L1_ME1b_even_; - std::unique_ptr es_diff_slope_L2_ME1b_even_; - - std::unique_ptr es_diff_slope_L1_ME1b_odd_; - std::unique_ptr es_diff_slope_L2_ME1b_odd_; - - std::unique_ptr es_diff_slope_L1_ME1a_even_; - std::unique_ptr es_diff_slope_L2_ME1a_even_; - - std::unique_ptr es_diff_slope_L1_ME1a_odd_; - std::unique_ptr es_diff_slope_L2_ME1a_odd_; - - std::unique_ptr es_diff_slope_L1_ME21_even_; - std::unique_ptr es_diff_slope_L2_ME21_even_; - - std::unique_ptr es_diff_slope_L1_ME21_odd_; - std::unique_ptr es_diff_slope_L2_ME21_odd_; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h index ead03fd749283..798089af923e3 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h @@ -15,8 +15,6 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/GEMClusterProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h" #include "Geometry/GEMGeometry/interface/GEMGeometry.h" -#include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" -#include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" class CSCGEMMotherboard : public CSCMotherboard { public: diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h deleted file mode 100644 index cbbc6475612f4..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef L1Trigger_CSCTriggerPrimitives_CSCLUTReader -#define L1Trigger_CSCTriggerPrimitives_CSCLUTReader - -#include -#include -#include -#include -#include -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class CSCLUTReader { -public: - enum ReadCodes { - SUCCESS = 0, - NO_ENTRIES = 1, - DUP_ENTRIES = 2, - MISS_ENTRIES = 3, - MAX_ADDRESS_OUTOFRANGE = 4, - NO_HEADER = 5 - }; - - /* CSCLUTReader(); */ - explicit CSCLUTReader(const std::string&); - ~CSCLUTReader() {} - - float lookup(int code) const; - float lookupPacked(const int input) const; - - // populates the map. - void initialize(); - - unsigned checkedInput(unsigned in, unsigned maxWidth) const; - - // I/O functions - void save(std::ofstream& output); - int load(const std::string& inFileName); - - float data(unsigned int address) const; - int read(std::istream& stream); - void write(std::ostream& stream) const; - - unsigned int nrBitsAddress() const { return nrBitsAddress_; } - unsigned int nrBitsData() const { return nrBitsData_; } - //following the convention of vector::size() - unsigned int maxSize() const; - bool empty() const { return data_.empty(); } - -private: - std::string fname_; - int readHeader(std::istream&); - - unsigned int nrBitsAddress_; //technically redundant with addressMask - unsigned int nrBitsData_; //technically redundant with dataMask - unsigned int addressMask_; - unsigned int dataMask_; - - std::vector data_; - - int m_codeInWidth; - unsigned m_outWidth; - bool m_initialized; -}; - -#endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index a13d9315a4f1c..a496c021a48bf 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -43,6 +43,9 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" class CSCMotherboard : public CSCBaseboard { public: @@ -93,6 +96,9 @@ class CSCMotherboard : public CSCBaseboard { /** Set configuration parameters obtained via EventSetup mechanism. */ void setConfigParameters(const CSCDBL1TPParameters* conf); + void setESLookupTables(const CSCL1TPLookupTableCCLUT* conf); + void setESLookupTables(const CSCL1TPLookupTableME11ILT* conf); + void setESLookupTables(const CSCL1TPLookupTableME21ILT* conf); /** Anode LCT processor. */ std::unique_ptr alctProc; @@ -102,6 +108,11 @@ class CSCMotherboard : public CSCBaseboard { // VK: change to protected, to allow inheritance protected: + // access to lookup tables via eventsetup + const CSCL1TPLookupTableCCLUT* lookupTableCCLUT_; + const CSCL1TPLookupTableME11ILT* lookupTableME11ILT_; + const CSCL1TPLookupTableME21ILT* lookupTableME21ILT_; + /* Containers for reconstructed ALCTs and CLCTs */ std::vector alctV; std::vector clctV; @@ -138,6 +149,8 @@ class CSCMotherboard : public CSCBaseboard { // encode special bits for high-multiplicity triggers unsigned showerSource_; + bool ignoreAlctCrossClct_; + /* Preferential index array in matching window, relative to the ALCT BX. Where the central match BX goes first, @@ -201,6 +214,8 @@ class CSCMotherboard : public CSCBaseboard { */ void copyValidToInValid(CSCALCTDigi&, CSCALCTDigi&, CSCCLCTDigi&, CSCCLCTDigi&) const; + bool doesALCTCrossCLCT(const CSCALCTDigi&, const CSCCLCTDigi&) const; + // CLCT pattern number: encodes the pattern number itself unsigned int encodePattern(const int clctPattern) const; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h index 7df54732c4007..ebf6befaf46bf 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h @@ -19,6 +19,9 @@ */ #include "CondFormats/CSCObjects/interface/CSCBadChambers.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" @@ -50,6 +53,9 @@ class CSCTriggerPrimitivesBuilder { /** Sets configuration parameters obtained via EventSetup mechanism. */ void setConfigParameters(const CSCDBL1TPParameters* conf); + void setESLookupTables(const CSCL1TPLookupTableCCLUT* conf); + void setESLookupTables(const CSCL1TPLookupTableME11ILT* conf); + void setESLookupTables(const CSCL1TPLookupTableME21ILT* conf); /// set CSC and GEM geometries for the matching needs void setCSCGeometry(const CSCGeometry* g) { csc_g = g; } diff --git a/L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h b/L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h index 9fae0a8cc5d3d..ff89a8f7a5db8 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/ComparatorCodeLUT.h @@ -14,8 +14,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" #include #include @@ -29,6 +29,8 @@ class ComparatorCodeLUT { // constructor ComparatorCodeLUT(const edm::ParameterSet& conf); + void setESLookupTables(const CSCL1TPLookupTableCCLUT* conf); + // runs the CCLUT procedure void run(CSCCLCTDigi& digi, unsigned numCFEBs) const; @@ -44,17 +46,11 @@ class ComparatorCodeLUT { // actual LUT used CSCPatternBank::LCTPatterns clct_pattern_ = {}; - std::vector positionLUTFiles_; - std::vector slopeLUTFiles_; - std::vector patternConversionLUTFiles_; - - // unique pointers to the luts - std::array, CSCConstants::NUM_CLCT_PATTERNS_RUN3> lutpos_; - std::array, CSCConstants::NUM_CLCT_PATTERNS_RUN3> lutslope_; - std::array, CSCConstants::NUM_CLCT_PATTERNS_RUN3> lutpatconv_; - // verbosity level unsigned infoV_; + + // access to lookup tables via eventsetup + const CSCL1TPLookupTableCCLUT* lookupTableCCLUT_; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMClusterProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMClusterProcessor.h index 893f4425bfb80..f61663044fd16 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMClusterProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMClusterProcessor.h @@ -8,11 +8,11 @@ */ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h" #include "L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" #include @@ -41,6 +41,10 @@ class GEMClusterProcessor { bool hasGE21Geometry16Partitions() const { return hasGE21Geometry16Partitions_; } + void setESLookupTables(const CSCL1TPLookupTableME11ILT* conf); + + void setESLookupTables(const CSCL1TPLookupTableME21ILT* conf); + private: // put coincidence clusters in GEMInternalCluster vector void addCoincidenceClusters(const GEMPadDigiClusterCollection*); @@ -69,52 +73,8 @@ class GEMClusterProcessor { // output collection std::vector clusters_; - // strings to paths of LUTs - std::vector padToHsME1aFiles_; - std::vector padToHsME1bFiles_; - std::vector padToHsME21Files_; - - std::vector padToEsME1aFiles_; - std::vector padToEsME1bFiles_; - std::vector padToEsME21Files_; - - std::vector rollToMaxWgME11Files_; - std::vector rollToMinWgME11Files_; - std::vector rollToMaxWgME21Files_; - std::vector rollToMinWgME21Files_; - - // unique pointers to the luts - std::unique_ptr GEMCSCLUT_pad_hs_ME1a_even_; - std::unique_ptr GEMCSCLUT_pad_hs_ME1a_odd_; - std::unique_ptr GEMCSCLUT_pad_hs_ME1b_even_; - std::unique_ptr GEMCSCLUT_pad_hs_ME1b_odd_; - std::unique_ptr GEMCSCLUT_pad_hs_ME21_even_; - std::unique_ptr GEMCSCLUT_pad_hs_ME21_odd_; - - std::unique_ptr GEMCSCLUT_pad_es_ME1a_even_; - std::unique_ptr GEMCSCLUT_pad_es_ME1a_odd_; - std::unique_ptr GEMCSCLUT_pad_es_ME1b_even_; - std::unique_ptr GEMCSCLUT_pad_es_ME1b_odd_; - std::unique_ptr GEMCSCLUT_pad_es_ME21_even_; - std::unique_ptr GEMCSCLUT_pad_es_ME21_odd_; - - std::unique_ptr GEMCSCLUT_roll_l1_max_wg_ME11_even_; - std::unique_ptr GEMCSCLUT_roll_l1_max_wg_ME11_odd_; - std::unique_ptr GEMCSCLUT_roll_l1_min_wg_ME11_even_; - std::unique_ptr GEMCSCLUT_roll_l1_min_wg_ME11_odd_; - std::unique_ptr GEMCSCLUT_roll_l1_max_wg_ME21_even_; - std::unique_ptr GEMCSCLUT_roll_l1_max_wg_ME21_odd_; - std::unique_ptr GEMCSCLUT_roll_l1_min_wg_ME21_even_; - std::unique_ptr GEMCSCLUT_roll_l1_min_wg_ME21_odd_; - - std::unique_ptr GEMCSCLUT_roll_l2_max_wg_ME11_even_; - std::unique_ptr GEMCSCLUT_roll_l2_max_wg_ME11_odd_; - std::unique_ptr GEMCSCLUT_roll_l2_min_wg_ME11_even_; - std::unique_ptr GEMCSCLUT_roll_l2_min_wg_ME11_odd_; - std::unique_ptr GEMCSCLUT_roll_l2_max_wg_ME21_even_; - std::unique_ptr GEMCSCLUT_roll_l2_max_wg_ME21_odd_; - std::unique_ptr GEMCSCLUT_roll_l2_min_wg_ME21_even_; - std::unique_ptr GEMCSCLUT_roll_l2_min_wg_ME21_odd_; + const CSCL1TPLookupTableME11ILT* lookupTableME11ILT_; + const CSCL1TPLookupTableME21ILT* lookupTableME21ILT_; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index a8a0377b67958..cd1b0cb18fb28 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -1,23 +1,38 @@ -//------------------------------------------------- -// -// Class: CSCTriggerPrimitivesProducer -// -// Description: Steering routine of the local Level-1 Cathode Strip Chamber -// trigger. -// -// Author List: S. Valuev, UCLA. -// -// -// Modifications: -// -//-------------------------------------------------- - -#include "L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h" +#ifndef L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h +#define L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h -#include "DataFormats/Common/interface/Handle.h" +/** \class CSCTriggerPrimitivesProducer + * + * Implementation of the local Level-1 Cathode Strip Chamber trigger. + * Simulates functionalities of the anode and cathode Local Charged Tracks + * (LCT) processors, of the Trigger Mother Board (TMB), and of the Muon Port + * Card (MPC). + * + * Input to the simulation are collections of the CSC wire and comparator + * digis. + * + * Produces four collections of the Level-1 CSC Trigger Primitives (track + * stubs, or LCTs): anode LCTs (ALCTs), cathode LCTs (CLCTs), correlated + * LCTs at TMB, and correlated LCTs at MPC. + * + * \author Slava Valuev, UCLA. + * + * The trigger primitive emulator has been expanded with options to + * use both ALCTs, CLCTs and GEM clusters. The GEM-CSC integrated + * local trigger combines ALCT, CLCT and GEM information to produce integrated + * stubs. The available stub types can be found in the class definition of + * CSCCorrelatedLCTDigi (DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h) + * + * authors: Sven Dildick (TAMU), Tao Huang (TAMU) + */ + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" @@ -25,10 +40,72 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" +#include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" - -// Configuration via EventSetup +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" +#include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h" +#include "CondFormats/DataRecord/interface/CSCDBL1TPParametersRcd.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/GEMGeometry/interface/GEMGeometry.h" +#include "Geometry/CSCGeometry/interface/CSCGeometry.h" + +// temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member +class CSCTriggerPrimitivesProducer : public edm::one::EDProducer<> { +public: + explicit CSCTriggerPrimitivesProducer(const edm::ParameterSet&); + ~CSCTriggerPrimitivesProducer() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + // master configuration + edm::ParameterSet config_; + + // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member + std::unique_ptr builder_; + + // input tags for input collections + edm::InputTag compDigiProducer_; + edm::InputTag wireDigiProducer_; + edm::InputTag gemPadDigiClusterProducer_; + + // tokens + edm::EDGetTokenT comp_token_; + edm::EDGetTokenT wire_token_; + edm::EDGetTokenT gem_pad_cluster_token_; + edm::ESGetToken cscToken_; + edm::ESGetToken gemToken_; + edm::ESGetToken pBadChambersToken_; + edm::ESGetToken pLookupTableCCLUTToken_; + edm::ESGetToken pLookupTableME11ILTToken_; + edm::ESGetToken pLookupTableME21ILTToken_; + edm::ESGetToken confToken_; + // switch to force the use of parameters from config file rather then from DB + bool debugParameters_; + + // switch to for enabling checking against the list of bad chambers + bool checkBadChambers_; + + // Write out pre-triggers + bool keepCLCTPreTriggers_; + bool keepALCTPreTriggers_; + + // write out showrs + bool keepShowers_; + + // switch to enable the integrated local triggers in ME11 and ME21 + bool runCCLUT_; + bool runME11ILT_; + bool runME21ILT_; +}; + +#endif CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterSet& conf) { config_ = conf; @@ -49,6 +126,7 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS // check whether you need to run the integrated local triggers const edm::ParameterSet commonParam(conf.getParameter("commonParam")); + runCCLUT_ = commonParam.getParameter("runCCLUT"); runME11ILT_ = commonParam.getParameter("runME11ILT"); runME21ILT_ = commonParam.getParameter("runME21ILT"); @@ -59,6 +137,13 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS cscToken_ = esConsumes(); gemToken_ = esConsumes(); pBadChambersToken_ = esConsumes(); + // consume lookup tables only when flags are set + if (runCCLUT_) + pLookupTableCCLUTToken_ = esConsumes(); + if (runME11ILT_) + pLookupTableME11ILTToken_ = esConsumes(); + if (runME21ILT_) + pLookupTableME21ILTToken_ = esConsumes(); confToken_ = esConsumes(); // register what this produces @@ -104,6 +189,36 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup // Find conditions data for bad chambers. edm::ESHandle pBadChambers = setup.getHandle(pBadChambersToken_); + if (runCCLUT_) { + edm::ESHandle conf = setup.getHandle(pLookupTableCCLUTToken_); + if (conf.product() == nullptr) { + edm::LogError("CSCTriggerPrimitivesProducer") + << "Failed to find a CSCL1TPLookupTableCCLUTRcd in EventSetup with runCCLUT_ on"; + return; + } + builder_->setESLookupTables(conf.product()); + } + + if (runME11ILT_) { + edm::ESHandle conf = setup.getHandle(pLookupTableME11ILTToken_); + if (conf.product() == nullptr) { + edm::LogError("CSCTriggerPrimitivesProducer") + << "Failed to find a CSCL1TPLookupTableME11ILTRcd in EventSetup with runME11ILT_ on"; + return; + } + builder_->setESLookupTables(conf.product()); + } + + if (runME21ILT_) { + edm::ESHandle conf = setup.getHandle(pLookupTableME21ILTToken_); + if (conf.product() == nullptr) { + edm::LogError("CSCTriggerPrimitivesProducer") + << "Failed to find a CSCL1TPLookupTableME21ILTRcd in EventSetup with runME21ILT_ on"; + return; + } + builder_->setESLookupTables(conf.product()); + } + // If !debugParameters then get config parameters using EventSetup mechanism. // This must be done in produce() for every event and not in beginJob() // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007). @@ -201,3 +316,6 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup if (runME11ILT_ or runME21ILT_) ev.put(std::move(oc_gemcopad)); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTriggerPrimitivesProducer); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h deleted file mode 100644 index 208066ed4398e..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h -#define L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h - -/** \class CSCTriggerPrimitivesProducer - * - * Implementation of the local Level-1 Cathode Strip Chamber trigger. - * Simulates functionalities of the anode and cathode Local Charged Tracks - * (LCT) processors, of the Trigger Mother Board (TMB), and of the Muon Port - * Card (MPC). - * - * Input to the simulation are collections of the CSC wire and comparator - * digis. - * - * Produces four collections of the Level-1 CSC Trigger Primitives (track - * stubs, or LCTs): anode LCTs (ALCTs), cathode LCTs (CLCTs), correlated - * LCTs at TMB, and correlated LCTs at MPC. - * - * \author Slava Valuev, UCLA. - * - * The trigger primitive emulator has been expanded with options to - * use both ALCTs, CLCTs and GEM pads. The GEM-CSC integrated - * local trigger combines ALCT, CLCT and GEM information to produce integrated - * stubs. The available stub types can be found in the class definition of - * CSCCorrelatedLCTDigi (DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h) - * Either single GEM pads or GEM pad clusters can be used as input. The online - * system will use GEM pad clusters however. - * - * authors: Sven Dildick (TAMU), Tao Huang (TAMU) - */ - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" -#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" -#include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" -#include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h" -#include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h" -#include "CondFormats/DataRecord/interface/CSCDBL1TPParametersRcd.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/GEMGeometry/interface/GEMGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" - -// temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member -class CSCTriggerPrimitivesProducer : public edm::one::EDProducer<> { -public: - explicit CSCTriggerPrimitivesProducer(const edm::ParameterSet&); - ~CSCTriggerPrimitivesProducer() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - // master configuration - edm::ParameterSet config_; - - // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member - std::unique_ptr builder_; - - // input tags for input collections - edm::InputTag compDigiProducer_; - edm::InputTag wireDigiProducer_; - edm::InputTag gemPadDigiClusterProducer_; - - // tokens - edm::EDGetTokenT comp_token_; - edm::EDGetTokenT wire_token_; - edm::EDGetTokenT gem_pad_cluster_token_; - edm::ESGetToken cscToken_; - edm::ESGetToken gemToken_; - edm::ESGetToken pBadChambersToken_; - edm::ESGetToken confToken_; - // switch to force the use of parameters from config file rather then from DB - bool debugParameters_; - - // switch to for enabling checking against the list of bad chambers - bool checkBadChambers_; - - // Write out pre-triggers - bool keepCLCTPreTriggers_; - bool keepALCTPreTriggers_; - - // write out showrs - bool keepShowers_; - - // switch to enable the integrated local triggers in ME11 and ME21 - bool runME11ILT_; - bool runME21ILT_; -}; - -#endif diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/SealModule.cc b/L1Trigger/CSCTriggerPrimitives/plugins/SealModule.cc deleted file mode 100644 index 4e9077860d272..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/plugins/SealModule.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h" - -DEFINE_FWK_MODULE(CSCTriggerPrimitivesProducer); diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index db054f871a288..4e8c92f44ef47 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -10,7 +10,6 @@ from L1Trigger.CSCTriggerPrimitives.params.clctParams import clctPSets from L1Trigger.CSCTriggerPrimitives.params.tmbParams import tmbPSets from L1Trigger.CSCTriggerPrimitives.params.auxiliaryParams import auxPSets -from L1Trigger.CSCTriggerPrimitives.params.cclutParams import cclutParams from L1Trigger.CSCTriggerPrimitives.params.gemcscParams import gemcscPSets from L1Trigger.CSCTriggerPrimitives.params.showerParams import showerPSet @@ -24,9 +23,6 @@ tmbPSets, gemcscPSets, - ## lookup tables for Run-3 - cclutParams.clone(), - # True: use parameters from this config # False: read parameters from DB using EventSetup mechanism debugParameters = cms.bool(False), diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/cclutParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/cclutParams.py deleted file mode 100644 index 59058fd52ec7a..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/python/params/cclutParams.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -## LUTs for the Run-3 CSC trigger -cclutParams = cms.PSet( - positionLUTFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat0_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat1_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat2_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat3_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat4_v1.txt" - ), - slopeLUTFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat0_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat1_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat2_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat3_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat4_v1.txt" - ), - patternConversionLUTFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePatternConversionLUT_pat0_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePatternConversionLUT_pat1_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePatternConversionLUT_pat2_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePatternConversionLUT_pat3_v1.txt", - "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePatternConversionLUT_pat4_v1.txt" - ), -) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py index 6549bf6aa5bec..96747607e171c 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py @@ -10,115 +10,7 @@ copadParamGE21 = copadParamGE11.clone() -## LUTs for the Run-3 GEM-CSC integrated local trigger -gemcscParams = cms.PSet( - - ## convert pad number to 1/2-strip in ME1a - padToHsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_odd.txt", - ), - ## convert pad number to 1/2-strip in ME1b - padToHsME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_odd.txt", - ), - ## convert pad number to 1/2-strip in ME21 - padToHsME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_odd.txt", - ), - ## convert pad number to 1/8-strip in ME1a - padToEsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_odd.txt", - ), - ## convert pad number to 1/8-strip in ME1b - padToEsME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_odd.txt", - ), - ## convert pad number to 1/8-strip in ME21 - padToEsME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_odd.txt", - ), - ## convert eta partition to minimum wiregroup in ME11 - rollToMinWgME11Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", - ), - ## convert eta partition to maximum wiregroup in ME11 - rollToMaxWgME11Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", - ), - ## convert eta partition to minimum wiregroup in ME21 - rollToMinWgME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", - ), - ## convert eta partition to maximum wiregroup in ME21 - rollToMaxWgME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", - ), - # lookup tables for the GEM-CSC slope correction - gemCscSlopeCorrectionFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer2.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer2.txt", - ), - # lookup tables for the GEM-CSC slope correction - gemCscSlopeCosiFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer2.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer2.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer2.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer2.txt", - ), - # lookup tables for the GEM-CSC slope correction - gemCscSlopeCosiCorrectionFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer2.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer1.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer2.txt", - ), - # convert differences in 1/8-strip numbers between GEM and CSC to Run-3 slopes - esDiffToSlopeME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_odd.txt", - ), - esDiffToSlopeME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_odd.txt", - ), - esDiffToSlopeME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_odd.txt", - ), -) - gemcscPSets = cms.PSet( - gemcscParams.clone(), copadParamGE11 = copadParamGE11.clone(), copadParamGE21 = copadParamGE21.clone(), ) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py index 740bfd7e4b0c6..a3eb50be5b0e6 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py @@ -105,36 +105,9 @@ dropLowQualityALCTsNoGEMs = True, ) -# LUTs to map wiregroup onto min and max half-strip number that it crosses in ME1/1 -wgCrossHsME11Params = cms.PSet( - wgCrossHsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_min_hs_ME1a.txt", - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_max_hs_ME1a.txt", - ), - wgCrossHsME1aGangedFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_min_hs_ME1a_ganged.txt", - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_max_hs_ME1a_ganged.txt", - ), - wgCrossHsME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_min_hs_ME1b.txt", - "L1Trigger/CSCTriggerPrimitives/data/ME11/CSCLUT_wg_max_hs_ME1b.txt", - ) -) - -# LUTs with correspondence between ALCT-CLCT combination -# code and the resulting best/second lct1 -lctCodeParams = cms.PSet( - lctCodeFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/LCTCode/CSCLUT_code_to_bestLCT.txt", - "L1Trigger/CSCTriggerPrimitives/data/LCTCode/CSCLUT_code_to_secondLCT.txt", - ) -) - tmbPSets = cms.PSet( tmbPhase1 = tmbPhase1.clone(), tmbPhase2 = tmbPhase2.clone(), tmbPhase2GE11 = tmbPhase2GE11.clone(), - tmbPhase2GE21 = tmbPhase2GE21.clone(), - wgCrossHsME11Params = wgCrossHsME11Params.clone(), - lctCodeParams = lctCodeParams.clone() + tmbPhase2GE21 = tmbPhase2GE21.clone() ) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCALCTCrossCLCT.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCALCTCrossCLCT.cc index 4a6db6ae749d2..e552b682301d9 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCALCTCrossCLCT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCALCTCrossCLCT.cc @@ -1,61 +1,40 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +namespace { + + // LUTs to map wiregroup onto min and max half-strip number that it crosses in ME1/1 + // These LUTs are deliberately not implemented as eventsetup objects + constexpr std::array wg_min_hs_ME1a_ = { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -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}}; + constexpr std::array wg_max_hs_ME1a_ = { + {223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 205, 189, 167, 150, -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}}; + constexpr std::array wg_min_hs_ME1a_ganged_ = { + {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -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}}; + constexpr std::array wg_max_hs_ME1a_ganged_ = { + {159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 150, -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}}; + constexpr std::array wg_min_hs_ME1b_ = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 73, 47, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + constexpr std::array wg_max_hs_ME1b_ = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 105, 93, 78, 63}}; +}; // namespace + CSCALCTCrossCLCT::CSCALCTCrossCLCT( unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet& conf) : endcap_(endcap), station_(station), ring_(ring) { const auto& commonParams = conf.getParameter("commonParam"); gangedME1a_ = commonParams.getParameter("gangedME1a"); ignoreAlctCrossClct_ = ignoreAlctCrossClct; - - if (!ignoreAlctCrossClct_) { - const edm::ParameterSet me11luts(conf.getParameter("wgCrossHsME11Params")); - wgCrossHsME1aFiles_ = me11luts.getParameter>("wgCrossHsME1aFiles"); - wgCrossHsME1aGangedFiles_ = me11luts.getParameter>("wgCrossHsME1aGangedFiles"); - wgCrossHsME1bFiles_ = me11luts.getParameter>("wgCrossHsME1bFiles"); - wg_cross_min_hs_ME1a_ = std::make_unique(wgCrossHsME1aFiles_[0]); - wg_cross_max_hs_ME1a_ = std::make_unique(wgCrossHsME1aFiles_[1]); - wg_cross_min_hs_ME1a_ganged_ = std::make_unique(wgCrossHsME1aGangedFiles_[0]); - wg_cross_max_hs_ME1a_ganged_ = std::make_unique(wgCrossHsME1aGangedFiles_[1]); - wg_cross_min_hs_ME1b_ = std::make_unique(wgCrossHsME1bFiles_[0]); - wg_cross_max_hs_ME1b_ = std::make_unique(wgCrossHsME1bFiles_[1]); - } -} - -void CSCALCTCrossCLCT::calculateLCTCodes(const CSCALCTDigi& bestALCT, - const CSCCLCTDigi& bestCLCT, - const CSCALCTDigi& secondALCT, - const CSCCLCTDigi& secondCLCT, - unsigned& bestLCTCode, - unsigned& secondLCTCode) const { - // Each of these calls should return "1" when the ALCT and CLCT are valid. - const bool ok11 = doesALCTCrossCLCT(bestALCT, bestCLCT); - const bool ok12 = doesALCTCrossCLCT(bestALCT, secondCLCT); - const bool ok21 = doesALCTCrossCLCT(secondALCT, bestCLCT); - const bool ok22 = doesALCTCrossCLCT(secondALCT, secondCLCT); - - /* - With these okxx, we now calculate a 4-bit code that determines - the best and second LCT combinations. - */ - - const unsigned code = (ok11 << 3) | (ok12 << 2) | (ok21 << 1) | (ok22); - - bestLCTCode = code_to_best_lct_->lookup(code); - secondLCTCode = code_to_second_lct_->lookup(code); - - edm::LogInfo("CSCALCTCrossCLCT") << "Calculate LCT combination code" << std::endl - << "ALCT1: " << bestALCT << std::endl - << "ALCT2: " << secondALCT << std::endl - << "CLCT1: " << bestCLCT << std::endl - << "CLCT2: " << secondCLCT << std::endl - << "LCT combination code: " << code << std::endl - << "LCT1: " << bestLCTCode << std::endl - << "LCT1: " << secondLCTCode << std::endl; } bool CSCALCTCrossCLCT::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { @@ -76,12 +55,16 @@ bool CSCALCTCrossCLCT::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi } bool CSCALCTCrossCLCT::doesWiregroupCrossHalfStrip(int wiregroup, int halfstrip) const { - const int min_hs_ME1a = wg_cross_min_hs_ME1a_->lookup(wiregroup); - const int max_hs_ME1a = wg_cross_max_hs_ME1a_->lookup(wiregroup); - const int min_hs_ME1a_ganged = wg_cross_min_hs_ME1a_ganged_->lookup(wiregroup); - const int max_hs_ME1a_ganged = wg_cross_max_hs_ME1a_ganged_->lookup(wiregroup); - const int min_hs_ME1b = wg_cross_min_hs_ME1b_->lookup(wiregroup); - const int max_hs_ME1b = wg_cross_max_hs_ME1b_->lookup(wiregroup); + // sanity-check for invalid wiregroups + if (wiregroup < 0 or wiregroup >= CSCConstants::NUM_WIREGROUPS_ME11) + return false; + + const int min_hs_ME1a = wg_min_hs_ME1a_[wiregroup]; + const int max_hs_ME1a = wg_max_hs_ME1a_[wiregroup]; + const int min_hs_ME1a_ganged = wg_min_hs_ME1a_ganged_[wiregroup]; + const int max_hs_ME1a_ganged = wg_max_hs_ME1a_ganged_[wiregroup]; + const int min_hs_ME1b = wg_min_hs_ME1b_[wiregroup]; + const int max_hs_ME1b = wg_max_hs_ME1b_[wiregroup]; // ME1/a half-strip starts at 128 if (halfstrip > CSCConstants::MAX_HALF_STRIP_ME1B) { diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 76475348ce879..503f420702083 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -140,6 +140,8 @@ void CSCCathodeLCTProcessor::setConfigParameters(const CSCDBL1TPParameters* conf } } +void CSCCathodeLCTProcessor::setESLookupTables(const CSCL1TPLookupTableCCLUT* conf) { cclut_->setESLookupTables(conf); } + void CSCCathodeLCTProcessor::checkConfigParameters() { // Make sure that the parameter values are within the allowed range. diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMatcher.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMatcher.cc index c4baf765e0146..20b13ad12bfd1 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMatcher.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMatcher.cc @@ -1,5 +1,4 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMatcher.h" -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include "L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" @@ -29,56 +28,11 @@ CSCGEMMatcher::CSCGEMMatcher( mitigateSlopeByCosi_ = tmbParams.getParameter("mitigateSlopeByCosi"); assign_gem_csc_bending_ = tmbParams.getParameter("assignGEMCSCBending"); +} - if (mitigateSlopeByCosi_) { - gemCscSlopeCosiFiles_ = conf.getParameter>("gemCscSlopeCosiFiles"); - - gem_csc_slope_cosi_2to1_L1_ME11_even_ = std::make_unique(gemCscSlopeCosiFiles_[0]); - gem_csc_slope_cosi_2to1_L1_ME11_odd_ = std::make_unique(gemCscSlopeCosiFiles_[1]); - gem_csc_slope_cosi_3to1_L1_ME11_even_ = std::make_unique(gemCscSlopeCosiFiles_[2]); - gem_csc_slope_cosi_3to1_L1_ME11_odd_ = std::make_unique(gemCscSlopeCosiFiles_[3]); - - gemCscSlopeCosiCorrectionFiles_ = conf.getParameter>("gemCscSlopeCosiCorrectionFiles"); - - gem_csc_slope_cosi_corr_L1_ME11_even_ = std::make_unique(gemCscSlopeCosiCorrectionFiles_[0]); - gem_csc_slope_cosi_corr_L2_ME11_even_ = std::make_unique(gemCscSlopeCosiCorrectionFiles_[1]); - gem_csc_slope_cosi_corr_L1_ME11_odd_ = std::make_unique(gemCscSlopeCosiCorrectionFiles_[2]); - gem_csc_slope_cosi_corr_L2_ME11_odd_ = std::make_unique(gemCscSlopeCosiCorrectionFiles_[3]); - } else { - gemCscSlopeCorrectionFiles_ = conf.getParameter>("gemCscSlopeCorrectionFiles"); - - gem_csc_slope_corr_L1_ME11_even_ = std::make_unique(gemCscSlopeCorrectionFiles_[0]); - gem_csc_slope_corr_L2_ME11_even_ = std::make_unique(gemCscSlopeCorrectionFiles_[1]); - gem_csc_slope_corr_L1_ME11_odd_ = std::make_unique(gemCscSlopeCorrectionFiles_[2]); - gem_csc_slope_corr_L2_ME11_odd_ = std::make_unique(gemCscSlopeCorrectionFiles_[3]); - } - - if (assign_gem_csc_bending_) { - if (station_ == 1) { - esDiffToSlopeME1aFiles_ = conf.getParameter>("esDiffToSlopeME1aFiles"); - esDiffToSlopeME1bFiles_ = conf.getParameter>("esDiffToSlopeME1bFiles"); - - es_diff_slope_L1_ME1a_even_ = std::make_unique(esDiffToSlopeME1aFiles_[0]); - es_diff_slope_L1_ME1a_odd_ = std::make_unique(esDiffToSlopeME1aFiles_[1]); - es_diff_slope_L2_ME1a_even_ = std::make_unique(esDiffToSlopeME1aFiles_[2]); - es_diff_slope_L2_ME1a_odd_ = std::make_unique(esDiffToSlopeME1aFiles_[3]); - - es_diff_slope_L1_ME1b_even_ = std::make_unique(esDiffToSlopeME1bFiles_[0]); - es_diff_slope_L1_ME1b_odd_ = std::make_unique(esDiffToSlopeME1bFiles_[1]); - es_diff_slope_L2_ME1b_even_ = std::make_unique(esDiffToSlopeME1bFiles_[2]); - es_diff_slope_L2_ME1b_odd_ = std::make_unique(esDiffToSlopeME1bFiles_[3]); - } - - if (station_ == 2) { - esDiffToSlopeME21Files_ = conf.getParameter>("esDiffToSlopeME21Files"); +void CSCGEMMatcher::setESLookupTables(const CSCL1TPLookupTableME11ILT* conf) { lookupTableME11ILT_ = conf; } - es_diff_slope_L1_ME21_even_ = std::make_unique(esDiffToSlopeME21Files_[0]); - es_diff_slope_L1_ME21_odd_ = std::make_unique(esDiffToSlopeME21Files_[1]); - es_diff_slope_L2_ME21_even_ = std::make_unique(esDiffToSlopeME21Files_[2]); - es_diff_slope_L2_ME21_odd_ = std::make_unique(esDiffToSlopeME21Files_[3]); - } - } -} +void CSCGEMMatcher::setESLookupTables(const CSCL1TPLookupTableME21ILT* conf) { lookupTableME21ILT_ = conf; } unsigned CSCGEMMatcher::calculateGEMCSCBending(const CSCCLCTDigi& clct, const GEMInternalCluster& cluster) const { // difference in 1/8-strip number @@ -90,14 +44,14 @@ unsigned CSCGEMMatcher::calculateGEMCSCBending(const CSCCLCTDigi& clct, const GE if (station_ == 2) { if (isEven_) { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME21_even_->lookup(diff); + slope = lookupTableME21ILT_->es_diff_slope_L1_ME21_even(diff); else - slope = es_diff_slope_L2_ME21_even_->lookup(diff); + slope = lookupTableME21ILT_->es_diff_slope_L2_ME21_even(diff); } else { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME21_odd_->lookup(diff); + slope = lookupTableME21ILT_->es_diff_slope_L1_ME21_odd(diff); else - slope = es_diff_slope_L2_ME21_odd_->lookup(diff); + slope = lookupTableME21ILT_->es_diff_slope_L2_ME21_odd(diff); } } @@ -106,26 +60,26 @@ unsigned CSCGEMMatcher::calculateGEMCSCBending(const CSCCLCTDigi& clct, const GE if (station_ == 1 and isME1a) { if (isEven_) { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME1a_even_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L1_ME1a_even(diff); else - slope = es_diff_slope_L2_ME1a_even_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L2_ME1a_even(diff); } else { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME1a_odd_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L1_ME1a_odd(diff); else - slope = es_diff_slope_L2_ME1a_odd_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L2_ME1a_odd(diff); } } else { if (isEven_) { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME1b_even_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L1_ME1b_even(diff); else - slope = es_diff_slope_L2_ME1b_even_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L2_ME1b_even(diff); } else { if (cluster.id().layer() == 1) - slope = es_diff_slope_L1_ME1b_odd_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L1_ME1b_odd(diff); else - slope = es_diff_slope_L2_ME1b_odd_->lookup(diff); + slope = lookupTableME11ILT_->es_diff_slope_L2_ME1b_odd(diff); } } @@ -458,16 +412,16 @@ uint16_t CSCGEMMatcher::mitigatedSlopeByConsistency(const CSCCLCTDigi& clct) con //need to look up in table 2->1 else if (cosi == 2) { if (chamber_ % 2 == 0) - return gem_csc_slope_cosi_2to1_L1_ME11_even_->lookup(clct.getSlope()); + return lookupTableME11ILT_->CSC_slope_cosi_2to1_L1_ME11_even(clct.getSlope()); else - return gem_csc_slope_cosi_2to1_L1_ME11_odd_->lookup(clct.getSlope()); + return lookupTableME11ILT_->CSC_slope_cosi_2to1_L1_ME11_odd(clct.getSlope()); } //need to look up in table 3->1 else if (cosi == 3) { if (chamber_ % 2 == 0) - return gem_csc_slope_cosi_3to1_L1_ME11_even_->lookup(clct.getSlope()); + return lookupTableME11ILT_->CSC_slope_cosi_3to1_L1_ME11_even(clct.getSlope()); else - return gem_csc_slope_cosi_3to1_L1_ME11_odd_->lookup(clct.getSlope()); + return lookupTableME11ILT_->CSC_slope_cosi_3to1_L1_ME11_odd(clct.getSlope()); } //just to avoid compiler errors an error code else { @@ -483,27 +437,27 @@ int CSCGEMMatcher::CSCGEMSlopeCorrector(bool isL1orCoincidence, int cscSlope) co //determine cosi-based slope correction if (chamber_ % 2 == 0) { if (isL1orCoincidence) - SlopeShift = gem_csc_slope_cosi_corr_L1_ME11_even_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_cosi_corr_L1_ME11_even(std::abs(cscSlope)); else - SlopeShift = gem_csc_slope_cosi_corr_L2_ME11_even_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_cosi_corr_L2_ME11_even(std::abs(cscSlope)); } else { if (isL1orCoincidence) - SlopeShift = gem_csc_slope_cosi_corr_L1_ME11_odd_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_cosi_corr_L1_ME11_odd(std::abs(cscSlope)); else - SlopeShift = gem_csc_slope_cosi_corr_L2_ME11_odd_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_cosi_corr_L2_ME11_odd(std::abs(cscSlope)); } } else { //determine shift by slope correction if (chamber_ % 2 == 0) { if (isL1orCoincidence) - SlopeShift = gem_csc_slope_corr_L1_ME11_even_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_corr_L1_ME11_even(std::abs(cscSlope)); else - SlopeShift = gem_csc_slope_corr_L2_ME11_even_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_corr_L2_ME11_even(std::abs(cscSlope)); } else { if (isL1orCoincidence) - SlopeShift = gem_csc_slope_corr_L1_ME11_odd_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_corr_L1_ME11_odd(std::abs(cscSlope)); else - SlopeShift = gem_csc_slope_corr_L2_ME11_odd_->lookup(std::abs(cscSlope)); + SlopeShift = lookupTableME11ILT_->CSC_slope_corr_L2_ME11_odd(std::abs(cscSlope)); } } return std::round(SlopeShift * SlopeSign * endcap_); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index acd00495b0068..b987b1657432c 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -72,6 +72,11 @@ void CSCGEMMotherboard::run(const CSCWireDigiCollection* wiredc, alctProc->setCSCGeometry(cscGeometry_); clctProc->setCSCGeometry(cscGeometry_); + // set CCLUT parameters if necessary + if (runCCLUT_) { + clctProc->setESLookupTables(lookupTableCCLUT_); + } + // Step 2: Run the processors const std::vector& alctV = alctProc->run(wiredc); // run anodeLCT const std::vector& clctV = clctProc->run(compdc); // run cathodeLCT @@ -83,6 +88,16 @@ void CSCGEMMotherboard::run(const CSCWireDigiCollection* wiredc, if (alctV.empty() and clctV.empty()) return; + // set the lookup tables for coordinate conversion and matching + if (isME11_) { + clusterProc_->setESLookupTables(lookupTableME11ILT_); + cscGEMMatcher_->setESLookupTables(lookupTableME11ILT_); + } + if (isME21_) { + clusterProc_->setESLookupTables(lookupTableME21ILT_); + cscGEMMatcher_->setESLookupTables(lookupTableME21ILT_); + } + // Step 3: run the GEM cluster processor to get the internal clusters clusterProc_->run(gemClusters); hasGE21Geometry16Partitions_ = clusterProc_->hasGE21Geometry16Partitions(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCLUTReader.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCLUTReader.cc deleted file mode 100644 index ec8923b970177..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCLUTReader.cc +++ /dev/null @@ -1,171 +0,0 @@ -#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -CSCLUTReader::CSCLUTReader(const std::string& fname) - : fname_(fname), - nrBitsAddress_(0), - nrBitsData_(0), - addressMask_(0), - dataMask_(0), - data_(), - m_codeInWidth(12), - m_outWidth(32) { - if (fname != std::string("")) { - load(fname); - } else { - initialize(); - } -} - -// I/O functions -void CSCLUTReader::save(std::ofstream& output) { write(output); } - -float CSCLUTReader::data(unsigned int address) const { - return (address & addressMask_) < data_.size() ? data_[address] : 0; -} - -int CSCLUTReader::load(const std::string& inFileName) { - std::ifstream fstream; - fstream.open(edm::FileInPath(inFileName.c_str()).fullPath()); - if (!fstream.good()) { - fstream.close(); - edm::LogError("CSCLUTReader") << "Failed to open LUT file: " << inFileName; - } - int readCode = read(fstream); - - m_initialized = true; - fstream.close(); - - return readCode; -} - -float CSCLUTReader::lookup(int code) const { - if (m_initialized) { - return lookupPacked(code); - } else { - edm::LogError("CSCLUTReader") << "LUT not initialized. " << fname_; - return 0; - } -} - -float CSCLUTReader::lookupPacked(const int input) const { - if (m_initialized) { - return data((unsigned int)input); - } else { - edm::LogError("CSCLUTReader") << "If you're not loading a LUT from file you need to implement lookupPacked."; - return 0; - } -} - -void CSCLUTReader::initialize() { - if (empty()) { - std::stringstream stream; - stream << "#
V1 " << m_codeInWidth << " " << m_outWidth << "
" << std::endl; - for (int in = 0; in < (1 << m_codeInWidth); ++in) { - int out = lookup(in); - stream << in << " " << out << std::endl; - } - read(stream); - } - m_initialized = true; -} - -unsigned CSCLUTReader::checkedInput(unsigned in, unsigned maxWidth) const { - unsigned maxIn = (1 << maxWidth) - 1; - return (in < maxIn ? in : maxIn); -} - -int CSCLUTReader::read(std::istream& stream) { - data_.clear(); - - int readHeaderCode = readHeader(stream); - if (readHeaderCode != SUCCESS) { - edm::LogError("CSCLUTReader") << "Failed to read header code. " << fname_; - return readHeaderCode; - } - - std::vector > entries; - unsigned int maxAddress = addressMask_; - std::string line; - - while (std::getline(stream, line)) { - line.erase(std::find(line.begin(), line.end(), '#'), line.end()); //ignore comments - std::istringstream lineStream(line); - std::pair entry; - while (lineStream >> entry.first >> entry.second) { - entry.first &= addressMask_; - // entry.second &= dataMask_; - entries.push_back(entry); - if (entry.first > maxAddress || maxAddress == addressMask_) - maxAddress = entry.first; - } - } - std::sort(entries.begin(), entries.end()); - if (entries.empty()) { - //log the error we read nothing - return NO_ENTRIES; - } - //this check is redundant as dups are also picked up by the next check but might make for easier debugging - if (std::adjacent_find(entries.begin(), entries.end(), [](auto const& a, auto const& b) { - return a.first == b.first; - }) != entries.end()) { - //log the error that we have duplicate addresses once masked - return DUP_ENTRIES; - } - if (entries.front().first != 0 || - std::adjacent_find(entries.begin(), entries.end(), [](auto const& a, auto const& b) { - return a.first + 1 != b.first; - }) != entries.end()) { - //log the error that we have a missing entry - return MISS_ENTRIES; - } - - if (maxAddress != std::numeric_limits::max()) - data_.resize(maxAddress + 1, 0); - else { - //log the error that we have more addresses than we can deal with (which is 4gb so something probably has gone wrong anyways) - return MAX_ADDRESS_OUTOFRANGE; - } - - std::transform(entries.begin(), entries.end(), data_.begin(), [](auto const& x) { return x.second; }); - return SUCCESS; -} - -void CSCLUTReader::write(std::ostream& stream) const { - stream << "#
V1 " << nrBitsAddress_ << " " << nrBitsData_ << "
" << std::endl; - for (unsigned int address = 0; address < data_.size(); address++) { - stream << (address & addressMask_) << " " << data(address) << std::endl; - } -} - -unsigned int CSCLUTReader::maxSize() const { - return addressMask_ == std::numeric_limits::max() ? addressMask_ : addressMask_ + 1; -} - -int CSCLUTReader::readHeader(std::istream& stream) { - int startPos = stream.tellg(); //we are going to reset to this position before we exit - std::string line; - while (std::getline(stream, line)) { - if (line.find("#
") == 0) { //line - std::istringstream lineStream(line); - - std::string version; //currently not doing anything with this - std::string headerField; //currently not doing anything with this - if (lineStream >> headerField >> version >> nrBitsAddress_ >> nrBitsData_) { - addressMask_ = nrBitsAddress_ != 32 ? (0x1 << nrBitsAddress_) - 1 : ~0x0; - dataMask_ = (0x1 << nrBitsData_) - 1; - stream.seekg(startPos); - return SUCCESS; - } - } - } - - nrBitsAddress_ = 0; - nrBitsData_ = 0; - addressMask_ = (0x1 << nrBitsAddress_) - 1; - dataMask_ = (0x1 << nrBitsData_) - 1; - - stream.seekg(startPos); - return NO_HEADER; -} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 67a7548908179..47d4013ea4900 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -75,8 +75,10 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, } // set up helper class to check if ALCT and CLCT cross - const bool ignoreAlctCrossClct = tmbParams_.getParameter("ignoreAlctCrossClct"); - cscOverlap_ = std::make_unique(endcap, station, theRing, ignoreAlctCrossClct, conf); + ignoreAlctCrossClct_ = tmbParams_.getParameter("ignoreAlctCrossClct"); + if (!ignoreAlctCrossClct_) { + cscOverlap_ = std::make_unique(endcap, station, theRing, ignoreAlctCrossClct_, conf); + } } void CSCMotherboard::clear() { @@ -121,6 +123,12 @@ void CSCMotherboard::setConfigParameters(const CSCDBL1TPParameters* conf) { } } +void CSCMotherboard::setESLookupTables(const CSCL1TPLookupTableCCLUT* conf) { lookupTableCCLUT_ = conf; } + +void CSCMotherboard::setESLookupTables(const CSCL1TPLookupTableME11ILT* conf) { lookupTableME11ILT_ = conf; } + +void CSCMotherboard::setESLookupTables(const CSCL1TPLookupTableME21ILT* conf) { lookupTableME21ILT_ = conf; } + void CSCMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc) { // Step 1: Setup clear(); @@ -135,6 +143,11 @@ void CSCMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparato alctProc->setCSCGeometry(cscGeometry_); clctProc->setCSCGeometry(cscGeometry_); + // set CCLUT parameters if necessary + if (runCCLUT_) { + clctProc->setESLookupTables(lookupTableCCLUT_); + } + // Step 2: Run the processors alctV = alctProc->run(wiredc); // run anodeLCT clctV = clctProc->run(compdc); // run cathodeLCT @@ -371,7 +384,7 @@ void CSCMotherboard::correlateLCTs(const CSCALCTDigi& bALCT, all information, even if it's unphysical. */ const bool bestCase3(match_trig_enable and bestALCT.isValid() and bestCLCT.isValid() and - cscOverlap_->doesALCTCrossCLCT(bestALCT, bestCLCT)); + doesALCTCrossCLCT(bestALCT, bestCLCT)); // at least one of the cases must be valid if (bestCase1 or bestCase2 or bestCase3) { @@ -391,7 +404,7 @@ void CSCMotherboard::correlateLCTs(const CSCALCTDigi& bALCT, all information, even if it's unphysical. */ const bool secondCase3(match_trig_enable and secondALCT.isValid() and secondCLCT.isValid() and - cscOverlap_->doesALCTCrossCLCT(secondALCT, secondCLCT)); + doesALCTCrossCLCT(secondALCT, secondCLCT)); // at least one component must be different in order to consider the secondLCT if ((secondALCT != bestALCT) or (secondCLCT != bestCLCT)) { @@ -423,6 +436,13 @@ void CSCMotherboard::copyValidToInValid(CSCALCTDigi& bestALCT, bestCLCT = secondCLCT; } +bool CSCMotherboard::doesALCTCrossCLCT(const CSCALCTDigi& alct, const CSCCLCTDigi& clct) const { + if (ignoreAlctCrossClct_) + return true; + else + return cscOverlap_->doesALCTCrossCLCT(alct, clct); +} + // This method calculates all the TMB words and then passes them to the // constructor of correlated LCTs. void CSCMotherboard::constructLCTs( diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index fbcd070d422f6..643f3d96b6bd1 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -95,6 +95,54 @@ void CSCTriggerPrimitivesBuilder::setConfigParameters(const CSCDBL1TPParameters* } } +void CSCTriggerPrimitivesBuilder::setESLookupTables(const CSCL1TPLookupTableCCLUT* conf) { + // Receives CSCL1TPLookupTableCCLUT percolated down from ESProducer. + for (int endc = min_endcap; endc <= max_endcap; endc++) { + for (int stat = min_station; stat <= max_station; stat++) { + int numsubs = ((stat == 1) ? max_subsector : 1); + for (int sect = min_sector; sect <= max_sector; sect++) { + for (int subs = min_subsector; subs <= numsubs; subs++) { + for (int cham = min_chamber; cham <= max_chamber; cham++) { + tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->setESLookupTables(conf); + } + } + } + } + } +} + +void CSCTriggerPrimitivesBuilder::setESLookupTables(const CSCL1TPLookupTableME11ILT* conf) { + for (int endc = min_endcap; endc <= max_endcap; endc++) { + for (int stat = min_station; stat <= max_station; stat++) { + int numsubs = ((stat == 1) ? max_subsector : 1); + for (int sect = min_sector; sect <= max_sector; sect++) { + for (int subs = min_subsector; subs <= numsubs; subs++) { + for (int cham = min_chamber; cham <= max_chamber; cham++) { + if (tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->id().isME11()) + tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->setESLookupTables(conf); + } + } + } + } + } +} + +void CSCTriggerPrimitivesBuilder::setESLookupTables(const CSCL1TPLookupTableME21ILT* conf) { + for (int endc = min_endcap; endc <= max_endcap; endc++) { + for (int stat = min_station; stat <= max_station; stat++) { + int numsubs = ((stat == 1) ? max_subsector : 1); + for (int sect = min_sector; sect <= max_sector; sect++) { + for (int subs = min_subsector; subs <= numsubs; subs++) { + for (int cham = min_chamber; cham <= max_chamber; cham++) { + if (tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->id().isME21()) + tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->setESLookupTables(conf); + } + } + } + } + } +} + void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc, diff --git a/L1Trigger/CSCTriggerPrimitives/src/ComparatorCodeLUT.cc b/L1Trigger/CSCTriggerPrimitives/src/ComparatorCodeLUT.cc index 2b55021f244ed..73c992eee232f 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/ComparatorCodeLUT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/ComparatorCodeLUT.cc @@ -2,19 +2,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" ComparatorCodeLUT::ComparatorCodeLUT(const edm::ParameterSet& conf) { - positionLUTFiles_ = conf.getParameter>("positionLUTFiles"); - slopeLUTFiles_ = conf.getParameter>("slopeLUTFiles"); - patternConversionLUTFiles_ = conf.getParameter>("patternConversionLUTFiles"); - - for (int i = 0; i < 5; ++i) { - lutpos_[i] = std::make_unique(positionLUTFiles_[i]); - lutslope_[i] = std::make_unique(slopeLUTFiles_[i]); - lutpatconv_[i] = std::make_unique(patternConversionLUTFiles_[i]); - } - clct_pattern_ = CSCPatternBank::clct_pattern_run3_; } +void ComparatorCodeLUT::setESLookupTables(const CSCL1TPLookupTableCCLUT* conf) { lookupTableCCLUT_ = conf; } + void ComparatorCodeLUT::run(CSCCLCTDigi& digi, unsigned numCFEBs) const { // print out the old CLCT for debugging if (infoV_ > 2) { @@ -67,8 +59,8 @@ void ComparatorCodeLUT::run(CSCCLCTDigi& digi, unsigned numCFEBs) const { digi.setRun3Pattern(pattern); // look-up the unsigned values - const unsigned positionCC(lutpos_[pattern]->lookup(comparatorCode)); - const unsigned slopeCC(lutslope_[pattern]->lookup(comparatorCode)); + const unsigned positionCC(lookupTableCCLUT_->cclutPosition(pattern, comparatorCode)); + const unsigned slopeCC(lookupTableCCLUT_->cclutSlope(pattern, comparatorCode)); const unsigned run2PatternCC(convertSlopeToRun2Pattern(slopeCC)); // if the slope is negative, set bending to 0 diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMClusterProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMClusterProcessor.cc index 51f81ff7a026b..b36fd7cf9d182 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMClusterProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMClusterProcessor.cc @@ -13,35 +13,6 @@ GEMClusterProcessor::GEMClusterProcessor(int region, unsigned station, unsigned maxDeltaPad_ = copad.getParameter("maxDeltaPad"); maxDeltaRoll_ = copad.getParameter("maxDeltaRoll"); maxDeltaBX_ = copad.getParameter("maxDeltaBX"); - - padToHsME1aFiles_ = conf.getParameter>("padToHsME1aFiles"); - padToHsME1bFiles_ = conf.getParameter>("padToHsME1bFiles"); - - padToEsME1aFiles_ = conf.getParameter>("padToEsME1aFiles"); - padToEsME1bFiles_ = conf.getParameter>("padToEsME1bFiles"); - - rollToMaxWgME11Files_ = conf.getParameter>("rollToMaxWgME11Files"); - rollToMinWgME11Files_ = conf.getParameter>("rollToMinWgME11Files"); - - GEMCSCLUT_pad_hs_ME1a_even_ = std::make_unique(padToHsME1aFiles_[0]); - GEMCSCLUT_pad_hs_ME1a_odd_ = std::make_unique(padToHsME1aFiles_[1]); - GEMCSCLUT_pad_hs_ME1b_even_ = std::make_unique(padToHsME1bFiles_[0]); - GEMCSCLUT_pad_hs_ME1b_odd_ = std::make_unique(padToHsME1bFiles_[1]); - - GEMCSCLUT_pad_es_ME1a_even_ = std::make_unique(padToEsME1aFiles_[0]); - GEMCSCLUT_pad_es_ME1a_odd_ = std::make_unique(padToEsME1aFiles_[1]); - GEMCSCLUT_pad_es_ME1b_even_ = std::make_unique(padToEsME1bFiles_[0]); - GEMCSCLUT_pad_es_ME1b_odd_ = std::make_unique(padToEsME1bFiles_[1]); - - GEMCSCLUT_roll_l1_min_wg_ME11_even_ = std::make_unique(rollToMinWgME11Files_[0]); - GEMCSCLUT_roll_l1_min_wg_ME11_odd_ = std::make_unique(rollToMinWgME11Files_[1]); - GEMCSCLUT_roll_l2_min_wg_ME11_even_ = std::make_unique(rollToMinWgME11Files_[2]); - GEMCSCLUT_roll_l2_min_wg_ME11_odd_ = std::make_unique(rollToMinWgME11Files_[3]); - - GEMCSCLUT_roll_l1_max_wg_ME11_even_ = std::make_unique(rollToMaxWgME11Files_[0]); - GEMCSCLUT_roll_l1_max_wg_ME11_odd_ = std::make_unique(rollToMaxWgME11Files_[1]); - GEMCSCLUT_roll_l2_max_wg_ME11_even_ = std::make_unique(rollToMaxWgME11Files_[2]); - GEMCSCLUT_roll_l2_max_wg_ME11_odd_ = std::make_unique(rollToMaxWgME11Files_[3]); } if (station_ == 2) { @@ -52,32 +23,15 @@ GEMClusterProcessor::GEMClusterProcessor(int region, unsigned station, unsigned maxDeltaPad_ = copad.getParameter("maxDeltaPad"); maxDeltaRoll_ = copad.getParameter("maxDeltaRoll"); maxDeltaBX_ = copad.getParameter("maxDeltaBX"); - - padToHsME21Files_ = conf.getParameter>("padToHsME21Files"); - padToEsME21Files_ = conf.getParameter>("padToEsME21Files"); - - rollToMaxWgME21Files_ = conf.getParameter>("rollToMaxWgME21Files"); - rollToMinWgME21Files_ = conf.getParameter>("rollToMinWgME21Files"); - - GEMCSCLUT_pad_hs_ME21_even_ = std::make_unique(padToHsME21Files_[0]); - GEMCSCLUT_pad_hs_ME21_odd_ = std::make_unique(padToHsME21Files_[1]); - GEMCSCLUT_pad_es_ME21_even_ = std::make_unique(padToEsME21Files_[0]); - GEMCSCLUT_pad_es_ME21_odd_ = std::make_unique(padToEsME21Files_[1]); - - GEMCSCLUT_roll_l1_min_wg_ME21_even_ = std::make_unique(rollToMinWgME21Files_[0]); - GEMCSCLUT_roll_l1_min_wg_ME21_odd_ = std::make_unique(rollToMinWgME21Files_[1]); - GEMCSCLUT_roll_l2_min_wg_ME21_even_ = std::make_unique(rollToMinWgME21Files_[2]); - GEMCSCLUT_roll_l2_min_wg_ME21_odd_ = std::make_unique(rollToMinWgME21Files_[3]); - - GEMCSCLUT_roll_l1_max_wg_ME21_even_ = std::make_unique(rollToMaxWgME21Files_[0]); - GEMCSCLUT_roll_l1_max_wg_ME21_odd_ = std::make_unique(rollToMaxWgME21Files_[1]); - GEMCSCLUT_roll_l2_max_wg_ME21_even_ = std::make_unique(rollToMaxWgME21Files_[2]); - GEMCSCLUT_roll_l2_max_wg_ME21_odd_ = std::make_unique(rollToMaxWgME21Files_[3]); } } void GEMClusterProcessor::clear() { clusters_.clear(); } +void GEMClusterProcessor::setESLookupTables(const CSCL1TPLookupTableME11ILT* conf) { lookupTableME11ILT_ = conf; } + +void GEMClusterProcessor::setESLookupTables(const CSCL1TPLookupTableME21ILT* conf) { lookupTableME21ILT_ = conf; } + void GEMClusterProcessor::run(const GEMPadDigiClusterCollection* in_clusters) { // Step 1: clear the GEMInternalCluster vector clear(); @@ -265,28 +219,28 @@ void GEMClusterProcessor::doCoordinateConversion() { if (station_ == 1) { if (isEven_) { // ME1/b - layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_first_pad); - layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_last_pad); + layer1_pad_to_first_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_even(layer1_first_pad); + layer1_pad_to_last_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_even(layer1_last_pad); // ME1/a - layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_first_pad); - layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_last_pad); + layer1_pad_to_first_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_even(layer1_first_pad); + layer1_pad_to_last_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_even(layer1_last_pad); } else { // ME1/b - layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_odd(layer1_first_pad); + layer1_pad_to_last_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_odd(layer1_last_pad); // ME1/a - layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_odd(layer1_first_pad); + layer1_pad_to_last_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_odd(layer1_last_pad); } } // ME2/1 if (station_ == 2) { if (isEven_) { - layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_first_pad); - layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_last_pad); + layer1_pad_to_first_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_even(layer1_first_pad); + layer1_pad_to_last_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_even(layer1_last_pad); } else { - layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_odd(layer1_first_pad); + layer1_pad_to_last_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_odd(layer1_last_pad); } } // middle 1/2-strip @@ -314,28 +268,28 @@ void GEMClusterProcessor::doCoordinateConversion() { if (station_ == 1) { if (isEven_) { // ME1/b - layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_first_pad); - layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_last_pad); + layer1_pad_to_first_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_even(layer1_first_pad); + layer1_pad_to_last_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_even(layer1_last_pad); // ME1/a - layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_first_pad); - layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_last_pad); + layer1_pad_to_first_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_even(layer1_first_pad); + layer1_pad_to_last_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_even(layer1_last_pad); } else { // ME1/b - layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_odd(layer1_first_pad); + layer1_pad_to_last_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_odd(layer1_last_pad); // ME1/a - layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_odd(layer1_first_pad); + layer1_pad_to_last_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_odd(layer1_last_pad); } } // ME2/1 if (station_ == 2) { if (isEven_) { - layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_first_pad); - layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_last_pad); + layer1_pad_to_first_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_even(layer1_first_pad); + layer1_pad_to_last_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_even(layer1_last_pad); } else { - layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_first_pad); - layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_last_pad); + layer1_pad_to_first_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_odd(layer1_first_pad); + layer1_pad_to_last_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_odd(layer1_last_pad); } } // middle 1/8-strip @@ -362,22 +316,22 @@ void GEMClusterProcessor::doCoordinateConversion() { // ME1/1 if (station_ == 1) { if (isEven_) { - roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME11_even_->lookup(roll); - roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME11_even_->lookup(roll); + roll_l1_to_min_wg = lookupTableME11ILT_->GEM_roll_L1_CSC_min_wg_ME11_even(roll); + roll_l1_to_max_wg = lookupTableME11ILT_->GEM_roll_L1_CSC_max_wg_ME11_even(roll); } else { - roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME11_odd_->lookup(roll); - roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME11_odd_->lookup(roll); + roll_l1_to_min_wg = lookupTableME11ILT_->GEM_roll_L1_CSC_min_wg_ME11_odd(roll); + roll_l1_to_max_wg = lookupTableME11ILT_->GEM_roll_L1_CSC_max_wg_ME11_odd(roll); } } // ME2/1 if (station_ == 2) { if (isEven_) { - roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME21_even_->lookup(roll); - roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME21_even_->lookup(roll); + roll_l1_to_min_wg = lookupTableME21ILT_->GEM_roll_L1_CSC_min_wg_ME21_even(roll); + roll_l1_to_max_wg = lookupTableME21ILT_->GEM_roll_L1_CSC_max_wg_ME21_even(roll); } else { - roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME21_odd_->lookup(roll); - roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME21_odd_->lookup(roll); + roll_l1_to_min_wg = lookupTableME21ILT_->GEM_roll_L1_CSC_min_wg_ME21_odd(roll); + roll_l1_to_max_wg = lookupTableME21ILT_->GEM_roll_L1_CSC_max_wg_ME21_odd(roll); } } @@ -400,28 +354,28 @@ void GEMClusterProcessor::doCoordinateConversion() { if (station_ == 1) { if (isEven_) { // ME1/b - layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_first_pad); - layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_last_pad); + layer2_pad_to_first_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_even(layer2_first_pad); + layer2_pad_to_last_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_even(layer2_last_pad); // ME1/a - layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_first_pad); - layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_last_pad); + layer2_pad_to_first_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_even(layer2_first_pad); + layer2_pad_to_last_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_even(layer2_last_pad); } else { // ME1/b - layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_odd(layer2_first_pad); + layer2_pad_to_last_hs = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1b_odd(layer2_last_pad); // ME1/a - layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_odd(layer2_first_pad); + layer2_pad_to_last_hs_me1a = lookupTableME11ILT_->GEM_pad_CSC_hs_ME1a_odd(layer2_last_pad); } } // ME2/1 if (station_ == 2) { if (isEven_) { - layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_first_pad); - layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_last_pad); + layer2_pad_to_first_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_even(layer2_first_pad); + layer2_pad_to_last_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_even(layer2_last_pad); } else { - layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_odd(layer2_first_pad); + layer2_pad_to_last_hs = lookupTableME21ILT_->GEM_pad_CSC_hs_ME21_odd(layer2_last_pad); } } // middle 1/2-strip @@ -448,29 +402,29 @@ void GEMClusterProcessor::doCoordinateConversion() { if (station_ == 1) { if (isEven_) { // ME1/b - layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_first_pad); - layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_last_pad); + layer2_pad_to_first_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_even(layer2_first_pad); + layer2_pad_to_last_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_even(layer2_last_pad); // ME1/a - layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_first_pad); - layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_last_pad); + layer2_pad_to_first_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_even(layer2_first_pad); + layer2_pad_to_last_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_even(layer2_last_pad); } else { // ME1/b - layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_odd(layer2_first_pad); + layer2_pad_to_last_es = lookupTableME11ILT_->GEM_pad_CSC_es_ME1b_odd(layer2_last_pad); // ME1/a - layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_odd(layer2_first_pad); + layer2_pad_to_last_es_me1a = lookupTableME11ILT_->GEM_pad_CSC_es_ME1a_odd(layer2_last_pad); } } // ME2/1 if (station_ == 2) { if (isEven_) { - layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_first_pad); - layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_last_pad); + layer2_pad_to_first_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_even(layer2_first_pad); + layer2_pad_to_last_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_even(layer2_last_pad); } else { - layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_first_pad); - layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_last_pad); + layer2_pad_to_first_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_odd(layer2_first_pad); + layer2_pad_to_last_es = lookupTableME21ILT_->GEM_pad_CSC_es_ME21_odd(layer2_last_pad); } } // middle 1/8-strip @@ -498,22 +452,22 @@ void GEMClusterProcessor::doCoordinateConversion() { // ME1/1 if (station_ == 1) { if (isEven_) { - roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME11_even_->lookup(roll); - roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME11_even_->lookup(roll); + roll_l2_to_min_wg = lookupTableME11ILT_->GEM_roll_L2_CSC_min_wg_ME11_even(roll); + roll_l2_to_max_wg = lookupTableME11ILT_->GEM_roll_L2_CSC_max_wg_ME11_even(roll); } else { - roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME11_odd_->lookup(roll); - roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME11_odd_->lookup(roll); + roll_l2_to_min_wg = lookupTableME11ILT_->GEM_roll_L2_CSC_min_wg_ME11_odd(roll); + roll_l2_to_max_wg = lookupTableME11ILT_->GEM_roll_L2_CSC_max_wg_ME11_odd(roll); } } // ME2/1 if (station_ == 2) { if (isEven_) { - roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME21_even_->lookup(roll); - roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME21_even_->lookup(roll); + roll_l2_to_min_wg = lookupTableME21ILT_->GEM_roll_L2_CSC_min_wg_ME21_even(roll); + roll_l2_to_max_wg = lookupTableME21ILT_->GEM_roll_L2_CSC_max_wg_ME21_even(roll); } else { - roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME21_odd_->lookup(roll); - roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME21_odd_->lookup(roll); + roll_l2_to_min_wg = lookupTableME21ILT_->GEM_roll_L2_CSC_min_wg_ME21_odd(roll); + roll_l2_to_max_wg = lookupTableME21ILT_->GEM_roll_L2_CSC_max_wg_ME21_odd(roll); } } diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py index 5aa22b8df029d..cf9daa976f0a3 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py @@ -35,6 +35,7 @@ process.load("EventFilter.CSCRawToDigi.cscUnpacker_cfi") process.load('EventFilter.GEMRawToDigi.muonGEMDigis_cfi') process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") +process.load("CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff") process.load('L1Trigger.L1TGEM.simGEMDigis_cff') process.load("DQM.L1TMonitor.L1TdeCSCTPG_cfi") process.load("DQM.L1TMonitor.L1TdeGEMTPG_cfi") diff --git a/L1Trigger/CSCTriggerPrimitives/test/runL1CSCTPEmulatorConfigAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runL1CSCTPEmulatorConfigAnalyzer_cfg.py index 776f9211b1377..435cf2a4d2a4e 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runL1CSCTPEmulatorConfigAnalyzer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runL1CSCTPEmulatorConfigAnalyzer_cfg.py @@ -23,6 +23,7 @@ process = cms.Process("TEST",Run2_2018) process.load('Configuration.StandardSequences.GeometryDB_cff') +process.load("CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff") process.load('L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi') process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag diff --git a/L1Trigger/Configuration/python/L1MuonEmulator_cff.py b/L1Trigger/Configuration/python/L1MuonEmulator_cff.py index 4c3b9472345de..8368a1f792342 100644 --- a/L1Trigger/Configuration/python/L1MuonEmulator_cff.py +++ b/L1Trigger/Configuration/python/L1MuonEmulator_cff.py @@ -4,6 +4,7 @@ from L1Trigger.DTTrigger.dtTriggerPrimitiveDigis_cfi import * from L1Trigger.DTTrackFinder.dttfDigis_cfi import * # CSC Trigger +from CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff import * from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * from L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi import * from L1Trigger.CSCTrackFinder.csctfDigis_cfi import * @@ -14,4 +15,3 @@ L1MuonTriggerPrimitives = cms.Sequence(cscTriggerPrimitiveDigis*dtTriggerPrimitiveDigis) L1MuonTrackFinders = cms.Sequence(csctfTrackDigis*csctfDigis*dttfDigis) L1MuonEmulator = cms.Sequence(L1MuonTriggerPrimitives*L1MuonTrackFinders*rpcTriggerDigis*gmtDigis) - diff --git a/L1Trigger/Configuration/python/ValL1Emulator_cff.py b/L1Trigger/Configuration/python/ValL1Emulator_cff.py index 97fe9a530f50f..d4f99ebb8b358 100644 --- a/L1Trigger/Configuration/python/ValL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/ValL1Emulator_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms # L1 Emulator sequence running on unpacked data -# each emulator run on the unpacked data of the previous (in the hardware chain) subsystem +# each emulator run on the unpacked data of the previous (in the hardware chain) subsystem # # Order if using the standard sequence # RawToDigi,ValL1Emulator @@ -38,7 +38,7 @@ # valHcalTTPDigis.HFDigiCollection = cms.InputTag('hcalDigis') - + # RCT emulator import L1Trigger.RegionalCaloTrigger.rctDigis_cfi valRctDigis = L1Trigger.RegionalCaloTrigger.rctDigis_cfi.rctDigis.clone() @@ -85,6 +85,8 @@ valDtTriggerPrimitiveDigis = L1Trigger.DTTrigger.dtTriggerPrimitiveDigis_cfi.dtTriggerPrimitiveDigis.clone() +# Lookup tables for the CSC TP emulator +from CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff import * # CSC TP emulator from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * valCscTriggerPrimitiveDigis = L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi.cscTriggerPrimitiveDigis.clone() @@ -95,7 +97,7 @@ 'MuonCSCWireDigi') valCscTriggerPrimitiveDigis.gangedME1a = cms.untracked.bool(False) -# CSC Track Finder - digi track generation +# CSC Track Finder - digi track generation # currently used also by DT TF to generate CSCTF stubs import L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi valCsctfTrackDigis = L1Trigger.CSCTrackFinder.csctfTrackDigis_cfi.csctfTrackDigis.clone() @@ -128,7 +130,7 @@ valRpcTriggerDigis.label = 'muonRPCDigis' -# Global Muon Trigger emulator - input from common GMT/GT unpacker (gtDigis) +# Global Muon Trigger emulator - input from common GMT/GT unpacker (gtDigis) import L1Trigger.GlobalMuonTrigger.gmtDigis_cfi valGmtDigis = L1Trigger.GlobalMuonTrigger.gmtDigis_cfi.gmtDigis.clone() # @@ -138,7 +140,7 @@ valGmtDigis.RPCfCandidates = cms.InputTag('l1GtUnpack','RPCf') valGmtDigis.MipIsoData = 'caloStage1Digis' -# producers for technical triggers +# producers for technical triggers # @@ -164,7 +166,7 @@ cms.InputTag('valRpcTechTrigDigis'), cms.InputTag('valHcalTechTrigDigis') ) -# Global Trigger emulator for Stage1 +# Global Trigger emulator for Stage1 import L1Trigger.GlobalTrigger.gtDigis_cfi valStage1GtDigis = L1Trigger.GlobalTrigger.gtDigis_cfi.gtDigis.clone() valStage1GtDigis.GmtInputTag = 'l1GtUnpack' @@ -189,8 +191,3 @@ ,ValL1TechnicalTriggers ,valGtDigis ) - - - - - diff --git a/L1Trigger/Configuration/python/customiseReEmul.py b/L1Trigger/Configuration/python/customiseReEmul.py index ab305f3c92a32..04a676deefa27 100644 --- a/L1Trigger/Configuration/python/customiseReEmul.py +++ b/L1Trigger/Configuration/python/customiseReEmul.py @@ -401,7 +401,9 @@ def L1TReEmulFromRAWLegacyMuon(process): process.simTwinMuxDigisForDttf.DTDigi_Source = cms.InputTag('bmtfDigis') process.simTwinMuxDigisForDttf.DTThetaDigi_Source = cms.InputTag('bmtfDigis') -## - CSC TP emulator + # Lookup tables for the CSC TP emulator + process.load("CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff") + ## - CSC TP emulator from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import cscTriggerPrimitiveDigis process.simCscTriggerPrimitiveDigis = cscTriggerPrimitiveDigis.clone() process.simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi' ) diff --git a/L1Trigger/L1TMuon/python/simDigis_cff.py b/L1Trigger/L1TMuon/python/simDigis_cff.py index b22ef6256e065..6e289fcf9d801 100644 --- a/L1Trigger/L1TMuon/python/simDigis_cff.py +++ b/L1Trigger/L1TMuon/python/simDigis_cff.py @@ -12,6 +12,8 @@ ) #simDtTriggerPrimitiveDigis.debug = cms.untracked.bool(True) +# Lookup tables for the CSC TP emulator +from CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff import * # - CSC TP emulator import L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi simCscTriggerPrimitiveDigis = L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi.cscTriggerPrimitiveDigis.clone( @@ -98,7 +100,7 @@ # from L1Trigger.L1TMuonBarrel.simKBmtfStubs_cfi import * from L1Trigger.L1TMuonBarrel.simKBmtfDigis_cfi import * -from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger +from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger phase2_trigger.toReplaceWith(SimL1TMuonTask, cms.Task(SimL1TMuonCommonTask, simTwinMuxDigis, simBmtfDigis, simKBmtfStubs, simKBmtfDigis, simEmtfDigis, simOmtfDigis, simGmtCaloSumDigis, simGmtStage2Digis)) ## GEM TPs From 1feb5a2d9392937d25e8b68da9893c4253667087 Mon Sep 17 00:00:00 2001 From: yeckang Date: Thu, 5 Aug 2021 15:45:51 +0200 Subject: [PATCH 011/923] Reduced the size of GEMDigiSimLink --- .../GEMDigiSimLink/interface/GEMDigiSimLink.h | 8 ++++---- SimDataFormats/GEMDigiSimLink/src/classes_def.xml | 4 ++-- SimMuon/GEMDigitizer/src/GEMDigiModule.cc | 11 +++-------- SimMuon/GEMDigitizer/src/ME0DigiModel.cc | 11 +++-------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h index 96c066fd1e146..c21e53906716b 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h @@ -8,12 +8,12 @@ class GEMDigiSimLink { public: - GEMDigiSimLink(uint16_t strip, int8_t bx, uint32_t detUnitId, + GEMDigiSimLink(uint16_t strip, int8_t bx, int8_t particleType, uint32_t trackId, EncodedEventId eventId) { strip_ = strip; bx_ = bx; - detUnitId_ = detUnitId; + particleType_ = particleType; trackId_ = trackId; eventId_ = eventId; } @@ -23,7 +23,7 @@ class GEMDigiSimLink { unsigned int getStrip() const { return strip_; } int getBx() const { return bx_; } - unsigned int getDetUnitId() const { return detUnitId_; } + int getParticleType() const { return particleType_; } unsigned int getTrackId() const { return trackId_; } EncodedEventId getEventId() const { return eventId_; } @@ -32,7 +32,7 @@ class GEMDigiSimLink { private: uint16_t strip_; int8_t bx_; - uint32_t detUnitId_; + int8_t particleType_; uint32_t trackId_; EncodedEventId eventId_; }; diff --git a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml index b687a72601143..d26f10ce0b1ff 100644 --- a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ - + diff --git a/SimMuon/GEMDigitizer/src/GEMDigiModule.cc b/SimMuon/GEMDigitizer/src/GEMDigiModule.cc index e053aae3fac40..44ef4a293dc0c 100644 --- a/SimMuon/GEMDigitizer/src/GEMDigiModule.cc +++ b/SimMuon/GEMDigitizer/src/GEMDigiModule.cc @@ -91,16 +91,11 @@ void GEMDigiModule::addLinksWithPartId(unsigned int strip, int bx) { if (hit == nullptr) continue; - theGemDigiSimLinks_.push_back(GEMDigiSimLink(digi, - hit->entryPoint(), - hit->momentumAtEntry(), - hit->timeOfFlight(), - hit->energyLoss(), + theGemDigiSimLinks_.push_back(GEMDigiSimLink(strip, + bx, hit->particleType(), - hit->detUnitId(), hit->trackId(), - hit->eventId(), - hit->processType())); + hit->eventId())); } } diff --git a/SimMuon/GEMDigitizer/src/ME0DigiModel.cc b/SimMuon/GEMDigitizer/src/ME0DigiModel.cc index 63166cacce21c..567e9fd813651 100644 --- a/SimMuon/GEMDigitizer/src/ME0DigiModel.cc +++ b/SimMuon/GEMDigitizer/src/ME0DigiModel.cc @@ -58,15 +58,10 @@ void ME0DigiModel::addLinksWithPartId(unsigned int strip, int bx) { if (hit == nullptr) continue; - theME0DigiSimLinks_.push_back(ME0DigiSimLink(digi, - hit->entryPoint(), - hit->momentumAtEntry(), - hit->timeOfFlight(), - hit->energyLoss(), + theME0DigiSimLinks_.push_back(ME0DigiSimLink(strip, + bx, hit->particleType(), - hit->detUnitId(), hit->trackId(), - hit->eventId(), - hit->processType())); + hit->eventId())); } } From fef5cd6babff1979b26e29d4df048c3475ee01a2 Mon Sep 17 00:00:00 2001 From: yeckang Date: Thu, 5 Aug 2021 15:48:15 +0200 Subject: [PATCH 012/923] Fixed the script for new GEMDigiSimLink format --- Validation/MuonGEMDigis/src/GEMDigiMatcher.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc b/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc index 2118760608181..87bd828869bd5 100644 --- a/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc +++ b/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc @@ -91,9 +91,8 @@ void GEMDigiMatcher::matchDigisSLToSimTrack(const edm::DetSetVectorid); for (auto sl = itsimlink->data.begin(); sl != itsimlink->data.end(); ++sl) { - GEMDetId p_id(sl->getDetUnitId()); - // ignore simlinks in non-matched chambers const auto& detids(muonSimHitMatcher_->detIds()); if (detids.find(p_id.rawId()) == detids.end()) @@ -105,8 +104,7 @@ void GEMDigiMatcher::matchDigisSLToSimTrack(const edm::DetSetVectorgetStrip() << " " << sl->getBx() - << " " << sl->getEnergyLoss() << " " << sl->getTimeOfFlight() << " " - << sl->getParticleType() << std::endl; + << " " << sl->getTrackId() << std::endl; // consider only the muon hits if (simMuOnly_ && std::abs(sl->getParticleType()) != 13) @@ -119,10 +117,7 @@ void GEMDigiMatcher::matchDigisSLToSimTrack(const edm::DetSetVectorhitsInDetId(p_id.rawId())) { // check if the simhit properties agree - if (simhit.particleType() == sl->getParticleType() and simhit.trackId() == sl->getTrackId() and - std::abs(simhit.energyLoss() - sl->getEnergyLoss()) < 0.001 and - std::abs(simhit.timeOfFlight() - sl->getTimeOfFlight()) < 0.001 and - simhit.entryPoint() == sl->getEntryPoint() and simhit.momentumAtEntry() == sl->getMomentumAtEntry()) { + if (simhit.trackId() == sl->getTrackId() and simhit.particleType() == sl->getParticleType()) { detid_to_simLinks_[p_id.rawId()].push_back(*sl); if (verboseSimLink_) edm::LogInfo("GEMDigiMatcher") << "...was matched!" << endl; From 5c7cc4480e707d2e2bea1ca54f51bc11d72d6526 Mon Sep 17 00:00:00 2001 From: yeckang Date: Thu, 5 Aug 2021 15:49:58 +0200 Subject: [PATCH 013/923] code-format --- .../GEMDigiSimLink/interface/GEMDigiSimLink.h | 10 ++++------ SimMuon/GEMDigitizer/src/GEMDigiModule.cc | 6 +----- SimMuon/GEMDigitizer/src/GEMSignalModel.cc | 3 ++- SimMuon/GEMDigitizer/src/ME0DigiModel.cc | 6 +----- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h index c21e53906716b..b5ac7e8caa79c 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h @@ -8,9 +8,7 @@ class GEMDigiSimLink { public: - GEMDigiSimLink(uint16_t strip, int8_t bx, int8_t particleType, - uint32_t trackId, EncodedEventId eventId) - { + GEMDigiSimLink(uint16_t strip, int8_t bx, int8_t particleType, uint32_t trackId, EncodedEventId eventId) { strip_ = strip; bx_ = bx; particleType_ = particleType; @@ -18,8 +16,8 @@ class GEMDigiSimLink { eventId_ = eventId; } - GEMDigiSimLink() { } - ~GEMDigiSimLink() { } + GEMDigiSimLink() {} + ~GEMDigiSimLink() {} unsigned int getStrip() const { return strip_; } int getBx() const { return bx_; } @@ -31,7 +29,7 @@ class GEMDigiSimLink { private: uint16_t strip_; - int8_t bx_; + int8_t bx_; int8_t particleType_; uint32_t trackId_; EncodedEventId eventId_; diff --git a/SimMuon/GEMDigitizer/src/GEMDigiModule.cc b/SimMuon/GEMDigitizer/src/GEMDigiModule.cc index 44ef4a293dc0c..6607bd1cb7438 100644 --- a/SimMuon/GEMDigitizer/src/GEMDigiModule.cc +++ b/SimMuon/GEMDigitizer/src/GEMDigiModule.cc @@ -91,11 +91,7 @@ void GEMDigiModule::addLinksWithPartId(unsigned int strip, int bx) { if (hit == nullptr) continue; - theGemDigiSimLinks_.push_back(GEMDigiSimLink(strip, - bx, - hit->particleType(), - hit->trackId(), - hit->eventId())); + theGemDigiSimLinks_.push_back(GEMDigiSimLink(strip, bx, hit->particleType(), hit->trackId(), hit->eventId())); } } diff --git a/SimMuon/GEMDigitizer/src/GEMSignalModel.cc b/SimMuon/GEMDigitizer/src/GEMSignalModel.cc index 798837fcbbe27..d8a3683acbad6 100644 --- a/SimMuon/GEMDigitizer/src/GEMSignalModel.cc +++ b/SimMuon/GEMDigitizer/src/GEMSignalModel.cc @@ -68,7 +68,8 @@ void GEMSignalModel::simulate(const GEMEtaPartition* roll, if (!(digiMuon || digiElec)) continue; const int bx(getSimHitBx(&hit, engine)); - if (bx != 0 and bx0filter_) continue; + if (bx != 0 and bx0filter_) + continue; const std::vector >& cluster(simulateClustering(top, &hit, bx, engine)); for (const auto& digi : cluster) { detectorHitMap_.emplace(digi, &hit); diff --git a/SimMuon/GEMDigitizer/src/ME0DigiModel.cc b/SimMuon/GEMDigitizer/src/ME0DigiModel.cc index 567e9fd813651..81aa5df300a6b 100644 --- a/SimMuon/GEMDigitizer/src/ME0DigiModel.cc +++ b/SimMuon/GEMDigitizer/src/ME0DigiModel.cc @@ -58,10 +58,6 @@ void ME0DigiModel::addLinksWithPartId(unsigned int strip, int bx) { if (hit == nullptr) continue; - theME0DigiSimLinks_.push_back(ME0DigiSimLink(strip, - bx, - hit->particleType(), - hit->trackId(), - hit->eventId())); + theME0DigiSimLinks_.push_back(ME0DigiSimLink(strip, bx, hit->particleType(), hit->trackId(), hit->eventId())); } } From e97ecfb0c7632a82741646a627a5961271a1f4b2 Mon Sep 17 00:00:00 2001 From: Taeun_Kwon Date: Thu, 5 Aug 2021 13:32:43 -0500 Subject: [PATCH 014/923] applyFixPCC --- CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h | 2 ++ CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 3 +++ CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 4 ++++ SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py | 2 ++ 4 files changed, 11 insertions(+) diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index 99133ebc7d479..34de77cdb33e6 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -69,6 +69,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { void set1TSContainHE(bool contain1TSHE) { contain1TSHE_ = contain1TSHE; } void setContainPhaseHB(double containPhaseNSHB) { containPhaseNSHB_ = containPhaseNSHB; } void setContainPhaseHE(double containPhaseNSHE) { containPhaseNSHE_ = containPhaseNSHE; } + void setApplyFixPCC(double applyFixPCC) { applyFixPCC_ = applyFixPCC; } void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB) { overrideDBweightsAndFilterHB_ = overrideDBweightsAndFilterHB; } @@ -122,6 +123,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_ = 6.0; double containPhaseNSHE_ = 6.0; + bool applyFixPCC_; double linearLSB_QIE8_, linearLSB_QIE11_, linearLSB_QIE11Overlap_; std::unique_ptr pulseCorr_; bool overrideDBweightsAndFilterHB_ = false; diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index 3009cc3b1d9a8..d8c14a3c067f4 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -63,6 +63,7 @@ HcaluLUTTPGCoder::HcaluLUTTPGCoder() allLinear_{}, contain1TSHB_{}, contain1TSHE_{}, + applyFixPCC_{}, linearLSB_QIE8_{}, linearLSB_QIE11_{}, linearLSB_QIE11Overlap_{} {} @@ -78,6 +79,7 @@ void HcaluLUTTPGCoder::init(const HcalTopology* top, const HcalTimeSlew* delay) allLinear_ = false; contain1TSHB_ = false; contain1TSHE_ = false; + applyFixPCC_ = false; linearLSB_QIE8_ = 1.; linearLSB_QIE11_ = 1.; linearLSB_QIE11Overlap_ = 1.; @@ -333,6 +335,7 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { assert(metadata != nullptr); float nominalgain_ = metadata->getNominalGain(); + pulseCorr_ = std::make_unique(MaximumFractionalError, applyFixPCC_); pulseCorr_->beginRun(&conditions, delay_); make_cosh_ieta_map(); diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index 8a3b32aab8d4a..d81cff7163dcf 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -59,6 +59,7 @@ class HcalTPGCoderULUT : public edm::ESProducer { bool read_FGLut_, read_Ascii_, read_XML_, LUTGenerationMode_, linearLUTs_; bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_, containPhaseNSHE_; + bool applyFixPCC_; bool overrideDBweightsAndFilterHB_, overrideDBweightsAndFilterHE_; double linearLSB_QIE8_, linearLSB_QIE11Overlap_, linearLSB_QIE11_; int maskBit_; @@ -86,6 +87,7 @@ HcalTPGCoderULUT::HcalTPGCoderULUT(const edm::ParameterSet& iConfig) { contain1TSHE_ = iConfig.getParameter("contain1TSHE"); containPhaseNSHB_ = iConfig.getParameter("containPhaseNSHB"); containPhaseNSHE_ = iConfig.getParameter("containPhaseNSHE"); + applyFixPCC_ = iConfig.getParameter("applyFixPCC"); overrideDBweightsAndFilterHB_ = iConfig.getParameter("overrideDBweightsAndFilterHB"); overrideDBweightsAndFilterHE_ = iConfig.getParameter("overrideDBweightsAndFilterHE"); @@ -123,6 +125,8 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* theCoder->setContainPhaseHB(containPhaseNSHB_); theCoder->setContainPhaseHE(containPhaseNSHE_); + theCoder->setApplyFixPCC(applyFixPCC_); + if (read_Ascii_ || read_XML_) { edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization"; if (read_Ascii_) { diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py index 5d6a02561e738..1a0e1880e521d 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py @@ -19,6 +19,7 @@ contain1TSHE = cms.bool(False), containPhaseNSHE = cms.double(6.0), containPhaseNSHB = cms.double(6.0), + applyFixPCC = cms.bool(False), overrideDBweightsAndFilterHB = cms.bool(False), overrideDBweightsAndFilterHE = cms.bool(False), tpScales = tpScales, @@ -33,5 +34,6 @@ run2_HCAL_2018.toModify(CaloTPGTranscoder, linearLUTs=cms.bool(True)) run2_HCAL_2018.toModify(HcalTPGCoderULUT, linearLUTs=cms.bool(True)) +run3_common.toModify(HcalTPGCoderULUT, applyFixPCC=cms.bool(True)) pp_on_AA.toModify(CaloTPGTranscoder, FG_HF_thresholds = cms.vuint32(15, 19)) pp_on_AA.toModify(HcalTPGCoderULUT, FG_HF_thresholds = cms.vuint32(15, 19)) From 84e957d1604afed5ff9688caa055bd5482a71f51 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 5 Aug 2021 13:42:42 +0200 Subject: [PATCH 015/923] Gate RegionalMuon (un)packer with fw version when running on EMTF displacement info EMTF doesn't yet send displaced muon information, but unfortunately sends debug data in the fields foreseen for use by dXY and pT unconstrained. With this change we avoid unpacking those data until the uGMT firmare version changes to indicate that we actually use it in the algorithm. --- .../BMTFPackerOutput.cc | 2 +- .../BMTFUnpackerOutput.cc | 2 +- .../implementations_stage2/GMTSetup.cc | 10 ++++- .../RegionalMuonGMTPacker.cc | 2 +- .../RegionalMuonGMTPacker.h | 6 ++- .../RegionalMuonGMTUnpacker.cc | 2 +- .../RegionalMuonGMTUnpacker.h | 6 ++- .../L1TRawToDigi/python/gmtStage2Raw_cfi.py | 4 +- .../interface/RegionalMuonRawDigiTranslator.h | 15 +++++-- .../src/RegionalMuonRawDigiTranslator.cc | 39 ++++++++++++------- 10 files changed, 59 insertions(+), 29 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc index 0e873900c8ef8..1395fd3f06323 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc @@ -20,7 +20,7 @@ namespace l1t { for (auto imu = muons->begin(); imu != muons->end(); imu++) { if (imu->processor() + 1 == board_id) { uint32_t firstWord(0), lastWord(0); - RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false); payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1 payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1 } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index d905880a3fc74..9869cf3afde81 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -67,7 +67,7 @@ namespace l1t { RegionalMuonCand muCand; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman); + muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman, false); if (muCand.hwPt() == 0) { continue; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index 83f29e7f27b62..c4508e7763388 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -43,8 +43,11 @@ namespace l1t { if (fed == 1402) { auto gmt_in_packer = static_pointer_cast( PackerFactory::get()->make("stage2::RegionalMuonGMTPacker")); + if (fw >= 0x6010000) { + gmt_in_packer->setUseEmtfDisplacementInfo(); + } if (fw >= 0x6000000) { - gmt_in_packer->setIsRun3(); + gmt_in_packer->setIsKbmtf(); } auto gmt_out_packer = static_pointer_cast(PackerFactory::get()->make("stage2::GMTMuonPacker")); @@ -86,8 +89,11 @@ namespace l1t { // input muons on links 36-71 auto gmt_in_unp = static_pointer_cast( UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker")); + if (fw >= 0x6010000) { + gmt_in_unp->setUseEmtfDisplacementInfo(); + } if (fw >= 0x6000000) { - gmt_in_unp->setIsRun3(); + gmt_in_unp->setIsKbmtf(); } for (int iLink = 72; iLink < 144; iLink += 2) { diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc index 64ed17ecf676b..36301c3037568 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc @@ -54,7 +54,7 @@ namespace l1t { uint32_t msw = 0; uint32_t lsw = 0; - RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isRun3_); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isKbmtf_, useEmtfDisplacementInfo_); payloadMap[linkTimes2].push_back(lsw); payloadMap[linkTimes2].push_back(msw); diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h index 67fa5f14d8aa7..e3feb1bce562b 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h @@ -13,13 +13,15 @@ namespace l1t { class RegionalMuonGMTPacker : public Packer { public: Blocks pack(const edm::Event&, const PackerTokens*) override; - void setIsRun3() { isRun3_ = true; }; + void setIsKbmtf() { isKbmtf_ = true; }; + void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; }; private: typedef std::map> PayloadMap; void packTF(const edm::Event&, const edm::EDGetTokenT&, Blocks&); - bool isRun3_{false}; + bool isKbmtf_{false}; + bool useEmtfDisplacementInfo_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc index d58909a9395fe..57a603a82294e 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc @@ -102,7 +102,7 @@ namespace l1t { RegionalMuonCand mu; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isRun3_); + mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isKbmtf_, useEmtfDisplacementInfo_); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid " diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h index 43362150b2a53..f991d1cffdca1 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h @@ -10,13 +10,15 @@ namespace l1t { class RegionalMuonGMTUnpacker : public Unpacker { public: bool unpack(const Block& block, UnpackerCollections* coll) override; - void setIsRun3() { isRun3_ = true; } + void setIsKbmtf() { isKbmtf_ = true; } + void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; } private: static constexpr unsigned nWords_ = 6; // every link transmits 6 words (3 muons) per bx static constexpr unsigned bxzs_enable_shift_ = 1; - bool isRun3_{false}; + bool isKbmtf_{false}; + bool useEmtfDisplacementInfo_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py index 2e35f21005890..eb031df1e82fd 100644 --- a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py +++ b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py @@ -13,7 +13,7 @@ ImdInputLabelOMTFNeg = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFNeg"), ImdInputLabelOMTFPos = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFPos"), FedId = cms.int32(1402), - FWId = cms.uint32(0x6000000), # FW version in GMT with displaced muon information + FWId = cms.uint32(0x3000000), # First used uGMT firmware version lenSlinkHeader = cms.untracked.int32(8), lenSlinkTrailer = cms.untracked.int32(8) ) @@ -32,4 +32,4 @@ ### Era: Run3_2021 from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 -stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6000000)) +stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6010000)) diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index 1bb1377411be3..3032b3971a240 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -6,14 +6,21 @@ namespace l1t { class RegionalMuonRawDigiTranslator { public: + static void fillRegionalMuonCand(RegionalMuonCand& mu, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63, + int proc, + tftype tf, + bool isKbmtf, + bool useEmtfDisplacementInfo); static void fillRegionalMuonCand( - RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isRun3); - static void fillRegionalMuonCand(RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isRun3); + RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKbmtf, bool useEmtfDisplacementInfo); static void generatePackedDataWords(const RegionalMuonCand& mu, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, - bool isRun3); - static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isRun3); + bool isKbmtf, + bool useEmtfDisplacementInfo); + static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isKbmtf, bool useEmtfDisplacementInfo); static int generateRawTrkAddress(const RegionalMuonCand&, bool isKalman); static constexpr unsigned ptMask_ = 0x1FF; diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index 482ee4fa754d9..d144a84ca0df5 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -6,7 +6,8 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& const uint32_t raw_data_32_63, const int proc, const tftype tf, - const bool isRun3) { + const bool isKbmtf, + const bool useEmtfDisplacementInfo) { // translations as defined in DN-15-017 mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_); mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_); @@ -44,7 +45,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu.setTrackSubAddress(RegionalMuonCand::kWheelSide, detSide); mu.setTrackSubAddress(RegionalMuonCand::kWheelNum, wheelNum); - if (!isRun3) { // The Run-2 standard configuration + if (!isKbmtf) { // The Run-2 standard configuration for BMTF mu.setTrackSubAddress(RegionalMuonCand::kStat1, statAddr1); mu.setTrackSubAddress(RegionalMuonCand::kStat2, statAddr2); mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr3); @@ -78,7 +79,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu.setTrackSubAddress(RegionalMuonCand::kTrkNum, (rawTrackAddress >> emtfTrAddrTrkNumShift_) & emtfTrAddrTrkNumMask_); mu.setTrackSubAddress(RegionalMuonCand::kBX, (rawTrackAddress >> emtfTrAddrBxShift_) & emtfTrAddrBxMask_); - if (isRun3) { // In Run-3 we receive displaced muon information from EMTF + if (useEmtfDisplacementInfo) { // In Run-3 we receive displaced muon information from EMTF mu.setHwPtUnconstrained((raw_data_32_63 >> emtfPtUnconstrainedShift_) & ptUnconstrainedMask_); mu.setHwDXY((raw_data_32_63 >> emtfDxyShift_) & dxyMask_); } @@ -98,16 +99,26 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu.setDataword(raw_data_32_63, raw_data_00_31); } -void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - RegionalMuonCand& mu, const uint64_t dataword, const int proc, const tftype tf, const bool isRun3) { - fillRegionalMuonCand( - mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), proc, tf, isRun3); +void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu, + const uint64_t dataword, + const int proc, + const tftype tf, + const bool isKbmtf, + const bool useEmtfDisplacementInfo) { + fillRegionalMuonCand(mu, + (uint32_t)(dataword & 0xFFFFFFFF), + (uint32_t)((dataword >> 32) & 0xFFFFFFFF), + proc, + tf, + isKbmtf, + useEmtfDisplacementInfo); } void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalMuonCand& mu, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, - const bool isRun3) { + const bool isKbmtf, + const bool useEmtfDisplacementInfo) { int abs_eta = mu.hwEta(); if (abs_eta < 0) { abs_eta += (1 << (etaSignShift_ - absEtaShift_)); @@ -122,24 +133,26 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM (mu.hwPhi() < 0) << phiSignShift_; // generate the raw track address from the subaddresses - int rawTrkAddr = generateRawTrkAddress(mu, isRun3); + int rawTrkAddr = generateRawTrkAddress(mu, isKbmtf); raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ | (rawTrkAddr & trackAddressMask_) << trackAddressShift_; - if (isRun3 && mu.trackFinderType() == bmtf) { + if (isKbmtf && mu.trackFinderType() == bmtf) { raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << bmtfPtUnconstrainedShift_ | (mu.hwDXY() & dxyMask_) << bmtfDxyShift_; - } else if (isRun3 && (mu.trackFinderType() == emtf_pos || mu.trackFinderType() == emtf_neg)) { + } else if (useEmtfDisplacementInfo && (mu.trackFinderType() == emtf_pos || mu.trackFinderType() == emtf_neg)) { raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << emtfPtUnconstrainedShift_ | (mu.hwDXY() & dxyMask_) << emtfDxyShift_; } } -uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu, const bool isRun3) { +uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu, + const bool isKbmtf, + const bool useEmtfDisplacementInfo) { uint32_t lsw; uint32_t msw; - generatePackedDataWords(mu, lsw, msw, isRun3); + generatePackedDataWords(mu, lsw, msw, isKbmtf, useEmtfDisplacementInfo); return (((uint64_t)msw) << 32) + lsw; } From 37a6b6e1ce8d3a0c8e77248c8e226abd43eb5d8e Mon Sep 17 00:00:00 2001 From: yeckang Date: Tue, 10 Aug 2021 17:09:31 +0200 Subject: [PATCH 016/923] remove digiSimLinkReaders (unused script) --- SimMuon/GEMDigitizer/test/BuildFile.xml | 8 - .../GEMDigitizer/test/GEMDigiSimLinkReader.cc | 447 ------------------ .../GEMDigitizer/test/ME0DigiSimLinkReader.cc | 208 -------- 3 files changed, 663 deletions(-) delete mode 100644 SimMuon/GEMDigitizer/test/GEMDigiSimLinkReader.cc delete mode 100644 SimMuon/GEMDigitizer/test/ME0DigiSimLinkReader.cc diff --git a/SimMuon/GEMDigitizer/test/BuildFile.xml b/SimMuon/GEMDigitizer/test/BuildFile.xml index fc2440452ce02..c79fd19d90f0c 100644 --- a/SimMuon/GEMDigitizer/test/BuildFile.xml +++ b/SimMuon/GEMDigitizer/test/BuildFile.xml @@ -16,14 +16,6 @@ - - - - - - - - diff --git a/SimMuon/GEMDigitizer/test/GEMDigiSimLinkReader.cc b/SimMuon/GEMDigitizer/test/GEMDigiSimLinkReader.cc deleted file mode 100644 index b55bec44cbc56..0000000000000 --- a/SimMuon/GEMDigitizer/test/GEMDigiSimLinkReader.cc +++ /dev/null @@ -1,447 +0,0 @@ -/** \class GEMDigiSimLinkReader - * - * Dumps GEMDigiSimLinks digis - * - * \authors: Roumyana Hadjiiska - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" -#include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "Geometry/GEMGeometry/interface/GEMGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "DataFormats/MuonDetId/interface/GEMDetId.h" -#include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h" -#include -#include - -#include "DataFormats/Common/interface/DetSet.h" -#include - -#include "Geometry/GEMGeometry/interface/GEMEtaPartitionSpecs.h" -#include "Geometry/CommonTopologies/interface/GEMStripTopology.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "TH1F.h" -#include "TH2F.h" - -using namespace std; - -class GEMDigiSimLinkReader : public edm::one::EDAnalyzer { -public: - explicit GEMDigiSimLinkReader(const edm::ParameterSet &pset); - - ~GEMDigiSimLinkReader() override {} - - void analyze(const edm::Event &, const edm::EventSetup &) override; - -private: - edm::EDGetTokenT simhitToken_; - edm::EDGetTokenT gemDigiToken_; - edm::EDGetTokenT > gemDigiSimLinkToken_; - bool debug_; - - TH1F *hProces; - TH1F *hParticleTypes; - TH1F *hAllSimHitsType; - - TH1F *energy_loss; - TH1F *processtypeElectrons; - TH1F *processtypePositrons; - TH1F *processtypeMuons; - - TH1F *Compton_energy; - TH1F *EIoni_energy; - TH1F *PairProd_energy; - TH1F *Conversions_energy; - TH1F *EBrem_energy; - - TH1F *Muon_energy; - - TH1F *gemCLS_allClusters; - TH1F *gemCLS_ClustersWithMuon; - TH1F *gemCLS_ElectronClusters; - TH1F *deltaPhi_allStations; - TH1F *deltaPhi_cls1; - TH1F *deltaPhi_cls2; - TH1F *deltaPhi_cls3; - TH1F *deltaPhi_cls4; - TH1F *deltaPhi_cls5; - - TH1F *deltaPhi_allStations_normalized; - TH1F *deltaPhi_GE11; - TH1F *deltaPhi_GE21; - - TH2F *mom_cls_allStations; - TH2F *deltaPhi_cls_allStations; - TH2F *deltaPhi_cls_allStations_normalized; - - TH2F *mom_cls_GE11; - TH2F *deltaPhi_cls_GE11; - - TH2F *mom_cls_GE21; - TH2F *deltaPhi_cls_GE21; - - TH1F *allClusters_histo; - TH1F *muonClusters_histo; - - TH1F *tof_allPart_bx0_ge; - TH1F *tof_allPart_bx0_ge11; - TH1F *tof_allPart_bx0_ge21; - TH1F *tof_mu_bx0_ge11; - TH1F *tof_mu_bx0_ge21; - TH1F *tof_elec_bx0_ge11; - TH1F *tof_elec_bx0_ge21; -}; - -GEMDigiSimLinkReader::GEMDigiSimLinkReader(const edm::ParameterSet &pset) - : simhitToken_(consumes(pset.getParameter("simhitToken"))), - gemDigiToken_(consumes(pset.getParameter("gemDigiToken"))), - gemDigiSimLinkToken_( - consumes >(pset.getParameter("gemDigiSimLinkToken"))), - debug_(pset.getParameter("debugFlag")) { - edm::Service fs; - - hProces = fs->make("hProces", "Process type for all the simHits", 20, 0, 20); - hAllSimHitsType = fs->make("hAllSimHitsType", "pdgId for All simHits", 500, 0, 500); - hParticleTypes = fs->make("hParticleTypes", "pdgId for digitized simHits", 500, 0, 500); - energy_loss = fs->make("energy_loss", "energy_loss", 10000000, 0., 0.001); - - processtypeElectrons = fs->make("processtypeElectrons", "processtypeElectrons", 20, 0, 20); - processtypePositrons = fs->make("processtypePositrons", "processtypePositrons", 20, 0, 20); - processtypeMuons = fs->make("processtypeMuons", "processtypeMuons", 20, 0, 20); - - Compton_energy = fs->make("Compton_energy", "Compton_energy", 10000000, 0., 10); - EIoni_energy = fs->make("EIoni_energy", "EIoni_energy", 10000000, 0., 10); - PairProd_energy = fs->make("PairProd_energy", "PairProd_energy", 10000000, 0., 10); - Conversions_energy = fs->make("Conversions_energy", "Conversions_energy", 10000000, 0., 10); - EBrem_energy = fs->make("EBrem_energy", "EBrem_energy", 10000000, 0., 10); - Muon_energy = fs->make("Muon_energy", "Muon_energy", 10000000, 0., 1000); - - gemCLS_allClusters = fs->make("gemCLS_allClusters", "gemCLS_allClusters", 21, -0.5, 20.5); - gemCLS_ClustersWithMuon = fs->make("gemCLS_ClustersWithMuon", "gemCLS_ClustersWithMuon", 21, -0.5, 20.5); - gemCLS_ElectronClusters = fs->make("gemCLS_ElectronClusters", "gemCLS_ElectronClusters", 21, -0.5, 20.5); - - deltaPhi_allStations = fs->make("deltaPhi_allStations", "deltaPhi_allStations", 2000000, -1., 1.); - deltaPhi_allStations_normalized = - fs->make("deltaPhi_allStations_normalized", "deltaPhi_allStations_normalized", 2000, -10., 10.); - deltaPhi_GE11 = fs->make("deltaPhi_GE11", "deltaPhi_GE11", 2000000, -1., 1.); - deltaPhi_GE21 = fs->make("deltaPhi_GE21", "deltaPhi_GE21", 2000000, -1., 1.); - - mom_cls_allStations = fs->make("mom_cls_allStations", "mom_cls_allStations", 20000, 0., 2000., 21, -0.5, 20.5); - mom_cls_allStations->SetXTitle("Muon Momentum [GeV]"); - mom_cls_allStations->SetYTitle("Cluster Size"); - - mom_cls_GE11 = fs->make("mom_cls_GE11", "mom_cls_GE11", 20000, 0., 2000., 21, -0.5, 20.5); - mom_cls_GE11->SetXTitle("Muon Momentum [GeV]"); - mom_cls_GE11->SetYTitle("Cluster Size"); - - mom_cls_GE21 = fs->make("mom_cls_GE21", "mom_cls_GE21", 20000, 0., 2000., 21, -0.5, 20.5); - mom_cls_GE21->SetXTitle("Muon Momentum [GeV]"); - mom_cls_GE21->SetYTitle("Cluster Size"); - - deltaPhi_cls_allStations = - fs->make("deltaPhi_cls_allStations", "deltaPhi_cls_allStations", 2000000, -1., 1., 21, -0.5, 20.5); - deltaPhi_cls_allStations->SetXTitle("Delta #phi [rad]"); - deltaPhi_cls_allStations->SetYTitle("Cluster Size"); - - deltaPhi_cls1 = fs->make("#Delta#phi_cls1", "#Delta#phi for CLS=1", 1000000, -0.5, 0.5); - deltaPhi_cls1->SetXTitle("#Delta#phi [rad]"); - - deltaPhi_cls2 = fs->make("#Delta#phi_cls2", "#Delta#phi for CLS=2", 1000000, -0.5, 0.5); - deltaPhi_cls2->SetXTitle("#Delta#phi [rad]"); - - deltaPhi_cls3 = fs->make("#Delta#phi_cls3", "#Delta#phi for CLS=3", 1000000, -0.5, 0.5); - deltaPhi_cls3->SetXTitle("#Delta#phi [rad]"); - - deltaPhi_cls4 = fs->make("#Delta#phi_cls4", "#Delta#phi for CLS=4", 1000000, -0.5, 0.5); - deltaPhi_cls4->SetXTitle("#Delta#phi [rad]"); - - deltaPhi_cls5 = fs->make("#Delta#phi_cls5", "#Delta#phi for CLS=5", 1000000, -0.5, 0.5); - deltaPhi_cls5->SetXTitle("#Delta#phi [rad]"); - - deltaPhi_cls_allStations_normalized = fs->make( - "deltaPhi_cls_allStations_normalized", "deltaPhi_cls_allStations_normalized", 2000, -10., 10., 21, -0.5, 20.5); - deltaPhi_cls_allStations_normalized->SetXTitle("Delta #phi / strip pitch"); - deltaPhi_cls_allStations_normalized->SetYTitle("Cluster Size"); - - deltaPhi_cls_GE11 = fs->make("deltaPhi_cls_GE11", "deltaPhi_cls_GE11", 2000000, -1., 1., 21, -0.5, 20.5); - deltaPhi_cls_GE11->SetXTitle("Delta #phi [rad]"); - deltaPhi_cls_GE11->SetYTitle("Cluster Size"); - - deltaPhi_cls_GE21 = fs->make("deltaPhi_cls_GE21", "deltaPhi_cls_GE21", 2000000, -1., 1., 21, -0.5, 20.5); - deltaPhi_cls_GE21->SetXTitle("Delta #phi [rad]"); - deltaPhi_cls_GE21->SetYTitle("Cluster Size"); - - allClusters_histo = fs->make("allClusters_histo", "allClusters_histo", 51, -0.5, 50.5); - muonClusters_histo = fs->make("muonClusters_histo", "muonClusters_histo", 51, -0.5, 50.5); - - tof_allPart_bx0_ge = fs->make("tof_allPart_bx0_ge", "tof_allPart_bx0_ge", 1000, 0., 100.); - tof_allPart_bx0_ge11 = fs->make("tof_allPart_bx0_ge11", "tof_allPart_bx0_ge11", 1000, 0., 100.); - tof_allPart_bx0_ge21 = fs->make("tof_allPart_bx0_ge21", "tof_allPart_bx0_ge21", 1000, 0., 100.); - tof_mu_bx0_ge11 = fs->make("tof_mu_bx0_ge11", "tof_mu_bx0_ge11", 1000, 0., 100.); - tof_mu_bx0_ge21 = fs->make("tof_mu_bx0_ge21", "tof_mu_bx0_ge21", 1000, 0., 100.); - tof_elec_bx0_ge11 = fs->make("tof_elec_bx0_ge11", "tof_elec_bx0_ge11", 1000, 0., 100.); - tof_elec_bx0_ge21 = fs->make("tof_elec_bx0_ge21", "tof_elec_bx0_ge21", 1000, 0., 100.); -} - -void GEMDigiSimLinkReader::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { - edm::Handle digis; - event.getByToken(gemDigiToken_, digis); - - edm::Handle simHits; - event.getByToken(simhitToken_, simHits); - - edm::ESHandle pDD; - eventSetup.get().get(pDD); - - edm::Handle > theSimlinkDigis; - event.getByToken(gemDigiSimLinkToken_, theSimlinkDigis); - - //loop over all simhits - for (const auto &simHit : *simHits) { - LogDebug("GEMDigiSimLinkReader") << "particle type\t" << simHit.particleType() << "\tprocess type\t" - << simHit.processType() << std::endl; - - hProces->Fill(simHit.processType()); - hAllSimHitsType->Fill(simHit.particleType()); - - if (std::abs(simHit.particleType()) == 13) - Muon_energy->Fill(simHit.pabs()); - if (std::abs(simHit.particleType()) == 11) { - if (simHit.processType() == 13) - Compton_energy->Fill(simHit.pabs()); - if (simHit.processType() == 2) - EIoni_energy->Fill(simHit.pabs()); - if (simHit.processType() == 4) - PairProd_energy->Fill(simHit.pabs()); - if (simHit.processType() == 14) - Conversions_energy->Fill(simHit.pabs()); - if (simHit.processType() == 3) - EBrem_energy->Fill(simHit.pabs()); - } - } - - //loop over the detectors which have digitized simhits - for (edm::DetSetVector::const_iterator itsimlink = theSimlinkDigis->begin(); - itsimlink != theSimlinkDigis->end(); - itsimlink++) { - //get the particular detector - int detid = itsimlink->detId(); - if (debug_) - LogDebug("GEMDigiSimLinkReader") << "detid\t" << detid << std::endl; - const GEMEtaPartition *roll = pDD->etaPartition(detid); - const GEMDetId gemId = roll->id(); - const int nstrips = roll->nstrips(); - - double fullAngularStripPitch = 0.; - std::map myCluster; // - std::vector muonFired; - std::map MuCluster; // - std::map ElecCluster; // - Local3DPoint locMuonEntry(0., 0., 0.); - GlobalPoint globMuonEntry(0., 0., 0.); - LocalVector lvMu(0., 0., 0.); - GlobalVector gvMu(0., 0., 0.); - double muMomentum = 0.; - - double simMuPhi = 0.; - double deltaPhi = 0.; - - //loop over GemDigiSimLinks - for (edm::DetSet::const_iterator link_iter = itsimlink->data.begin(); - link_iter != itsimlink->data.end(); - ++link_iter) { - int strip = link_iter->getStrip(); - int processtype = link_iter->getProcessType(); - int particletype = link_iter->getParticleType(); - int bx = link_iter->getBx(); - double partTof = link_iter->getTimeOfFlight(); - double myEnergyLoss = link_iter->getEnergyLoss(); - const StripTopology &topology = roll->specificTopology(); - double angularHalfRoll = (-1) * topology.stripAngle(roll->nstrips()); - double halfAngularStripPitch = angularHalfRoll / nstrips; - fullAngularStripPitch = 2 * halfAngularStripPitch; - - if (debug_) { - LogDebug("GEMDigiSimLinkReader") << "roll Id\t" << gemId << std::endl - << "number of strips \t" << nstrips << std::endl - << "simhit particle type\t" << particletype << std::endl - << "simhit process type\t" << processtype << std::endl - << "linked to strip with number\t" << strip << std::endl - << "in bunch crossing\t" << bx << std::endl - << "energy loss\t" << myEnergyLoss << std::endl - << "time of flight't" << partTof << std::endl - << "roll Id\t" << roll->id() << "\tangularStripCoverage \t" - << fullAngularStripPitch << std::endl; - } - - hParticleTypes->Fill(particletype); - - if (particletype == 11) - processtypeElectrons->Fill(processtype); - if (particletype == -11) - processtypePositrons->Fill(processtype); - if (std::abs(particletype) == 13) { - LogDebug("GEMDigiSimLinkReader") << "particle\t" << particletype << "\tdetektor\t" << gemId << std::endl; - processtypeMuons->Fill(processtype); - locMuonEntry = link_iter->getEntryPoint(); - globMuonEntry = roll->toGlobal(locMuonEntry); - simMuPhi = globMuonEntry.phi(); - lvMu = (link_iter->getMomentumAtEntry()); - muMomentum = gvMu.mag(); - } - - if (bx == 0) { - tof_allPart_bx0_ge->Fill(partTof); - if (gemId.station() == 1) - tof_allPart_bx0_ge11->Fill(partTof); - if (gemId.station() == 3) - tof_allPart_bx0_ge21->Fill(partTof); - if (std::abs(particletype) == 13) { - if (gemId.station() == 1) - tof_mu_bx0_ge11->Fill(partTof); - if (gemId.station() == 3) - tof_mu_bx0_ge21->Fill(partTof); - MuCluster.emplace(strip, particletype); - } else if (std::abs(particletype) == 11) { - if (gemId.station() == 1) - tof_elec_bx0_ge11->Fill(partTof); - if (gemId.station() == 3) - tof_elec_bx0_ge21->Fill(partTof); - ElecCluster.emplace(strip, particletype); - } else - continue; - } - } - - // add electron and muon hits to cluster - for (const auto &p : MuCluster) - myCluster.emplace(p); - for (const auto &p : ElecCluster) - myCluster.emplace(p); - for (const auto &p : MuCluster) - if (std::abs(p.second) == 13) - muonFired.emplace_back(p.first); - - if (!myCluster.empty()) { - LogDebug("GEMDigiSimLinkReader") << "=+=+=+=+=+=+=+=" << std::endl; - LogDebug("GEMDigiSimLinkReader") << "Muon size " << muonFired.size() << std::endl; - - std::vector allFired; - std::vector > tempCluster; - for (std::map::iterator it = myCluster.begin(); it != myCluster.end(); ++it) { - allFired.push_back(it->first); - } - - int clusterInd = 0; - for (unsigned int kk = 0; kk < allFired.size(); kk++) { - LogDebug("GEMDigiSimLinkReader") << "kk\t" << kk << std::endl; - int myDelta = 0; - std::vector prazen; - tempCluster.push_back(prazen); - (tempCluster[clusterInd]).push_back(allFired[kk]); - unsigned int i = kk; - LogDebug("GEMDigiSimLinkReader") << "i\t" << i << "\tpush kk\t" << allFired[kk] << "\tclusterInd\t" - << clusterInd << std::endl; - for (; i < allFired.size(); i++) { - if (i + 1 < allFired.size()) { - myDelta = allFired[i + 1] - allFired[i]; - if (myDelta == 1) { - tempCluster[clusterInd].push_back(allFired[i + 1]); - LogDebug("GEMDigiSimLinkReader") - << "i\t" << i << "\ti+1\t" << i + 1 << "\tpush i+1\t" << allFired[i + 1] << std::endl; - } else - break; - } - } - kk = i + 2; - clusterInd++; - } - - int firstStrip = 0; - int lastStrip = 0; - int muonCluster = 0; - GlobalPoint pointDigiHit; - allClusters_histo->Fill(tempCluster.size()); - - for (unsigned int j = 0; j < tempCluster.size(); j++) { - bool checkMu = false; - unsigned int tempSize = (tempCluster[j]).size(); - gemCLS_allClusters->Fill((tempCluster[j]).size()); - for (unsigned int l = 0; l < (tempCluster[j]).size(); ++l) { - std::vector::iterator muIt = find(muonFired.begin(), muonFired.end(), (tempCluster[j])[l]); - if (muIt != muonFired.end()) { - checkMu = true; - } else { - checkMu = false; - } - if (checkMu) - muonCluster++; - } - - firstStrip = (tempCluster[j])[0]; - lastStrip = (tempCluster[j])[tempSize - 1]; - - if (firstStrip == lastStrip) - pointDigiHit = roll->toGlobal(roll->centreOfStrip(firstStrip)); - else { - double myDeltaX = (roll->centreOfStrip(lastStrip).x() + roll->centreOfStrip(firstStrip).x()) / 2.; - double myDeltaY = (roll->centreOfStrip(lastStrip).y() + roll->centreOfStrip(firstStrip).y()) / 2.; - double myDeltaZ = (roll->centreOfStrip(lastStrip).y() + roll->centreOfStrip(firstStrip).z()) / 2.; - Local3DPoint locDigi(myDeltaX, myDeltaY, myDeltaZ); - pointDigiHit = roll->toGlobal(locDigi); - } - - double digiPhi = pointDigiHit.phi(); - if (checkMu) { - gemCLS_ClustersWithMuon->Fill((tempCluster[j]).size()); - deltaPhi = simMuPhi - digiPhi; - deltaPhi_allStations->Fill(deltaPhi); - if ((tempCluster[j]).size() == 1) - deltaPhi_cls1->Fill(deltaPhi); - else if ((tempCluster[j]).size() == 2) - deltaPhi_cls2->Fill(deltaPhi); - else if ((tempCluster[j]).size() == 3) - deltaPhi_cls3->Fill(deltaPhi); - else if ((tempCluster[j]).size() == 4) - deltaPhi_cls4->Fill(deltaPhi); - else if ((tempCluster[j]).size() == 5) - deltaPhi_cls5->Fill(deltaPhi); - - deltaPhi_allStations_normalized->Fill(deltaPhi / fullAngularStripPitch); - mom_cls_allStations->Fill(muMomentum, (tempCluster[j]).size()); - deltaPhi_cls_allStations->Fill(deltaPhi, (tempCluster[j]).size()); - deltaPhi_cls_allStations_normalized->Fill(deltaPhi / fullAngularStripPitch, (tempCluster[j]).size()); - if (gemId.station() == 1) { - deltaPhi_GE11->Fill(deltaPhi); - mom_cls_GE11->Fill(muMomentum, (tempCluster[j]).size()); - deltaPhi_cls_GE11->Fill(deltaPhi, (tempCluster[j]).size()); - } else if (gemId.station() == 3) { - deltaPhi_GE21->Fill(deltaPhi); - mom_cls_GE21->Fill(muMomentum, (tempCluster[j]).size()); - deltaPhi_cls_GE21->Fill(deltaPhi, (tempCluster[j]).size()); - } - } else - gemCLS_ElectronClusters->Fill((tempCluster[j]).size()); - } //end tempCluster - - muonClusters_histo->Fill(muonCluster); - - } //end myCluster!=0 - - } //end given detector -} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(GEMDigiSimLinkReader); diff --git a/SimMuon/GEMDigitizer/test/ME0DigiSimLinkReader.cc b/SimMuon/GEMDigitizer/test/ME0DigiSimLinkReader.cc deleted file mode 100644 index 8849d79e8eebf..0000000000000 --- a/SimMuon/GEMDigitizer/test/ME0DigiSimLinkReader.cc +++ /dev/null @@ -1,208 +0,0 @@ -/** \class ME0DigiSimLinkReader - * - * Dumps ME0DigiSimLinks digis - * - * \authors: Roumyana Hadjiiska - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" -#include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "Geometry/GEMGeometry/interface/ME0Geometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "DataFormats/MuonDetId/interface/ME0DetId.h" -#include "DataFormats/GEMDigi/interface/ME0DigiCollection.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimDataFormats/GEMDigiSimLink/interface/ME0DigiSimLink.h" -#include -#include -#include "DataFormats/Common/interface/DetSet.h" -#include -#include "Geometry/GEMGeometry/interface/ME0EtaPartitionSpecs.h" -#include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "TH1F.h" - -using namespace std; - -class ME0DigiSimLinkReader : public edm::one::EDAnalyzer { -public: - explicit ME0DigiSimLinkReader(const edm::ParameterSet &pset); - - ~ME0DigiSimLinkReader() override {} - - void analyze(const edm::Event &, const edm::EventSetup &) override; - -private: - edm::EDGetTokenT simhitToken_; - edm::EDGetTokenT me0DigiToken_; - edm::EDGetTokenT > me0DigiSimLinkToken_; - bool debug_; - - TH1F *hProces; - TH1F *hParticleTypes; - TH1F *hAllSimHitsType; - TH1F *energy_loss; - TH1F *processtypeElectrons; - TH1F *processtypePositrons; - TH1F *processtypeMuons; - TH1F *Compton_energy; - TH1F *EIoni_energy; - TH1F *PairProd_energy; - TH1F *Conversions_energy; - TH1F *EBrem_energy; - TH1F *Muon_energy; - TH1F *tof_allPart_bx0; - TH1F *tof_mu_bx0; - TH1F *tof_elec_bx0; -}; - -ME0DigiSimLinkReader::ME0DigiSimLinkReader(const edm::ParameterSet &pset) - : simhitToken_(consumes(pset.getParameter("simhitToken"))), - me0DigiToken_(consumes(pset.getParameter("me0DigiToken"))), - me0DigiSimLinkToken_( - consumes >(pset.getParameter("me0DigiSimLinkToken"))), - debug_(pset.getParameter("debugFlag")) { - usesResource("TFileService"); - edm::Service fs; - hProces = fs->make("hProces", "Process type for all the simHits", 20, 0, 20); - hAllSimHitsType = fs->make("hAllSimHitsType", "pdgId for All simHits", 500, 0, 500); - hParticleTypes = fs->make("hParticleTypes", "pdgId for digitized simHits", 500, 0, 500); - energy_loss = fs->make("energy_loss", "energy_loss", 10000000, 0., 0.001); - - processtypeElectrons = fs->make("processtypeElectrons", "processtypeElectrons", 20, 0, 20); - processtypePositrons = fs->make("processtypePositrons", "processtypePositrons", 20, 0, 20); - processtypeMuons = fs->make("processtypeMuons", "processtypeMuons", 20, 0, 20); - - Compton_energy = fs->make("Compton_energy", "Compton_energy", 10000000, 0., 10); - EIoni_energy = fs->make("EIoni_energy", "EIoni_energy", 10000000, 0., 10); - PairProd_energy = fs->make("PairProd_energy", "PairProd_energy", 10000000, 0., 10); - Conversions_energy = fs->make("Conversions_energy", "Conversions_energy", 10000000, 0., 10); - EBrem_energy = fs->make("EBrem_energy", "EBrem_energy", 10000000, 0., 10); - Muon_energy = fs->make("Muon_energy", "Muon_energy", 10000000, 0., 1000); - - tof_allPart_bx0 = fs->make("tof_allPart_bx0", "tof_allPart_bx0", 1000, 0., 100.); - tof_mu_bx0 = fs->make("tof_mu_bx0", "tof_mu_bx0", 1000, 0., 100.); - tof_elec_bx0 = fs->make("tof_elec_bx0", "tof_elec_bx0", 1000, 0., 100.); -} - -void ME0DigiSimLinkReader::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { - edm::Handle digis; - event.getByToken(me0DigiToken_, digis); - - edm::Handle simHits; - event.getByToken(simhitToken_, simHits); - - edm::ESHandle pDD; - eventSetup.get().get(pDD); - - edm::Handle > theSimlinkDigis; - event.getByToken(me0DigiSimLinkToken_, theSimlinkDigis); - - //loop over all simhits - for (const auto &simHit : *simHits) { - hProces->Fill(simHit.processType()); - hAllSimHitsType->Fill(simHit.particleType()); - - if (std::abs(simHit.particleType()) == 13) { - Muon_energy->Fill(simHit.pabs()); - } else if (std::abs(simHit.particleType()) == 11) { - if (simHit.processType() == 13) - Compton_energy->Fill(simHit.pabs()); - else if (simHit.processType() == 2) - EIoni_energy->Fill(simHit.pabs()); - else if (simHit.processType() == 4) - PairProd_energy->Fill(simHit.pabs()); - else if (simHit.processType() == 14) - Conversions_energy->Fill(simHit.pabs()); - else if (simHit.processType() == 3) - EBrem_energy->Fill(simHit.pabs()); - } - } - - //loop over the detectors which have digitized simhits - for (edm::DetSetVector::const_iterator itsimlink = theSimlinkDigis->begin(); - itsimlink != theSimlinkDigis->end(); - itsimlink++) { - int detid = itsimlink->detId(); - if (debug_) - LogDebug("ME0DigiSimLinkReader") << "detid\t" << detid << std::endl; - const ME0EtaPartition *roll = pDD->etaPartition(detid); - const ME0DetId me0Id = roll->id(); - const int nstrips = roll->nstrips(); - - double fullAngularStripPitch = 0.; - Local3DPoint locMuonEntry(0., 0., 0.); - GlobalPoint globMuonEntry(0., 0., 0.); - LocalVector lvMu(0., 0., 0.); - GlobalVector gvMu(0., 0., 0.); - - //loop over ME0DigiSimLinks - for (edm::DetSet::const_iterator link_iter = itsimlink->data.begin(); - link_iter != itsimlink->data.end(); - ++link_iter) { - int strip = link_iter->getStrip(); - int processtype = link_iter->getProcessType(); - int particletype = link_iter->getParticleType(); - int bx = link_iter->getBx(); - double partTof = link_iter->getTimeOfFlight(); - double myEnergyLoss = link_iter->getEnergyLoss(); - const StripTopology &topology = roll->specificTopology(); - double angularHalfRoll = (-1) * topology.stripAngle(roll->nstrips()); - double halfAngularStripPitch = angularHalfRoll / nstrips; - fullAngularStripPitch = 2 * halfAngularStripPitch; - - if (debug_) { - LogDebug("ME0DigiSimLinkReader") << "roll Id\t" << me0Id << std::endl - << "number of strips \t" << nstrips << std::endl - << "simhit particle type\t" << particletype << std::endl - << "simhit process type\t" << processtype << std::endl - << "linked to strip with number\t" << strip << std::endl - << "in bunch crossing\t" << bx << std::endl - << "energy loss\t" << myEnergyLoss << std::endl - << "time of flight't" << partTof << std::endl - << "roll Id\t" << roll->id() << "\tangularStripCoverage \t" - << fullAngularStripPitch << std::endl; - } - - hParticleTypes->Fill(particletype); - - if (particletype == 11) - processtypeElectrons->Fill(processtype); - if (particletype == -11) - processtypePositrons->Fill(processtype); - if (std::abs(particletype) == 13) { - processtypeMuons->Fill(processtype); - locMuonEntry = link_iter->getEntryPoint(); - globMuonEntry = roll->toGlobal(locMuonEntry); - lvMu = (link_iter->getMomentumAtEntry()); - } - - if (bx == 0) { - if (me0Id.station() != 1) - LogDebug("ME0DigiSimLinkReader") << "wrong ME0 station !=1" << std::endl; - else { - tof_allPart_bx0->Fill(partTof); - if (std::abs(particletype) == 13) { - tof_mu_bx0->Fill(partTof); - } else if (std::abs(particletype) == 11) { - if (me0Id.station() == 1) - tof_elec_bx0->Fill(partTof); - } else - continue; - } - } - } - } -} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(ME0DigiSimLinkReader); From f45c5fb39b52d92fa2728da49c7f44d27f7ed304 Mon Sep 17 00:00:00 2001 From: lathomasexport Date: Thu, 12 Aug 2021 17:14:40 +0200 Subject: [PATCH 017/923] Bug fix for track MET in miniAOD tools --- .../PatUtils/python/tools/runMETCorrectionsAndUncertainties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index 1bcf4c4a7d4e0..e4af61c9f3a95 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -1728,7 +1728,7 @@ def miniAODConfigurationPre(self, process, patMetModuleSequence, pfCandCollectio patMetModuleSequence += getattr(process, "pfMetCHS") patMetModuleSequence += getattr(process, "patCHSMet") - pfTrk = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV(0) > 0 && charge()!=0")) + pfTrk = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("pvAssociationQuality()>=4 && charge()!=0 && vertexRef().key()==0")) addToProcessAndTask("pfTrk", pfTrk, process, task) pfMetTrk = pfMet.clone(src = 'pfTrk') addToProcessAndTask("pfMetTrk", pfMetTrk, process, task) From b0653a235cb961e6b7b1336ce7b6f193e87fc661 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Tue, 20 Jul 2021 17:53:15 +0200 Subject: [PATCH 018/923] name binning constants, add comments --- .../SiPixelRecHits/interface/pixelCPEforGPU.h | 30 ++++++++++++++----- .../SiPixelRecHits/src/PixelCPEFast.cc | 10 +++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h index 37922bc1ebb6d..0d4f2ca5679ea 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h @@ -12,6 +12,17 @@ #include "HeterogeneousCore/CUDAUtilities/interface/cudaCompat.h" #include "CUDADataFormats/TrackingRecHit/interface/SiPixelHitStatus.h" +namespace CPEFastParametrisation { + // From https://cmssdt.cern.ch/dxr/CMSSW/source/CondFormats/SiPixelTransient/src/SiPixelGenError.cc#485-486 + // qbin: int (0-4) describing the charge of the cluster + // [0: 1.5 smallest charge, bin4-> largest charge + // whereas in CondFormats/SiPixelTransient/src/SiPixelGenError.cc it is the opposite + // so we reverse the bin here -> GenErrorQBins - 1 - bin + cp.status[ic].qBin = GenErrorQBins - 1 - bin; cp.status[ic].isOneX = isOneX; cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX; cp.status[ic].isOneY = isOneY; cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY; - auto xoff = 81.f * comParams.thePitchX; - int jx = std::min(15, std::max(0, int(16.f * (cp.xpos[ic] + xoff) / (2 * xoff)))); + auto xoff = float(phase1PixelTopology::xOffset) * comParams.thePitchX; + int jx = std::min((NumErrorBins - 1), std::max(0, int(float(NumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff)))); auto toCM = [](uint8_t x) { return float(x) * 1.e-4; }; diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 8156a70723ffe..c56ef05bc8d77 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -204,9 +204,9 @@ void PixelCPEFast::fillParamsForGpu() { g.sy2 = std::max(55, toMicron(cp.sy2)); // sometimes sy2 is smaller than others (due to angle?) // sample xerr as function of position - auto const xoff = -81.f * commonParamsGPU_.thePitchX; + auto const xoff = -float(phase1PixelTopology::xOffset) * commonParamsGPU_.thePitchX; - for (int ix = 0; ix < 16; ++ix) { + for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f); auto gvx = p.theOrigin.x() - x; auto gvy = p.theOrigin.y(); @@ -221,8 +221,8 @@ void PixelCPEFast::fillParamsForGpu() { } #ifdef EDM_ML_DEBUG // sample yerr as function of position - auto const yoff = -54.f * 4.f * commonParamsGPU_.thePitchY; - for (int ix = 0; ix < 16; ++ix) { + auto const yoff = -float(phase1PixelTopology::yOffset) * commonParamsGPU_.thePitchY; + for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f); auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchY; auto gvy = p.theOrigin.y() - y; @@ -279,7 +279,7 @@ void PixelCPEFast::fillParamsForGpu() { // sample y in "angle" (estimated from cluster size) float ys = 8.f - 4.f; // apperent bias of half pixel (see plot) // sample yerr as function of "size" - for (int iy = 0; iy < 16; ++iy) { + for (int iy = 0; iy < CPEFastParametrisation::NumErrorBins; ++iy) { ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3) if (15 == iy) ys += 8.f; // last bin for "overflow" From 3fdd45827cf0acd616a7f9747fc1893c6a1893f4 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Wed, 21 Jul 2021 11:13:01 +0200 Subject: [PATCH 019/923] name constants, add link to plot --- RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index c56ef05bc8d77..4fc4b06369bc4 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -247,7 +247,7 @@ void PixelCPEFast::fillParamsForGpu() { auto aveCB = cp.cotbeta; // sample x by charge - int qbin = 5; // low charge + int qbin = CPEFastParametrisation::GenErrorQBins; // low charge int k = 0; for (int qclus = 1000; qclus < 200000; qclus += 1000) { errorFromTemplates(p, cp, qclus); @@ -263,25 +263,26 @@ void PixelCPEFast::fillParamsForGpu() { << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2 << std::endl; #endif // EDM_ML_DEBUG } - assert(k <= 5); + assert(k <= CPEFastParametrisation::GenErrorQBins); // fill the rest (sometimes bin 4 is missing) - for (int kk = k; kk < 5; ++kk) { + for (int kk = k; kk < CPEFastParametrisation::GenErrorQBins; ++kk) { g.xfact[kk] = g.xfact[k - 1]; g.yfact[kk] = g.yfact[k - 1]; g.minCh[kk] = g.minCh[k - 1]; } auto detx = 1.f / g.xfact[0]; auto dety = 1.f / g.yfact[0]; - for (int kk = 0; kk < 5; ++kk) { + for (int kk = 0; kk < CPEFastParametrisation::GenErrorQBins; ++kk) { g.xfact[kk] *= detx; g.yfact[kk] *= dety; } // sample y in "angle" (estimated from cluster size) float ys = 8.f - 4.f; // apperent bias of half pixel (see plot) + // plot: https://indico.cern.ch/event/934821/contributions/3974619/attachments/2091853/3515041/DigilessReco.pdf page 25 // sample yerr as function of "size" for (int iy = 0; iy < CPEFastParametrisation::NumErrorBins; ++iy) { ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3) - if (15 == iy) + if (CPEFastParametrisation::NumErrorBins - 1 == iy) ys += 8.f; // last bin for "overflow" // cp.cotalpha = ys*(commonParamsGPU_.thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below) cp.cotbeta = std::copysign(ys * (commonParamsGPU_.thePitchY / (8.f * thickness)), aveCB); From dc55466c7a5544cc700c36c4d2e3ec9cfa8ce98e Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Wed, 21 Jul 2021 11:46:31 +0200 Subject: [PATCH 020/923] add comments to code --- .../PixelTriplets/plugins/BrokenLineFitOnGPU.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h index acee643134460..083d0dad07de3 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h @@ -90,16 +90,20 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, #ifdef YERR_FROM_DC auto const &dp = hhp->cpeParams().detParams(hhp->detectorIndex(hit)); auto status = hhp->status(hit); - int qbin = 4 - status.qBin; + int qbin = CPEFastParametrisation::GenErrorQBins - status.qBin; assert(qbin >= 0 && qbin < 5); bool nok = (status.isBigY | status.isOneY); // compute cotanbeta and use it to recompute error dp.frame.rotation().multiply(dx, dy, dz, ux, uy, uz); auto cb = std::abs(uy / uz); - int bin = int(cb * (285.f / 150.f) * 8.f) - 4; - bin = std::max(0, std::min(15, bin)); - float yerr = dp.sigmay[bin] * 1.e-4f; - yerr *= dp.yfact[qbin]; // inflate + // phase 1 pixel sensors - also available in DB + const float thickness = 285.f; + const float pitchY = 150.f; + int bin = int(cb * (thickness / pitchY) * 8.f) - 4; + // truncate bin to [0, 15] interval -> number of error bins for this parametrisation + bin = std::max(0, std::min(CPEFastParametrisation::NumErrorBins - 1, bin)); + float yerr = dp.sigmay[bin] * 1.e-4f; // toCM + yerr *= dp.yfact[qbin]; // inflate yerr *= yerr; yerr += dp.apeYY; yerr = nok ? hhp->yerrLocal(hit) : yerr; From fc931e594e5aac593b33f53cf02fc7d586c0f43d Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Thu, 22 Jul 2021 10:29:19 +0200 Subject: [PATCH 021/923] small changes --- .../interface/phase1PixelTopology.h | 4 ++++ .../SiPixelRecHits/interface/pixelCPEforGPU.h | 8 ++++++-- .../SiPixelRecHits/src/PixelCPEFast.cc | 4 ++-- .../PixelTriplets/plugins/BrokenLineFitOnGPU.h | 14 +++++++------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h index c2b5bc9d95f83..4e70cd86e1524 100644 --- a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h +++ b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h @@ -19,6 +19,10 @@ namespace phase1PixelTopology { constexpr int16_t xOffset = -81; constexpr int16_t yOffset = -54 * 4; + constexpr uint16_t pixelThickness = 285; + constexpr uint16_t pixelPitchX = 100; + constexpr uint16_t pixelPitchY = 150; + constexpr uint32_t numPixsInModule = uint32_t(numRowsInModule) * uint32_t(numColsInModule); constexpr uint32_t numberOfModules = 1856; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h index 0d4f2ca5679ea..cee2626025116 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h @@ -367,8 +367,12 @@ namespace pixelCPEforGPU { cp.status[ic].isOneY = isOneY; cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY; - auto xoff = float(phase1PixelTopology::xOffset) * comParams.thePitchX; - int jx = std::min((NumErrorBins - 1), std::max(0, int(float(NumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff)))); + auto xoff = -float(phase1PixelTopology::xOffset) * comParams.thePitchX; + int low_value = 0; + int high_value = NumErrorBins - 1; + int bin_value = float(NumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff); + // return estimated bin value truncated to [0, 15] + int jx = std::clamp(bin_value, low_value, high_value); auto toCM = [](uint8_t x) { return float(x) * 1.e-4; }; diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 4fc4b06369bc4..ee6ae78571017 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -204,7 +204,7 @@ void PixelCPEFast::fillParamsForGpu() { g.sy2 = std::max(55, toMicron(cp.sy2)); // sometimes sy2 is smaller than others (due to angle?) // sample xerr as function of position - auto const xoff = -float(phase1PixelTopology::xOffset) * commonParamsGPU_.thePitchX; + auto const xoff = float(phase1PixelTopology::xOffset) * commonParamsGPU_.thePitchX; for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f); @@ -221,7 +221,7 @@ void PixelCPEFast::fillParamsForGpu() { } #ifdef EDM_ML_DEBUG // sample yerr as function of position - auto const yoff = -float(phase1PixelTopology::yOffset) * commonParamsGPU_.thePitchY; + auto const yoff = float(phase1PixelTopology::yOffset) * commonParamsGPU_.thePitchY; for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f); auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchY; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h index 083d0dad07de3..dafafa6b47a55 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h @@ -90,18 +90,18 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, #ifdef YERR_FROM_DC auto const &dp = hhp->cpeParams().detParams(hhp->detectorIndex(hit)); auto status = hhp->status(hit); - int qbin = CPEFastParametrisation::GenErrorQBins - status.qBin; + int qbin = CPEFastParametrisation::GenErrorQBins - 1 - status.qBin; assert(qbin >= 0 && qbin < 5); bool nok = (status.isBigY | status.isOneY); // compute cotanbeta and use it to recompute error dp.frame.rotation().multiply(dx, dy, dz, ux, uy, uz); auto cb = std::abs(uy / uz); - // phase 1 pixel sensors - also available in DB - const float thickness = 285.f; - const float pitchY = 150.f; - int bin = int(cb * (thickness / pitchY) * 8.f) - 4; - // truncate bin to [0, 15] interval -> number of error bins for this parametrisation - bin = std::max(0, std::min(CPEFastParametrisation::NumErrorBins - 1, bin)); + int bin = + int(cb * (float(phase1PixelTopology::pixelThickess) / float(phase1PixelTopology::pixelPitchY)) * 8.f) - 4; + int low_value = 0; + int high_value = CPEFastParametrisation::NumErrorBins - 1; + // return estimated bin value truncated to [0, 15] + bin = std::clamp(bin, low_value, high_value); float yerr = dp.sigmay[bin] * 1.e-4f; // toCM yerr *= dp.yfact[qbin]; // inflate yerr *= yerr; From 11f56a7ce7d2cd6afa02a67e7bb069bfde0c0333 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Sun, 15 Aug 2021 23:14:55 +0200 Subject: [PATCH 022/923] reduce repeated computations --- .../SiPixelRecHits/src/PixelCPEFast.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index ee6ae78571017..7d686ccde26e2 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -178,11 +178,14 @@ void PixelCPEFast::fillParamsForGpu() { auto toMicron = [&](float x) { return std::min(511, int(x * 1.e4f + 0.5f)); }; + // average angle + auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchX; + auto gvy = p.theOrigin.y(); + auto gvz = 1.f / p.theOrigin.z(); + //--- Note that the normalization is not required as only the ratio used + { - // average angle - auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchX; - auto gvy = p.theOrigin.y(); - auto gvz = 1.f / p.theOrigin.z(); + // calculate angles (fed into errorFromTemplates) cp.cotalpha = gvx * gvz; cp.cotbeta = gvy * gvz; errorFromTemplates(p, cp, 20000.); @@ -235,13 +238,7 @@ void PixelCPEFast::fillParamsForGpu() { } #endif // EDM_ML_DEBUG - // average angle - auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchX; - auto gvy = p.theOrigin.y(); - auto gvz = 1.f / p.theOrigin.z(); - //--- Note that the normalization is not required as only the ratio used - - // calculate angles (fed into errorFromTemplates) + // calculate angles (repeated) cp.cotalpha = gvx * gvz; cp.cotbeta = gvy * gvz; auto aveCB = cp.cotbeta; From f107145b647f14863abf999550ed7e3ac48ddca5 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 16 Aug 2021 09:49:41 +0200 Subject: [PATCH 023/923] Removed lexical_cast boost dependency --- .../testTrackerAlignmentPayloadInspector.cpp | 4 +-- .../test/testBeamSpotPayloadInspector.cpp | 6 ++-- .../src/OnlineDBOutputService.cc | 4 +-- ...estAlCaRecoTriggerBitsPayloadInspector.cpp | 4 +-- .../test/testRunInfoPayloadInspector.cpp | 4 +-- .../interface/SiPixelGainCalibHelper.h | 4 +-- ...xelFEDChannelContainer_PayloadInspector.cc | 2 +- .../test/testSiPixelPayloadInspector.cpp | 34 +++++++++---------- .../SiStripApvGain_PayloadInspector.cc | 4 +-- .../plugins/SiStripNoises_PayloadInspector.cc | 6 ++-- .../SiStripPedestals_PayloadInspector.cc | 4 +-- .../test/testSiStripPayloadInspector.cpp | 24 ++++++------- CondCore/Utilities/bin/conddb_test_read.cpp | 2 +- .../plugins/BasicP_PayloadInspector.cc | 6 ++-- CondCore/Utilities/src/CondDBFetch.cc | 2 +- CondCore/Utilities/src/PayloadInspector.cc | 4 +-- CondCore/Utilities/test/testPngHistograms.cpp | 2 +- 17 files changed, 58 insertions(+), 58 deletions(-) diff --git a/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp b/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp index 486c5d7d2824d..7124f3ff69990 100644 --- a/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp +++ b/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "TrackerAlignment_v21_offline"; - cond::Time_t start = boost::lexical_cast(294034); - cond::Time_t end = boost::lexical_cast(305898); + cond::Time_t start = static_cast(294034); + cond::Time_t end = static_cast(305898); std::cout << "## Alignment Histos" << std::endl; diff --git a/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp b/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp index 6fc591f7a4be5..4a0741a2a7b3f 100644 --- a/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp +++ b/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp @@ -27,8 +27,8 @@ int main(int argc, char** argv) { // BeamSpot std::string tag = "BeamSpotObjects_PCL_byLumi_v0_prompt"; - cond::Time_t start = boost::lexical_cast(1406876667347162); - //cond::Time_t end = boost::lexical_cast(1406876667347162); + cond::Time_t start = static_cast(1406876667347162); + //cond::Time_t end = static_cast(1406876667347162); edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpot plots " << std::endl; @@ -37,7 +37,7 @@ int main(int argc, char** argv) { edm::LogPrint("testBeamSpotPayloadInspector") << histoParameters.data() << std::endl; tag = "BeamSpotOnlineTestLegacy"; - start = boost::lexical_cast(1443392479297557); + start = static_cast(1443392479297557); edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpotOnline plots " << std::endl; diff --git a/CondCore/DBOutputService/src/OnlineDBOutputService.cc b/CondCore/DBOutputService/src/OnlineDBOutputService.cc index 3896bfc7e8aa0..20d53634e9950 100644 --- a/CondCore/DBOutputService/src/OnlineDBOutputService.cc +++ b/CondCore/DBOutputService/src/OnlineDBOutputService.cc @@ -69,8 +69,8 @@ namespace cond { if (!std::getline(sinfo, slumi, ',')) { throw Exception("Can't get lumi id from OMS Service."); } - unsigned int run = boost::lexical_cast(srun); - unsigned int lumi = boost::lexical_cast(slumi); + unsigned int run = std::stoul(srun); + unsigned int lumi = std::stoul(slumi); lastLumiProcessed = cond::time::lumiTime(run, lumi); return lastLumiProcessed; } diff --git a/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp b/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp index d08272a31ec45..4eb5a7ecf29e7 100644 --- a/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp +++ b/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "AlCaRecoHLTpaths8e29_1e31_v7_hlt"; - cond::Time_t start = boost::lexical_cast(270000); - cond::Time_t end = boost::lexical_cast(304820); + cond::Time_t start = static_cast(270000); + cond::Time_t end = static_cast(304820); std::cout << "## AlCaRecoTriggerBit Histos" << std::endl; diff --git a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp index dc78079b886b4..5bd13a5c89358 100644 --- a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp +++ b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "runinfo_31X_hlt"; - cond::Time_t start = boost::lexical_cast(311950); - cond::Time_t end = boost::lexical_cast(312237); + cond::Time_t start = static_cast(311950); + cond::Time_t end = static_cast(312237); std::cout << "## RunInfo testing" << std::endl; diff --git a/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h index 5f8598040d07f..824c54cc592eb 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h @@ -426,7 +426,7 @@ namespace gainCalibHelper { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("SetLog"); if (ip != paramValues.end()) { - auto answer = boost::lexical_cast(ip->second); + auto answer = ip->second; if (!SiPixelPI::checkAnswerOK(answer, setLog)) { throw cms::Exception(label_) << "\nERROR: " << answer @@ -590,7 +590,7 @@ namespace gainCalibHelper { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("SetLog"); if (ip != paramValues.end()) { - auto answer = boost::lexical_cast(ip->second); + auto answer = ip->second; if (!SiPixelPI::checkAnswerOK(answer, setLog)) { throw cms::Exception(label_) << "\nERROR: " << answer diff --git a/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc b/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc index fd440af137345..1839bdf4fe5e5 100644 --- a/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc +++ b/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc @@ -82,7 +82,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("Scenarios"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; diff --git a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp index 34b6ad1d50ed0..8f726f3b53b02 100644 --- a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp +++ b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp @@ -33,8 +33,8 @@ int main(int argc, char** argv) { // Lorentz Angle std::string tag = "SiPixelLorentzAngle_v11_offline"; - cond::Time_t start = boost::lexical_cast(303790); - cond::Time_t end = boost::lexical_cast(324245); + cond::Time_t start = static_cast(303790); + cond::Time_t end = static_cast(324245); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising Lorentz Angle plots " << std::endl; @@ -68,7 +68,7 @@ int main(int argc, char** argv) { // 2 tags comparisons std::string tag2 = "SiPixelLorentzAngle_2016_ultralegacymc_v2"; - cond::Time_t start2 = boost::lexical_cast(1); + cond::Time_t start2 = static_cast(1); SiPixelLorentzAngleValueComparisonTwoTags histo6; histo6.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2)); @@ -81,8 +81,8 @@ int main(int argc, char** argv) { // SiPixelQuality tag = "SiPixelQuality_forDigitizer_phase1_2018_permanentlyBad"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQuality plots " << std::endl; @@ -97,8 +97,8 @@ int main(int argc, char** argv) { // SiPixelGainCalibrationOffline tag = "SiPixelGainCalibration_2009runs_express"; - start = boost::lexical_cast(312203); - end = boost::lexical_cast(312203); + start = static_cast(312203); + end = static_cast(312203); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGainCalibrationOffline plots " << std::endl; @@ -118,7 +118,7 @@ int main(int argc, char** argv) { histo13.process(connectionString, PI::mk_input(tag, start, end)); edm::LogPrint("testSiPixelPayloadInspector") << histo13.data() << std::endl; - end = boost::lexical_cast(326851); + end = static_cast(326851); SiPixelGainCalibOfflinePedestalComparisonSingleTag histo14; histo14.process(connectionString, PI::mk_input(tag, start, end)); @@ -143,8 +143,8 @@ int main(int argc, char** argv) { // SiPixelTemplates tag = "SiPixelTemplateDBObject38Tv3_express"; - start = boost::lexical_cast(326083); - end = boost::lexical_cast(326083); + start = static_cast(326083); + end = static_cast(326083); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelTemplates plots " << std::endl; @@ -177,8 +177,8 @@ int main(int argc, char** argv) { // SiPixelGenErrors tag = "SiPixelGenErrorDBObject_phase1_BoR3_HV350_Tr2000"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGenErrors plots " << std::endl; @@ -193,8 +193,8 @@ int main(int argc, char** argv) { // SiPixelQualityProbabilities tag = "SiPixelQualityProbabilities_UltraLegacy2018_v0_mc"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQualityProbabilities plots " << std::endl; @@ -205,8 +205,8 @@ int main(int argc, char** argv) { // SiPixelDynamicInefficiency tag = "SiPixelDynamicInefficiency_PhaseI_v9"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixeDynamicInefficiency plots " << std::endl; @@ -215,7 +215,7 @@ int main(int argc, char** argv) { edm::LogPrint("testSiPixelPayloadInspector") << histo26.data() << std::endl; tag2 = "SiPixelDynamicInefficiency_PhaseI_v6"; - start2 = boost::lexical_cast(1); + start2 = static_cast(1); SiPixelFullIneffROCsMapCompareTwoTags histo27; histo27.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2)); diff --git a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc index bc21118b11bc0..dc2b59002db67 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc @@ -566,7 +566,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); } // trick to deal with the multi-ioved tag and two tag case at the same time @@ -674,7 +674,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); edm::LogPrint("SiStripApvGain_PayloadInspector") << "using custom z-axis saturation: " << nsigma << " sigmas" << std::endl; } else { diff --git a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index f367b6ab14a05..213e1c848a583 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -117,7 +117,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; @@ -316,7 +316,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { - the_detid = boost::lexical_cast(ip->second); + the_detid = std::stoul(ip->second); } if (payload.get()) { @@ -962,7 +962,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); } // trick to deal with the multi-ioved tag and two tag case at the same time diff --git a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc index 862300c85b89c..19089ff7b30ad 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc @@ -116,7 +116,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; @@ -315,7 +315,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { - the_detid = boost::lexical_cast(ip->second); + the_detid = std::stoul(ip->second); } if (payload.get()) { diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 285202ed5293c..012152eb49e39 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -31,8 +31,8 @@ int main(int argc, char** argv) { // Gains std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline"; - cond::Time_t start = boost::lexical_cast(132440); - cond::Time_t end = boost::lexical_cast(285368); + cond::Time_t start = static_cast(132440); + cond::Time_t end = static_cast(285368); boost::python::dict inputs; edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl; @@ -72,8 +72,8 @@ int main(int argc, char** argv) { // Noise tag = "SiStripNoise_GR10_v1_hlt"; - start = boost::lexical_cast(312968); - end = boost::lexical_cast(313120); + start = static_cast(312968); + end = static_cast(313120); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Noise plots " << std::endl; @@ -98,8 +98,8 @@ int main(int argc, char** argv) { // Pedestals tag = "SiStripPedestals_v2_prompt"; - start = boost::lexical_cast(303420); - end = boost::lexical_cast(313120); + start = static_cast(303420); + end = static_cast(313120); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Pedestal plots " << std::endl; @@ -120,8 +120,8 @@ int main(int argc, char** argv) { //Latency tag = "SiStripLatency_v2_prompt"; - start = boost::lexical_cast(315347); - end = boost::lexical_cast(316675); + start = static_cast(315347); + end = static_cast(316675); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Latency plots " << std::endl; @@ -135,8 +135,8 @@ int main(int argc, char** argv) { //Threshold tag = "SiStripThreshold_v1_prompt"; - start = boost::lexical_cast(315352); - end = boost::lexical_cast(315460); + start = static_cast(315352); + end = static_cast(315460); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Threshold plots " << std::endl; @@ -146,8 +146,8 @@ int main(int argc, char** argv) { // test SiStripTkMaps tag = "SiStripBadComponents_startupMC_for2017_v1_mc"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising SiStripTkMaps plots " << std::endl; diff --git a/CondCore/Utilities/bin/conddb_test_read.cpp b/CondCore/Utilities/bin/conddb_test_read.cpp index a4024d9fac3b7..2cbb9d44c4672 100644 --- a/CondCore/Utilities/bin/conddb_test_read.cpp +++ b/CondCore/Utilities/bin/conddb_test_read.cpp @@ -53,7 +53,7 @@ int cond::TestReadUtilities::execute() { std::string siovs = getOptionValue("iovs"); tokenizer tok(siovs); for (auto &t : tok) { - iovs.push_back(boost::lexical_cast(t)); + iovs.push_back(std::stoull(t)); } } diff --git a/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc b/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc index 35a4a52429b79..fbcd8389f8b9d 100644 --- a/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc +++ b/CondCore/Utilities/plugins/BasicP_PayloadInspector.cc @@ -34,15 +34,15 @@ namespace { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("Factor"); if (ip != paramValues.end()) { - v = v * boost::lexical_cast(ip->second); + v = v * std::stof(ip->second); } ip = paramValues.find("Offset"); if (ip != paramValues.end()) { - v = v + boost::lexical_cast(ip->second); + v = v + std::stof(ip->second); } ip = paramValues.find("Scale"); if (ip != paramValues.end()) { - v = v * boost::lexical_cast(ip->second); + v = v * std::stof(ip->second); } return v; } diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index d950d7145e5ce..3df053b00879f 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -344,7 +344,7 @@ namespace cond { bool found = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo); if (!found) throwException( - "Payload with id " + boost::lexical_cast(payloadId) + " has not been found in the database.", + "Payload with id " + payloadId + " has not been found in the database.", "fetch"); return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr); } diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index 15a0f80b4b6f3..8df6d785274e4 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -79,8 +79,8 @@ namespace cond { std::string tagName = boost::python::extract(entry[0]); std::string time0s = boost::python::extract(entry[1]); std::string time1s = boost::python::extract(entry[2]); - cond::Time_t time0 = boost::lexical_cast(time0s); - cond::Time_t time1 = boost::lexical_cast(time1s); + cond::Time_t time0 = std::stoull(time0s); + cond::Time_t time1 = std::stoull(time1s); tags[i] = std::make_tuple(tagName, time0, time1); } ret = exec_process(connectionString, tags); diff --git a/CondCore/Utilities/test/testPngHistograms.cpp b/CondCore/Utilities/test/testPngHistograms.cpp index f527f6e4ce27e..0ecbfef087a3b 100644 --- a/CondCore/Utilities/test/testPngHistograms.cpp +++ b/CondCore/Utilities/test/testPngHistograms.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = std::string("BasicPayload_v10.0"); - cond::Time_t since = boost::lexical_cast("901"); + cond::Time_t since = std::stoull("901"); std::cout << "## PNG Histo" << std::endl; From 394f18d0c3b87f5385ba66849ca813b5c7f3bce9 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Wed, 4 Aug 2021 13:44:44 +0200 Subject: [PATCH 024/923] change width, shift and mask type to uint32_t --- .../interface/PixelChannelIdentifier.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h index 9c79103ec17d0..030988608bead 100644 --- a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h +++ b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h @@ -2,6 +2,7 @@ #define DATAFORMATS_PIXELCHANMNELIDENTIFIER_H #include +#include namespace pixelchanelidentifierimpl { /** @@ -10,7 +11,7 @@ namespace pixelchanelidentifierimpl { class Packing { public: - using PackedDigiType = unsigned int; + using PackedDigiType = uint32_t; // Constructor: pre-computes masks and shifts from field widths constexpr Packing(unsigned int row_w, unsigned int column_w, unsigned int flag_w, unsigned int adc_w) @@ -30,14 +31,14 @@ namespace pixelchanelidentifierimpl { max_column(column_mask), max_adc(adc_mask) {} - const int row_width; - const int column_width; - const int adc_width; + const uint32_t row_width; + const uint32_t column_width; + const uint32_t adc_width; - const int row_shift; - const int column_shift; - const int flag_shift; - const int adc_shift; + const uint32_t row_shift; + const uint32_t column_shift; + const uint32_t flag_shift; + const uint32_t adc_shift; const PackedDigiType row_mask; const PackedDigiType column_mask; From 4eee658fc9445f05d57facbfb83024a0a04f9ad8 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Tue, 10 Aug 2021 09:30:40 +0200 Subject: [PATCH 025/923] use Packing from pixelchanelidentifierimpl for gpu --- .../plugins/SiPixelRawToClusterGPUKernel.h | 56 +++---------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h index 85356f340c16f..49bfd528382d9 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h @@ -4,6 +4,7 @@ #include #include +#include "DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h" #include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h" #include "CUDADataFormats/SiPixelDigi/interface/SiPixelDigiErrorsCUDA.h" #include "CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h" @@ -56,62 +57,19 @@ namespace pixelgpudetails { uint32_t col; }; - class Packing { - public: - using PackedDigiType = uint32_t; - - // Constructor: pre-computes masks and shifts from field widths - __host__ __device__ inline constexpr Packing(unsigned int row_w, - unsigned int column_w, - unsigned int time_w, - unsigned int adc_w) - : row_width(row_w), - column_width(column_w), - adc_width(adc_w), - row_shift(0), - column_shift(row_shift + row_w), - time_shift(column_shift + column_w), - adc_shift(time_shift + time_w), - row_mask(~(~0U << row_w)), - column_mask(~(~0U << column_w)), - time_mask(~(~0U << time_w)), - adc_mask(~(~0U << adc_w)), - rowcol_mask(~(~0U << (column_w + row_w))), - max_row(row_mask), - max_column(column_mask), - max_adc(adc_mask) {} - - uint32_t row_width; - uint32_t column_width; - uint32_t adc_width; - - uint32_t row_shift; - uint32_t column_shift; - uint32_t time_shift; - uint32_t adc_shift; - - PackedDigiType row_mask; - PackedDigiType column_mask; - PackedDigiType time_mask; - PackedDigiType adc_mask; - PackedDigiType rowcol_mask; - - uint32_t max_row; - uint32_t max_column; - uint32_t max_adc; - }; - - __host__ __device__ inline constexpr Packing packing() { return Packing(11, 11, 0, 10); } + __host__ __device__ inline constexpr pixelchanelidentifierimpl::Packing packing() { + return pixelchanelidentifierimpl::Packing(11, 10, 1, 10); + } - __host__ __device__ inline uint32_t pack(uint32_t row, uint32_t col, uint32_t adc) { - constexpr Packing thePacking = packing(); + __host__ __device__ inline uint32_t pack(uint32_t row, uint32_t col, uint32_t adc, uint32_t flag = 0) { + constexpr pixelchanelidentifierimpl::Packing thePacking = packing(); adc = std::min(adc, thePacking.max_adc); return (row << thePacking.row_shift) | (col << thePacking.column_shift) | (adc << thePacking.adc_shift); } constexpr uint32_t pixelToChannel(int row, int col) { - constexpr Packing thePacking = packing(); + constexpr pixelchanelidentifierimpl::Packing thePacking = packing(); return (row << thePacking.column_width) | col; } From 0444cd730b9444ffe36089641249d61f9bdd2228 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Tue, 10 Aug 2021 09:31:16 +0200 Subject: [PATCH 026/923] reduce further duplication --- .../plugins/SiPixelRawToClusterGPUKernel.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h index 49bfd528382d9..a84662b397542 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h @@ -57,13 +57,11 @@ namespace pixelgpudetails { uint32_t col; }; - __host__ __device__ inline constexpr pixelchanelidentifierimpl::Packing packing() { - return pixelchanelidentifierimpl::Packing(11, 10, 1, 10); - } + inline constexpr pixelchanelidentifierimpl::Packing packing() { return PixelChannelIdentifier::thePacking; } - __host__ __device__ inline uint32_t pack(uint32_t row, uint32_t col, uint32_t adc, uint32_t flag = 0) { + inline constexpr uint32_t pack(uint32_t row, uint32_t col, uint32_t adc, uint32_t flag = 0) { constexpr pixelchanelidentifierimpl::Packing thePacking = packing(); - adc = std::min(adc, thePacking.max_adc); + adc = std::min(adc, uint32_t(thePacking.max_adc)); return (row << thePacking.row_shift) | (col << thePacking.column_shift) | (adc << thePacking.adc_shift); } From 9d489adc0e1d19b20facfd3e28d2ab051bd3b48e Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Mon, 16 Aug 2021 10:56:47 +0200 Subject: [PATCH 027/923] update SiPixelDetId Readme --- DataFormats/SiPixelDetId/README.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/DataFormats/SiPixelDetId/README.md b/DataFormats/SiPixelDetId/README.md index a7e70e623ceab..974688cfaacef 100644 --- a/DataFormats/SiPixelDetId/README.md +++ b/DataFormats/SiPixelDetId/README.md @@ -1,11 +1,18 @@ -2016.05.11 ATricomi+EMigliore (INFN) changes in PixelChannelIdentifier.cc -Change PixelChannelIdentifier::thePacking() to have indexes spanning the full module in case of small pixels (phase II InnerPixel) +Changes - timeline +##### 2016.05.11 ATricomi+EMigliore (INFN) changes in PixelChannelIdentifier.cc +- Change PixelChannelIdentifier::thePacking() to have indexes spanning the full module in case of small pixels (phase II InnerPixel) -PixelChannelIdentifier::thePacking( 11, 11, 0, 10); // It was row=8,col=9, time=4, adc=11 +##### 2021.08.16. Reserve one bit for the flag in pixel digi packing - see PRs #34509 and #34662 +- Change packing from (11, **11**, **0**, 10) -> (11, **10**, **1**, 10), reducing row x column to 2048x1024; and time -> flag -Reserved bits -row = 11 -> 2^11-1 = 2047 -col = 11 -> 2^11-1 = 2047 -time = 0 (not used) -adc = 10 -> 2^10-1 = 1023 +--- +#### PixelChannelIdentifier::thePacking( 11, 10, 1, 10); // row, column, flag, adc +// Before phase II changes, it was row=8,col=9, time=4, adc=11 +// Before introducing the flag, it was row=11, col=11, time=0, adc=10 + +#### Reserved bits: +- row = 11 -> 2^11-1 = 2047 +- col = 10 -> 2^10-1 = 1023 +- flag = 1 -> 0/1 +- adc = 10 -> 2^10-1 = 1023 From 5e63bd99f833910ba2078ab8dcea2b6a1d4e28d5 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Mon, 16 Aug 2021 19:10:33 +0800 Subject: [PATCH 028/923] remove unused headers for CommonTools packages --- .../CandAlgos/interface/CloneProducer.h | 59 ----- CommonTools/CandUtils/interface/CandMatcher.h | 239 ------------------ .../CandUtils/interface/FastCandMatcher.h | 103 -------- .../CandUtils/interface/NamedCandCombiner.h | 150 ----------- .../ParticleFlow/interface/ObjectSelector.h | 43 ---- .../ParticleFlow/interface/ObjectSelectors.h | 17 -- .../interface/BinomialProbability.h | 49 ---- .../UtilAlgos/interface/DummyMatchSelector.h | 26 -- .../UtilAlgos/interface/MassMinSelector.h | 21 -- .../UtilAlgos/interface/MassRangeSelector.h | 22 -- CommonTools/UtilAlgos/interface/MinSelector.h | 20 -- .../UtilAlgos/interface/ObjectPairFilter.h | 60 ----- .../interface/ObjectRefVectorSelector.h | 23 -- .../UtilAlgos/interface/OrPairSelector.h | 21 -- CommonTools/Utils/interface/Angle.h | 23 -- CommonTools/Utils/interface/InvariantMass.h | 12 - CommonTools/Utils/interface/LazyResult.h | 76 ------ CommonTools/Utils/interface/MassMinSelector.h | 22 -- .../Utils/interface/MassRangeSelector.h | 23 -- CommonTools/Utils/interface/MinSelector.h | 19 -- CommonTools/Utils/interface/OrPairSelector.h | 22 -- 21 files changed, 1050 deletions(-) delete mode 100644 CommonTools/CandAlgos/interface/CloneProducer.h delete mode 100755 CommonTools/CandUtils/interface/CandMatcher.h delete mode 100755 CommonTools/CandUtils/interface/FastCandMatcher.h delete mode 100755 CommonTools/CandUtils/interface/NamedCandCombiner.h delete mode 100644 CommonTools/ParticleFlow/interface/ObjectSelector.h delete mode 100644 CommonTools/ParticleFlow/interface/ObjectSelectors.h delete mode 100644 CommonTools/Statistics/interface/BinomialProbability.h delete mode 100644 CommonTools/UtilAlgos/interface/DummyMatchSelector.h delete mode 100755 CommonTools/UtilAlgos/interface/MassMinSelector.h delete mode 100755 CommonTools/UtilAlgos/interface/MassRangeSelector.h delete mode 100755 CommonTools/UtilAlgos/interface/MinSelector.h delete mode 100755 CommonTools/UtilAlgos/interface/ObjectPairFilter.h delete mode 100755 CommonTools/UtilAlgos/interface/ObjectRefVectorSelector.h delete mode 100755 CommonTools/UtilAlgos/interface/OrPairSelector.h delete mode 100644 CommonTools/Utils/interface/Angle.h delete mode 100755 CommonTools/Utils/interface/InvariantMass.h delete mode 100644 CommonTools/Utils/interface/LazyResult.h delete mode 100755 CommonTools/Utils/interface/MassMinSelector.h delete mode 100755 CommonTools/Utils/interface/MassRangeSelector.h delete mode 100755 CommonTools/Utils/interface/MinSelector.h delete mode 100755 CommonTools/Utils/interface/OrPairSelector.h diff --git a/CommonTools/CandAlgos/interface/CloneProducer.h b/CommonTools/CandAlgos/interface/CloneProducer.h deleted file mode 100644 index 4405c92d80ae4..0000000000000 --- a/CommonTools/CandAlgos/interface/CloneProducer.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CandAlgos_CloneProducer_h -#define CandAlgos_CloneProducer_h -/** \class CloneProducer - * - * Clones a concrete Candidate collection - * to a CandidateCollection (i.e.: OwnVector) filled - * with clones of the original candidate collection - * - * \author: Francesco Fabozzi, INFN - * modified by Luca Lista, INFN - * - * Template parameters: - * - C : Concrete candidate collection type - * - */ -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Candidate/interface/Candidate.h" - -template -class CloneProducer : public edm::EDProducer { -public: - /// constructor from parameter set - explicit CloneProducer( const edm::ParameterSet& ); - /// destructor - ~CloneProducer(); - -private: - /// process an event - virtual void produce( edm::Event&, const edm::EventSetup& ); - /// labels of the collection to be converted - edm::EDGetTokenT srcToken_; -}; - -template -CloneProducer::CloneProducer( const edm::ParameterSet& par ) : - srcToken_( consumes( par.template getParameter( "src" ) ) ) { - produces(); -} - -template -CloneProducer::~CloneProducer() { -} - -template -void CloneProducer::produce( edm::Event& evt, const edm::EventSetup& ) { - std::unique_ptr coll( new reco::CandidateCollection ); - edm::Handle masterCollection; - evt.getByToken( srcToken_, masterCollection ); - for( size_t i = 0; i < masterCollection->size(); ++i ) { - reco::CandidateBaseRef masterClone( edm::Ref( masterCollection, i ) ); - coll->push_back( masterClone->clone() ); - } - evt.put( std::move( coll ) ); -} - -#endif diff --git a/CommonTools/CandUtils/interface/CandMatcher.h b/CommonTools/CandUtils/interface/CandMatcher.h deleted file mode 100755 index 9a0c2c1fdcbf6..0000000000000 --- a/CommonTools/CandUtils/interface/CandMatcher.h +++ /dev/null @@ -1,239 +0,0 @@ -#ifndef CandUtils_CandMatcher_h -#define CandUtils_CandMatcher_h -/* class CandMatcher - * - * \author Luca Lista, INFN - * - */ -#include -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Common/interface/AssociationMap.h" -#include "DataFormats/Common/interface/OneToOne.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "CommonTools/CandUtils/interface/CandMapTrait.h" - -template -class CandMatcherBase { -public: - /// map type - typedef typename reco::helper::CandMapTrait::type map_type; - /// ref type - typedef typename reco::helper::CandRefTrait::ref_type ref_type; - /// refProd type - typedef typename reco::helper::CandRefTrait::refProd_type refProd_type; - /// map vector - typedef std::vector map_vector; - /// concrete candidate reference type - typedef typename map_type::key_type reference_type; - /// concrete candidate reference type - typedef typename reference_type::value_type value_type; - /// constructor - explicit CandMatcherBase( const map_vector & maps ); - /// constructor - explicit CandMatcherBase( const map_type & map ); - /// destructor - virtual ~CandMatcherBase(); - /// get match from transient reference - ref_type operator()( const reco::Candidate & ) const; - -protected: - /// get ultimate daughter (can skip status = 3 in MC) - virtual std::vector getDaughters( const reco::Candidate * ) const = 0; - /// composite candidate preselection - virtual bool compositePreselect( const reco::Candidate & c, const reco::Candidate & m ) const = 0; - /// init maps - void initMaps(); - -protected: - const std::vector & maps() const { return maps_; } -private: - /// pointers to stored maps - std::vector maps_; - /// reference to matched collectino - refProd_type matched_; - /// pointer map type - typedef std::map CandRefMap; - /// pointer map type - typedef std::map MatchedRefMap; - /// pointer map of candidates (e.g.: reco) - CandRefMap candRefs_; - /// pointer map of matched candidates (e.g.: MC truth) - MatchedRefMap matchedRefs_; - /// mother + n.daughters indices from matched - std::vector > matchedMothers_; - /// init at constructor - void init(); -}; - -template -class CandMatcher : public CandMatcherBase { -public: - /// constructor - explicit CandMatcher( const typename CandMatcherBase::map_vector & maps ); - /// constructor - explicit CandMatcher( const typename CandMatcherBase::map_type & map ); - /// destructor - virtual ~CandMatcher(); - -protected: - /// get ultimate daughter (get all in the general case) - virtual std::vector getDaughters( const reco::Candidate * ) const; - /// composite candidate preselection - virtual bool compositePreselect( const reco::Candidate & c, const reco::Candidate & m ) const; -}; - -#include -#include - -template -void CandMatcherBase::init() { - matched_ = maps_.front()->refProd().val; - for( typename map_vector::const_iterator m = maps_.begin() + 1; - m != maps_.end(); ++ m ) { - if( (*m)->refProd().val != matched_ ) - throw edm::Exception( edm::errors::InvalidReference ) - << "Multiple match maps specified matching different MC truth collections.\n" - << "Please, specify maps all matching to the same MC truth collection.\n" - << "In most of the cases you may want to match to genParticleCandidate."; - } -} - -template -CandMatcherBase::CandMatcherBase( const typename CandMatcherBase::map_vector & maps ): - maps_( maps ) { - init(); -} - -template -CandMatcherBase::CandMatcherBase( const typename CandMatcherBase::map_type & map ): - maps_( 1, & map ) { - init(); -} - -template -void CandMatcherBase::initMaps() { - using namespace reco; - using namespace std; - for( typename map_vector::const_iterator m = maps_.begin(); - m != maps_.end(); ++ m ) { - typename CandMatcherBase::map_type::ref_type::key_type cands = (*m)->refProd().key; - for( size_t i = 0; i < cands->size(); ++ i ) { - candRefs_[ & (*cands)[ i ] ] = reference_type( cands, i ); - } - const C2 & matched = * matched_; - size_t matchedSize = matched.size(); - for( size_t i = 0; i < matchedSize; ++ i ) - matchedRefs_[ & matched[ i ] ] = ref_type( matched_, i ); - matchedMothers_.resize( matchedSize ); - for( size_t i = 0; i < matchedSize; ++ i ) { - const Candidate & c = matched[ i ]; - for( Candidate::const_iterator d = c.begin(); d != c.end(); ++ d ) { - vector daus = getDaughters( & * d ); - for( size_t j = 0; j < daus.size(); ++ j ) { - const Candidate * daughter = daus[ j ]; - typename MatchedRefMap::const_iterator f = matchedRefs_.find( daughter ); - if ( f == matchedRefs_.end() ) continue; - size_t k = f->second.key(); - assert( k < matchedMothers_.size() ); - matchedMothers_[ k ].insert( i ); - } - } - } - } -} - -template -CandMatcherBase::~CandMatcherBase() { -} - -template -typename CandMatcherBase::ref_type CandMatcherBase::operator()( const reco::Candidate & c ) const { - using namespace reco; - using namespace std; - if ( c.hasMasterClone() ) - return (*this)( * c.masterClone() ); - unsigned int nDau = c.numberOfDaughters(); - const C2 & matched = * matched_; - if ( nDau > 0 ) { - // check for composite candidate c - // navigate to daughters and find parent matches - set momsIntersection, momDaughters, tmp; - for( Candidate::const_iterator d = c.begin(); d != c.end(); ++ d ) { - // check here generically if status == 3, then descend down to one more level - ref_type m = (*this)( * d ); - // if a daughter does not match, return a null ref. - if ( m.isNull() ) return ref_type(); - // get matched mother indices (fetched previously) - const set & allMomDaughters = matchedMothers_[ m.key() ]; - momDaughters.clear(); - for( set::const_iterator k = allMomDaughters.begin(); - k != allMomDaughters.end(); ++ k ) { - size_t m = * k; - if( compositePreselect( c, matched[ m ] ) ) - momDaughters.insert( m ); - } - // if no mother was found return null reference - if ( momDaughters.size() == 0 ) return ref_type(); - // the first time, momsIntersection is set to momDaughters - if ( momsIntersection.size() == 0 ) momsIntersection = momDaughters; - else { - tmp.clear(); - set_intersection( momsIntersection.begin(), momsIntersection.end(), - momDaughters.begin(), momDaughters.end(), - inserter( tmp, tmp.begin() ) ); - swap( momsIntersection, tmp ); - } - if ( momsIntersection.size() == 0 ) return ref_type(); - } - // if multiple mothers are found, return a null reference - if ( momsIntersection.size() > 1 ) return ref_type(); - // return a reference to the unique mother - return ref_type( matched_, * momsIntersection.begin() ); - } else { - // check for non-composite (leaf) candidate - // if one of the maps contains the candidate c - for( typename std::vector::const_iterator m = maps_.begin(); - m != maps_.end(); ++ m ) { - typename CandRefMap::const_iterator f = candRefs_.find( & c ); - if ( f != candRefs_.end() ) { - reference_type ref = f->second; - typename map_type::const_iterator f = (*m)->find( ref ); - if ( f != (*m)->end() ) { - return f->val; - } - } - } - return ref_type(); - } -} - -template -CandMatcher::CandMatcher( const typename CandMatcherBase::map_vector & maps ) : - CandMatcherBase( maps ) { - CandMatcherBase::initMaps(); -} - -template -CandMatcher::CandMatcher( const typename CandMatcherBase::map_type & map ) : - CandMatcherBase( map ) { - CandMatcherBase::initMaps(); -} - -template -CandMatcher::~CandMatcher() { -} - -template -std::vector CandMatcher::getDaughters( const reco::Candidate * c ) const { - std::vector v; - v.push_back( c ); - return v; -} - -template -bool CandMatcher::compositePreselect( const reco::Candidate & c, const reco::Candidate & m ) const { - // By default, check that the number of daughters is identical - return( c.numberOfDaughters() == m.numberOfDaughters() ); -} - -#endif diff --git a/CommonTools/CandUtils/interface/FastCandMatcher.h b/CommonTools/CandUtils/interface/FastCandMatcher.h deleted file mode 100755 index aad0f64bf0243..0000000000000 --- a/CommonTools/CandUtils/interface/FastCandMatcher.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef CandUtils_FastCandMatcher_h -#define CandUtils_FastCandMatcher_h -/* class CandMatcher - * - * \author Luca Lista, INFN - * - */ -#include -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Common/interface/AssociationMap.h" -#include "DataFormats/Common/interface/OneToOne.h" -#include "FWCore/Utilities/interface/EDMException.h" - -template -class FastCandMatcher { -public: - /// map type - typedef edm::AssociationMap > map_type; - /// map vector - typedef std::vector map_vector; - /// constructor - explicit FastCandMatcher( const map_vector & maps ); - /// constructor - explicit FastCandMatcher( const map_type & map ); - /// get match from transient reference - const reco::Candidate * operator()( const reco::Candidate & ) const; - -protected: - const std::vector & maps() const { return maps_; } -private: - /// pointers to stored maps - std::vector maps_; -}; - -template -FastCandMatcher::FastCandMatcher( const typename FastCandMatcher::map_vector & maps ): - maps_( maps ) { -} - -template -FastCandMatcher::FastCandMatcher( const typename FastCandMatcher::map_type & map ): - maps_( 1, & map ) { -} - -template -const reco::Candidate * FastCandMatcher::operator()( const reco::Candidate & c ) const { - using namespace reco; - using namespace std; - if ( c.hasMasterClone() ) - return (*this)( * c.masterClone() ); - unsigned int nDau = c.numberOfDaughters(); - if ( nDau > 0 ) { - // check for composite candidate c - // navigate to daughters and find parent matches - set momsIntersection, momDaughters, tmp; - for( Candidate::const_iterator dau = c.begin(); dau != c.end(); ++ dau ) { - // check here generically if status == 3, then descend down to one more level - const Candidate * dauMatch = (*this)( * dau ); - // if a daughter does not match, return a null ref. - if ( dauMatch == 0 ) return 0; - // get matched mothers - size_t mothers = dauMatch->numberOfMothers(); - for( size_t i = 0; i < mothers; ++ i ) { - const reco::Candidate * mom = dauMatch->mother( i ); - if ( mom != 0 && mom->pdgId() == dauMatch->pdgId() && - mom->status() == 3 && dauMatch->status() == 1 ) { - // assume a single mother at this point... - mom = mom->mother( 0 ); - } - momDaughters.insert( mom ); - } - // if no mother was found return null reference - if ( momDaughters.size() == 0 ) return 0; - // the first time, momsIntersection is set to momDaughters - if ( momsIntersection.size() == 0 ) momsIntersection = momDaughters; - else { - tmp.clear(); - set_intersection( momsIntersection.begin(), momsIntersection.end(), - momDaughters.begin(), momDaughters.end(), - inserter( tmp, tmp.begin() ) ); - swap( momsIntersection, tmp ); - } - if ( momsIntersection.size() == 0 ) return 0; - } - // if multiple mothers are found, return a null reference - if ( momsIntersection.size() > 1 ) return 0; - // return a reference to the unique mother - return * momsIntersection.begin(); - } else { - // check for non-composite (leaf) candidate - // if one of the maps contains the candidate c - for( typename std::vector::const_iterator m = maps_.begin(); - m != maps_.end(); ++ m ) { - for( typename map_type::const_iterator i = (*m)->begin(); i != (*m)->end(); ++ i ) { - if ( & * i->key == & c ) - return & * i->val; - } - } - return 0; - } -} - -#endif diff --git a/CommonTools/CandUtils/interface/NamedCandCombiner.h b/CommonTools/CandUtils/interface/NamedCandCombiner.h deleted file mode 100755 index 6f1633fc6c77f..0000000000000 --- a/CommonTools/CandUtils/interface/NamedCandCombiner.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef CandUtils_NamedCandCombiner_h -#define CandUtils_NamedCandCombiner_h -/** \class NamedCandCombiner - * - * \author Luca Lista, INFN - * - */ -#include "CommonTools/CandUtils/interface/NamedCandCombinerBase.h" -#include "CommonTools/CandUtils/interface/AddFourMomenta.h" -#include "CommonTools/CandUtils/interface/CandSelector.h" -#include "CommonTools/UtilAlgos/interface/AnyPairSelector.h" -#include "DataFormats/Candidate/interface/NamedCompositeCandidate.h" -#include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h" -#include - -namespace combiner { - namespace helpers { - struct NormalClone { - template - static void addDaughter(CMP & cmp, const Ptr & c, std::string name) { - cmp.addDaughter(*c, name); - } - }; - - struct ShallowClone { - template - static void addDaughter(CMP & cmp, const reco::CandidatePtr & c, std::string name) { - if(c->numberOfDaughters()==0) - cmp.addDaughter(reco::ShallowClonePtrCandidate(c), name); - else - cmp.addDaughter(*c, name); - } - }; - } -} - -template -class NamedCandCombiner : public NamedCandCombinerBase { -public: - /// default constructor - NamedCandCombiner(std::string name) : - NamedCandCombinerBase(name), - select_(), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and two charges - NamedCandCombiner(std::string name, int q1, int q2) : - NamedCandCombinerBase(name, q1, q2), - select_(), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and three charges - NamedCandCombiner(std::string name, int q1, int q2, int q3 ) : - NamedCandCombinerBase(name, q1, q2, q3), - select_(), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and four charges - NamedCandCombiner(std::string name, int q1, int q2, int q3, int q4) : - NamedCandCombinerBase(name, q1, q2, q3, q4), - select_(), selectPair_(), setup_(), name_(name) { } - /// default constructor - NamedCandCombiner(std::string name, const Selector & select) : - NamedCandCombinerBase(name), - select_(select), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and two charges - NamedCandCombiner(std::string name, const Selector & select, int q1, int q2 ) : - NamedCandCombinerBase(name, q1, q2), - select_(select), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and three charges - NamedCandCombiner(std::string name, const Selector & select, int q1, int q2, int q3 ) : - NamedCandCombinerBase(name, q1, q2, q3), - select_(select), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector and four charges - NamedCandCombiner(std::string name, const Selector & select, int q1, int q2, int q3, int q4 ) : - NamedCandCombinerBase(name, q1, q2, q3, q4), - select_(select), selectPair_(), setup_(), name_(name) { } - /// constructor from selector - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair) : - NamedCandCombinerBase(name), - select_(select), selectPair_(selectPair), setup_(), name_(name) { } - /// constructor from a selector and two charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, int q1, int q2) : - NamedCandCombinerBase(name, q1, q2), - select_(select), selectPair_(selectPair), setup_(), name_(name) { } - /// constructor from a selector and three charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3) : - NamedCandCombinerBase(name, q1, q2, q3), - select_(select), selectPair_(selectPair), setup_(), name_(name) { } - /// constructor from a selector and four charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3, int q4) : - NamedCandCombinerBase(name, q1, q2, q3, q4), - select_(select), selectPair_(selectPair), setup_(), name_(name) { } - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup) : - NamedCandCombinerBase(name), - select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// constructor from a selector and two charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2) : - NamedCandCombinerBase(name, q1, q2), - select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// constructor from a selector and three charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3) : - NamedCandCombinerBase(name, q1, q2, q3), - select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// constructor from a selector and four charges - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3, int q4) : - NamedCandCombinerBase(name, q1, q2, q3, q4), - select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// constructor from a selector, specifying to check for charge - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup,const std::vector & dauCharge) : - NamedCandCombinerBase(name, true, dauCharge), select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// constructor from a selector, specifying to check for charge - NamedCandCombiner( std::string name, const Selector & select, const PairSelector & selectPair, const std::vector & dauCharge ) : - NamedCandCombinerBase(name, true, dauCharge), select_(select), selectPair_(selectPair), setup_(), name_(name) { } - /// constructor from a selector, specifying to check for charge - NamedCandCombiner(std::string name, const std::vector & dauCharge) : - NamedCandCombinerBase(name, true, dauCharge), select_(), selectPair_(), setup_(), name_(name) { } - /// constructor from a selector, specifying optionally to check for charge - NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, - bool checkCharge, bool checkOverlap, const std::vector & dauCharge) : - NamedCandCombinerBase(name, checkCharge, checkOverlap, dauCharge), - select_(select), selectPair_(selectPair), setup_(setup), name_(name) { } - /// return reference to setup object to allow its initialization - Setup & setup() { return setup_; } - -private: - /// select a candidate - virtual bool select(const reco::Candidate & c) const { - return select_(c); - } - /// select a candidate - virtual bool selectPair(const reco::Candidate & c1, const reco::Candidate & c2) const { - return selectPair_(c1, c2); - } - /// set kinematics to reconstructed composite - virtual void setup(reco::NamedCompositeCandidate & c) const { - setup_.set(c); - } - /// add candidate daughter - virtual void addDaughter(reco::NamedCompositeCandidate & cmp, const reco::CandidatePtr & c, std::string n) const { - Cloner::addDaughter(cmp, c, n); - } - /// candidate selector - Selector select_; - /// candidate pair selector - PairSelector selectPair_; - /// utility to setup composite candidate kinematics from daughters - Setup setup_; - /// name - std::string name_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/interface/ObjectSelector.h b/CommonTools/ParticleFlow/interface/ObjectSelector.h deleted file mode 100644 index 49d7280d68d7e..0000000000000 --- a/CommonTools/ParticleFlow/interface/ObjectSelector.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef CommonTools_ParticleFlow_ObjectSelector -#define CommonTools_ParticleFlow_ObjectSelector - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - - -namespace edm { - class EventSetup; -} - -namespace ipf2pat { - - template< typename Selector, typename CollectionType > - class ObjectSelector { - public: - ObjectSelector(const edm::ParameterSet& ps) : - eventSetupPtr_(0), - selector_(ps) {} - - - const CollectionType& select( const edm::Handle& handleToCollection, - const edm::EventBase& event ) { - /* static edm::Event e; */ - selector_.select( handleToCollection, event, *eventSetupPtr_ ); - return selector_.selected(); - } - - - private: - const edm::EventSetup* eventSetupPtr_; - - Selector selector_; - }; - - -} - - - -#endif diff --git a/CommonTools/ParticleFlow/interface/ObjectSelectors.h b/CommonTools/ParticleFlow/interface/ObjectSelectors.h deleted file mode 100644 index a4a6a207899c3..0000000000000 --- a/CommonTools/ParticleFlow/interface/ObjectSelectors.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CommonTools_ParticleFlow_ObjectSelectors -#define CommonTools_ParticleFlow_ObjectSelectors - -#include "CommonTools/ParticleFlow/interface/ObjectSelector.h" -#include "CommonTools/ParticleFlow/interface/PtMinPFCandidateSelectorDefinition.h" -#include "CommonTools/ParticleFlow/interface/PdgIdPFCandidateSelectorDefinition.h" -#include "CommonTools/ParticleFlow/interface/IsolatedPFCandidateSelectorDefinition.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" - - -namespace ipf2pat { - typedef ObjectSelector< pf2pat::PtMinPFCandidateSelectorDefinition, reco::PFCandidateCollection > PtMinPFCandidateSelector; - typedef ObjectSelector< pf2pat::PdgIdPFCandidateSelectorDefinition, reco::PFCandidateCollection > PdgIdPFCandidateSelector; - typedef ObjectSelector< pf2pat::IsolatedPFCandidateSelectorDefinition, reco::PFCandidateCollection > IsolatedPFCandidateSelector; -} - -#endif diff --git a/CommonTools/Statistics/interface/BinomialProbability.h b/CommonTools/Statistics/interface/BinomialProbability.h deleted file mode 100644 index 70cc211076dd8..0000000000000 --- a/CommonTools/Statistics/interface/BinomialProbability.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef BinomialProbability_H -#define BinomialProbability_H - -#include - -/** A simple class for accumulating binomial "events", - * i.e. events that have a yes/no outcome, - * and for computing the binomial error on the - * fraction of positive hits. - */ - -class BinomialProbability { -public: - - BinomialProbability() : theHits(0), theTotal(0) {} - - BinomialProbability(int hits, int entries) : - theHits(hits), theTotal(entries) {} - - float value() const { - return theTotal == 0 ? 0 :float(theHits) / float(theTotal); - } - - float error() const { - float p = value(); - return theTotal <= 1 ? 0 : sqrt( p*(1.f - p)/(theTotal-1)); - } - - int entries() const { return theTotal;} - - int hits() const { return theHits;} - - void hit() { theHits++; theTotal++;} - - void miss() { theTotal++;} - - void update( bool hit) { - if ( hit) theHits++; - theTotal++; - } - -private: - - int theHits; - int theTotal; - -}; - -#endif diff --git a/CommonTools/UtilAlgos/interface/DummyMatchSelector.h b/CommonTools/UtilAlgos/interface/DummyMatchSelector.h deleted file mode 100644 index 8d0d99aab14d8..0000000000000 --- a/CommonTools/UtilAlgos/interface/DummyMatchSelector.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef DummyMatchSelector_h -#define DummyMatchSelector_h - -/** - Dummy class for preselection of object matches. -*/ - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -namespace reco { - - template - class DummyMatchSelector { - - public: - - DummyMatchSelector(const edm::ParameterSet& cfg) { } - - bool operator()( const T1 & c, const T2 & hlt ) const { return true; } - - }; - -} - - -#endif diff --git a/CommonTools/UtilAlgos/interface/MassMinSelector.h b/CommonTools/UtilAlgos/interface/MassMinSelector.h deleted file mode 100755 index 73f37fc036aa6..0000000000000 --- a/CommonTools/UtilAlgos/interface/MassMinSelector.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef UtilAlgos_MassMinSelector_h -#define UtilAlgos_MassMinSelector_h -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "CommonTools/Utils/interface/MassMinSelector.h" - -namespace reco { - namespace modules { - - template<> - struct ParameterAdapter { - static MassMinSelector make( const edm::ParameterSet & cfg ) { - return - MassMinSelector( cfg.getParameter( "massMin" ) ); - } - }; - - } -} - -#endif - diff --git a/CommonTools/UtilAlgos/interface/MassRangeSelector.h b/CommonTools/UtilAlgos/interface/MassRangeSelector.h deleted file mode 100755 index 62019baf4e5b3..0000000000000 --- a/CommonTools/UtilAlgos/interface/MassRangeSelector.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef UtilAlgos_MassRangeSelector_h -#define UtilAlgos_MassRangeSelector_h -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "CommonTools/Utils/interface/MassRangeSelector.h" - -namespace reco { - namespace modules { - - template<> - struct ParameterAdapter { - static MassRangeSelector make( const edm::ParameterSet & cfg ) { - return - MassRangeSelector( cfg.getParameter( "massMin" ), - cfg.getParameter( "massMax" ) ); - } - }; - - } -} - -#endif - diff --git a/CommonTools/UtilAlgos/interface/MinSelector.h b/CommonTools/UtilAlgos/interface/MinSelector.h deleted file mode 100755 index efa3d22ccca5d..0000000000000 --- a/CommonTools/UtilAlgos/interface/MinSelector.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef UtilAlgos_MinSelector_h -#define UtilAlgos_MinSelector_h -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "CommonTools/Utils/interface/MinSelector.h" - -namespace reco { - namespace modules { - - template - struct ParameterAdapter > { - static MinSelector make( const edm::ParameterSet & cfg ) { - return MinSelector( cfg.template getParameter( "min" ) ); - } - }; - - } -} - -#endif - diff --git a/CommonTools/UtilAlgos/interface/ObjectPairFilter.h b/CommonTools/UtilAlgos/interface/ObjectPairFilter.h deleted file mode 100755 index 18a66ca61d081..0000000000000 --- a/CommonTools/UtilAlgos/interface/ObjectPairFilter.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef RecoAlgos_ObjectPairFilter_h -#define RecoAlgos_ObjectPairFilter_h -/** \class ObjectPairFilter - * - * Filters an event if one or more pairs of objects passes a given selection - * - * \author Luca Lista, INFN - * - * \version $Revision: 1.3 $ - * - * $Id: ObjectPairFilter.h,v 1.3 2010/02/20 20:55:26 wmtan Exp $ - * - */ - -#include "FWCore/Framework/interface/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include -#include - -template -class ObjectPairFilter : public edm::EDFilter { -public: - /// constructor - explicit ObjectPairFilter( const edm::ParameterSet & cfg ) : - select_( reco::modules::make( cfg ) ), - srcToken_( consumes( cfg.template getParameter( "src" ) ) ), - minNumber_( 1 ) { - std::vector ints = cfg.template getParameterNamesForType(); - const std::string minNumber( "minNumber" ); - bool foundMinNumber = std::find( ints.begin(), ints.end(), minNumber ) != ints.end(); - if ( foundMinNumber ) - minNumber_ = cfg.template getParameter( minNumber ); - } - -private: - /// process one event - bool filter( edm::Event& evt, const edm::EventSetup&) override { - edm::Handle source; - evt.getByToken( srcToken_, source ); - size_t n = 0; - for( typename C::const_iterator i = source->begin(); i != source->end(); ++ i ) - for( typename C::const_iterator j = i + 1; j != source->end(); ++ j ) { - if ( select_( * i, * j ) ) n ++; - if ( n >= minNumber_ ) return true; - } - return false; - } - /// object filter - S select_; - /// source collection label - edm::EDGetTokenT srcToken_; - /// minimum number of entries in a collection - unsigned int minNumber_; -}; - -#endif - diff --git a/CommonTools/UtilAlgos/interface/ObjectRefVectorSelector.h b/CommonTools/UtilAlgos/interface/ObjectRefVectorSelector.h deleted file mode 100755 index 0537972897fcc..0000000000000 --- a/CommonTools/UtilAlgos/interface/ObjectRefVectorSelector.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CandAlgos_ObjectRefVectorSelector_h -#define CandAlgos_ObjectRefVectorSelector_h -/* \class RefVectorRefVectorStoreMananger - * - * \author Luca Lista, INFN - * - */ -#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" -#include "DataFormats/Common/interface/RefVector.h" - -template, - typename SizeSelector = NonNullNumberSelector, - typename PostProcessor = helper::NullPostProcessor > -class ObjectRefVectorSelector : - public ObjectSelector { -public: - explicit ObjectRefVectorSelector( const edm::ParameterSet & cfg ) : - ObjectSelector( cfg ) { } -}; - -#endif - diff --git a/CommonTools/UtilAlgos/interface/OrPairSelector.h b/CommonTools/UtilAlgos/interface/OrPairSelector.h deleted file mode 100755 index afea4fecf1847..0000000000000 --- a/CommonTools/UtilAlgos/interface/OrPairSelector.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef UtilAlgos_OrPairSelector_h -#define UtilAlgos_OrPairSelector_h -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "CommonTools/Utils/interface/OrPairSelector.h" - -namespace reco { - namespace modules { - - template - struct ParameterAdapter > { - static OrPairSelector make(const edm::ParameterSet & cfg) { - return OrPairSelector(modules::make(cfg.getParameter("cut1")), - modules::make(cfg.getParameter("cut2"))); - } - }; - - } -} - -#endif - diff --git a/CommonTools/Utils/interface/Angle.h b/CommonTools/Utils/interface/Angle.h deleted file mode 100644 index baf9889550e9a..0000000000000 --- a/CommonTools/Utils/interface/Angle.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CommonTools_Utils_Angle_h -#define CommonTools_Utils_Angle_h - -/* \class Angle - * - * returns three-dimensional Angle between two objects; - * defined via scalar product: - * angle = acos((v1 * v2)/(|v1| * |v2|)) - * - * \author Christian Veelken, UC Davis - */ - -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/Math/interface/angle.h" - -template -struct Angle { - double operator()( const T1 & t1, const T2 & t2 ) const { - return angle( t1, t2 ); - } -}; - -#endif diff --git a/CommonTools/Utils/interface/InvariantMass.h b/CommonTools/Utils/interface/InvariantMass.h deleted file mode 100755 index 52b1c3500c095..0000000000000 --- a/CommonTools/Utils/interface/InvariantMass.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CommonTools_Utils_InvariantMass_h -#define CommonTools_Utils_InvariantMass_h -#include "DataFormats/Math/interface/LorentzVector.h" - -template -struct InvariantMass { - double operator()( const T1 & t1, const T2 & t2 ) const { - return ( t1.momentum() + t2.momentum() ).mass(); - } -}; - -#endif diff --git a/CommonTools/Utils/interface/LazyResult.h b/CommonTools/Utils/interface/LazyResult.h deleted file mode 100644 index e15dc6afd1cf2..0000000000000 --- a/CommonTools/Utils/interface/LazyResult.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef CommonTools_Utils_LazyResult_h -#define CommonTools_Utils_LazyResult_h -// -*- C++ -*- -// -// Package: CommonTools/Utils -// Class : LazyResult -// -/**\class LazyResult LazyResult.h "CommonTools/Utils/interface/LazyResult.h" - Description: Wrapper around a function call for lazy execution. - - Usage: - // example: lazy addition - auto result = LazyResult(std::plus, x, x); - std::cout << result.value() << std::endl; - -Notes: - * The arguments for the delayed call are stored by reference (watch their - lifetime). - * The overhead in memory compared to just storing the result is small: one - reference per argument, one bool flag and a function pointer (on my system: - 1 byte for lambda function, 8 bytes for global function and 16 bytes for - member function due to possible index to virtual table). - -Implementation: - - * For the Args... we explicitly add const& (also in the the args_ tuple). - Otherwise, the arguments will be stored by value which comes with too much - overhead. This implies that the lifetime of the arguments passed to - LazyResult neet to live longer than the LazyResult instance. Function pointers - are small, so no need for const& to the Func. - * An alternative to using a ::value() member function to get the result could - be a cast operator: operator Result const &(). This might be pretty because - the result is automatically evaluated the first time you try to bind it to - a Result const &. I think this would however be too implicit and dangerous. - -*/ -// -// Original Author: Jonas Rembser -// Created: Mon, 14 Jun 2020 00:00:00 GMT -// - -#include -#include - -template -class LazyResult { -public: - using Result = typename std::invoke_result::type; - - LazyResult(Func func, Args const&... args) : func_(func), args_(args...) {} - - Result const& value() { - if (!evaluated_) { - evaluate(); - } - return result_; - } - -private: - void evaluate() { evaluateImpl(std::make_index_sequence{}); } - - template - void evaluateImpl(std::index_sequence) { - result_ = func_(std::get(args_)...); - evaluated_ = true; - } - - // having evaluated_ and the potentially small func_ together might - // save alignemnt bits (e.g. a lambda function is just 1 byte) - bool evaluated_ = false; - Func func_; - std::tuple args_; - Result result_; -}; - -#endif diff --git a/CommonTools/Utils/interface/MassMinSelector.h b/CommonTools/Utils/interface/MassMinSelector.h deleted file mode 100755 index 8a8bdc2099199..0000000000000 --- a/CommonTools/Utils/interface/MassMinSelector.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef RecoAlgos_MassMinSelector_h -#define RecoAlgos_MassMinSelector_h -/* \class MassMinSelector - * - * \author Luca Lista, INFN - * - * $Id: MassMinSelector.h,v 1.1 2007/07/12 08:30:40 llista Exp $ - */ - -struct MassMinSelector { - MassMinSelector( double massMin ) : - massMin_( massMin ) { } - template - bool operator()( const T & t ) const { - return t.mass() >= massMin_; - } - -private: - double massMin_; -}; - -#endif diff --git a/CommonTools/Utils/interface/MassRangeSelector.h b/CommonTools/Utils/interface/MassRangeSelector.h deleted file mode 100755 index c4b68f3342690..0000000000000 --- a/CommonTools/Utils/interface/MassRangeSelector.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef RecoAlgos_MassRangeSelector_h -#define RecoAlgos_MassRangeSelector_h -/* \class MassRangeSelector - * - * \author Luca Lista, INFN - * - * $Id: MassRangeSelector.h,v 1.3 2007/06/18 18:33:53 llista Exp $ - */ - -struct MassRangeSelector { - MassRangeSelector( double massMin, double massMax ) : - massMin_( massMin ), massMax_( massMax ) { } - template - bool operator()( const T & t ) const { - double mass = t.mass(); - return ( mass >= massMin_ && mass <= massMax_ ); - } - -private: - double massMin_, massMax_; -}; - -#endif diff --git a/CommonTools/Utils/interface/MinSelector.h b/CommonTools/Utils/interface/MinSelector.h deleted file mode 100755 index 14e2fa5b23c3d..0000000000000 --- a/CommonTools/Utils/interface/MinSelector.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RecoAlgos_MinSelector_h -#define RecoAlgos_MinSelector_h -/* \class MinSelector - * - * \author Luca Lista, INFN - * - * $Id: MinSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ - */ - -template -struct MinSelector { - MinSelector( T min ) : min_( min ) { } - bool operator()( T t ) const { return t >= min_; } - -private: - T min_; -}; - -#endif diff --git a/CommonTools/Utils/interface/OrPairSelector.h b/CommonTools/Utils/interface/OrPairSelector.h deleted file mode 100755 index 2619ee3378a2c..0000000000000 --- a/CommonTools/Utils/interface/OrPairSelector.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CommonTools_Utils_OrPairSelector_h -#define CommonTools_Utils_OrPairSelector_h -/* \class OrPairSelector - * - * \author Luca Lista, INFN - * - * $Id: OrPairSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ - */ - -template -struct OrPairSelector { - OrPairSelector(const S1 & s1, const S2 & s2) : s1_(s1), s2_(s2) { } - template - bool operator()(const T1 & t1, const T2 & t2) const { - return s1_(t1) || s2_(t2); - } -private: - S1 s1_; - S2 s2_; -}; - -#endif From c9dd8e6201254cf78e39a30aeba3d15c6e61112a Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Mon, 16 Aug 2021 07:12:24 -0700 Subject: [PATCH 029/923] Enable mkFit by default only for InitialStepPreSplitting, InitialStep, HighPtTripletStep and DetachedQuadStep --- .../ProcessModifiers/python/trackingMkFit_cff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Configuration/ProcessModifiers/python/trackingMkFit_cff.py b/Configuration/ProcessModifiers/python/trackingMkFit_cff.py index d8bfde4165a77..14bc499d1d301 100644 --- a/Configuration/ProcessModifiers/python/trackingMkFit_cff.py +++ b/Configuration/ProcessModifiers/python/trackingMkFit_cff.py @@ -18,13 +18,13 @@ trackingMkFitCommon, trackingMkFitInitialStepPreSplitting, trackingMkFitInitialStep, - trackingMkFitLowPtQuadStep, +# trackingMkFitLowPtQuadStep, # to be enabled later trackingMkFitHighPtTripletStep, - trackingMkFitLowPtTripletStep, +# trackingMkFitLowPtTripletStep, # to be enabled later trackingMkFitDetachedQuadStep, # trackingMkFitDetachedTripletStep, # to be enabled later # trackingMkFitPixelPairStep, # to be enabled later # trackingMkFitMixedTripletStep, # to be enabled later - trackingMkFitPixelLessStep, - trackingMkFitTobTecStep, +# trackingMkFitPixelLessStep, # to be enabled later +# trackingMkFitTobTecStep, # to be enabled later ) From 8d21af8261ee5d975e57e5793c4f2b2936f9e46e Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Mon, 16 Aug 2021 07:16:01 -0700 Subject: [PATCH 030/923] Enable usage of SiStrip quality DB information by default for mkFit --- RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc index abd5ca4ccc626..7da3ecd890877 100644 --- a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc +++ b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc @@ -66,7 +66,7 @@ void MkFitEventOfHitsProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add("pixelHits", edm::InputTag{"mkFitSiPixelHits"}); desc.add("stripHits", edm::InputTag{"mkFitSiStripHits"}); - desc.add("useStripStripQualityDB", false)->setComment("Use SiStrip quality DB information"); + desc.add("useStripStripQualityDB", true)->setComment("Use SiStrip quality DB information"); descriptions.addWithDefaultLabel(desc); } From fbbdad2758446cbeeaf0386a63b06196670e91de Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Mon, 16 Aug 2021 07:25:35 -0700 Subject: [PATCH 031/923] Restrict SiStrip DB information to invalid APVs if only a part of the module is inactive --- .../MkFit/plugins/MkFitEventOfHitsProducer.cc | 59 +++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc index 7da3ecd890877..109c76f5e4e71 100644 --- a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc +++ b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc @@ -4,19 +4,21 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" +#include "CalibTracker/Records/interface/SiStripQualityRcd.h" + +#include "DataFormats/TrackerCommon/interface/TrackerDetSide.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" +#include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + #include "RecoTracker/MkFit/interface/MkFitClusterIndexToHit.h" #include "RecoTracker/MkFit/interface/MkFitEventOfHits.h" #include "RecoTracker/MkFit/interface/MkFitGeometry.h" #include "RecoTracker/MkFit/interface/MkFitHitWrapper.h" #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" -#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" -#include "CalibTracker/Records/interface/SiStripQualityRcd.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "DataFormats/TrackerCommon/interface/TrackerDetSide.h" - // mkFit includes #include "mkFit/HitStructures.h" #include "mkFit/MkStdSeqs.h" @@ -85,14 +87,51 @@ void MkFitEventOfHitsProducer::produce(edm::StreamID iID, edm::Event& iEvent, co const auto& trackerGeom = iSetup.getData(geomToken_); const auto& badStrips = siStripQuality.getBadComponentList(); for (const auto& bs : badStrips) { - const auto& surf = trackerGeom.idToDet(DetId(bs.detid))->surface(); const DetId detid(bs.detid); + const auto& surf = trackerGeom.idToDet(detid)->surface(); bool isBarrel = (mkFitGeom.topology()->side(detid) == static_cast(TrackerDetSide::Barrel)); const auto ilay = mkFitGeom.mkFitLayerNumber(detid); - deadvectors[ilay].push_back({surf.phiSpan().first, - surf.phiSpan().second, - (isBarrel ? surf.zSpan().first : surf.rSpan().first), - (isBarrel ? surf.zSpan().second : surf.rSpan().second)}); + const auto q1 = isBarrel ? surf.zSpan().first : surf.rSpan().first; + const auto q2 = isBarrel ? surf.zSpan().second : surf.rSpan().second; + if (bs.BadModule) + deadvectors[ilay].push_back({surf.phiSpan().first, surf.phiSpan().second, q1, q2}); + else { //assume that BadApvs are filled in sync with BadFibers + auto const& topo = dynamic_cast(trackerGeom.idToDet(detid)->topology()); + int firstApv = -1; + int lastApv = -1; + + auto addRangeAPV = [&topo, &surf, &q1, &q2](int first, int last, mkfit::DeadVec& dv) { + auto const firstPoint = surf.toGlobal(topo.localPosition(first * 128)); + auto const lastPoint = surf.toGlobal(topo.localPosition((last + 1) * 128)); + float phi1 = firstPoint.phi(); + float phi2 = lastPoint.phi(); + if (reco::deltaPhi(phi1, phi2) > 0) + std::swap(phi1, phi2); + LogTrace("SiStripBadComponents")<<"insert bad range "< Date: Mon, 16 Aug 2021 17:04:19 +0200 Subject: [PATCH 032/923] bug fix (raise the size of particle type container in gemDigiSimLink) --- SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h | 4 ++-- SimDataFormats/GEMDigiSimLink/src/classes_def.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h index b5ac7e8caa79c..22852206a116a 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h @@ -8,7 +8,7 @@ class GEMDigiSimLink { public: - GEMDigiSimLink(uint16_t strip, int8_t bx, int8_t particleType, uint32_t trackId, EncodedEventId eventId) { + GEMDigiSimLink(uint16_t strip, int8_t bx, int16_t particleType, uint32_t trackId, EncodedEventId eventId) { strip_ = strip; bx_ = bx; particleType_ = particleType; @@ -30,7 +30,7 @@ class GEMDigiSimLink { private: uint16_t strip_; int8_t bx_; - int8_t particleType_; + int16_t particleType_; uint32_t trackId_; EncodedEventId eventId_; }; diff --git a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml index d26f10ce0b1ff..d792d5861f028 100644 --- a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ - + From 02a6a8ee766204ce08aaaa9caad9d0496095fbab Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 16 Aug 2021 18:16:20 +0200 Subject: [PATCH 033/923] [L1Trigger] Move public headers in to interface directory --- .../{src => interface}/L1MuDTAddressArray.h | 0 .../DTTrackFinder/{src => interface}/L1MuDTSecProcId.h | 0 L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h | 10 +++++----- .../{src => interface}/L1MuDTTrackAssParam.h | 0 .../{src => interface}/L1MuDTTrackSegEta.h | 2 +- .../{src => interface}/L1MuDTTrackSegLoc.h | 0 .../{src => interface}/L1MuDTTrackSegPhi.h | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc | 6 +++--- L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTERS.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc | 6 +++--- L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTTrackFinder.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.cc | 4 ++-- L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.cc | 2 +- .../GlobalCaloTrigger/interface/L1GctHfBitCountsLut.h | 2 +- .../GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h | 2 +- L1Trigger/GlobalCaloTrigger/interface/L1GctHtMissLut.h | 2 +- .../{src => interface}/L1GctJetCount.h | 4 ++-- .../interface/L1GctJetEtCalibrationLut.h | 2 +- .../GlobalCaloTrigger/interface/L1GctJetFinderBase.h | 4 ++-- .../GlobalCaloTrigger/interface/L1GctJetLeafCard.h | 4 ++-- .../GlobalCaloTrigger/{src => interface}/L1GctLut.h | 0 .../{src => interface}/L1GctTwosComplement.h | 0 .../{src => interface}/L1GctUnsignedInt.h | 0 .../GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h | 4 ++-- .../GlobalCaloTrigger/interface/L1GctWheelJetFpga.h | 2 +- .../GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h | 2 +- L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.cc | 2 +- L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc | 2 +- L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.cc | 2 +- L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.cc | 2 +- L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h | 2 +- L1Trigger/GlobalCaloTrigger/test/testEtTypes.cpp | 6 +++--- 51 files changed, 66 insertions(+), 66 deletions(-) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTAddressArray.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTSecProcId.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackAssParam.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegEta.h (97%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegLoc.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegPhi.h (98%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctJetCount.h (96%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctLut.h (100%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctTwosComplement.h (100%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctUnsignedInt.h (100%) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h b/L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h similarity index 100% rename from L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h b/L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h similarity index 100% rename from L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h diff --git a/L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h b/L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h index 08a9c7e22087e..dd5bdfbb20dde 100644 --- a/L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h +++ b/L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h @@ -34,11 +34,11 @@ #include #include -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" // --------------------- // -- Class Interface -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h similarity index 100% rename from L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h similarity index 97% rename from L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h index 275cec66c3562..26ca476f93725 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h +++ b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h @@ -27,7 +27,7 @@ // Collaborating Class Declarations -- //------------------------------------ -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" // --------------------- // -- Class Interface -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h similarity index 100% rename from L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h similarity index 98% rename from L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h rename to L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h index eb4fa6edefe5f..7555d14ff683b 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h +++ b/L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h @@ -27,7 +27,7 @@ // Collaborating Class Declarations -- //------------------------------------ -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" // --------------------- // -- Class Interface -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.cc b/L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.cc index 7a9f2a8198562..3066fec5f3d8d 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.cc @@ -15,7 +15,7 @@ // This Class's Header -- //----------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" //--------------- // C++ Headers -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc index a5ed909a8237a..be36c1df67171 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc @@ -33,10 +33,10 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h" #include "CondFormats/L1TObjects/interface/L1MuDTPhiLut.h" #include "CondFormats/DataRecord/interface/L1MuDTPhiLutRcd.h" #include "CondFormats/L1TObjects/interface/L1MuDTPtaLut.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h index bbe7f35253916..62fd059f5c84a 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h @@ -37,7 +37,7 @@ #include #include "CondFormats/L1TObjects/interface/L1MuDTAssParam.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTPhiLut; class L1MuDTPtaLut; class L1MuDTTrackSegPhi; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.cc b/L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.cc index d827810fe3abc..418c6b4713334 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.cc @@ -31,8 +31,8 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" using namespace std; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTERS.cc b/L1Trigger/DTTrackFinder/src/L1MuDTERS.cc index 78fb6aa6b3378..b6e178479f2e9 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTERS.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTERS.cc @@ -29,7 +29,7 @@ //------------------------------- #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc index ddd7a9b301d3a..0d16a83cf4632 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc @@ -32,7 +32,7 @@ #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "CondFormats/L1TObjects/interface/L1MuDTExtLut.h" #include "CondFormats/DataRecord/interface/L1MuDTExtLutRcd.h" #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc index 3c2c89afc4b9d..991b5cc5338a4 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc @@ -35,8 +35,8 @@ //------------------------------- #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h index abf34a610e8a3..282364a7543dd 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h @@ -39,7 +39,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/EDGetToken.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTChambThContainer; class L1MuDTTrackSegEta; class L1MuDTTrackFinder; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc index b928eed9a6f13..472e6e74e12b1 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc @@ -36,9 +36,9 @@ #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTERS.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h" #include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.cc b/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.cc index deb6a3a096864..3f7e3e7b4a333 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.cc @@ -31,7 +31,7 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc index 5f1dc55b027a8..897a2c65aebf3 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc @@ -31,8 +31,8 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTEUX.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTERS.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.cc index 3436ff396f22d..586e3bd0684d1 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.cc @@ -15,7 +15,7 @@ // This Class's Header -- //----------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" //--------------- // C++ Headers -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.cc index c5d3ac2e89494..874195788ef57 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.cc @@ -27,7 +27,7 @@ // Collaborating Class Headers -- //------------------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" using namespace std; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h index cfc1e0755e6d6..de323e7ba923e 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h @@ -28,7 +28,7 @@ // Collaborating Class Declarations -- //------------------------------------ -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" class L1MuDTSectorProcessor; // --------------------- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc index bd33a39cd487a..5a82f72c8c648 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc @@ -31,7 +31,7 @@ #include #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h index 0c3d29e70bfc4..560790bda1c6c 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h @@ -30,7 +30,7 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" //------------------------------------ // Collaborating Class Declarations -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc index b1f3beda6f0ab..7b977e3747603 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc @@ -32,8 +32,8 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc index 014453b7ad9e6..eadfb1994b625 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc @@ -29,9 +29,9 @@ // Collaborating Class Headers -- //------------------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h" #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h" #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h" #include "CondFormats/L1TObjects/interface/L1MuPacking.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.cc index 10a0e3345a62b..6956d58d0aed1 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.cc @@ -9,7 +9,7 @@ // //-------------------------------------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h" #include using namespace std; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h index 969d4180a62a2..4c1972bdbd947 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h @@ -38,8 +38,8 @@ // Collaborating Class Declarations -- //------------------------------------ -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssParam.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTAddressArray.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackAssParam.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTSectorProcessor; // --------------------- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackFinder.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrackFinder.cc index e798eebe3abfd..ea7b4c0f82805 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackFinder.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackFinder.cc @@ -33,7 +33,7 @@ #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackCand.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcMap.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h" diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.cc index db4d3ed8c8227..48ca2e8940e33 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.cc @@ -15,7 +15,7 @@ // This Class's Header -- //----------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegEta.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegEta.h" //--------------- // C++ Headers -- @@ -30,7 +30,7 @@ // Collaborating Class Headers -- //------------------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" using namespace std; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc index 7b714667bb400..5e42255f4bc4a 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.cc @@ -15,7 +15,7 @@ // This Class's Header -- //----------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" //--------------- // C++ Headers -- diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.cc b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.cc index 9f42a1468a1c5..9243bc6129a96 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.cc @@ -15,7 +15,7 @@ // This Class's Header -- //----------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegPhi.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" //--------------- // C++ Headers -- @@ -29,7 +29,7 @@ // Collaborating Class Headers -- //------------------------------- -#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackSegLoc.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegLoc.h" using namespace std; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.cc b/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.cc index f40e49fac60ec..59469c2e017ee 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.cc @@ -33,7 +33,7 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h" -#include "L1Trigger/DTTrackFinder/src/L1MuDTSecProcId.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTSecProcId.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h" diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctHfBitCountsLut.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctHfBitCountsLut.h index 9cee30ffb85fe..42b91b13adf70 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctHfBitCountsLut.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctHfBitCountsLut.h @@ -1,7 +1,7 @@ #ifndef L1GCTHFBITCOUNTSLUT_H_ #define L1GCTHFBITCOUNTSLUT_H_ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h index da1a1afe4a2db..944ec323db353 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h @@ -1,7 +1,7 @@ #ifndef L1GCTHFETSUMSLUT_H_ #define L1GCTHFETSUMSLUT_H_ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctHtMissLut.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctHtMissLut.h index d7dcd0c2a6cec..0d9243d8e8b6c 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctHtMissLut.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctHtMissLut.h @@ -1,7 +1,7 @@ #ifndef L1GCTHTMISSLUT_H_ #define L1GCTHTMISSLUT_H_ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h similarity index 96% rename from L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h rename to L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h index 805610db7bc47..9858fdd4af34e 100644 --- a/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h @@ -1,8 +1,8 @@ #ifndef L1GCTJETCOUNT_H #define L1GCTJETCOUNT_H -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h index 36c8108e8bcae..a9f3ebbcf1ce3 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h @@ -4,7 +4,7 @@ #define JET_ET_CAL_LUT_ADD_BITS 11 #define JET_ET_CAL_LUT_DAT_BITS 6 -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" class L1GctJetFinderParams; class L1CaloEtScale; diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h index 6479010445844..d845517220208 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h @@ -9,8 +9,8 @@ #include "L1Trigger/GlobalCaloTrigger/interface/L1GctRegion.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJet.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h index eaeb60d11f24e..c8e3b7a764e11 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h @@ -7,8 +7,8 @@ #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctLut.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h similarity index 100% rename from L1Trigger/GlobalCaloTrigger/src/L1GctLut.h rename to L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h similarity index 100% rename from L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h rename to L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h similarity index 100% rename from L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h rename to L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h index 53825d8ee676b..9c768ab1b7d73 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h @@ -6,8 +6,8 @@ #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" #include diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelJetFpga.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelJetFpga.h index 67dfb8bd1544e..4d4b6ba12aa82 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelJetFpga.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GctWheelJetFpga.h @@ -20,7 +20,7 @@ #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" class L1GctJetSorter; diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h b/L1Trigger/GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h index 33641b037e5a9..20a514261c6b5 100644 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h +++ b/L1Trigger/GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h @@ -6,7 +6,7 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h" #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h" diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.cc b/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.cc index 01541d5c65858..2edba26f029a9 100644 --- a/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.cc +++ b/L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.cc @@ -1,5 +1,5 @@ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h" // no code here, these are template classes // see http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc b/L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc index adc0b7dc52bd6..02f48e5f208e0 100644 --- a/L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc +++ b/L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc @@ -1,5 +1,5 @@ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" // no code here, these are template classes // see http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.cc b/L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.cc index 195ba985cc388..0c4ce2cb694ae 100644 --- a/L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.cc +++ b/L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.cc @@ -1,5 +1,5 @@ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h" // no code here, these are template classes // see http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 diff --git a/L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.cc b/L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.cc index 50ac6e2b101b1..2eb2c15b4e9b3 100644 --- a/L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.cc +++ b/L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.cc @@ -1,5 +1,5 @@ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" // no code here, these are template classes // see http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 diff --git a/L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h b/L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h index ac15a3d7db226..8ef65a4e5b732 100644 --- a/L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h +++ b/L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h @@ -1,7 +1,7 @@ #ifndef L1GCTLUTFROMFILE_H_ #define L1GCTLUTFROMFILE_H_ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctLut.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctLut.h" #include #include diff --git a/L1Trigger/GlobalCaloTrigger/test/testEtTypes.cpp b/L1Trigger/GlobalCaloTrigger/test/testEtTypes.cpp index a019371f8a52b..f66907ed6d7ad 100644 --- a/L1Trigger/GlobalCaloTrigger/test/testEtTypes.cpp +++ b/L1Trigger/GlobalCaloTrigger/test/testEtTypes.cpp @@ -1,8 +1,8 @@ -#include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" -#include "L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h" +#include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h" #include From 2b3e7b36c8c231b0d8c1babbafb76fbcd85787b1 Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Mon, 16 Aug 2021 18:18:29 +0200 Subject: [PATCH 034/923] From code checks/format --- RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc index 109c76f5e4e71..4b02442c7b85c 100644 --- a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc +++ b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc @@ -95,7 +95,7 @@ void MkFitEventOfHitsProducer::produce(edm::StreamID iID, edm::Event& iEvent, co const auto q2 = isBarrel ? surf.zSpan().second : surf.rSpan().second; if (bs.BadModule) deadvectors[ilay].push_back({surf.phiSpan().first, surf.phiSpan().second, q1, q2}); - else { //assume that BadApvs are filled in sync with BadFibers + else { //assume that BadApvs are filled in sync with BadFibers auto const& topo = dynamic_cast(trackerGeom.idToDet(detid)->topology()); int firstApv = -1; int lastApv = -1; @@ -106,15 +106,16 @@ void MkFitEventOfHitsProducer::produce(edm::StreamID iID, edm::Event& iEvent, co float phi1 = firstPoint.phi(); float phi2 = lastPoint.phi(); if (reco::deltaPhi(phi1, phi2) > 0) - std::swap(phi1, phi2); - LogTrace("SiStripBadComponents")<<"insert bad range "< Date: Mon, 16 Aug 2021 19:29:24 +0200 Subject: [PATCH 035/923] Update README with description of mkFit-specific parameters --- RecoTracker/MkFit/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoTracker/MkFit/README.md b/RecoTracker/MkFit/README.md index 273ee6f59fd95..ad7bd3fb45141 100644 --- a/RecoTracker/MkFit/README.md +++ b/RecoTracker/MkFit/README.md @@ -49,7 +49,7 @@ $ runTheMatrix.py -l --apply 2 --command "--procModifiers tracking * *maxCandsPerSeed:* maximum number of concurrent track candidates per given seed * *maxHolesPerCand:* maximum number of allowed holes on a candidate * *maxConsecHoles:* maximum number of allowed consecutive holes on a candidate -* *chi2Cut:* chi2 cut for accepting a new hit +* *chi2Cut_min:* minimum chi2 cut for accepting a new hit * *chi2CutOverlap:* chi2 cut for accepting an overlap hit * *pTCutOverlap:* pT cut below which the overlap hits are not picked up @@ -81,3 +81,5 @@ $ runTheMatrix.py -l --apply 2 --command "--procModifiers tracking * *c_dp_sf:* additional scaling factor for dphi cut * *c_dq_[012]:* dr (endcap) / dz (barrel) selection window cut (= [0]*1/pT + [1]*std::fabs(theta-pi/2) + [2]) * *c_dq_sf:* additional scaling factor for dr (endcap) / dz (barrel) cut +* *c_c2_[012]:* chi2 cut for accepting new hit (= [0]*1/pT + [1]*std::fabs(theta-pi/2) + [2]) +* *c_c2_sf:* additional scaling factor for chi2 cut From 7089fddde7e07c9f46b21323cb937801f4cf5c05 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 18 Aug 2021 10:28:09 +0200 Subject: [PATCH 036/923] [EventFilter] Move private headers in plugins dir; merge plugins cc/h files --- .../CSCTFRawToDigi/interface/CSCTFAnalyzer.h | 44 --- .../CSCTFRawToDigi/interface/CSCTFPacker.h | 44 --- .../CSCTFRawToDigi/interface/CSCTFUnpacker.h | 47 --- .../CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc | 44 ++- .../CSCTFRawToDigi/plugins/CSCTFPacker.cc | 44 ++- .../CSCTFRawToDigi/plugins/CSCTFUnpacker.cc | 46 ++- .../CSCTFRawToDigi/plugins/SealModule.cc | 8 - .../EcalRawToDigi/interface/MatacqProducer.h | 319 ------------------ .../EcalRawToDigi/plugins/EcalDumpRaw.cc | 4 + .../EcalRawToDigi/plugins/EcalRawToDigi.cc | 107 +++++- .../EcalRawToDigi/plugins/EcalRawToDigi.h | 107 ------ .../plugins/EcalRegionCablingESProducer.cc | 47 ++- .../plugins/EcalRegionCablingESProducer.h | 46 --- .../EcalRawToDigi/plugins/MatacqProducer.cc | 319 +++++++++++++++++- .../EcalRawToDigi/plugins/SealModules.cc | 14 - 15 files changed, 605 insertions(+), 635 deletions(-) delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h delete mode 100644 EventFilter/CSCTFRawToDigi/plugins/SealModule.cc delete mode 100644 EventFilter/EcalRawToDigi/interface/MatacqProducer.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/SealModules.cc diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h deleted file mode 100644 index 8d9917d281f40..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CSCTFAnalyzer_h -#define CSCTFAnalyzer_h - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -//consumes -#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" -#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" - -#include -#include - -class CSCTFAnalyzer : public edm::EDAnalyzer { -private: - edm::InputTag mbProducer, lctProducer, trackProducer, statusProducer; - TTree *tree; - TFile *file; - int dtPhi[12][2]; - - edm::EDGetTokenT L1CSCS_Tok; - edm::EDGetTokenT > CSCTC_Tok; - edm::EDGetTokenT CSCCDC_Tok; - edm::EDGetTokenT L1CST_Tok; - -public: - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - - explicit CSCTFAnalyzer(const edm::ParameterSet &conf); - ~CSCTFAnalyzer(void) override { - file->cd(); - tree->Write(); - file->Close(); - } -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h deleted file mode 100644 index 4164f7fdce1fd..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CSCTFPacker_h -#define CSCTFPacker_h - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "FWCore/Framework/interface/one/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" -#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" - -#include - -class CSCTFPacker : public edm::one::EDProducer<> { -private: - edm::InputTag lctProducer, mbProducer, trackProducer; - - bool zeroSuppression; - unsigned short nTBINs; - unsigned short activeSectors; - bool putBufferToEvent; - - bool swapME1strips; - - FILE* file; - - int m_minBX, m_maxBX, central_lct_bx, central_sp_bx; - - edm::EDGetTokenT CSCCDC_Tok; - edm::EDGetTokenT > CSCTC_Tok; - edm::EDGetTokenT L1CSCTr_Tok; - -public: - void produce(edm::Event& e, const edm::EventSetup& c) override; - - explicit CSCTFPacker(const edm::ParameterSet& conf); - ~CSCTFPacker(void) override; -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h deleted file mode 100644 index b0470ab41f599..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef CSCTFUnpacker_h -#define CSCTFUnpacker_h - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include -#include - -//CSC Track Finder Raw Data Format -#include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" - -//FEDRawData -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" - -#include -#include - -class CSCTriggerMapping; - -class CSCTFUnpacker : public edm::stream::EDProducer<> { -private: - int m_minBX, m_maxBX; - bool swapME1strips; - - CSCTriggerMapping* mapping; // redundant, but needed - - CSCTFEvent tfEvent; // TF data container - - // geometry may not be properly set in CSC TF data - // make an artificial assignment of each of 12 SPs (slots 6-11 and 16-21) to 12 sectors (1-12, 0-not assigned) - std::vector slot2sector; - - // label of the module which produced raw data - edm::InputTag producer; - - edm::EDGetTokenT Raw_token; - -public: - void produce(edm::Event& e, const edm::EventSetup& c) override; - - CSCTFUnpacker(const edm::ParameterSet& pset); - ~CSCTFUnpacker(void) override; -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc index 80ed4e9042564..1e348b9420efa 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc @@ -1,4 +1,43 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" + +//consumes +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" +#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" + +#include +#include + +class CSCTFAnalyzer : public edm::EDAnalyzer { +private: + edm::InputTag mbProducer, lctProducer, trackProducer, statusProducer; + TTree *tree; + TFile *file; + int dtPhi[12][2]; + + edm::EDGetTokenT L1CSCS_Tok; + edm::EDGetTokenT > CSCTC_Tok; + edm::EDGetTokenT CSCCDC_Tok; + edm::EDGetTokenT L1CST_Tok; + +public: + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + + explicit CSCTFAnalyzer(const edm::ParameterSet &conf); + ~CSCTFAnalyzer(void) override { + file->cd(); + tree->Write(); + file->Close(); + } +}; + #include "DataFormats/Common/interface/Handle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -192,3 +231,6 @@ void CSCTFAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { edm::LogInfo("CSCTFAnalyzer") << " No valid L1CSCTrackCollection products found"; } } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFAnalyzer); diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc index b9ee603bc976a..edc65539eee02 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc @@ -1,4 +1,43 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" +#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" + +#include + +class CSCTFPacker : public edm::one::EDProducer<> { +private: + edm::InputTag lctProducer, mbProducer, trackProducer; + + bool zeroSuppression; + unsigned short nTBINs; + unsigned short activeSectors; + bool putBufferToEvent; + + bool swapME1strips; + + FILE* file; + + int m_minBX, m_maxBX, central_lct_bx, central_sp_bx; + + edm::EDGetTokenT CSCCDC_Tok; + edm::EDGetTokenT > CSCTC_Tok; + edm::EDGetTokenT L1CSCTr_Tok; + +public: + void produce(edm::Event& e, const edm::EventSetup& c) override; + + explicit CSCTFPacker(const edm::ParameterSet& conf); + ~CSCTFPacker(void) override; +}; + #include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" #include @@ -397,3 +436,6 @@ void CSCTFPacker::produce(edm::Event& e, const edm::EventSetup& c) { if (file) fwrite(spDDUrecord, 2, pos - spDDUrecord, file); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFPacker); diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc index 8ef1ce1e3109c..3d4b1a427643f 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc @@ -1,4 +1,45 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include +#include + +//CSC Track Finder Raw Data Format +#include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" + +//FEDRawData +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include +#include + +class CSCTriggerMapping; + +class CSCTFUnpacker : public edm::stream::EDProducer<> { +private: + int m_minBX, m_maxBX; + bool swapME1strips; + + CSCTriggerMapping* mapping; // redundant, but needed + + CSCTFEvent tfEvent; // TF data container + + // geometry may not be properly set in CSC TF data + // make an artificial assignment of each of 12 SPs (slots 6-11 and 16-21) to 12 sectors (1-12, 0-not assigned) + std::vector slot2sector; + + // label of the module which produced raw data + edm::InputTag producer; + + edm::EDGetTokenT Raw_token; + +public: + void produce(edm::Event& e, const edm::EventSetup& c) override; + + CSCTFUnpacker(const edm::ParameterSet& pset); + ~CSCTFUnpacker(void) override; +}; //Framework stuff #include "DataFormats/Common/interface/Handle.h" @@ -330,3 +371,6 @@ void CSCTFUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { e.put(std::move(trackProduct)); e.put(std::move(statusProduct)); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFUnpacker); diff --git a/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc b/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc deleted file mode 100644 index 1a69f18313757..0000000000000 --- a/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include -#include -#include - -DEFINE_FWK_MODULE(CSCTFUnpacker); -DEFINE_FWK_MODULE(CSCTFPacker); -DEFINE_FWK_MODULE(CSCTFAnalyzer); diff --git a/EventFilter/EcalRawToDigi/interface/MatacqProducer.h b/EventFilter/EcalRawToDigi/interface/MatacqProducer.h deleted file mode 100644 index fad2161e4324e..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/MatacqProducer.h +++ /dev/null @@ -1,319 +0,0 @@ -#ifndef PRODUCER_H -#define PRODUCER_H - -//#define USE_STORAGE_MANAGER - -#ifdef USE_STORAGE_MANAGER -#include "Utilities/StorageFactory/interface/Storage.h" -#include "Utilities/StorageFactory/interface/StorageFactory.h" -#else //USE_STORAGE_MANAGER not defined -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif //_LARGEFILE64_SOURCE not defined -#define _FILE_OFFSET_BITS 64 -#include -#endif //USE_STORAGE_MANAGER defined - -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "EventFilter/EcalRawToDigi/interface/MatacqRawEvent.h" -#include "EventFilter/EcalRawToDigi/src/MatacqDataFormatter.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" - -#include -#include -#include -#include - -#include - -struct NullOut { - NullOut& operator<<(std::ostream& (*pf)(std::ostream&)) { return *this; } - template - inline NullOut& operator<<(const T& a) { - return *this; - } -}; - -class MatacqProducer : public edm::EDProducer { -public: - enum calibTrigType_t { laserType = 4, ledType = 5, tpType = 6, pedType = 7 }; - -private: -#ifdef USE_STORAGE_MANAGER - typedef IOOffset filepos_t; - typedef std::unique_ptr FILE_t; -#else - typedef off_t filepos_t; - typedef FILE* FILE_t; -#endif - struct MatacqEventId { - MatacqEventId() : run(0), orbit(0) {} - MatacqEventId(uint32_t r, uint32_t o) : run(r), orbit(o) {} - - /** Run number - */ - uint32_t run; - - /** Orbit id - */ - uint32_t orbit; - - bool operator<(const MatacqEventId& a) { - return (this->run < a.run) || ((this->run == a.run) && (this->orbit < a.orbit)); - } - - bool operator>(const MatacqEventId& a) { - return (this->run > a.run) || ((this->run == a.run) && (this->orbit > a.orbit)); - } - - bool operator==(const MatacqEventId& a) { return !((*this) < a || (*this) > a); } - }; - - /** Estimates matacq event position in a file from its orbit id. This - * estimator requires that every event in the file has the same length. A - * linear extrapolation of pos=f(orbit) function from first and last event - * is performed. It gives only a rough estimate, relevant only to initiliaze - * the event search. - */ - class PosEstimator { - //Note: a better estimate could be obtained by using segment of linear - //functions. In such implementation, the estimator must be updated - //each time a point with wrong estimate has been found. - public: - PosEstimator() : eventLength_(0), orbitStepMean_(0), firstOrbit_(0), invalid_(true), verbosity_(0) {} - void init(MatacqProducer* mp); - bool invalid() const { return invalid_; } - int64_t pos(int orb) const; - int eventLength() const { return eventLength_; } - int firstOrbit() const { return firstOrbit_; } - void verbosity(int verb) { verbosity_ = verb; } - - private: - int eventLength_; - int orbitStepMean_; - int firstOrbit_; - bool invalid_; - int verbosity_; - }; - -public: - /** Constructor - * @param params seletive readout parameters - */ - explicit MatacqProducer(const edm::ParameterSet& params); - - /** Destructor - */ - ~MatacqProducer() override; - - /** Produces the EDM products - * @param CMS event - * @param eventSetup event conditions - */ - void produce(edm::Event& event, const edm::EventSetup& eventSetup) override; - -private: - /** Add matacq digi to the event - * @param event the event - * @param digiInstanceName_ name to give to the matacq digi instance - */ - void addMatacqData(edm::Event& event); - - /** Retrieve the file containing a given matacq event - * @param runNumber Number of the run the matacq event is looking from - * @param orbitId Id of the orbit of the matacq event - * @param fileChange if not null pointer, set to true if the file changed. - * @return true if file retrieval succeeded, false otherwise. - * found. - */ - bool getMatacqFile(uint32_t runNumber, uint32_t orbitId, bool* fileChange = nullptr); - - bool getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fileChange); - /*,bool doWrap = false, std::streamoff maxPos = -1);*/ - - uint32_t getRunNumber(edm::Event& ev) const; - uint32_t getOrbitId(edm::Event& ev) const; - - bool getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb); - - int getCalibTriggerType(edm::Event& ev) const; - - /** Loading orbit correction table from file. @see orbitOffsetFile_ - */ - void loadOrbitOffset(); - - /** Move input file read pointer. On failure file is rewind. - * @param buf buffer to store read data - * @param n size of data block - * @param mess text to insert in the eventual error message. - * @return true on success, false on failure - */ - bool mseek(filepos_t offset, int whence = SEEK_SET, const char* mess = nullptr); - - bool mtell(filepos_t& pos); - - /** Read a data block from input file. On failure file position is restored - * and if position restoring fails, file is rewind. - * @param buf buffer to store read data - * @param n size of data block - * @param mess text to insert in the eventual error message. - * @param peek if true file position is restored after the data read - * @return true on success, false on failure - */ - bool mread(char* buf, size_t n, const char* mess = nullptr, bool peek = false); - - bool mcheck(const std::string& name); - - bool mopen(const std::string& name); - - void mclose(); - - bool misOpened(); - - bool meof(); - - bool mrewind(); - - bool msize(filepos_t& s); - - void newRun(int prevRun, int newRun); - - static std::string runSubDir(uint32_t runNumber); - -private: - std::vector fileNames_; - - /** Instance name to use for the produced Matacq digi collection - */ - std::string digiInstanceName_; - - /** Instance name to use for the produced Matacq raw data collection - */ - std::string rawInstanceName_; - - /** Parameter to switch module timing. - */ - bool timing_; - - /** Parameter to disable matacq data production. For timing purpose. - */ - bool disabled_; - - /** Verbosity level - */ - int verbosity_; - - /** Swictch for Matacq digi producion - */ - bool produceDigis_; - - /** Switch for Matacq FED raw data production - */ - bool produceRaw_; - - /** Name of the raw data collection the Matacq data must be merge to - * if merging is enabled. - */ - edm::InputTag inputRawCollection_; - - /** EDM token to access the raw data collection the Matacq data must be merge to - * if merging is enabled. - */ - edm::EDGetTokenT inputRawCollectionToken_; - - /** Switch for merging Matacq raw data with existing raw data - * collection. - */ - bool mergeRaw_; - - /** When true look for matacq data independently of trigger type. - */ - bool ignoreTriggerType_; - - MatacqRawEvent matacq_; - - /** Stream of currently opened matacq file - */ - FILE_t inFile_; - - static const int bufferSize = 30000; //must greater or equal to maximum - // matacq event size. - std::vector data_; - MatacqDataFormatter formatter_; - const static int orbitTolerance_; - uint32_t openedFileRunNumber_; - int32_t lastOrb_; - int fastRetrievalThresh_; - - PosEstimator posEstim_; - - timeval startTime_; - - /** File name of table with orbit offset between - * matacq event and DCC. Used to recover data suffering from orbit - * miss-synchonization - */ - std::string orbitOffsetFile_; - - /** Orbit offset table. @see orbitOffsetFile_ - */ - std::map orbitOffset_; - - /** Switch for orbit ID correction. @see orbitOffsetFile_ - */ - bool doOrbitOffset_; - - /** Name of currently opened matacq file - */ - std::string inFileName_; - - static const int matacqFedId_ = 655; - - struct stats_t { - double nEvents; - double nLaserEventsWithMatacq; - double nNonLaserEventsWithMatacq; - } stats_; - - const static stats_t stats_init; - /** Log file name - */ - std::string logFileName_; - - /** Log file - */ - std::ofstream logFile_; - - /** counter for event skipping - */ - int eventSkipCounter_; - - /** Number of events to skip in case of error - */ - int onErrorDisablingEvtCnt_; - - /** Name of file to log timing - */ - std::string timeLogFile_; - /** Buffer for timing - */ - timeval timer_; - - /** Output stream to log code timing - */ - std::ofstream timeLog_; - - /** Switch for code timing. - */ - bool logTiming_; - - /** Number of the currently processed run - */ - uint32_t runNumber_; -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc b/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc index 8788bfe7e2cba..f1eee6d3bc76c 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc @@ -871,3 +871,7 @@ std::string EcalDumpRaw::tpgTag(int tccType, unsigned iSeq) const { } return buf.str(); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(EcalDumpRaw); + diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc index 650e0e1911cfb..7fa75f32f1127 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc @@ -1,4 +1,106 @@ -#include "EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h" +/* + *\ Class EcalRawToDigi + * + * This class takes unpacks ECAL raw data + * produces digis and raw data format prolblems reports + * + * \file EcalRawToDigi.h + * + * \author N. Almeida + * \author G. Franzoni + * +*/ + +#include + +#include "EventFilter/EcalRawToDigi/interface/DCCRawDataDefinitions.h" + +#include +#include +#include +#include +#include +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" + +#include +#include +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include +#include +#include +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" +#include + +class EcalElectronicsMapper; +class EcalElectronicsMapping; +class DCCDataUnpacker; + +class EcalRawToDigi : public edm::stream::EDProducer<> { +public: + /** + * Class constructor + */ + explicit EcalRawToDigi(const edm::ParameterSet& ps); + + /** + * Functions that are called by framework at each event + */ + void produce(edm::Event& e, const edm::EventSetup& c) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + // function called at start of each run + void beginRun(const edm::Run& run, const edm::EventSetup& es) override; + + /** + * Class destructor + */ + ~EcalRawToDigi() override; + + edm::ESWatcher watcher_; + +private: + //list of FEDs to unpack + std::vector fedUnpackList_; + + std::vector orderedFedUnpackList_; + std::vector orderedDCCIdList_; + + unsigned int numbXtalTSamples_; + unsigned int numbTriggerTSamples_; + + bool headerUnpacking_; + bool srpUnpacking_; + bool tccUnpacking_; + bool feUnpacking_; + bool memUnpacking_; + bool syncCheck_; + bool feIdCheck_; + bool forceToKeepFRdata_; + bool first_; + bool put_; + + edm::EDGetTokenT dataToken_; + edm::EDGetTokenT fedsToken_; + edm::ESGetToken chStatusToken_; + edm::ESGetToken ecalMappingToken_; + + // -- For regional unacking : + bool REGIONAL_; + + //an electronics mapper class + EcalElectronicsMapper* myMap_; + + //Ecal unpacker + DCCDataUnpacker* theUnpacker_; + + unsigned int nevts_; // NA: for testing + double RUNNING_TIME_, SETUP_TIME_; +}; + #include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h" #include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h" @@ -524,3 +626,6 @@ EcalRawToDigi::~EcalRawToDigi() { if (theUnpacker_) delete theUnpacker_; } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(EcalRawToDigi); diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h deleted file mode 100644 index a26eca3bdfd82..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef _ECALRAWTODIGIDEV_H_ -#define _ECALRAWTODIGIDEV_H_ - -/* - *\ Class EcalRawToDigi - * - * This class takes unpacks ECAL raw data - * produces digis and raw data format prolblems reports - * - * \file EcalRawToDigi.h - * - * \author N. Almeida - * \author G. Franzoni - * -*/ - -#include - -#include "EventFilter/EcalRawToDigi/interface/DCCRawDataDefinitions.h" - -#include -#include -#include -#include -#include -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" - -#include -#include -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include -#include -#include -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" -#include - -class EcalElectronicsMapper; -class EcalElectronicsMapping; -class DCCDataUnpacker; - -class EcalRawToDigi : public edm::stream::EDProducer<> { -public: - /** - * Class constructor - */ - explicit EcalRawToDigi(const edm::ParameterSet& ps); - - /** - * Functions that are called by framework at each event - */ - void produce(edm::Event& e, const edm::EventSetup& c) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - // function called at start of each run - void beginRun(const edm::Run& run, const edm::EventSetup& es) override; - - /** - * Class destructor - */ - ~EcalRawToDigi() override; - - edm::ESWatcher watcher_; - -private: - //list of FEDs to unpack - std::vector fedUnpackList_; - - std::vector orderedFedUnpackList_; - std::vector orderedDCCIdList_; - - unsigned int numbXtalTSamples_; - unsigned int numbTriggerTSamples_; - - bool headerUnpacking_; - bool srpUnpacking_; - bool tccUnpacking_; - bool feUnpacking_; - bool memUnpacking_; - bool syncCheck_; - bool feIdCheck_; - bool forceToKeepFRdata_; - bool first_; - bool put_; - - edm::EDGetTokenT dataToken_; - edm::EDGetTokenT fedsToken_; - edm::ESGetToken chStatusToken_; - edm::ESGetToken ecalMappingToken_; - - // -- For regional unacking : - bool REGIONAL_; - - //an electronics mapper class - EcalElectronicsMapper* myMap_; - - //Ecal unpacker - DCCDataUnpacker* theUnpacker_; - - unsigned int nevts_; // NA: for testing - double RUNNING_TIME_, SETUP_TIME_; -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc index d5cef950503f5..4237d346f2780 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc @@ -1,4 +1,46 @@ -#include "EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h" +// -*- C++ -*- +// +// Package: EcalRegionCablingESProducer +// Class: EcalRegionCablingESProducer +// +/**\class EcalRegionCablingESProducer EcalRegionCablingESProducer.h EventFilter/EcalRegionCablingESProducer/src/EcalRegionCablingESProducer.cc + + Description: + + Implementation: + +*/ +// +// Original Author: Jean-Roch Vlimant +// Created: Sun Oct 7 00:37:06 CEST 2007 +// +// + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCablingRecord.h" +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" + +class EcalRegionCablingESProducer : public edm::ESProducer { +public: + EcalRegionCablingESProducer(const edm::ParameterSet&); + ~EcalRegionCablingESProducer() override; + + typedef std::unique_ptr ReturnType; + + ReturnType produce(const EcalRegionCablingRecord&); + +private: + edm::ParameterSet conf_; + + edm::ESGetToken esEcalElectronicsMappingToken_; +}; EcalRegionCablingESProducer::EcalRegionCablingESProducer(const edm::ParameterSet& iConfig) : conf_(iConfig) { auto cc = setWhatProduced(this); @@ -12,3 +54,6 @@ EcalRegionCablingESProducer::ReturnType EcalRegionCablingESProducer::produce(con return std::make_unique(conf_, mapping.product()); } + +#include "FWCore/Framework/interface/ModuleFactory.h" +DEFINE_FWK_EVENTSETUP_MODULE(EcalRegionCablingESProducer); diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h deleted file mode 100644 index 485cf367cfc87..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef EventFilter_EcalRawToDigi_EcalRegionCablingESProducer_H -#define EventFilter_EcalRawToDigi_EcalRegionCablingESProducer_H -// -*- C++ -*- -// -// Package: EcalRegionCablingESProducer -// Class: EcalRegionCablingESProducer -// -/**\class EcalRegionCablingESProducer EcalRegionCablingESProducer.h EventFilter/EcalRegionCablingESProducer/src/EcalRegionCablingESProducer.cc - - Description: - - Implementation: - -*/ -// -// Original Author: Jean-Roch Vlimant -// Created: Sun Oct 7 00:37:06 CEST 2007 -// -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCablingRecord.h" -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" - -class EcalRegionCablingESProducer : public edm::ESProducer { -public: - EcalRegionCablingESProducer(const edm::ParameterSet&); - ~EcalRegionCablingESProducer() override; - - typedef std::unique_ptr ReturnType; - - ReturnType produce(const EcalRegionCablingRecord&); - -private: - edm::ParameterSet conf_; - - edm::ESGetToken esEcalElectronicsMappingToken_; -}; -#endif diff --git a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc index d50b96c0725fc..d8437f56633fd 100644 --- a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc @@ -1,3 +1,318 @@ +//#define USE_STORAGE_MANAGER + +#ifdef USE_STORAGE_MANAGER +#include "Utilities/StorageFactory/interface/Storage.h" +#include "Utilities/StorageFactory/interface/StorageFactory.h" +#else //USE_STORAGE_MANAGER not defined +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif //_LARGEFILE64_SOURCE not defined +#define _FILE_OFFSET_BITS 64 +#include +#endif //USE_STORAGE_MANAGER defined + +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "EventFilter/EcalRawToDigi/interface/MatacqRawEvent.h" +#include "EventFilter/EcalRawToDigi/src/MatacqDataFormatter.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include +#include +#include +#include + +#include + +struct NullOut { + NullOut& operator<<(std::ostream& (*pf)(std::ostream&)) { return *this; } + template + inline NullOut& operator<<(const T& a) { + return *this; + } +}; + +class MatacqProducer : public edm::EDProducer { +public: + enum calibTrigType_t { laserType = 4, ledType = 5, tpType = 6, pedType = 7 }; + +private: +#ifdef USE_STORAGE_MANAGER + typedef IOOffset filepos_t; + typedef std::unique_ptr FILE_t; +#else + typedef off_t filepos_t; + typedef FILE* FILE_t; +#endif + struct MatacqEventId { + MatacqEventId() : run(0), orbit(0) {} + MatacqEventId(uint32_t r, uint32_t o) : run(r), orbit(o) {} + + /** Run number + */ + uint32_t run; + + /** Orbit id + */ + uint32_t orbit; + + bool operator<(const MatacqEventId& a) { + return (this->run < a.run) || ((this->run == a.run) && (this->orbit < a.orbit)); + } + + bool operator>(const MatacqEventId& a) { + return (this->run > a.run) || ((this->run == a.run) && (this->orbit > a.orbit)); + } + + bool operator==(const MatacqEventId& a) { return !((*this) < a || (*this) > a); } + }; + + /** Estimates matacq event position in a file from its orbit id. This + * estimator requires that every event in the file has the same length. A + * linear extrapolation of pos=f(orbit) function from first and last event + * is performed. It gives only a rough estimate, relevant only to initiliaze + * the event search. + */ + class PosEstimator { + //Note: a better estimate could be obtained by using segment of linear + //functions. In such implementation, the estimator must be updated + //each time a point with wrong estimate has been found. + public: + PosEstimator() : eventLength_(0), orbitStepMean_(0), firstOrbit_(0), invalid_(true), verbosity_(0) {} + void init(MatacqProducer* mp); + bool invalid() const { return invalid_; } + int64_t pos(int orb) const; + int eventLength() const { return eventLength_; } + int firstOrbit() const { return firstOrbit_; } + void verbosity(int verb) { verbosity_ = verb; } + + private: + int eventLength_; + int orbitStepMean_; + int firstOrbit_; + bool invalid_; + int verbosity_; + }; + +public: + /** Constructor + * @param params seletive readout parameters + */ + explicit MatacqProducer(const edm::ParameterSet& params); + + /** Destructor + */ + ~MatacqProducer() override; + + /** Produces the EDM products + * @param CMS event + * @param eventSetup event conditions + */ + void produce(edm::Event& event, const edm::EventSetup& eventSetup) override; + +private: + /** Add matacq digi to the event + * @param event the event + * @param digiInstanceName_ name to give to the matacq digi instance + */ + void addMatacqData(edm::Event& event); + + /** Retrieve the file containing a given matacq event + * @param runNumber Number of the run the matacq event is looking from + * @param orbitId Id of the orbit of the matacq event + * @param fileChange if not null pointer, set to true if the file changed. + * @return true if file retrieval succeeded, false otherwise. + * found. + */ + bool getMatacqFile(uint32_t runNumber, uint32_t orbitId, bool* fileChange = nullptr); + + bool getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fileChange); + /*,bool doWrap = false, std::streamoff maxPos = -1);*/ + + uint32_t getRunNumber(edm::Event& ev) const; + uint32_t getOrbitId(edm::Event& ev) const; + + bool getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb); + + int getCalibTriggerType(edm::Event& ev) const; + + /** Loading orbit correction table from file. @see orbitOffsetFile_ + */ + void loadOrbitOffset(); + + /** Move input file read pointer. On failure file is rewind. + * @param buf buffer to store read data + * @param n size of data block + * @param mess text to insert in the eventual error message. + * @return true on success, false on failure + */ + bool mseek(filepos_t offset, int whence = SEEK_SET, const char* mess = nullptr); + + bool mtell(filepos_t& pos); + + /** Read a data block from input file. On failure file position is restored + * and if position restoring fails, file is rewind. + * @param buf buffer to store read data + * @param n size of data block + * @param mess text to insert in the eventual error message. + * @param peek if true file position is restored after the data read + * @return true on success, false on failure + */ + bool mread(char* buf, size_t n, const char* mess = nullptr, bool peek = false); + + bool mcheck(const std::string& name); + + bool mopen(const std::string& name); + + void mclose(); + + bool misOpened(); + + bool meof(); + + bool mrewind(); + + bool msize(filepos_t& s); + + void newRun(int prevRun, int newRun); + + static std::string runSubDir(uint32_t runNumber); + +private: + std::vector fileNames_; + + /** Instance name to use for the produced Matacq digi collection + */ + std::string digiInstanceName_; + + /** Instance name to use for the produced Matacq raw data collection + */ + std::string rawInstanceName_; + + /** Parameter to switch module timing. + */ + bool timing_; + + /** Parameter to disable matacq data production. For timing purpose. + */ + bool disabled_; + + /** Verbosity level + */ + int verbosity_; + + /** Swictch for Matacq digi producion + */ + bool produceDigis_; + + /** Switch for Matacq FED raw data production + */ + bool produceRaw_; + + /** Name of the raw data collection the Matacq data must be merge to + * if merging is enabled. + */ + edm::InputTag inputRawCollection_; + + /** EDM token to access the raw data collection the Matacq data must be merge to + * if merging is enabled. + */ + edm::EDGetTokenT inputRawCollectionToken_; + + /** Switch for merging Matacq raw data with existing raw data + * collection. + */ + bool mergeRaw_; + + /** When true look for matacq data independently of trigger type. + */ + bool ignoreTriggerType_; + + MatacqRawEvent matacq_; + + /** Stream of currently opened matacq file + */ + FILE_t inFile_; + + static const int bufferSize = 30000; //must greater or equal to maximum + // matacq event size. + std::vector data_; + MatacqDataFormatter formatter_; + const static int orbitTolerance_; + uint32_t openedFileRunNumber_; + int32_t lastOrb_; + int fastRetrievalThresh_; + + PosEstimator posEstim_; + + timeval startTime_; + + /** File name of table with orbit offset between + * matacq event and DCC. Used to recover data suffering from orbit + * miss-synchonization + */ + std::string orbitOffsetFile_; + + /** Orbit offset table. @see orbitOffsetFile_ + */ + std::map orbitOffset_; + + /** Switch for orbit ID correction. @see orbitOffsetFile_ + */ + bool doOrbitOffset_; + + /** Name of currently opened matacq file + */ + std::string inFileName_; + + static const int matacqFedId_ = 655; + + struct stats_t { + double nEvents; + double nLaserEventsWithMatacq; + double nNonLaserEventsWithMatacq; + } stats_; + + const static stats_t stats_init; + /** Log file name + */ + std::string logFileName_; + + /** Log file + */ + std::ofstream logFile_; + + /** counter for event skipping + */ + int eventSkipCounter_; + + /** Number of events to skip in case of error + */ + int onErrorDisablingEvtCnt_; + + /** Name of file to log timing + */ + std::string timeLogFile_; + /** Buffer for timing + */ + timeval timer_; + + /** Output stream to log code timing + */ + std::ofstream timeLog_; + + /** Switch for code timing. + */ + bool logTiming_; + + /** Number of the currently processed run + */ + uint32_t runNumber_; +}; + #include #include #include @@ -18,7 +333,6 @@ #include "DataFormats/EcalDigi/interface/EcalMatacqDigi.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "EventFilter/EcalRawToDigi/interface/MatacqProducer.h" #include "EventFilter/EcalRawToDigi/src/Majority.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" @@ -1163,3 +1477,6 @@ bool MatacqProducer::getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb) { return true; } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(MatacqProducer); diff --git a/EventFilter/EcalRawToDigi/plugins/SealModules.cc b/EventFilter/EcalRawToDigi/plugins/SealModules.cc deleted file mode 100644 index e1e9ddf7c8539..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/SealModules.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#include "FWCore/Framework/interface/ModuleFactory.h" -#include "EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h" -DEFINE_FWK_EVENTSETUP_MODULE(EcalRegionCablingESProducer); - -#include "EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h" -DEFINE_FWK_MODULE(EcalRawToDigi); - -#include "EventFilter/EcalRawToDigi/interface/MatacqProducer.h" -DEFINE_FWK_MODULE(MatacqProducer); - -#include "EventFilter/EcalRawToDigi/interface/EcalDumpRaw.h" -DEFINE_FWK_MODULE(EcalDumpRaw); From ddde684f3094e868a9f06a4d2dbea5e527ca3397 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 18 Aug 2021 10:37:35 +0200 Subject: [PATCH 037/923] code-format --- EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc | 4 ++-- EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc index 1e348b9420efa..e74f6dee3dc3e 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc @@ -46,7 +46,7 @@ class CSCTFAnalyzer : public edm::EDAnalyzer { #include #include -CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet& conf) : edm::EDAnalyzer() { +CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet &conf) : edm::EDAnalyzer() { mbProducer = conf.getUntrackedParameter("mbProducer", edm::InputTag("csctfunpacker")); lctProducer = conf.getUntrackedParameter("lctProducer", edm::InputTag("csctfunpacker")); trackProducer = conf.getUntrackedParameter("trackProducer", edm::InputTag("csctfunpacker")); @@ -85,7 +85,7 @@ CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet& conf) : edm::EDAnalyzer() L1CST_Tok = consumes(edm::InputTag(trackProducer.label(), trackProducer.instance())); } -void CSCTFAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { +void CSCTFAnalyzer::analyze(const edm::Event &e, const edm::EventSetup &c) { /* edm::Handle rawdata; e.getByToken("source","",rawdata); diff --git a/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc b/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc index f1eee6d3bc76c..e7229b37557cc 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalDumpRaw.cc @@ -874,4 +874,3 @@ std::string EcalDumpRaw::tpgTag(int tccType, unsigned iSeq) const { #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(EcalDumpRaw); - From 6b33c5bd46fad84d9edacfae97c5495a644dbc6f Mon Sep 17 00:00:00 2001 From: tuthongtran <44227844+tuthongtran@users.noreply.github.com> Date: Wed, 18 Aug 2021 14:21:48 +0200 Subject: [PATCH 038/923] Change for python 3 --- RecoLuminosity/LumiDB/scripts/pileupCalc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLuminosity/LumiDB/scripts/pileupCalc.py b/RecoLuminosity/LumiDB/scripts/pileupCalc.py index a434265f681c5..077fbb111422e 100755 --- a/RecoLuminosity/LumiDB/scripts/pileupCalc.py +++ b/RecoLuminosity/LumiDB/scripts/pileupCalc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from builtins import range VERSION='1.00' From c254d669999daf197848aa4bb829f45b69775470 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Wed, 18 Aug 2021 16:11:23 +0200 Subject: [PATCH 039/923] Removed unused headers/test files --- .../interface/DTCompactMapPluginHandler.h | 1 - .../interface/DTConfigPluginHandler.h | 1 - .../CastorObjects/interface/AllClasses.h | 16 - CondFormats/Common/interface/Constants.h | 16 - .../interface/SiStripBadChannelRcd.h | 1 - .../DataRecord/interface/SiStripBadFiberRcd.h | 1 - .../interface/SiStripBadModuleRcd.h | 1 - .../DataRecord/interface/SiStripModuleHVRcd.h | 1 - .../interface/SiStripPerformanceSummaryRcd.h | 1 - .../interface/SiStripRunSummaryRcd.h | 1 - .../HcalObjects/interface/HcalItemArrayColl.h | 101 ---- .../interface/HcalItemArrayCollById.h | 161 ------ .../eos/polymorphic_portable_archive.hpp | 35 -- .../interface/eos/portable_archive.hpp | 35 -- .../interface/MapPathTodetUnit.h | 0 .../EcalIntercalibConstantsHandler.h | 17 - .../EcalIntercalibConstantsMCHandler.h | 18 - .../interface/EcalIntercalibErrorsHandler.h | 23 - .../EcalIntercalibErrorsXMLTranslator.h | 17 - .../EcalPFRecHitThresholdsXMLTranslator.h | 17 - .../interface/EcalTimeCalibConstantsHandler.h | 18 - .../EcalTimeCalibConstantsXMLTranslator.h | 19 - .../interface/EcalTimeCalibErrorsHandler.h | 18 - .../EcalTimeCalibErrorsXMLTranslator.h | 19 - CondTools/Ecal/test/testXMLTranslators.cc | 472 ------------------ CondTools/L1Trigger/interface/Interval.h | 104 ---- .../RPC/interface/L1RPCHwConfigDBWriter.h | 18 - CondTools/RPC/interface/RPCEMapDBWriter.h | 18 - .../interface/SiStripCondObjBuilderBase.h | 30 -- .../interface/SiStripDepCondObjBuilderBase.h | 30 -- OnlineDB/CSCCondDB/interface/AutoCorrMat.h | 112 ----- .../CSCCondDB/interface/CSCCableReadTest.h | 27 - OnlineDB/CSCCondDB/interface/CSCxTalk.h | 162 ------ OnlineDB/CSCCondDB/interface/SaturationFcn.h | 65 --- OnlineDB/EcalCondDB/interface/IConfig.h | 14 - OnlineDB/EcalCondDB/interface/IRunIOV.h | 23 - OnlineDB/EcalCondDB/interface/ITimeIOV.h | 21 - .../EcalCondDB/interface/all_cali_types.h | 7 - OnlineDB/EcalCondDB/interface/all_dcu_types.h | 11 - OnlineDB/EcalCondDB/interface/all_mod_types.h | 21 - .../EcalCondDB/test/InsertDCUIdarkPed.cpp | 354 ------------- OnlineDB/EcalCondDB/test/TestChannelView.cpp | 125 ----- OnlineDB/EcalCondDB/test/TestDCU.cpp | 315 ------------ OnlineDB/EcalCondDB/test/TestMOD.cpp | 265 ---------- 44 files changed, 2732 deletions(-) delete mode 100644 CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h delete mode 100644 CondCore/DTPlugins/interface/DTConfigPluginHandler.h delete mode 100644 CondFormats/CastorObjects/interface/AllClasses.h delete mode 100644 CondFormats/Common/interface/Constants.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadChannelRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadFiberRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadModuleRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripModuleHVRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h delete mode 100644 CondFormats/HcalObjects/interface/HcalItemArrayColl.h delete mode 100644 CondFormats/HcalObjects/interface/HcalItemArrayCollById.h delete mode 100644 CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp delete mode 100644 CondFormats/Serialization/interface/eos/portable_archive.hpp delete mode 100644 CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h delete mode 100644 CondTools/Ecal/test/testXMLTranslators.cc delete mode 100644 CondTools/L1Trigger/interface/Interval.h delete mode 100644 CondTools/RPC/interface/L1RPCHwConfigDBWriter.h delete mode 100644 CondTools/RPC/interface/RPCEMapDBWriter.h delete mode 100644 CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h delete mode 100644 CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h delete mode 100644 OnlineDB/CSCCondDB/interface/AutoCorrMat.h delete mode 100644 OnlineDB/CSCCondDB/interface/CSCCableReadTest.h delete mode 100644 OnlineDB/CSCCondDB/interface/CSCxTalk.h delete mode 100644 OnlineDB/CSCCondDB/interface/SaturationFcn.h delete mode 100644 OnlineDB/EcalCondDB/interface/IConfig.h delete mode 100644 OnlineDB/EcalCondDB/interface/IRunIOV.h delete mode 100644 OnlineDB/EcalCondDB/interface/ITimeIOV.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_cali_types.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_dcu_types.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_mod_types.h delete mode 100644 OnlineDB/EcalCondDB/test/InsertDCUIdarkPed.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestChannelView.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestDCU.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestMOD.cpp diff --git a/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h b/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h deleted file mode 100644 index c6ea5fb08b964..0000000000000 --- a/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h +++ /dev/null @@ -1 +0,0 @@ -#error obsolete header diff --git a/CondCore/DTPlugins/interface/DTConfigPluginHandler.h b/CondCore/DTPlugins/interface/DTConfigPluginHandler.h deleted file mode 100644 index c6ea5fb08b964..0000000000000 --- a/CondCore/DTPlugins/interface/DTConfigPluginHandler.h +++ /dev/null @@ -1 +0,0 @@ -#error obsolete header diff --git a/CondFormats/CastorObjects/interface/AllClasses.h b/CondFormats/CastorObjects/interface/AllClasses.h deleted file mode 100644 index ac0d1349110df..0000000000000 --- a/CondFormats/CastorObjects/interface/AllClasses.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CondFormats_CastorObjects_AllClasses_h -#define CondFormats_CastorObjects_AllClasses_h -#include "CondFormats/CastorObjects/interface/AllObjects.h" -/* -class CastorPedestals; -class CastorPedestalWidths; -class CastorGains; -class CastorRawGains; -class CastorGainWidths; -class CastorQIEShape; -class CastorQIEData; -class CastorCalibrationQIEData; -class CastorChannelQuality; -class CastorElectronicsMap; -*/ -#endif diff --git a/CondFormats/Common/interface/Constants.h b/CondFormats/Common/interface/Constants.h deleted file mode 100644 index 8a4253dbcc168..0000000000000 --- a/CondFormats/Common/interface/Constants.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CondCommon_Constants_h -#define CondCommon_Constants_h -#include -#include -#include - -/* constants other than time used in cond - */ - -namespace cond { - - const std::string invalidToken(" "); - -} - -#endif //CondCommon_Constants_h diff --git a/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h b/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h b/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h b/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h b/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h b/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h b/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/HcalObjects/interface/HcalItemArrayColl.h b/CondFormats/HcalObjects/interface/HcalItemArrayColl.h deleted file mode 100644 index 40997120b675e..0000000000000 --- a/CondFormats/HcalObjects/interface/HcalItemArrayColl.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef CondFormats_HcalObjects_HcalItemArrayColl_h -#define CondFormats_HcalObjects_HcalItemArrayColl_h - -#include "boost/array.hpp" -#include "boost/serialization/access.hpp" -#include "boost/serialization/version.hpp" -#include "boost/serialization/shared_ptr.hpp" -#include "boost/serialization/vector.hpp" -#include "boost/version.hpp" -#if BOOST_VERSION < 106400 -#include "boost/serialization/array.hpp" -#else -#include "boost/serialization/boost_array.hpp" -#endif - -#include -#include -#include - -// -// This collection manages arrays of pointers and references. -// In particular, it can be used for storing objects in -// an inheritance hierarchy by their base pointers. -// The pointee objects are owned by this collection. -// -template -class HcalItemArrayColl { -public: - typedef Item value_type; - typedef std::array, N> InputArray; - static constexpr unsigned arraySize() { return N; } - - // The following method adds a new array of pointers to the collection. - // This class will take ownership of the pointee objects. - void push_back(InputArray& arr) { - StoredArray st; - for (unsigned i = 0; i < N; ++i) - st[i] = std::shared_ptr(arr[i].release()); - data_.push_back(st); - } - - // Other modifiers - inline void clear() { data_.clear(); } - inline void reserve(const unsigned n) { data_.reserve(n); } - - // Some inspectors - inline std::size_t size() const { return data_.size(); } - inline bool empty() const { return data_.empty(); } - - // The following function returns nullptr if - // one of the argument indices is out of range - inline const Item* get(const unsigned itemIndex, const unsigned arrayIndex) const { - if (itemIndex < data_.size() && arrayIndex < N) - return data_[itemIndex][arrayIndex].get(); - else - return nullptr; - } - - // The following function throws an exception if - // one of the argument indices is out of range - inline Item& at(const unsigned itemIndex, const unsigned arrayIndex) const { - return *data_.at(itemIndex).at(arrayIndex); - } - - // Deep comparison for equality is useful for testing serialization - bool operator==(const HcalItemArrayColl& r) const { - const std::size_t sz = data_.size(); - if (sz != r.data_.size()) - return false; - for (std::size_t i = 0; i < sz; ++i) - for (unsigned j = 0; j < N; ++j) - if (!(*data_[i][j] == *r.data_[i][j])) - return false; - return true; - } - - inline bool operator!=(const HcalItemArrayColl& r) const { return !(*this == r); } - -private: - typedef boost::array, N> StoredArray; - std::vector data_; - - friend class boost::serialization::access; - - template - inline void serialize(Archive& ar, unsigned /* version */) { - ar& data_; - } -}; - -// boost serialization version number for this template -namespace boost { - namespace serialization { - template - struct version > { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - } // namespace serialization -} // namespace boost - -#endif // CondFormats_HcalObjects_HcalItemArrayColl_h diff --git a/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h b/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h deleted file mode 100644 index 2c66a4860a717..0000000000000 --- a/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef CondFormats_HcalObjects_HcalItemArrayCollById_h -#define CondFormats_HcalObjects_HcalItemArrayCollById_h - -#include - -#include "FWCore/Utilities/interface/Exception.h" - -#include "CondFormats/HcalObjects/interface/HcalItemArrayColl.h" -#include "CondFormats/HcalObjects/interface/HcalIndexLookup.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "CondFormats/HcalObjects/interface/HcalDetIdTransform.h" -#include "CondFormats/HcalObjects/interface/AbsHcalAlgoData.h" - -// -// This collection allows lookup of arrays of items by HcalDetId. -// If the given HcalDetId is not explicitly listed in the -// lookup table, default item is returned. -// -// Just like HcalItemArrayColl, this collection works with pointers -// and references only, so it can be used with the inheritance -// scenarios. Note that the ownership of objects is shared with -// the collection provided in the constructor. The default array -// is owned by this collection. Its ownership will also become -// shared if a copy of this collection is made. -// -template -class HcalItemArrayCollById : public AbsHcalAlgoData { -public: - typedef Item value_type; - typedef typename HcalItemArrayColl::InputArray InputArray; - static constexpr unsigned arraySize() { return N; } - - // Dummy constructor. To be used for deserialization only. - inline HcalItemArrayCollById() : transformCode_(HcalDetIdTransform::N_TRANSFORMS) {} - - // Normal constructor - HcalItemArrayCollById(const HcalItemArrayColl& coll, - const HcalIndexLookup& indexLookupTable, - const unsigned detIdTransformCode, - InputArray& defaultFunctors) - : coll_(coll), lookup_(indexLookupTable), transformCode_(detIdTransformCode) { - // Check that the lookup table is valid for this application - if (lookup_.hasDuplicateIds()) - throw cms::Exception( - "In HcalItemArrayCollById constructor:" - " invalid lookup table"); - - // Check that the lookup table is consistent with the size - // of the collection - const unsigned maxIndex = lookup_.largestIndex(); - if (maxIndex != HcalIndexLookup::InvalidIndex && maxIndex >= coll_.size()) - throw cms::Exception( - "In HcalItemArrayCollById constructor:" - " collection and lookup table are inconsistent"); - - HcalDetIdTransform::validateCode(transformCode_); - - // Take care of the default array - setDefault(defaultFunctors); - } - - inline virtual ~HcalItemArrayCollById() {} - - // Modifier for the default array of items - inline void setDefault(InputArray& arr) { - for (unsigned i = 0; i < N; ++i) - default_[i] = std::shared_ptr(arr[i].release()); - } - - // Size of the internal collection, not counting the default - inline std::size_t size() const { return coll_.size(); } - - // Look up the index into the collection by detector id - inline unsigned getIndex(const HcalDetId& id) const { - return lookup_.find(HcalDetIdTransform::transform(id, transformCode_)); - } - - // Item lookup by its index and array index. If item lookup - // by index fails and the array index is not out of bounds, - // default item is returned. - inline const Item* getByIndex(const unsigned itemIndex, const unsigned arrayIndex) const { - const Item* f = coll_.get(itemIndex, arrayIndex); - if (f == nullptr && arrayIndex < N) - f = default_[arrayIndex].get(); - return f; - } - - // The following method will return nullptr if - // there is no corresponding default - inline const Item* getDefault(const unsigned arrayIndex) const { - if (arrayIndex < N) - return default_[arrayIndex].get(); - else - return nullptr; - } - - // Convenience function for getting what we need by id. - // Note that, if you are simply cycling over array indices, - // it will be more efficient to retrieve the item index - // first and then use "getByIndex" method. - inline const Item* get(const HcalDetId& id, const unsigned arrayIndex) const { - return getByIndex(getIndex(id), arrayIndex); - } - - // Similar comment applies here if you are just cycling over array indices - inline const Item& at(const HcalDetId& id, const unsigned arrayIndex) const { - const Item* f = getByIndex(getIndex(id), arrayIndex); - if (f == nullptr) - throw cms::Exception("In HcalItemArrayCollById::at: invalid detector id"); - return *f; - } - -protected: - virtual bool isEqual(const AbsHcalAlgoData& other) const override { - const HcalItemArrayCollById& r = static_cast(other); - if (coll_ != r.coll_) - return false; - if (lookup_ != r.lookup_) - return false; - if (transformCode_ != r.transformCode_) - return false; - for (unsigned j = 0; j < N; ++j) { - // The default may or may not be there - const bool ld = default_[j].get(); - const bool rd = r.default_[j].get(); - if (ld != rd) - return false; - if (ld) - if (!(*default_[j] == *r.default_[j])) - return false; - } - return true; - } - -private: - typedef boost::array, N> StoredArray; - - HcalItemArrayColl coll_; - HcalIndexLookup lookup_; - StoredArray default_; - uint32_t transformCode_; - - friend class boost::serialization::access; - - template - inline void serialize(Archive& ar, unsigned /* version */) { - ar& coll_& lookup_& default_& transformCode_; - } -}; - -// boost serialization version number for this template -namespace boost { - namespace serialization { - template - struct version > { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - } // namespace serialization -} // namespace boost - -#endif // CondFormats_HcalObjects_HcalItemArrayCollById_h diff --git a/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp b/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp deleted file mode 100644 index 45933afa4bbd5..0000000000000 --- a/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/** - * \file polymorphic_portable_archive.hpp - * \brief Needed for unit tests on portable archives. - * \author christian.pfligersdorffer@gmx.at - * - * Header for testing portable archives with all of the serialization tests. - * Before use copy all hpp files from this directory to your boost folder - * boost_.../libs/serialization/test and run from there a visual studio - * prompt with b2 oder bjam -sBOOST_ARCHIVE_LIST=portable_archive.hpp - * - * \note Since portable archives version 5.0 we depend on program_options! - * Edit libs/serialization/test/Jamfile.v2 and change the requirements to - * : requirements /boost/filesystem /boost/program_options - */ -/****************************************************************************/ - -#pragma warning(disable : 4217 4127 4310 4244 4800 4267) - -// text_archive test header -// include output archive header -#include "portable_oarchive.hpp" -// set name of test output archive -typedef eos::polymorphic_portable_oarchive test_oarchive; -// set name of test output stream -typedef std::ofstream test_ostream; - -// repeat the above for input archive -#include "portable_iarchive.hpp" -typedef eos::polymorphic_portable_iarchive test_iarchive; -typedef std::ifstream test_istream; - -// define open mode for streams -// binary archives should use std::ios_base::binary -#define TEST_STREAM_FLAGS std::ios_base::binary diff --git a/CondFormats/Serialization/interface/eos/portable_archive.hpp b/CondFormats/Serialization/interface/eos/portable_archive.hpp deleted file mode 100644 index f5b51ccb82cee..0000000000000 --- a/CondFormats/Serialization/interface/eos/portable_archive.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/** - * \file portable_archive.hpp - * \brief Needed for unit tests on portable archives. - * \author christian.pfligersdorffer@gmx.at - * - * Header for testing portable archives with all of the serialization tests. - * Before use copy all hpp files from this directory to your boost folder - * boost_.../libs/serialization/test and run from there a visual studio - * prompt with b2 oder bjam -sBOOST_ARCHIVE_LIST=portable_archive.hpp - * - * \note Since portable archives version 5.0 we depend on program_options! - * Edit libs/serialization/test/Jamfile.v2 and change the requirements to - * : requirements /boost/filesystem /boost/program_options - */ -/****************************************************************************/ - -#pragma warning(disable : 4217 4127 4310 4244 4800 4267) - -// text_archive test header -// include output archive header -#include "portable_oarchive.hpp" -// set name of test output archive -typedef eos::portable_oarchive test_oarchive; -// set name of test output stream -typedef std::ofstream test_ostream; - -// repeat the above for input archive -#include "portable_iarchive.hpp" -typedef eos::portable_iarchive test_iarchive; -typedef std::ifstream test_istream; - -// define open mode for streams -// binary archives should use std::ios_base::binary -#define TEST_STREAM_FLAGS std::ios_base::binary diff --git a/CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h b/CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h b/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h deleted file mode 100644 index 062fd8546863b..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - \file - Declaration of class IntercalibConstantsHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibConstantsHandler.h,v 1.1 2008/11/14 15:46:05 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibConstantsHandler_h_ -#define _CondToolsEcal_EcalIntercalibConstantsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibConstantsHandler; - -#endif diff --git a/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h b/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h deleted file mode 100644 index f92ede7ae1f35..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class InterlcalibConstantsMCHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibConstantsMCHandler.h,v 1.1 2009/04/08 15:20:25 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibConstantsMCHandler_h_ -#define _CondToolsEcal_EcalIntercalibConstantsMCHandler_h_ - - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibConstantsMCHandler; - -#endif diff --git a/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h b/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h deleted file mode 100644 index f881eb7356ebf..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - \file - Declaration of class IntercalibErrorsHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibErrorsHandler.h,v 1.1 2008/11/14 15:46:05 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibErrorsHandler_h_ -#define _CondToolsEcal_EcalIntercalibErrorsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibErrorsHandler; - -#endif // _CondToolsEcal_EcalIntercalibErrorsHandler_h_ - -// Configure (x)emacs for this file ... -// Local Variables: -// mode:c++ -// compile-command: "scram b" -// End diff --git a/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h b/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h deleted file mode 100644 index eec459e867071..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Translates a EcalIntercalibErrors record to XML - and vice versa - - \author Stefano ARGIRO - \version $Id: EcalIntercalibErrorsXMLTranslator.h,v 1.3 2009/06/30 16:15:16 argiro Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalIntercalibErrorsXMLTranslator_h_ -#define __EcalIntercalibErrorsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalIntercalibErrorsXMLTranslator; - -#endif // __EcalIntercalibErrorsXMLTranslator_h_ diff --git a/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h b/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h deleted file mode 100644 index 509ed640de898..0000000000000 --- a/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Translates a EcalPFRecHitThresholds record to XML - and vice versa - - \author Stefano ARGIRO - \version $Id: EcalPFRecHitThresholdsXMLTranslator.h,v 1.2 2009/06/30 14:40:11 argiro Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalPFRecHitThresholdsXMLTranslator_h_ -#define __EcalPFRecHitThresholdsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalPFRecHitThresholdsXMLTranslator; - -#endif // __EcalPFRecHitThresholdsXMLTranslator_h_ diff --git a/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h b/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h deleted file mode 100644 index f48c154857f93..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class EcalTimeCalibConstantsHandler - - \author Seth COOPER - \version $Id: EcalTimeCalibConstantsHandler.h,v 1.1 2009/10/26 14:14:11 scooper Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalTimeCalibConstantsHandler_h_ -#define _CondToolsEcal_EcalTimeCalibConstantsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalTimeCalibConstantsHandler; - -#endif - diff --git a/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h b/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h deleted file mode 100644 index 945623f0d7c1c..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - Translates an EcalTimeCalibConstants record to XML - and vice versa - - \author Seth COOPER - \version $Id: EcalTimeCalibConstantsXMLTranslator.h,v 1.1 2009/10/26 16:15:16 scooper Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalTimeCalibConstantsXMLTranslator_h_ -#define __EcalTimeCalibConstantsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalTimeCalibConstantsXMLTranslator; - - -#endif // __EcalTimeCalibConstantsXMLTranslator_h_ - diff --git a/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h b/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h deleted file mode 100644 index b6b829e068020..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class EcalTimeCalibErrorsHandler - - \author Seth COOPER - \version $Id: EcalTimeCalibErrorsHandler.h,v 1.1 2009/10/26 14:14:11 scooper Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalTimeCalibErrorsHandler_h_ -#define _CondToolsEcal_EcalTimeCalibErrorsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalTimeCalibErrorsHandler; - -#endif - diff --git a/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h b/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h deleted file mode 100644 index 241363a884e78..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - Translates an EcalTimeCalibErrors record to XML - and vice versa - - \author Seth COOPER - \version $Id: EcalTimeCalibErrorsXMLTranslator.h,v 1.1 2009/10/26 16:15:16 scooper Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalTimeCalibErrorsXMLTranslator_h_ -#define __EcalTimeCalibErrorsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalTimeCalibErrorsXMLTranslator; - - -#endif // __EcalTimeCalibErrorsXMLTranslator_h_ - diff --git a/CondTools/Ecal/test/testXMLTranslators.cc b/CondTools/Ecal/test/testXMLTranslators.cc deleted file mode 100644 index cde70f806f3aa..0000000000000 --- a/CondTools/Ecal/test/testXMLTranslators.cc +++ /dev/null @@ -1,472 +0,0 @@ -#include "CondTools/Ecal/interface/EcalADCToGeVXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalLinearCorrectionsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalWeightGroupXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTBWeightsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalLaserAPDPNRatiosXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h" - -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" - -#include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" - -#include "CondTools/Ecal/interface/EcalGainRatiosXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalChannelStatusXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalWeightSetXMLTranslator.h" - -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" - -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" - -#include "CondFormats/EcalObjects/interface/EcalWeightSet.h" -#include "CondTools/Ecal/interface/EcalCondHeader.h" - -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" - -#include "DataFormats/EcalDetId/interface/EBDetId.h" - - - -#include -using std::cout; -using std::endl; - -#include - -int main(){ - - // Test ADCtoGeV - - EcalCondHeader header; - EcalCondHeader header2; - - - header.method_="testmethod"; - header.version_="testversion"; - header.datasource_="testdata"; - header.since_=123; - header.tag_="testtag"; - header.date_="Mar 24 1973"; - - - - EcalADCToGeVConstant adctogev_constant; - EcalADCToGeVConstant adctogev_constant2; - - adctogev_constant.setEBValue(1.1); - adctogev_constant.setEEValue(2.2); - - std::string adctogevfile("/tmp/EcalADCToGeVConstant.xml"); - std::string adctogevfile2("/tmp/adctogev2.xml"); - - EcalADCToGeVXMLTranslator::writeXML(adctogevfile,header,adctogev_constant); - EcalADCToGeVXMLTranslator::readXML(adctogevfile,header2,adctogev_constant2); - EcalADCToGeVXMLTranslator::writeXML(adctogevfile2,header2,adctogev_constant2); - - - // Test Intercalibration - - - EcalLinearCorrections lin_constants; - EcalIntercalibConstants intercalib_constants; - EcalIntercalibErrors intercalib_errors; - - std::string linfile("/tmp/EcalLinearCorrections.xml"); - std::string intercalibfile("/tmp/EcalIntercalibConstants.xml"); - std::string intercaliberrfile("/tmp/EcalIntercalibErrors.xml"); - std::string intercalibfiledb("/tmp/EcalIntercalibConstantsDB.xml"); - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - - EcalIntercalibConstant intercalib_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalIntercalibConstant lin_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalIntercalibError intercalib_error = intercalib_constant +1; - - lin_constants[rawid]=lin_constant; - intercalib_constants[rawid]=intercalib_constant; - intercalib_errors[rawid] =intercalib_error; - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - EcalLinearCorrection lin_constant = EEDetId::unhashIndex(cellid).ix();; - EcalIntercalibConstant intercalib_constant = EEDetId::unhashIndex(cellid).ix();; - EcalIntercalibError intercalib_error = intercalib_constant +1; - - lin_constants[rawid]=lin_constant; - intercalib_constants[rawid]=intercalib_constant; - intercalib_errors[rawid]=intercalib_error; - } // if - } - - - - EcalLinearCorrectionsXMLTranslator::writeXML(linfile,header, - lin_constants); - - EcalIntercalibConstantsXMLTranslator::writeXML(intercalibfile,header, - intercalib_constants); - - EcalIntercalibErrorsXMLTranslator::writeXML(intercaliberrfile,header, - intercalib_errors); - - EcalIntercalibConstants lin_constants2; - EcalIntercalibConstants intercalib_constants2; - EcalIntercalibErrors intercalib_errors2; - - - EcalLinearCorrectionsXMLTranslator::readXML(linfile,header2, - lin_constants2); - - EcalIntercalibConstantsXMLTranslator::readXML(intercalibfile,header2, - intercalib_constants2); - - EcalIntercalibErrorsXMLTranslator::readXML(intercaliberrfile,header2, - intercalib_errors2); - - std::string linfile2("/tmp/linfile-2.xml"); - std::string intercalibfile2("/tmp/intercalibfile-2.xml"); - std::string intercaliberrfile2("/tmp/intercaliberrfile-2.xml"); - - EcalLinearCorrectionsXMLTranslator::writeXML(linfile2, - header2, - lin_constants2); - EcalIntercalibConstantsXMLTranslator::writeXML(intercalibfile2, - header2, - intercalib_constants2); - - EcalIntercalibErrorsXMLTranslator::writeXML(intercaliberrfile,header2, - intercalib_errors2); - - cout << "Done testing Intercalib abd Linear Corrections" << endl; - - // Test Timing Intercalibration - - - EcalTimeCalibConstants timeCalib_constants; - EcalTimeCalibErrors timeCalib_errors; - - std::string timeCalibFile("/tmp/EcalTimeCalibConstants.xml"); - std::string timeCalibErrFile("/tmp/EcalTimeCalibErrors.xml"); - std::string timeCalibFileDB("/tmp/EcalTimeCalibConstantsDB.xml"); - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - - EcalTimeCalibConstant timeCalib_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalTimeCalibError timeCalib_error = timeCalib_constant +1; - - timeCalib_constants[rawid]=timeCalib_constant; - timeCalib_errors[rawid] =timeCalib_error; - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - EcalTimeCalibConstant timeCalib_constant = EEDetId::unhashIndex(cellid).ix();; - EcalTimeCalibError timeCalib_error = timeCalib_constant +1; - - timeCalib_constants[rawid]=timeCalib_constant; - timeCalib_errors[rawid]=timeCalib_error; - } // if - } - - - - EcalTimeCalibConstantsXMLTranslator::writeXML(timeCalibFile,header, - timeCalib_constants); - - EcalTimeCalibErrorsXMLTranslator::writeXML(timeCalibErrFile,header, - timeCalib_errors); - - EcalTimeCalibConstants timeCalib_constants2; - EcalTimeCalibErrors timeCalib_errors2; - - - EcalTimeCalibConstantsXMLTranslator::readXML(timeCalibFile,header2, - timeCalib_constants2); - - EcalTimeCalibErrorsXMLTranslator::readXML(timeCalibErrFile,header, - timeCalib_errors2); - - std::string timeCalibFile2("/tmp/timeCalibFile-2.xml"); - std::string timeCalibErrFile2("/tmp/timeCalibErrFile-2.xml"); - - EcalTimeCalibConstantsXMLTranslator::writeXML(timeCalibFile2, - header2, - timeCalib_constants2); - - EcalTimeCalibErrorsXMLTranslator::writeXML(timeCalibErrFile2,header2, - timeCalib_errors2); - cout << "Done testing timing intercalib " << endl; - - // test xtalgroup - - EcalWeightGroupXMLTranslator grouptrans; - - EcalWeightXtalGroups groups; - - std::string groupfile("/tmp/EcalWeightXtalGroups.xml"); - - for (int cellid = 0 ; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - // a random gid - EcalXtalGroupId gid( EBDetId::unhashIndex(cellid).iphi()); - groups[rawid]=gid; - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - // a random gid - EcalXtalGroupId gid( EEDetId::unhashIndex(cellid).ix()); - groups[rawid]=gid; - } // if - } - - - - grouptrans.writeXML(groupfile,header,groups); - - EcalWeightXtalGroups groups2; - - grouptrans.readXML(groupfile,header2,groups2); - - std::string groupfile2("/tmp/group-2.xml"); - - grouptrans.writeXML(groupfile2,header2,groups2); - - cout << "Done testing groups " << endl; - - EcalGainRatiosXMLTranslator transGainRatios; - - EcalGainRatios gainratios; - - std::string filenamegr("/tmp/EcalGainRatios.xml"); - std::string newfilegr("/tmp/gainratios-2.xml"); - - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - EcalMGPAGainRatio ecalGR; - ecalGR.setGain12Over6(2.); - ecalGR.setGain6Over1(5.); - - gainratios.insert(std::make_pair(EBDetId::unhashIndex(cellid),ecalGR)); - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EE cells - - if (EEDetId::validHashIndex(cellid)){ - EcalMGPAGainRatio ecalGR; - ecalGR.setGain12Over6(2.); - ecalGR.setGain6Over1(5.); - gainratios.insert(std::make_pair(EEDetId::unhashIndex(cellid),ecalGR)); - } // if - } - - - transGainRatios.writeXML(filenamegr,header,gainratios); - - EcalGainRatios gainratios2; - transGainRatios.readXML(filenamegr,header2,gainratios2); - - - transGainRatios.writeXML(newfilegr,header2,gainratios2); - - - cout << "Done testing gainratios " << endl; - - EcalChannelStatusXMLTranslator transChannelStatus; - - EcalChannelStatus channelstatus; - - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - EcalChannelStatusCode ecalCSC = EcalChannelStatusCode(16); - - uint32_t rawid= EBDetId::unhashIndex(cellid); - - channelstatus[rawid]=ecalCSC; - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on Ee cells - - if (EEDetId::validHashIndex(cellid)){ - - uint32_t rawid= EEDetId::unhashIndex(cellid); - EcalChannelStatusCode ecalCSC = EcalChannelStatusCode(35); - channelstatus[rawid]=ecalCSC; - } // if - } - - std::string cscfile("/tmp/EcalChannelStatus.xml"); - - transChannelStatus.writeXML(cscfile,header,channelstatus); - - EcalChannelStatus channelstatus2; - - transChannelStatus.readXML(cscfile,header2,channelstatus2); - - std::string cscfile2("/tmp/cscfile-2.xml"); - - transChannelStatus.writeXML(cscfile2,header2,channelstatus2); - - - cout << "Done testing channelstatus " << endl; - - EcalTBWeightsXMLTranslator transWeight; - - EcalWeightSet weightset; - - - for(int i=0;i<3;i++) - { - for(int k=0;k<10;k++) - { - weightset.getWeightsBeforeGainSwitch()(i,k) = 1.2*k; - weightset.getWeightsAfterGainSwitch()(i,k) = 1.2*k; - } - } - - - - for(int i=0;i<10;i++) - { - for(int k=0;k<10;k++) - { - weightset.getChi2WeightsBeforeGainSwitch()(i,k) = 1.2*k; - weightset.getChi2WeightsAfterGainSwitch()(i,k) = 1.2*k; - } - } - - EcalXtalGroupId gid=1; - EcalTBWeights::EcalTDCId tid=2; - - - EcalTBWeights tbw; - tbw.setValue(gid,tid,weightset); - - - std::string filew("/tmp/EcalTBWeights.xml"); - std::string filew2("/tmp/tbweight2.xml"); - - transWeight.writeXML(filew,header,tbw); - - - EcalTBWeights tbw2; - - transWeight.readXML(filew,header2,tbw2); - - transWeight.writeXML(filew2,header2,tbw2); - - - // test laser - - std::string filelaser("/tmp/EcalLaserAPDPNratios.xml"); - std::string filelaser2("/tmp/EcalLaserAPDPNratios-2.xml"); - - EcalLaserAPDPNRatios laserrecord1; - EcalLaserAPDPNRatios laserrecord2; - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid= EBDetId::unhashIndex(cellid); - - EcalLaserAPDPNRatios::EcalLaserAPDPNpair pair; - pair.p1 =1; - pair.p2 =2; - pair.p3 =3; - - laserrecord1.setValue(rawid,pair); - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on Ee cells - - if (EEDetId::validHashIndex(cellid)){ - - uint32_t rawid= EEDetId::unhashIndex(cellid); - EcalLaserAPDPNRatios::EcalLaserAPDPNpair pair; - pair.p1 =1; - pair.p2 =2; - pair.p3 =3; - - laserrecord1.setValue(rawid,pair); - - } // if - } - - EcalLaserAPDPNRatiosXMLTranslator::writeXML(filelaser,header,laserrecord1); - EcalLaserAPDPNRatiosXMLTranslator::readXML(filelaser,header2,laserrecord2); - EcalLaserAPDPNRatiosXMLTranslator::writeXML(filelaser2,header2,laserrecord2); - return 0; -} diff --git a/CondTools/L1Trigger/interface/Interval.h b/CondTools/L1Trigger/interface/Interval.h deleted file mode 100644 index 48217473b3f37..0000000000000 --- a/CondTools/L1Trigger/interface/Interval.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef CondTools_L1Trigger_Interval_h -#define CondTools_L1Trigger_Interval_h - -#include -#include - -namespace l1t -{ - /* Template class that will be used to represnt interval from one value to another. - * In general this class is not interested in what interval mark means, most of the time - * it should be number, time or something similar - * - * This class requires that TimeType should have defined operator == and < as defined in STL. - * It is enforced via sserts that start time is less then end time under provided operator <. - * TimeType requires empty constructor. - * - * Payload should have defined copy constructor and assigment operator. - */ - template - class Interval - { - public: - /* Construncts the class with provided start and end times. Payload is created - * with default constructor. - */ - Interval (const TimeType& start, const TimeType& end) - : m_start (start), m_end (end), isInvalid (false) - { assert (m_start <= m_end); } - - /* Constructs the class with given start and end times, as well as given payload. - */ - Interval (const TimeType& start, const TimeType& end, const PayloadType& payload) - : m_start(start), m_end (end), _payload (payload), isInvalid (false) {} - - /* Sets the payload to the given one. */ - void setPayload (const PayloadType& payload) { this->_payload = payload; } - /* Returns the payload */ - const PayloadType& payload () const { return this->_payload; } - - /* Returns start time */ - const TimeType & start () const { return this->m_start; } - /* Returns end time */ - const TimeType & end () const { return this->m_end; } - - /* Static member that will define an invalid interval. Two invalid interfaces are - * always considered equal. - */ - static Interval & invalid (); - - // Operator overloading - bool operator== (const Interval & other) const - { return (this->isInvalid == true && other.isInvalid == true ) || - (this->start () == other.start ()) && (this->end () == other.end () && - this->isInvalid == other.isInvalid); } - - bool operator!= (const Interval & other) const - { return ! (*this == other); } - - protected: - /* Private data */ - TimeType m_start; - TimeType m_end; - PayloadType _payload; - - /* flag that will check if this interval is invalid */ - bool isInvalid; - }; - - /* Manages a list of intervals and provides method to find interval that contains - * some value. - * - * Template parameters are used to manage Interval class, so all requirements to these - * parameters comes from Interval class - */ - template - class IntervalManager - { - public: - /* Adds one given interval to the list of intervals. - */ - void addInterval (const Interval & interval) - { intervalMap.insert (std::make_pair (interval.start (), interval)); } - - /* Removes all stored intervals from the list - */ - void clear () { intervalMap.clear (); } - - /* Returns interval that contaisn given time. If multiple intervals exists - * any of them is returned - */ - const Interval & find (const TimeType & time) const; - - protected: - /* Information to store list of intervals */ - typedef std::map > IntervalMap; - IntervalMap intervalMap; - }; - -} // namespace - -// implementation -#include "CondTools/L1Trigger/src/Interval.icc" - -#endif diff --git a/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h b/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h deleted file mode 100644 index 5ac0c70158af1..0000000000000 --- a/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef L1RPCHWCONFIGDBWRITER -#define L1RPCHWCONFIGDBWRITER - -#include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondTools/RPC/interface/L1RPCHwConfigSourceHandler.h" - - -class L1RPCHwConfigDBWriter : public popcon::PopConAnalyzer -{ - public: - L1RPCHwConfigDBWriter(const edm::ParameterSet&); - private: - void initSource(const edm::Event& evt, const edm::EventSetup& est); - int m_validate; -}; - - -#endif diff --git a/CondTools/RPC/interface/RPCEMapDBWriter.h b/CondTools/RPC/interface/RPCEMapDBWriter.h deleted file mode 100644 index 37175c3ade0b4..0000000000000 --- a/CondTools/RPC/interface/RPCEMapDBWriter.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef RPCEMAPDBWRITER -#define RPCEMAPDBWRITER - -#include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondTools/RPC/interface/RPCEMapSourceHandler.h" - - -class RPCEMapDBWriter : public popcon::PopConAnalyzer -{ - public: - RPCEMapDBWriter(const edm::ParameterSet&); - private: - void initSource(const edm::Event& evt, const edm::EventSetup& est); - int m_validate; -}; - - -#endif diff --git a/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h b/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h deleted file mode 100644 index 115599f4b0aef..0000000000000 --- a/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiStrip_SiStripCondObjBuilderBase_H -#define CondTools_SiStrip_SiStripCondObjBuilderBase_H - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include - -template -class SiStripCondObjBuilderBase { -public: - SiStripCondObjBuilderBase(const edm::ParameterSet& pset) : _pset(pset){}; - virtual ~SiStripCondObjBuilderBase() noexcept(false){}; - - virtual void initialize(){}; - - /** Returns MetaData information in a stringstream */ - virtual void getMetaDataString(std::stringstream& ss){}; - - /** Check MetaData information in a stringstream */ - virtual bool checkForCompatibility(std::string ss) { return true; } - - /** Returns the CondObj */ - virtual void getObj(T*& obj){}; - -protected: - T* obj_; - edm::ParameterSet _pset; -}; - -#endif // CondTools_SiStrip_SiStripCondObjBuilderBase_H diff --git a/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h b/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h deleted file mode 100644 index 7e0b86c9b86d2..0000000000000 --- a/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiStrip_SiStripDepCondObjBuilderBase_H -#define CondTools_SiStrip_SiStripDepCondObjBuilderBase_H - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include - -template -class SiStripDepCondObjBuilderBase { -public: - SiStripDepCondObjBuilderBase(const edm::ParameterSet& pset) : _pset(pset){}; - virtual ~SiStripDepCondObjBuilderBase(){}; - - virtual void initialize(){}; - - /** Returns MetaData information in a stringstream */ - virtual void getMetaDataString(std::stringstream& ss){}; - - /** Check MetaData information in a stringstream */ - virtual bool checkForCompatibility(std::string ss) { return true; } - - /** Returns the CondObj */ - virtual void getObj(T*& obj, const D* depObj){}; - -protected: - T* obj_; - edm::ParameterSet _pset; -}; - -#endif // CondTools_SiStrip_SiStripDepCondObjBuilderBase_H diff --git a/OnlineDB/CSCCondDB/interface/AutoCorrMat.h b/OnlineDB/CSCCondDB/interface/AutoCorrMat.h deleted file mode 100644 index 7727adb480b82..0000000000000 --- a/OnlineDB/CSCCondDB/interface/AutoCorrMat.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Author: Stan Durkin - -*/ - -#include -#include -#define LAYERS_ma 6 -#define STRIPS_ma 80 - -class AutoCorrMat{ - - public: - - AutoCorrMat(){ - for(int i=0;i<12;i++){ - Mat[i]=0.0; - N[i]=0.0; - } - } - - ~AutoCorrMat(){} - - void zero(){ - for(int i=0;i<12;i++){ - Mat[i]=0.0; - N[i]=0.0; - } - for (int i=3;i<12;i++){ - evar[i]=1; - variance[i]=10.0; - mymean[i]=3.2; - } - evt=0; - } - - void add(int *adc){ - int pairs[12][2]={{3,3},{3,4},{4,4},{3,5},{4,5},{5,5},{4,6},{5,6},{6,6},{5,7},{6,7},{7,7}}; - double ped=(adc[0]+adc[1])/2.; - evt++; - - for(int i=3;i<8;i++){ - if(fabs(adc[i]-ped)<25.){ - evar[i]++; - mymean[i] += adc[i]-ped; - variance[i] += (adc[i]-ped)*(adc[i]-ped); - } - } - - for(int i=0;i<12;i++){ - - //Add values within 3 sigma of mean only - float threeSigma0 = 3. * sqrt(variance[pairs[i][0]]/evar[pairs[i][0]]); - float threeSigma1 = 3. * sqrt(variance[pairs[i][1]]/evar[pairs[i][1]]); - - if (fabs(adc[pairs[i][0]]-ped) -#include - - -class Conv{ - - public: - - Conv(){} - - //square wave fcn convoluted with 1/(t+2.5) - float elec(float t,float vs){ - float f; - if (t<=vs){ - f=log(t+2.5)-log(2.5); - } - else{ - f=log(t+2.5)-log(t-50+2.5); - } - return f; - }//end elec - - - //calculate single electron distribution in 6.25 ns steps - void mkbins(float vs){ - int i,k; - float t; - for(i=0;i<120;i++) conve[i]=0.0; - for(i=0;i<120;i++){ - for(k=0;k<16;k++){ - t=(6.25*i)+(k*0.625); - conve[i]=conve[i]+elec(t,vs); - } - } - } //end mkbins - - - //convolution function - void convolution(float *xleft_a, float *xleft_b, float *min_left, float *xright_a, float *xright_b, float *min_right, float *pTime){ - //void(convolution){ - - float max, cross0,cross2,min_l,min_r,sum_x=0.0,sumx2=0.; - float sum_y_left=0.0,sum_y_right=0.0,sum_xy_left=0.0,sum_xy_right=0.0; - float a_left=0.0,a_right=0.0,b_left=0.0,b_right=0.0,chi2_left=0.0,chi2_right=0.0,chi_left=0.0,chi_right=0.0; - float aleft=0.0,aright=0.0,bleft=0.0,bright=0.0; - int i,j,k,l,imax=0; - - for(l=0;l<3;l++){ - for(i=0;i<119;i++)conv[l][i]=0.0; - for(j=0;j<119;j++){ - for(k=0;k<119;k++){ - if(j+k<119)conv[l][j+k]=conv[l][j+k]+convd[l][j]*conve[k]; - } - } - } - max=0; - min_l=9999999999999999.0; - min_r=9999999999999999.0; - for(i=0;i<119;i++){ - if(conv[1][i]>max){ - max=conv[1][i]; - imax=i; - } - } - - //find the max peak time from 3 timebins when line intersects x axis a+b*x=0 -> x=-a/b - float time1=-999.0, time2=-999.0, time3=-999.0; - float data1=-999.0, data2=-999.0, data3=-999.0; - float peakTime=0.0; - - time1=imax-1; - time2=imax; - time3=imax+1; - - data1=conv[1][imax-1]; - data2=conv[1][imax]; - data3=conv[1][imax+1]; - - peakTime=(0.5)*((time1*time1*(data3-data2)+time2*time2*(data1-data3)+time3*time3*(data2-data1))/(time1*(data3-data2)+time2*(data1-data3)+time3*(data2-data1)))*6.25; - - for(l=0;l<3;l++){ - for(i=0;i<119;i++)conv[l][i]=conv[l][i]/max; - } - - int nobs = 0; - for (int j=0; j<119; j++){ - if (conv[1][j]>0.6) nobs++; - } - - for(i=0;i<119;i++){ - cross0=0.0; - cross2=0.0; - - if(conv[1][i]>0.6){ - cross0=conv[0][i]/(conv[0][i]+conv[1][i]+conv[2][i]); - cross2=conv[2][i]/(conv[0][i]+conv[1][i]+conv[2][i]); - - sum_x += i; - sum_y_left += cross0; - sum_y_right += cross2; - sumx2 += i*i; - sum_xy_left += i*cross0; - sum_xy_right += i*cross2; - } - } - - //LMS fitting straight line y=a+b*x - - bleft = ((nobs*sum_xy_left) - (sum_x * sum_y_left))/((nobs*sumx2) - (sum_x*sum_x)); - bright = ((nobs*sum_xy_right) - (sum_x * sum_y_right))/((nobs*sumx2) - (sum_x*sum_x)); - - aleft = ((sum_y_left*sumx2)-(sum_x*sum_xy_left))/((nobs*sumx2)-(sum_x*sum_x)); - aright = ((sum_y_right*sumx2)-(sum_x*sum_xy_right))/((nobs*sumx2)-(sum_x*sum_x)); - - for(i=0;i<119;i++ ){ - chi2_left += (cross0 -(aleft+(bleft*i)))*(cross0 -(aleft+(bleft*i))); - chi2_right += (cross2 -(aright+(bright*i)))*(cross2 -(aright+(bright*i))); - } - - if(chi_left -#include - - -using namespace ROOT::Minuit2; - -class SaturationFcn : public FCNBase{ - - public: - - SaturationFcn(){} - - ~SaturationFcn(){} - - - void set_data(int N,float *charge_ptr,float *adc_ptr){ - - float x[20],y[20]; - - for(int i=0;i& x) const { - double chisq = 0.0; - int N=20; - for(int i=0;i - -#include "OnlineDB/EcalCondDB/interface/IUniqueDBObject.h" - -/** - * Abstract base class for a definition object - */ -class IConfig : public IUniqueDBObject { -}; - -#endif diff --git a/OnlineDB/EcalCondDB/interface/IRunIOV.h b/OnlineDB/EcalCondDB/interface/IRunIOV.h deleted file mode 100644 index b114539609030..0000000000000 --- a/OnlineDB/EcalCondDB/interface/IRunIOV.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IRUNIOV_H -#define IRUNIOV_H - -#include -#include - -#include "OnlineDB/EcalCondDB/interface/ITag.h" - -typedef int run_t; - -class IIOV; - -class IRunIOV { -public: - virtual ~IRunIOV() {} - - virtual void fetchAt(IIOV* fillIOV, const run_t run, ITag* tag) const noexcept(false) = 0; - - virtual void fetchWithin(std::vector* fillVec, const run_t beginRun, const run_t endRun, ITag* tag) const - noexcept(false) = 0; -}; - -#endif diff --git a/OnlineDB/EcalCondDB/interface/ITimeIOV.h b/OnlineDB/EcalCondDB/interface/ITimeIOV.h deleted file mode 100644 index 7bfe3eff2c1ba..0000000000000 --- a/OnlineDB/EcalCondDB/interface/ITimeIOV.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ITIMEIOV_H -#define ITIMEIOV_H - -#include -#include - -#include "OnlineDB/EcalCondDB/interface/Tm.h" -#include "OnlineDB/EcalCondDB/interface/ITag.h" -#include "OnlineDB/EcalCondDB/interface/IIOV.h" - -class ITimeIOV { -public: - virtual ~ITimeIOV() {} - - virtual void fetchAt(IIOV* fillIOV, const Tm eventTm, ITag* tag) const noexcept(false) = 0; - - virtual void fetchWithin(std::vector* fillVec, const Tm beginTm, const Tm endTm, ITag* tag) const - noexcept(false) = 0; -}; - -#endif diff --git a/OnlineDB/EcalCondDB/interface/all_cali_types.h b/OnlineDB/EcalCondDB/interface/all_cali_types.h deleted file mode 100644 index 9f653882c73e9..0000000000000 --- a/OnlineDB/EcalCondDB/interface/all_cali_types.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "OnlineDB/EcalCondDB/interface/CaliTag.h" -#include "OnlineDB/EcalCondDB/interface/CaliIOV.h" -#include "OnlineDB/EcalCondDB/interface/CaliGeneralDat.h" -#include "OnlineDB/EcalCondDB/interface/CaliCrystalIntercalDat.h" -#include "OnlineDB/EcalCondDB/interface/CaliHVScanRatioDat.h" -#include "OnlineDB/EcalCondDB/interface/CaliGainRatioDat.h" -#include "OnlineDB/EcalCondDB/interface/CaliTempDat.h" diff --git a/OnlineDB/EcalCondDB/interface/all_dcu_types.h b/OnlineDB/EcalCondDB/interface/all_dcu_types.h deleted file mode 100644 index d739ae4adc7ea..0000000000000 --- a/OnlineDB/EcalCondDB/interface/all_dcu_types.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "OnlineDB/EcalCondDB/interface/DCUTag.h" -#include "OnlineDB/EcalCondDB/interface/DCUCCSDat.h" -#include "OnlineDB/EcalCondDB/interface/DCUIOV.h" -#include "OnlineDB/EcalCondDB/interface/DCUCapsuleTempDat.h" -#include "OnlineDB/EcalCondDB/interface/DCUCapsuleTempRawDat.h" -#include "OnlineDB/EcalCondDB/interface/DCUIDarkDat.h" -#include "OnlineDB/EcalCondDB/interface/DCUIDarkPedDat.h" -#include "OnlineDB/EcalCondDB/interface/DCUVFETempDat.h" -#include "OnlineDB/EcalCondDB/interface/DCULVRTempsDat.h" -#include "OnlineDB/EcalCondDB/interface/DCULVRBTempsDat.h" -#include "OnlineDB/EcalCondDB/interface/DCULVRVoltagesDat.h" diff --git a/OnlineDB/EcalCondDB/interface/all_mod_types.h b/OnlineDB/EcalCondDB/interface/all_mod_types.h deleted file mode 100644 index 2755198814870..0000000000000 --- a/OnlineDB/EcalCondDB/interface/all_mod_types.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ALLMOD -#define ALLMOD - -#include "OnlineDB/EcalCondDB/interface/RunTag.h" -#include "OnlineDB/EcalCondDB/interface/RunIOV.h" -#include "OnlineDB/EcalCondDB/interface/MODRunIOV.h" -#include "OnlineDB/EcalCondDB/interface/RunDat.h" -#include "OnlineDB/EcalCondDB/interface/RunCommentDat.h" -#include "OnlineDB/EcalCondDB/interface/RunPTMTempDat.h" -#include "OnlineDB/EcalCondDB/interface/RunConfigDat.h" -#include "OnlineDB/EcalCondDB/interface/RunFEConfigDat.h" -#include "OnlineDB/EcalCondDB/interface/RunTPGConfigDat.h" -#include "OnlineDB/EcalCondDB/interface/RunH4TablePositionDat.h" -#include "OnlineDB/EcalCondDB/interface/MODCCSTRDat.h" -#include "OnlineDB/EcalCondDB/interface/MODCCSFEDat.h" -#include "OnlineDB/EcalCondDB/interface/MODCCSHFDat.h" -#include "OnlineDB/EcalCondDB/interface/MODDCCOperationDat.h" -#include "OnlineDB/EcalCondDB/interface/MODDCCDetailsDat.h" -#endif - - diff --git a/OnlineDB/EcalCondDB/test/InsertDCUIdarkPed.cpp b/OnlineDB/EcalCondDB/test/InsertDCUIdarkPed.cpp deleted file mode 100644 index e6e7dcc935bda..0000000000000 --- a/OnlineDB/EcalCondDB/test/InsertDCUIdarkPed.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "OnlineDB/EcalCondDB/interface/all_dcu_types.h" - - -using namespace std; -using std::string; - -class CondDBApp { -public: - - /** - * App constructor; Makes the database connection - */ - CondDBApp( string sid, string user, string pass) - { - try { - cout << "Making connection..." << flush; - econn = new EcalCondDBInterface( sid, user, pass ); - cout << "Done." << endl; - } catch (runtime_error &e) { - cerr << e.what() << endl; - exit(-1); - } - - locations[0] = "H4"; - locations[1] = "867-1"; - locations[2] = "867-2"; - locations[3] = "867-3"; - } - - - - /** - * App destructor; Cleans up database connection - */ - ~CondDBApp() - { - delete econn; - } - - - - DCUIOV makeDCUIOV() - { - LocationDef locdef; - locdef.setLocation("P5_Co"); - DCUTag dcutag; - dcutag.setLocationDef(locdef); - dcutag.setGeneralTag("IDarkPedestalsRun"); - - // Our beginning time will be the current GMT time - // This is the time zone that should be written to the DB! - // (Actually UTC) - Tm since; - since.setToCurrentGMTime(); - - // Our beginning run number will be the seconds representation - // of that time, and we will increment our IoV based on - // a microsecond representation - uint64_t microseconds = since.microsTime(); - startmicros = microseconds; - - // Set the properties of the iov - DCUIOV dcuiov; - - dcuiov.setSince(since); - dcuiov.setDCUTag(dcutag); - - return dcuiov; - } - - - - /** - * Write objects with associated DCUIOVs - * IOVs are written using automatic updating of the 'till', as if - * the time of the end of the run was not known at the time of writing. - */ - - void testWrite(std::string filename) - { - - float temp_vec[61200]; - int ih4_vec[61200]; - int ih4; - float temp; - - for(int ic=0; ic<61200; ic++){ - temp_vec[ic]=0; - ih4_vec[ic]=0; - } - - - cout << "read IDark Pedestal file " << filename << endl; - - - FILE *fin; // input file - fin = fopen(filename.c_str(),"r"); - - char line[256]; - - fgets(line,255,fin); // first is the comment line - - - while(fgets(line,255,fin)) - { - - std::string EBorEE; - std::stringstream aStrStream; - aStrStream << line; - - int ism=0; - aStrStream >> EBorEE >> ism>> ih4 >> temp; - - ih4=ih4-1; // in the file ih4 follows the electronics numbering but plus one - - if (EBorEE == "EB-") ism=ism+18; - - int ic=(ism-1)*1700+ih4; - - temp_vec[ic]=temp; - ih4_vec[ic]=ih4; - - } - fclose(fin); - - - - cout << "Writing DCUCapsuleTempDat objects to database..." << endl; - cout << "Making a DCUIOV..." << flush; - DCUIOV dcuiov = this->makeDCUIOV(); - cout << "Done." << endl; - - this->printIOV(&dcuiov); - - Tm eventTm = dcuiov.getSince(); - DCUTag dcutag = dcuiov.getDCUTag(); - - // Get channel ID for SM 10, crystal c - // int c = 1; - // EcalLogicID ecid; - - cout << "Loading ecal logic id from DB" << endl; - vector ecid_vec; - ecid_vec = econn->getEcalLogicIDSetOrdered("EB_elec_crystal_number", 1, 36, 0, 1699, - EcalLogicID::NULLID,EcalLogicID::NULLID, - "EB_elec_crystal_number",12); - - - map dataset; - - - for (int c=0; c<61200; c++){ - // the channels are turned in phi and eta - - DCUIDarkPedDat capTemp; - capTemp.setPed(temp_vec[c]); - // Fill the dataset - dataset[ecid_vec[c]] = capTemp; - - } - - // Insert the dataset, identifying by iov - cout << "Inserting dataset..." << flush; - econn->insertDataArraySet(&dataset, &dcuiov); - cout << "Done." << endl; - - }; - - - - /** - * Write a data set - */ - template - void testTable(DATT* data, IOVT* iov, EcalLogicID* ecid) - { - tablesTried++; - try { - cout << "Table " << tablesTried << "..." << flush; - map dataset; - dataset[*ecid] = *data; - econn->insertDataSet(&dataset, iov); - cout << "write OK..." << flush; - dataset.clear(); - econn->fetchDataSet(&dataset, iov); - if (!dataset.size()) { - throw(runtime_error("Zero rows read back")); - } - cout << "read OK" << endl; - tablesOK++; - } catch (runtime_error &e) { - cout << "testTable FAILED: " << e.what() << endl; - } catch (...) { - cout << "testTable FAILED: unknown exception" << endl; - } - } - - - - /** - * Write to each of the data tables - */ - void testAllTables() - { - cout << "Testing writing to all tables..." << endl; - tablesTried = 0; - tablesOK = 0; - - // get a dummy logic ID - EcalLogicID logicID = econn->getEcalLogicID(-1); - - // DCUIOV tables - DCUIOV dcuiov = this->makeDCUIOV(); - - DCUCapsuleTempDat table01; - testTable(&table01, &dcuiov, &logicID); - - DCUCapsuleTempRawDat table02; - testTable(&table02, &dcuiov, &logicID); - - DCUIDarkDat table03; - testTable(&table03, &dcuiov, &logicID); - - DCUIDarkPedDat table04; - testTable(&table04, &dcuiov, &logicID); - - DCUVFETempDat table05; - testTable(&table05, &dcuiov, &logicID); - - DCULVRTempsDat table06; - testTable(&table06, &dcuiov, &logicID); - - DCULVRBTempsDat table07; - testTable(&table07, &dcuiov, &logicID); - - DCULVRVoltagesDat table08; - testTable(&table08, &dcuiov, &logicID); - - cout << "Test of writing to all tables complete" << endl; - cout << tablesOK << " of " << tablesTried << " written to successfully" << endl << endl << endl; - }; - - - -private: - CondDBApp(); // hidden default constructor - EcalCondDBInterface* econn; - string locations[4]; - uint64_t startmicros; - uint64_t endmicros; - run_t startrun; - run_t endrun; - - int tablesTried; - int tablesOK; - - /** - * Iterate through the dataset and print some data - */ - void printDataSet( const map* dataset, int limit = 0 ) const - { - cout << "==========printDataSet()" << endl; - if (dataset->size() == 0) { - cout << "No data in map!" << endl; - } - EcalLogicID ecid; - DCUCapsuleTempDat capsTemp; - - int count = 0; - typedef map< EcalLogicID, DCUCapsuleTempDat >::const_iterator CI; - for (CI p = dataset->begin(); p != dataset->end(); p++) { - count++; - if (limit && count > limit) { return; } - ecid = p->first; - capsTemp = p->second; - - cout << "SM: " << ecid.getID1() << endl; - cout << "Xtal: " << ecid.getID2() << endl; - cout << "capsule temp: " << capsTemp.getCapsuleTemp() << endl; - cout << "========================" << endl; - } - cout << endl; - } - - - /** - * Print out a DCUTag - */ - void printTag( const DCUTag* tag) const - { - cout << endl; - cout << "=============DCUTag:" << endl; - cout << "GeneralTag: " << tag->getGeneralTag() << endl; - cout << "Location: " << tag->getLocationDef().getLocation() << endl; - cout << "====================" << endl; - } - - void printIOV( const DCUIOV* iov) const - { - cout << endl; - cout << "=============DCUIOV:" << endl; - DCUTag tag = iov->getDCUTag(); - printTag(&tag); - cout << "since: " << iov->getSince().str() << endl; - cout << "till: " << iov->getTill().str() << endl; - cout << "====================" << endl; - } -}; - - - -int main (int argc, char* argv[]) -{ - string filename; - string sid; - string user; - string pass; - - - if (argc != 5) { - cout << "Usage:" << endl; - cout << " " << argv[0] << " " << endl; - exit(-1); - } - - sid = argv[1]; - user = argv[2]; - pass = argv[3]; - filename=argv[4]; - - try { - CondDBApp app(sid, user, pass); - - app.testWrite(filename); - - } catch (exception &e) { - cout << "ERROR: " << e.what() << endl; - } catch (...) { - cout << "Unknown error caught" << endl; - } - - cout << "All Done." << endl; - - return 0; -} diff --git a/OnlineDB/EcalCondDB/test/TestChannelView.cpp b/OnlineDB/EcalCondDB/test/TestChannelView.cpp deleted file mode 100644 index d3b8cb918a53c..0000000000000 --- a/OnlineDB/EcalCondDB/test/TestChannelView.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include -#include - -#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "OnlineDB/EcalCondDB/interface/all_dcu_types.h" - - -using namespace std; - -class CondDBApp { -public: - - /** - * App constructor; Makes the database connection - */ - CondDBApp( string sid, string user, string pass) - { - try { - cout << "Making connection..." << flush; - econn = new EcalCondDBInterface( sid, user, pass ); - cout << "Done." << endl; - } catch (runtime_error &e) { - cerr << e.what() << endl; - exit(-1); - } - - locations[0] = "H4"; - locations[1] = "867-1"; - locations[2] = "867-2"; - locations[3] = "867-3"; - } - - - - /** - * App destructor; Cleans up database connection - */ - ~CondDBApp() - { - delete econn; - } - - - /** - * test read - */ - void test() { - cout << "test of the channelview table..." << endl; - - - - // Get channel ID for SM 10, crystal c - // int c = 1; - // EcalLogicID ecid; - vector ecid_vec; - ecid_vec = econn->getEcalLogicIDSet("EB_elec_crystal_number", 10, 10, 1, 10,EcalLogicID::NULLID, EcalLogicID::NULLID,"EB_crystal_number"); - // ecid = econn->getEcalLogicID("EB_crystal_number", 10, c); - for (int i=0; i<(int)ecid_vec.size() ; i++){ - int id1=ecid_vec[i].getID1(); - int id2=ecid_vec[i].getID2(); - int log_id=ecid_vec[i].getLogicID(); - cout << "id1="< " << endl; - exit(-1); - } - - host = argv[1]; - sid = argv[2]; - user = argv[3]; - pass = argv[4]; - - try { - CondDBApp app(sid, user, pass); - - app.test(); - } catch (exception &e) { - cout << "ERROR: " << e.what() << endl; - } catch (...) { - cout << "Unknown error caught" << endl; - } - - cout << "All Done." << endl; - - return 0; -} diff --git a/OnlineDB/EcalCondDB/test/TestDCU.cpp b/OnlineDB/EcalCondDB/test/TestDCU.cpp deleted file mode 100644 index 3c052c5ffe260..0000000000000 --- a/OnlineDB/EcalCondDB/test/TestDCU.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include -#include -#include -#include -#include - -#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "OnlineDB/EcalCondDB/interface/all_dcu_types.h" - - -using namespace std; - -class CondDBApp { -public: - - /** - * App constructor; Makes the database connection - */ - CondDBApp( string sid, string user, string pass) - { - try { - cout << "Making connection..." << flush; - econn = new EcalCondDBInterface( sid, user, pass ); - cout << "Done." << endl; - } catch (runtime_error &e) { - cerr << e.what() << endl; - exit(-1); - } - - locations[0] = "H4"; - locations[1] = "867-1"; - locations[2] = "867-2"; - locations[3] = "867-3"; - } - - - - /** - * App destructor; Cleans up database connection - */ - ~CondDBApp() - { - delete econn; - } - - - - DCUIOV makeDCUIOV() - { - LocationDef locdef; - locdef.setLocation(locations[3]); - DCUTag dcutag; - dcutag.setLocationDef(locdef); - - - // Our beginning time will be the current GMT time - // This is the time zone that should be written to the DB! - // (Actually UTC) - Tm since; - since.setToCurrentGMTime(); - - // Our beginning run number will be the seconds representation - // of that time, and we will increment our IoV based on - // a microsecond representation - uint64_t microseconds = since.microsTime(); - startmicros = microseconds; - - // Set the properties of the iov - DCUIOV dcuiov; - - dcuiov.setSince(since); - dcuiov.setDCUTag(dcutag); - - return dcuiov; - } - - - - /** - * Write objects with associated DCUIOVs - * IOVs are written using automatic updating of the 'till', as if - * the time of the end of the run was not known at the time of writing. - */ - void testWrite() - { - cout << "Writing DCUCapsuleTempDat objects to database..." << endl; - cout << "Making a DCUIOV..." << flush; - DCUIOV dcuiov = this->makeDCUIOV(); - cout << "Done." << endl; - - this->printIOV(&dcuiov); - - Tm eventTm = dcuiov.getSince(); - DCUTag dcutag = dcuiov.getDCUTag(); - - // Get channel ID for SM 10, crystal c - // int c = 1; - // EcalLogicID ecid; - vector ecid_vec; - ecid_vec = econn->getEcalLogicIDSet("EB_crystal_number", 10, 10, 1, 1700); - // ecid = econn->getEcalLogicID("EB_crystal_number", 10, c); - - - - map dataset; - int count=0; - for (int c=1; c<1701; c++){ - // the channels are turned in phi and eta - DCUCapsuleTempDat capTemp; - - int i = 1; - float val = 0.11111 + i; - capTemp.setCapsuleTemp(val); - - // Fill the dataset - dataset[ecid_vec[count]] = capTemp; - - count++; - } - - // Insert the dataset, identifying by iov - cout << "Inserting dataset..." << flush; - econn->insertDataArraySet(&dataset, &dcuiov); - cout << "Done." << endl; - - // Fetch it back - cout << "Fetching dataset..." << flush; - dataset.clear(); - econn->fetchDataSet(&dataset, &dcuiov); - cout << "retrieved " << dataset.size() << " channel-value pairs" << endl; - printDataSet(&dataset); - - // Fetch back DCUIOV just written - cout << "Fetching IOV just written..." << flush; - DCUIOV dcuiov_prime = econn->fetchDCUIOV(&dcutag, eventTm); - cout << "Done." << endl << endl << endl; - this->printIOV(&dcuiov_prime); - }; - - - - /** - * Write a data set - */ - template - void testTable(DATT* data, IOVT* iov, EcalLogicID* ecid) - { - tablesTried++; - try { - cout << "Table " << tablesTried << "..." << flush; - map dataset; - dataset[*ecid] = *data; - econn->insertDataSet(&dataset, iov); - cout << "write OK..." << flush; - dataset.clear(); - econn->fetchDataSet(&dataset, iov); - if (!dataset.size()) { - throw(runtime_error("Zero rows read back")); - } - cout << "read OK" << endl; - tablesOK++; - } catch (runtime_error &e) { - cout << "testTable FAILED: " << e.what() << endl; - } catch (...) { - cout << "testTable FAILED: unknown exception" << endl; - } - } - - - - /** - * Write to each of the data tables - */ - void testAllTables() - { - cout << "Testing writing to all tables..." << endl; - tablesTried = 0; - tablesOK = 0; - - // get a dummy logic ID - EcalLogicID logicID = econn->getEcalLogicID(-1); - - // DCUIOV tables - DCUIOV dcuiov = this->makeDCUIOV(); - - DCUCapsuleTempDat table01; - testTable(&table01, &dcuiov, &logicID); - - DCUCapsuleTempRawDat table02; - testTable(&table02, &dcuiov, &logicID); - - DCUIDarkDat table03; - testTable(&table03, &dcuiov, &logicID); - - DCUIDarkPedDat table04; - testTable(&table04, &dcuiov, &logicID); - - DCUVFETempDat table05; - testTable(&table05, &dcuiov, &logicID); - - DCULVRTempsDat table06; - testTable(&table06, &dcuiov, &logicID); - - DCULVRBTempsDat table07; - testTable(&table07, &dcuiov, &logicID); - - DCULVRVoltagesDat table08; - testTable(&table08, &dcuiov, &logicID); - - cout << "Test of writing to all tables complete" << endl; - cout << tablesOK << " of " << tablesTried << " written to successfully" << endl << endl << endl; - }; - - - -private: - CondDBApp(); // hidden default constructor - EcalCondDBInterface* econn; - string locations[4]; - uint64_t startmicros; - uint64_t endmicros; - run_t startrun; - run_t endrun; - - int tablesTried; - int tablesOK; - - /** - * Iterate through the dataset and print some data - */ - void printDataSet( const map* dataset, int limit = 0 ) const - { - cout << "==========printDataSet()" << endl; - if (dataset->size() == 0) { - cout << "No data in map!" << endl; - } - EcalLogicID ecid; - DCUCapsuleTempDat capsTemp; - - int count = 0; - typedef map< EcalLogicID, DCUCapsuleTempDat >::const_iterator CI; - for (CI p = dataset->begin(); p != dataset->end(); p++) { - count++; - if (limit && count > limit) { return; } - ecid = p->first; - capsTemp = p->second; - - cout << "SM: " << ecid.getID1() << endl; - cout << "Xtal: " << ecid.getID2() << endl; - cout << "capsule temp: " << capsTemp.getCapsuleTemp() << endl; - cout << "========================" << endl; - } - cout << endl; - } - - - /** - * Print out a DCUTag - */ - void printTag( const DCUTag* tag) const - { - cout << endl; - cout << "=============DCUTag:" << endl; - cout << "GeneralTag: " << tag->getGeneralTag() << endl; - cout << "Location: " << tag->getLocationDef().getLocation() << endl; - cout << "====================" << endl; - } - - void printIOV( const DCUIOV* iov) const - { - cout << endl; - cout << "=============DCUIOV:" << endl; - DCUTag tag = iov->getDCUTag(); - printTag(&tag); - cout << "since: " << iov->getSince().str() << endl; - cout << "till: " << iov->getTill().str() << endl; - cout << "====================" << endl; - } -}; - - - -int main (int argc, char* argv[]) -{ - string host; - string sid; - string user; - string pass; - - if (argc != 5) { - cout << "Usage:" << endl; - cout << " " << argv[0] << " " << endl; - exit(-1); - } - - host = argv[1]; - sid = argv[2]; - user = argv[3]; - pass = argv[4]; - - try { - CondDBApp app(sid, user, pass); - - app.testWrite(); - app.testAllTables(); - } catch (exception &e) { - cout << "ERROR: " << e.what() << endl; - } catch (...) { - cout << "Unknown error caught" << endl; - } - - cout << "All Done." << endl; - - return 0; -} diff --git a/OnlineDB/EcalCondDB/test/TestMOD.cpp b/OnlineDB/EcalCondDB/test/TestMOD.cpp deleted file mode 100644 index cb21a155d3074..0000000000000 --- a/OnlineDB/EcalCondDB/test/TestMOD.cpp +++ /dev/null @@ -1,265 +0,0 @@ -#include -#include -#include -#include -#include -#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "OnlineDB/EcalCondDB/interface/all_mod_types.h" - - -using namespace std; - -class CondDBApp { -public: - - /** - * App constructor; Makes the database connection - */ - CondDBApp(string host, string sid, string user, string pass) - { - try { - cout << "Making connection..." << flush; - econn = new EcalCondDBInterface( sid, user, pass ); - cout << "Done." << endl; - } catch (runtime_error &e) { - cerr << e.what() << endl; - exit(-1); - } - - locations[0] = "H4"; - locations[1] = "867-1"; - locations[2] = "867-2"; - locations[3] = "867-3"; - } - - - - /** - * App destructor; Cleans up database connection - */ - ~CondDBApp() - { - delete econn; - } - - - RunIOV makeRunIOV() - { - // The objects necessary to identify a dataset - LocationDef locdef; - RunTypeDef rundef; - RunTag runtag; - - locdef.setLocation(locations[3]); - - rundef.setRunType("TEST"); - - runtag.setLocationDef(locdef); - runtag.setRunTypeDef(rundef); - - // Our beginning time will be the current GMT time - // This is the time zone that should be written to the DB! - // (Actually UTC) - Tm startTm; - startTm.setToCurrentGMTime(); - - // Our beginning run number will be the seconds representation - // of that time, and we will increment our IoV based on - // a microsecond representation - uint64_t microseconds = startTm.microsTime(); - startmicros = microseconds; - run_t run = (int)(microseconds/1000000); - startrun = run; - - cout << "Starting Time: " << startTm.str() << endl; - cout << "Starting Micros: " << startmicros << endl; - cout << "Starting Run: " << startrun << endl; - - // Set the properties of the iov - RunIOV runiov; - - startTm.setToMicrosTime(microseconds); - cout << "Setting run " << run << " run_start " << startTm.str() << endl; - runiov.setRunNumber(run); - runiov.setRunStart(startTm); - runiov.setRunTag(runtag); - - return runiov; - } - - - MODRunIOV makeMODRunIOV(RunIOV* runiov) - { - MODRunIOV modiov; - modiov.setRunIOV(*runiov); - modiov.setSubRunNumber(0); - modiov.setSubRunStart(runiov->getRunStart()); - - return modiov; - } - - - - /** - * Write MODCCSTRDat objects with associated RunIOVs - * IOVs are written using automatic updating of the 'RunEnd', as if - * the time of the end of the run was not known at the time of writing. - */ - void testWrite() - { - cout << "Writing MODCCSTRDat to database..." << endl; - RunIOV runiov = this->makeRunIOV(); - RunTag runtag = runiov.getRunTag(); - run_t run = runiov.getRunNumber(); - - // write to the DB - cout << "Inserting run..." << flush; - econn->insertRunIOV(&runiov); - cout << "Done." << endl; - printIOV(&runiov); - - // fetch it back - cout << "Fetching run by tag just used..." << flush; - RunIOV runiov_prime = econn->fetchRunIOV(&runtag, run); - cout << "Done." << endl; - printIOV(&runiov_prime); - cout << "Fetching run by location..." << flush; - RunIOV runiov_prime2 = econn->fetchRunIOV(runtag.getLocationDef().getLocation(), run); - cout << "Done." << endl; - printIOV(&runiov_prime2); - - // MODitoring Tag and IOV - MODRunIOV modiov = this->makeMODRunIOV(&runiov); - - // Get channel ID for SM 10, crystal c - int c = 1; - EcalLogicID ecid; - ecid = econn->getEcalLogicID("EB_token_ring", 10, c); - - // Set the data - /* MODCCSTRDat d; - map dataset; - int i = 1112287340; - d.setWord(i); - dataset[ecid] = d; - // Insert the dataset, identifying by iov - cout << "Inserting dataset..." << flush; - econn->insertDataSet(&dataset, &modiov); - cout << "Done." << endl; - */ - - // Set the data - MODCCSHFDat dhf; - map datasethf; - std::string fname="/u1/fra/test.txt"; - dhf.setFile(fname); - dhf.setTest(123); - std::cout<< "here it is: " <insertDataSet(&datasethf, &modiov); - cout << "Done." << endl; - - // Fetch it back - /* cout << "Fetching dataset..." << flush; - dataset.clear(); - econn->fetchDataSet(&dataset, &modiov); - cout << "retrieved " << dataset.size() << " channel-value pairs" << endl; - */ - - cout << "Done." << endl << endl << endl; - }; - - - - /** - * Write a data set - */ - template - void testTable(DATT* data, IOVT* iov, EcalLogicID* ecid) - { - tablesTried++; - try { - cout << "Table " << tablesTried << "..." << flush; - map dataset; - dataset[*ecid] = *data; - econn->insertDataSet(&dataset, iov); - cout << "write OK..." << flush; - dataset.clear(); - econn->fetchDataSet(&dataset, iov); - if (!dataset.size()) { - throw(runtime_error("Zero rows read back")); - } - cout << "read OK" << endl; - tablesOK++; - } catch (runtime_error &e) { - cout << "testTable FAILED: " << e.what() << endl; - } catch (...) { - cout << "testTable FAILED: unknown exception" << endl; - } - } - - - - -private: - CondDBApp(); // hidden default constructor - EcalCondDBInterface* econn; - string locations[4]; - uint64_t startmicros; - uint64_t endmicros; - run_t startrun; - run_t endrun; - - int tablesTried; - int tablesOK; - - - void printIOV( const RunIOV* iov) const - { - cout << endl; - cout << "=============RunIOV:" << endl; - RunTag tag = iov->getRunTag(); - - cout << "Run Number: " << iov->getRunNumber() << endl; - cout << "Run Start: " << iov->getRunStart().str() << endl; - cout << "Run End: " << iov->getRunEnd().str() << endl; - cout << "====================" << endl; - } -}; - - - -int main (int argc, char* argv[]) -{ - string host; - string sid; - string user; - string pass; - - if (argc != 5) { - cout << "Usage:" << endl; - cout << " " << argv[0] << " " << endl; - exit(-1); - } - - host = argv[1]; - sid = argv[2]; - user = argv[3]; - pass = argv[4]; - - try { - CondDBApp app(host, sid, user, pass); - - app.testWrite(); - } catch (exception &e) { - cout << "ERROR: " << e.what() << endl; - } catch (...) { - cout << "Unknown error caught" << endl; - } - - cout << "All Done." << endl; - - return 0; -} From a1785849806404aa236d474a36312f6a5a16b84c Mon Sep 17 00:00:00 2001 From: yeckang Date: Wed, 18 Aug 2021 17:26:27 +0200 Subject: [PATCH 040/923] Applying comment from perrotta (initializing isMatched as false) --- Validation/MuonGEMDigis/src/GEMDigiMatcher.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc b/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc index 87bd828869bd5..573f58cb47b4c 100644 --- a/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc +++ b/Validation/MuonGEMDigis/src/GEMDigiMatcher.cc @@ -215,7 +215,7 @@ void GEMDigiMatcher::matchClustersToSimTrack(const GEMPadDigiClusterCollection& auto clusters_in_det = clusters.get(p_id); for (auto cluster = clusters_in_det.first; cluster != clusters_in_det.second; ++cluster) { - bool isMatched; + bool isMatched = false; // ignore 16-partition GE2/1 pads if (p_id.isGE21() and cluster->nPartitions() == GEMPadDigiCluster::GE21SplitStrip) From aee5ef297db1fdd7d69de191c9445bb731c6cc02 Mon Sep 17 00:00:00 2001 From: Mariana Date: Wed, 18 Aug 2021 17:32:48 +0200 Subject: [PATCH 041/923] removed unused code; removed auxiliary variable fltr --- HLTrigger/special/plugins/HLTPPSCalFilter.cc | 75 +++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/HLTrigger/special/plugins/HLTPPSCalFilter.cc b/HLTrigger/special/plugins/HLTPPSCalFilter.cc index 683f282778756..aa0d3038c4d1c 100644 --- a/HLTrigger/special/plugins/HLTPPSCalFilter.cc +++ b/HLTrigger/special/plugins/HLTPPSCalFilter.cc @@ -25,9 +25,7 @@ #include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" -#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" // pixel -#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" // strip -#include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h" // diamond +#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" // pixel #include @@ -43,12 +41,6 @@ class HLTPPSCalFilter : public edm::global::EDFilter<> { edm::InputTag pixelLocalTrackInputTag_; // Input tag identifying the pixel detector edm::EDGetTokenT> pixelLocalTrackToken_; - edm::InputTag stripLocalTrackInputTag_; // Input tag identifying the strip detector - edm::EDGetTokenT> stripLocalTrackToken_; - - edm::InputTag diamondLocalTrackInputTag_; // Input tag identifying the diamond detector - edm::EDGetTokenT> diamondLocalTrackToken_; - int minTracks_; int maxTracks_; @@ -60,10 +52,6 @@ void HLTPPSCalFilter::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add("pixelLocalTrackInputTag", edm::InputTag("ctppsPixelLocalTracks")) ->setComment("input tag of the pixel local track collection"); - desc.add("stripLocalTrackInputTag", edm::InputTag("totemRPLocalTrackFitter")) - ->setComment("input tag of the strip local track collection"); - desc.add("diamondLocalTrackInputTag", edm::InputTag("ctppsDiamondLocalTracks")) - ->setComment("input tag of the diamond local track collection"); desc.add("minTracks", 1)->setComment("minimum number of tracks in pot"); desc.add("maxTracks", -1)->setComment("maximum number of tracks in pot"); @@ -79,12 +67,6 @@ HLTPPSCalFilter::HLTPPSCalFilter(const edm::ParameterSet& iConfig) : pixelLocalTrackInputTag_(iConfig.getParameter("pixelLocalTrackInputTag")), pixelLocalTrackToken_(consumes>(pixelLocalTrackInputTag_)), - stripLocalTrackInputTag_(iConfig.getParameter("stripLocalTrackInputTag")), - stripLocalTrackToken_(consumes>(stripLocalTrackInputTag_)), - - diamondLocalTrackInputTag_(iConfig.getParameter("diamondLocalTrackInputTag")), - diamondLocalTrackToken_(consumes>(diamondLocalTrackInputTag_)), - minTracks_(iConfig.getParameter("minTracks")), maxTracks_(iConfig.getParameter("maxTracks")), @@ -96,8 +78,6 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event // maps for assigning filter pass / fail std::unordered_map pixel_filter_; - std::unordered_map strip_filter_; - std::unordered_map diam_filter_; // pixel map definition pixel_filter_[CTPPSPixelDetId(0, 0, 3)] = false; @@ -105,10 +85,7 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event pixel_filter_[CTPPSPixelDetId(1, 0, 3)] = false; pixel_filter_[CTPPSPixelDetId(1, 2, 3)] = false; - // strip map definition - // diamond map definition - - // First filter on pixels (2017+) selection + // filter on pixels (2017+) selection if (!pixel_filter_.empty()) { edm::Handle> pixelTracks; iEvent.getByToken(pixelLocalTrackToken_, pixelTracks); @@ -117,14 +94,16 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event if (pixel_filter_.count(rpv.id) == 0) { continue; } - auto& fltr = pixel_filter_.at(rpv.id); - fltr = true; + // assume pass condition if there is at least one track + pixel_filter_.at(rpv.id) = true; + // count number of valid tracks const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); + // fail condition if ntrks not within minTracks, maxTracks values if (minTracks_ > 0 && ntrks < minTracks_) - fltr = false; + pixel_filter_.at(rpv.id) = false; if (maxTracks_ > 0 && ntrks > maxTracks_) - fltr = false; + pixel_filter_.at(rpv.id) = false; } // compilation of filter conditions @@ -137,44 +116,6 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event } } - // Then filter on strips (2016-17) selection - if (!strip_filter_.empty()) { - edm::Handle> stripTracks; - iEvent.getByToken(stripLocalTrackToken_, stripTracks); - - for (const auto& rpv : *stripTracks) { - if (strip_filter_.count(rpv.id) == 0) - continue; - auto& fltr = strip_filter_.at(rpv.id); - fltr = true; - - const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); - if (minTracks_ > 0 && ntrks < minTracks_) - fltr = false; - if (maxTracks_ > 0 && ntrks > maxTracks_) - fltr = false; - } - } - - // Finally filter on diamond (2016+) selection - if (!diam_filter_.empty()) { - edm::Handle> diamondTracks; - iEvent.getByToken(diamondLocalTrackToken_, diamondTracks); - - for (const auto& rpv : *diamondTracks) { - if (diam_filter_.count(rpv.id) == 0) - continue; - auto& fltr = diam_filter_.at(rpv.id); - fltr = true; - - const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); - if (minTracks_ > 0 && ntrks < minTracks_) - fltr = false; - if (maxTracks_ > 0 && ntrks > maxTracks_) - fltr = false; - } - } - return false; } From c2f3f43826d2ae6d76a49d2858cd5b4399a64e36 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Wed, 18 Aug 2021 18:15:15 +0200 Subject: [PATCH 042/923] applied checks --- CondCore/Utilities/src/CondDBFetch.cc | 4 +--- CondCore/Utilities/src/CondDBFetch.cc.rej | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 CondCore/Utilities/src/CondDBFetch.cc.rej diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index 3df053b00879f..17d8d2531d6c6 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -343,9 +343,7 @@ namespace cond { std::string payloadTypeName; bool found = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo); if (!found) - throwException( - "Payload with id " + payloadId + " has not been found in the database.", - "fetch"); + throwException("Payload with id " + payloadId + " has not been found in the database.", "fetch"); return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr); } diff --git a/CondCore/Utilities/src/CondDBFetch.cc.rej b/CondCore/Utilities/src/CondDBFetch.cc.rej new file mode 100644 index 0000000000000..2528fb80fbcf6 --- /dev/null +++ b/CondCore/Utilities/src/CondDBFetch.cc.rej @@ -0,0 +1,13 @@ +--- CondCore/Utilities/src/CondDBFetch.cc ++++ CondCore/Utilities/src/CondDBFetch.cc +@@ -344,9 +344,7 @@ + std::string payloadTypeName; + bool found = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo); + if (!found) +- throwException( +- "Payload with id " + payloadId + " has not been found in the database.", +- "fetch"); ++ throwException("Payload with id " + payloadId + " has not been found in the database.", "fetch"); + return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr); + } + From 91d1cafa99953018fe8d4b3223eee72c437cce9c Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Wed, 18 Aug 2021 20:49:37 +0200 Subject: [PATCH 043/923] Use constants and derive nAPVs from the strip topology, and add deps on directly included packages --- RecoTracker/MkFit/plugins/BuildFile.xml | 4 ++++ .../MkFit/plugins/MkFitEventOfHitsProducer.cc | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/RecoTracker/MkFit/plugins/BuildFile.xml b/RecoTracker/MkFit/plugins/BuildFile.xml index 6b3e4e3d48396..076fc4af249ce 100644 --- a/RecoTracker/MkFit/plugins/BuildFile.xml +++ b/RecoTracker/MkFit/plugins/BuildFile.xml @@ -1,6 +1,9 @@ + + + @@ -10,6 +13,7 @@ + diff --git a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc index 4b02442c7b85c..5459be9f7aabe 100644 --- a/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc +++ b/RecoTracker/MkFit/plugins/MkFitEventOfHitsProducer.cc @@ -7,6 +7,7 @@ #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" #include "CalibTracker/Records/interface/SiStripQualityRcd.h" +#include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h" #include "DataFormats/TrackerCommon/interface/TrackerDetSide.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" @@ -101,8 +102,8 @@ void MkFitEventOfHitsProducer::produce(edm::StreamID iID, edm::Event& iEvent, co int lastApv = -1; auto addRangeAPV = [&topo, &surf, &q1, &q2](int first, int last, mkfit::DeadVec& dv) { - auto const firstPoint = surf.toGlobal(topo.localPosition(first * 128)); - auto const lastPoint = surf.toGlobal(topo.localPosition((last + 1) * 128)); + auto const firstPoint = surf.toGlobal(topo.localPosition(first * sistrip::STRIPS_PER_APV)); + auto const lastPoint = surf.toGlobal(topo.localPosition((last + 1) * sistrip::STRIPS_PER_APV)); float phi1 = firstPoint.phi(); float phi2 = lastPoint.phi(); if (reco::deltaPhi(phi1, phi2) > 0) @@ -112,18 +113,18 @@ void MkFitEventOfHitsProducer::produce(edm::StreamID iID, edm::Event& iEvent, co dv.push_back({phi1, phi2, q1, q2}); }; - for (int apv = 0; apv < 6; ++apv) { + const int nApvs = topo.nstrips() / sistrip::STRIPS_PER_APV; + for (int apv = 0; apv < nApvs; ++apv) { const bool isBad = bs.BadApvs & (1 << apv); - if (isBad) - LogTrace("SiStripBadComponents") << "bad apv " << apv << " on " << bs.detid; if (isBad) { + LogTrace("SiStripBadComponents") << "bad apv " << apv << " on " << bs.detid; if (lastApv == -1) { firstApv = apv; lastApv = apv; } else if (lastApv + 1 == apv) lastApv++; - if (apv == 5) + if (apv + 1 == nApvs) addRangeAPV(firstApv, lastApv, deadvectors[ilay]); } else if (firstApv != -1) { addRangeAPV(firstApv, lastApv, deadvectors[ilay]); From 4743cd80bc8f9e856ea868ba46fef065a8daf07d Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 18 Aug 2021 16:46:14 -0500 Subject: [PATCH 044/923] Make operator functions 'hidden' friends of ExpressionAST The friends are now only available for argument dependent lookup if an ExpressionAST is directly being used. This avoids having an implicit conversion of arguments to ExpressionAST from happening. This fixes a gcc 11 compilation problem. --- .../interface/TrackerDetIdSelector.h | 42 +++++++++++--- .../src/TrackerDetIdSelector.cc | 58 +++++++++---------- 2 files changed, 59 insertions(+), 41 deletions(-) diff --git a/FastSimulation/TrackingRecHitProducer/interface/TrackerDetIdSelector.h b/FastSimulation/TrackingRecHitProducer/interface/TrackerDetIdSelector.h index d7dccb00540c8..a20d021fcdc55 100644 --- a/FastSimulation/TrackingRecHitProducer/interface/TrackerDetIdSelector.h +++ b/FastSimulation/TrackingRecHitProducer/interface/TrackerDetIdSelector.h @@ -15,8 +15,20 @@ struct BinaryOP; struct UnaryOP; +struct ExpressionAST; struct Nil {}; +namespace detail { + ExpressionAST opLesser(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opLesserEq(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opEq(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opNotEq(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opGreater(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opGreaterEq(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opAnd(ExpressionAST const& lhs, ExpressionAST const& rhs); + ExpressionAST opOr(ExpressionAST const& lhs, ExpressionAST const& rhs); +} // namespace detail + struct ExpressionAST { typedef boost::variant(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator>=(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator==(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator<=(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator<(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator!=(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator&&(ExpressionAST const& lhs, ExpressionAST const& rhs); -ExpressionAST operator||(ExpressionAST const& lhs, ExpressionAST const& rhs); + friend ExpressionAST operator>(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opGreater(lhs, rhs); + } + friend ExpressionAST operator>=(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opGreaterEq(lhs, rhs); + } + friend ExpressionAST operator==(ExpressionAST const& lhs, ExpressionAST const& rhs) { return detail::opEq(lhs, rhs); } + friend ExpressionAST operator!=(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opNotEq(lhs, rhs); + } + friend ExpressionAST operator<(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opLesser(lhs, rhs); + } + friend ExpressionAST operator<=(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opLesserEq(lhs, rhs); + } + friend ExpressionAST operator&&(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return detail::opAnd(lhs, rhs); + } + friend ExpressionAST operator||(ExpressionAST const& lhs, ExpressionAST const& rhs) { return detail::opOr(lhs, rhs); } +}; struct BinaryOP { enum class OP { GREATER, GREATER_EQUAL, EQUAL, LESS_EQUAL, LESS, NOT_EQUAL, AND, OR } op; diff --git a/FastSimulation/TrackingRecHitProducer/src/TrackerDetIdSelector.cc b/FastSimulation/TrackingRecHitProducer/src/TrackerDetIdSelector.cc index 8839f28e03b9f..4780c3389b3fd 100644 --- a/FastSimulation/TrackingRecHitProducer/src/TrackerDetIdSelector.cc +++ b/FastSimulation/TrackingRecHitProducer/src/TrackerDetIdSelector.cc @@ -80,46 +80,40 @@ const TrackerDetIdSelector::StringFunctionMap TrackerDetIdSelector::functionTabl } ; -ExpressionAST operator>(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::GREATER, lhs, rhs); - return ast; -} +namespace detail { + ExpressionAST opGreater(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::GREATER, lhs, rhs); + } -ExpressionAST operator>=(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::GREATER_EQUAL, lhs, rhs); - return ast; -} + ExpressionAST opGreaterEq(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::GREATER_EQUAL, lhs, rhs); + } -ExpressionAST operator==(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::EQUAL, lhs, rhs); - return ast; -} + ExpressionAST opEq(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::EQUAL, lhs, rhs); + } -ExpressionAST operator<=(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::LESS_EQUAL, lhs, rhs); - return ast; -} + ExpressionAST opLesserEq(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::LESS_EQUAL, lhs, rhs); + } -ExpressionAST operator<(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(::BinaryOP::OP::LESS, lhs, rhs); - return ast; -} + ExpressionAST opLesser(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(::BinaryOP::OP::LESS, lhs, rhs); + } -ExpressionAST operator!=(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::NOT_EQUAL, lhs, rhs); - return ast; -} + ExpressionAST opNotEq(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::NOT_EQUAL, lhs, rhs); + } -ExpressionAST operator&&(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::AND, lhs, rhs); - return ast; -} + ExpressionAST opAnd(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::AND, lhs, rhs); + } -ExpressionAST operator||(ExpressionAST const& lhs, ExpressionAST const& rhs) { - ExpressionAST ast = BinaryOP(BinaryOP::OP::OR, lhs, rhs); - return ast; -} + ExpressionAST opOr(ExpressionAST const& lhs, ExpressionAST const& rhs) { + return BinaryOP(BinaryOP::OP::OR, lhs, rhs); + } +} // namespace detail ExpressionAST& ExpressionAST::operator!() { expr = UnaryOP(UnaryOP::OP::NEG, expr); return *this; From 94fb6e167b64d38586958e41e4179415b23ba9a2 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee Date: Thu, 19 Aug 2021 15:26:40 +0200 Subject: [PATCH 045/923] replace EDProducer with clone cfipython and drop type spec --- .../python/producersLayer1/jetProducer_cfi.py | 124 +++++++++--------- .../python/producersLayer1/jetUpdater_cfi.py | 31 +++-- .../python/recoLayer0/jetCorrFactors_cfi.py | 25 ++-- 3 files changed, 90 insertions(+), 90 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cfi.py index c48510ccc20a9..f8445c5f87e9f 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cfi.py @@ -1,10 +1,11 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.PatAlgos.PATJetProducer_cfi as _mod -_patJets = cms.EDProducer("PATJetProducer", +_patJets = _mod.PATJetProducer.clone( # input - jetSource = cms.InputTag("ak4PFJetsCHS"), + jetSource = "ak4PFJetsCHS", # add user data - userData = cms.PSet( + userData = dict( # add custom classes here userClasses = cms.PSet( src = cms.VInputTag('') @@ -22,81 +23,80 @@ src = cms.VInputTag('') ), # add "inline" functions here - userFunctions = cms.vstring(), - userFunctionLabels = cms.vstring() + userFunctions = [], + userFunctionLabels = [] ), # embedding of RECO items (do not use on AOD input!) #embedCaloTowers = cms.bool(False), # optional # embedding of AOD items - embedPFCandidates = cms.bool(False), + embedPFCandidates = False, # jet energy corrections - addJetCorrFactors = cms.bool(True), - jetCorrFactorsSource = cms.VInputTag(cms.InputTag("patJetCorrFactors") ), + addJetCorrFactors = True, + jetCorrFactorsSource = ["patJetCorrFactors" ], # btag information - addBTagInfo = cms.bool(True), ## master switch - addDiscriminators = cms.bool(True), ## addition btag discriminators - discriminatorSources = cms.VInputTag( - cms.InputTag("pfJetBProbabilityBJetTags"), - cms.InputTag("pfJetProbabilityBJetTags"), - cms.InputTag("pfTrackCountingHighEffBJetTags"), - cms.InputTag("pfSimpleSecondaryVertexHighEffBJetTags"), - cms.InputTag("pfSimpleInclusiveSecondaryVertexHighEffBJetTags"), - cms.InputTag("pfCombinedSecondaryVertexV2BJetTags"), - cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - cms.InputTag("softPFMuonBJetTags"), - cms.InputTag("softPFElectronBJetTags"), - cms.InputTag("pfCombinedMVAV2BJetTags"), - # CTagging - cms.InputTag('pfCombinedCvsLJetTags'), - cms.InputTag('pfCombinedCvsBJetTags'), - # DeepFlavour - cms.InputTag('pfDeepCSVJetTags:probb'), - cms.InputTag('pfDeepCSVJetTags:probc'), - cms.InputTag('pfDeepCSVJetTags:probudsg'), - cms.InputTag('pfDeepCSVJetTags:probbb'), - # New DeepFlavour (commented until available in RelVals) - #cms.InputTag('pfDeepFlavourJetTags:probb'), - #cms.InputTag('pfDeepFlavourJetTags:probbb'), - #cms.InputTag('pfDeepFlavourJetTags:problepb'), - #cms.InputTag('pfDeepFlavourJetTags:probc'), - #cms.InputTag('pfDeepFlavourJetTags:probuds'), - #cms.InputTag('pfDeepFlavourJetTags:probg') - ), + addBTagInfo = True, ## master switch + addDiscriminators = True, ## addition btag discriminators + discriminatorSources = ["pfJetBProbabilityBJetTags", + "pfJetProbabilityBJetTags", + "pfTrackCountingHighEffBJetTags", + "pfSimpleSecondaryVertexHighEffBJetTags", + "pfSimpleInclusiveSecondaryVertexHighEffBJetTags", + "pfCombinedSecondaryVertexV2BJetTags", + "pfCombinedInclusiveSecondaryVertexV2BJetTags", + "softPFMuonBJetTags", + "softPFElectronBJetTags", + "pfCombinedMVAV2BJetTags", + # CTagging + 'pfCombinedCvsLJetTags', + 'pfCombinedCvsBJetTags', + # DeepFlavour + 'pfDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probc', + 'pfDeepCSVJetTags:probudsg', + 'pfDeepCSVJetTags:probbb', + # New DeepFlavour (commented until available in RelVals) + #'pfDeepFlavourJetTags:probb', + #'pfDeepFlavourJetTags:probbb', + #'pfDeepFlavourJetTags:problepb', + #'pfDeepFlavourJetTags:probc', + #'pfDeepFlavourJetTags:probuds', + #'pfDeepFlavourJetTags:probg' + ], # clone tag infos ATTENTION: these take lots of space! # usually the discriminators from the default algos # are sufficient - addTagInfos = cms.bool(False), - tagInfoSources = cms.VInputTag(), + addTagInfos = False, + tagInfoSources = [], # track association - addAssociatedTracks = cms.bool(True), - trackAssociationSource = cms.InputTag("ak4JetTracksAssociatorAtVertexPF"), + addAssociatedTracks = True, + trackAssociationSource = "ak4JetTracksAssociatorAtVertexPF", # jet charge - addJetCharge = cms.bool(True), - jetChargeSource = cms.InputTag("patJetCharge"), + addJetCharge = True, + jetChargeSource = "patJetCharge", # add jet ID for calo jets. This should be of type ak4JetID, ak7JetID, ... - addJetID = cms.bool(False), - jetIDMap = cms.InputTag("ak4JetID"), + addJetID = False, + jetIDMap = "ak4JetID", # mc matching - addGenPartonMatch = cms.bool(True), ## switch on/off matching to quarks from hard scatterin - embedGenPartonMatch = cms.bool(True), ## switch on/off embedding of the GenParticle parton for this jet - genPartonMatch = cms.InputTag("patJetPartonMatch"), ## particles source to be used for the matching - addGenJetMatch = cms.bool(True), ## switch on/off matching to GenJet's - embedGenJetMatch = cms.bool(True), ## switch on/off embedding of matched genJet's - genJetMatch = cms.InputTag("patJetGenJetMatch"), ## GenJet source to be used for the matching - addPartonJetMatch = cms.bool(False), ## switch on/off matching to PartonJet's (not implemented yet) - partonJetSource = cms.InputTag("NOT_IMPLEMENTED"), ## ParticleJet source to be used for the matching + addGenPartonMatch = True, ## switch on/off matching to quarks from hard scatterin + embedGenPartonMatch = True, ## switch on/off embedding of the GenParticle parton for this jet + genPartonMatch = "patJetPartonMatch", ## particles source to be used for the matching + addGenJetMatch = True, ## switch on/off matching to GenJet's + embedGenJetMatch = True, ## switch on/off embedding of matched genJet's + genJetMatch = "patJetGenJetMatch", ## GenJet source to be used for the matching + addPartonJetMatch = False, ## switch on/off matching to PartonJet's (not implemented yet) + partonJetSource = "NOT_IMPLEMENTED", ## ParticleJet source to be used for the matching # jet flavour idetification configurables - getJetMCFlavour = cms.bool(True), - useLegacyJetMCFlavour = cms.bool(False), - addJetFlavourInfo = cms.bool(True), - JetPartonMapSource = cms.InputTag("patJetFlavourAssociationLegacy"), - JetFlavourInfoSource = cms.InputTag("patJetFlavourAssociation"), + getJetMCFlavour = True, + useLegacyJetMCFlavour = False, + addJetFlavourInfo = True, + JetPartonMapSource = "patJetFlavourAssociationLegacy", + JetFlavourInfoSource = "patJetFlavourAssociation", # efficiencies - addEfficiencies = cms.bool(False), - efficiencies = cms.PSet(), + addEfficiencies = False, + efficiencies = dict(), # resolution - addResolutions = cms.bool(False), - resolutions = cms.PSet() + addResolutions = False, + resolutions = dict() ) from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/jetUpdater_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/jetUpdater_cfi.py index b32a10ede5ac5..f40539449db05 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/jetUpdater_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/jetUpdater_cfi.py @@ -1,10 +1,11 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.PatAlgos.PATJetUpdater_cfi as _mod -updatedPatJets = cms.EDProducer("PATJetUpdater", +updatedPatJets = _mod.PATJetUpdater.clone( # input - jetSource = cms.InputTag("slimmedJets"), + jetSource = "slimmedJets", # add user data - userData = cms.PSet( + userData = dict( # add custom classes here userClasses = cms.PSet( src = cms.VInputTag('') @@ -22,24 +23,22 @@ src = cms.VInputTag('') ), # add "inline" functions here - userFunctions = cms.vstring(), - userFunctionLabels = cms.vstring() + userFunctions = [], + userFunctionLabels = [] ), # sort - sort = cms.bool(True), + sort = True, # jet energy corrections - addJetCorrFactors = cms.bool(True), - jetCorrFactorsSource = cms.VInputTag(cms.InputTag("updatedPatJetCorrFactors") ), + addJetCorrFactors = True, + jetCorrFactorsSource = ["updatedPatJetCorrFactors"], # btag information - addBTagInfo = cms.bool(True), ## master switch - addDiscriminators = cms.bool(True), ## addition of btag discriminators - discriminatorSources = cms.VInputTag(), + addBTagInfo = True, ## master switch + addDiscriminators = True, ## addition of btag discriminators + discriminatorSources = [], # clone tag infos ATTENTION: these take lots of space! # usually the discriminators from the default algos # are sufficient - addTagInfos = cms.bool(False), - tagInfoSources = cms.VInputTag(), - printWarning = cms.bool(True) + addTagInfos = False, + tagInfoSources = [], + printWarning = True ) - - diff --git a/PhysicsTools/PatAlgos/python/recoLayer0/jetCorrFactors_cfi.py b/PhysicsTools/PatAlgos/python/recoLayer0/jetCorrFactors_cfi.py index 37ac9bf3975dc..a7f95e7765d9d 100644 --- a/PhysicsTools/PatAlgos/python/recoLayer0/jetCorrFactors_cfi.py +++ b/PhysicsTools/PatAlgos/python/recoLayer0/jetCorrFactors_cfi.py @@ -1,28 +1,29 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.PatAlgos.JetCorrFactorsProducer_cfi as _mod # module to produce jet correction factors associated in a valuemap -patJetCorrFactors = cms.EDProducer("JetCorrFactorsProducer", +patJetCorrFactors = _mod.JetCorrFactorsProducer.clone( ## the use of emf in the JEC is not yet implemented - emf = cms.bool(False), + emf = False, ## input collection of jets - src = cms.InputTag("ak4PFJetsCHS"), + src = "ak4PFJetsCHS", ## payload postfix for testing - payload = cms.string('AK4PFchs'), + payload = 'AK4PFchs', ## correction levels - levels = cms.vstring( + levels = [ ## tags for the individual jet corrections; when ## not available the string should be set to 'none' 'L1FastJet', 'L2Relative', 'L3Absolute',#'L5Flavor', 'L7Parton' - ), + ], ## define the type of L5Flavor corrections for here. These can ## be of type 'J' for dijet derived, or of type 'T' for ttbar ## derived. - flavorType = cms.string('J'), + flavorType = 'J', ## in case you are using JPT jets you must have specified the L1Offset ## corrections by a dedicated L1JPTOffset correction level. This dedi- ## cated correction level has an ordinary L1Offset or L1FastJet corrector ## as input, which needs to be specified via this additional parameter - extraJPTOffset = cms.string("L1FastJet"), + extraJPTOffset = "L1FastJet", ## in case that L1Offset or L1FastJet corrections are part ## of the parameter levels add the optional parameter ## primaryVertices here to specify the primary vertex @@ -30,15 +31,15 @@ ## or L1FastJet correction from. This parameter will ONLY ## be read out if the correction level L1Offset or ## L1FastJet is found in levels. - useNPV = cms.bool(True), - primaryVertices = cms.InputTag('offlinePrimaryVertices'), + useNPV = True, + primaryVertices = 'offlinePrimaryVertices', ## in case that L1FastJet corrections are part of the ## parameter levels add the optional parameter rho ## here to specify the energy density parameter for ## the corresponding jet collection (this variable is ## typically taken from kt6PFJets). - useRho = cms.bool(True), - rho = cms.InputTag('fixedGridRhoFastjetAll'), + useRho = True, + rho = 'fixedGridRhoFastjetAll', ) from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA From 950ef2db3360d980083ff9b474ef8b8266d632b9 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 16 Aug 2021 15:54:50 +0200 Subject: [PATCH 046/923] Migrate getting MixingModuleConfig to esConsumes() --- Mixing/Base/interface/BMixingModule.h | 1 + Mixing/Base/interface/PileUp.h | 11 ++++++++++- Mixing/Base/src/BMixingModule.cc | 12 ++++++------ Mixing/Base/src/PileUp.cc | 14 +++++++++----- SimGeneral/MixingModule/plugins/MixingModule.cc | 15 ++++++++------- SimGeneral/MixingModule/plugins/MixingModule.h | 1 + SimGeneral/MixingModule/plugins/MixingWorker.h | 16 ++++------------ .../MixingModule/plugins/MixingWorkerBase.h | 2 +- .../MixingModule/plugins/SecSourceAnalyzer.cc | 3 ++- .../MixingModule/plugins/SecSourceAnalyzer.h | 2 +- 10 files changed, 43 insertions(+), 34 deletions(-) diff --git a/Mixing/Base/interface/BMixingModule.h b/Mixing/Base/interface/BMixingModule.h index 4db67af02b82e..9fe8e9d94e811 100644 --- a/Mixing/Base/interface/BMixingModule.h +++ b/Mixing/Base/interface/BMixingModule.h @@ -32,6 +32,7 @@ namespace edm { int minBunch_; int maxBunch_; bool playback_; + bool configFromDB_ = false; std::vector sourceNames_; std::vector> inputConfigs_; }; diff --git a/Mixing/Base/interface/PileUp.h b/Mixing/Base/interface/PileUp.h index d20f542da13e0..6353a525b0037 100644 --- a/Mixing/Base/interface/PileUp.h +++ b/Mixing/Base/interface/PileUp.h @@ -5,7 +5,9 @@ #include #include #include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Sources/interface/VectorInputSource.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "DataFormats/Provenance/interface/EventID.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -23,6 +25,9 @@ namespace CLHEP { class HepRandomEngine; } // namespace CLHEP +class MixingModuleConfig; +class MixingRcd; + namespace edm { class SecondaryEventProvider; class StreamID; @@ -39,7 +44,10 @@ namespace edm { class PileUp { public: - explicit PileUp(ParameterSet const& pset, const std::shared_ptr& config); + explicit PileUp(ParameterSet const& pset, + const std::shared_ptr& config, + edm::ConsumesCollector iC, + const bool mixingConfigFromDB); ~PileUp(); template @@ -128,6 +136,7 @@ namespace edm { int minBunch_cosmics_; int maxBunch_cosmics_; + edm::ESGetToken configToken_; size_t fileNameHash_; std::shared_ptr productRegistry_; std::unique_ptr const input_; diff --git a/Mixing/Base/src/BMixingModule.cc b/Mixing/Base/src/BMixingModule.cc index e8b34b8b50319..66143eeaad84e 100644 --- a/Mixing/Base/src/BMixingModule.cc +++ b/Mixing/Base/src/BMixingModule.cc @@ -183,16 +183,14 @@ namespace edm { maxBunch_(globalConf->maxBunch_), mixProdStep1_(pset.getParameter("mixProdStep1")), mixProdStep2_(pset.getParameter("mixProdStep2")), - readDB_(false), + readDB_(globalConf->configFromDB_), playback_(globalConf->playback_) { - if (pset.exists("readDB")) - readDB_ = pset.getParameter("readDB"); - for (size_t makeIdx = 0; makeIdx < maxNbSources_; makeIdx++) { if (globalConf->inputConfigs_[makeIdx]) { const edm::ParameterSet& psin = pset.getParameter(globalConf->inputConfigs_[makeIdx]->sourcename_); - inputSources_.push_back(std::make_shared(psin, globalConf->inputConfigs_[makeIdx])); + inputSources_.push_back( + std::make_shared(psin, globalConf->inputConfigs_[makeIdx], consumesCollector(), readDB_)); inputSources_.back()->input(makeIdx); } else { inputSources_.push_back(nullptr); @@ -224,6 +222,9 @@ namespace edm { for (size_t makeIdx = 0; makeIdx < maxNbSources; makeIdx++) { inputConfigs_.push_back(maybeConfigPileUp(pset, sourceNames_[makeIdx], minBunch_, maxBunch_, playback_)); } + + if (pset.exists("readDB")) + configFromDB_ = pset.getParameter("readDB"); } } // namespace MixingCache @@ -241,7 +242,6 @@ namespace edm { } void BMixingModule::beginRun(edm::Run const& run, edm::EventSetup const& setup) { - update(setup); for (size_t endIdx = 0; endIdx < maxNbSources_; ++endIdx) { if (inputSources_[endIdx]) inputSources_[endIdx]->beginRun(run, setup); diff --git a/Mixing/Base/src/PileUp.cc b/Mixing/Base/src/PileUp.cc index d9dea4c40efa0..d43c8200a64e7 100644 --- a/Mixing/Base/src/PileUp.cc +++ b/Mixing/Base/src/PileUp.cc @@ -64,7 +64,10 @@ static Double_t GetRandom(TH1* th1, CLHEP::HepRandomEngine* rng) { //////////////////////////////////////////////////////////////////////////////// namespace edm { - PileUp::PileUp(ParameterSet const& pset, const std::shared_ptr& config) + PileUp::PileUp(ParameterSet const& pset, + const std::shared_ptr& config, + edm::ConsumesCollector iC, + const bool mixingConfigFromDB) : type_(pset.getParameter("type")), Source_type_(config->sourcename_), averageNumber_(config->averageNumber_), @@ -92,6 +95,10 @@ namespace edm { randomEngine_(), playback_(config->playback_), sequential_(pset.getUntrackedParameter("sequential", false)) { + if (mixingConfigFromDB) { + configToken_ = iC.esConsumes(); + } + // Use the empty parameter set for the parameter set ID of our "@MIXING" process. processConfiguration_->setParameterSetID(ParameterSet::emptyParameterSetID()); processContext_->setProcessConfiguration(processConfiguration_.get()); @@ -234,10 +241,7 @@ namespace edm { void PileUp::reload(const edm::EventSetup& setup) { //get the required parameters from DB. - edm::ESHandle configM; - setup.get().get(configM); - - const MixingInputConfig& config = configM->config(inputType_); + const MixingInputConfig& config = setup.getData(configToken_).config(inputType_); //get the type type_ = config.type(); diff --git a/SimGeneral/MixingModule/plugins/MixingModule.cc b/SimGeneral/MixingModule/plugins/MixingModule.cc index bbd8aff1f51ba..0087007f5b847 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.cc +++ b/SimGeneral/MixingModule/plugins/MixingModule.cc @@ -266,6 +266,9 @@ namespace edm { produces(); edm::ConsumesCollector iC(consumesCollector()); + if (globalConf->configFromDB_) { + configToken_ = esConsumes(); + } // Create and configure digitizers createDigiAccumulators(ps_mix, iC); } @@ -288,16 +291,14 @@ namespace edm { } void MixingModule::reload(const edm::EventSetup& setup) { - // TODO for esConsumes migration: assume for now this function is mostly unused //change the basic parameters. - edm::ESHandle config; - setup.get().get(config); - minBunch_ = config->minBunch(); - maxBunch_ = config->maxBunch(); - bunchSpace_ = config->bunchSpace(); + auto const& config = setup.getData(configToken_); + minBunch_ = config.minBunch(); + maxBunch_ = config.maxBunch(); + bunchSpace_ = config.bunchSpace(); //propagate to change the workers for (unsigned int ii = 0; ii < workersObjects_.size(); ++ii) { - workersObjects_[ii]->reload(setup); + workersObjects_[ii]->reload(minBunch_, maxBunch_, bunchSpace_); } } diff --git a/SimGeneral/MixingModule/plugins/MixingModule.h b/SimGeneral/MixingModule/plugins/MixingModule.h index fe0121b173385..998f767a0bc9c 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.h +++ b/SimGeneral/MixingModule/plugins/MixingModule.h @@ -100,6 +100,7 @@ namespace edm { bool mixProdStep1_; CrossingFramePlaybackInfoNew* playbackInfo_; + edm::ESGetToken configToken_; std::vector adjusters_; std::vector adjustersObjects_; std::vector workers_; diff --git a/SimGeneral/MixingModule/plugins/MixingWorker.h b/SimGeneral/MixingModule/plugins/MixingWorker.h index 133da14cbf1c5..7f2d0b5c97406 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorker.h +++ b/SimGeneral/MixingModule/plugins/MixingWorker.h @@ -17,10 +17,7 @@ #include "DataFormats/Common/interface/Wrapper.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/DataRecord/interface/MixingRcd.h" -#include "CondFormats/RunInfo/interface/MixingModuleConfig.h" #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include "SimDataFormats/CrossingFrame/interface/PCrossingFrame.h" @@ -108,15 +105,10 @@ namespace edm { ~MixingWorker() override { ; } public: - void reload(const edm::EventSetup &setup) override { - // TODO for esConsumes migration: assume for now this function is mostly unused - //get the required parameters from DB. - // watch the label/tag - edm::ESHandle config; - setup.get().get(config); - minBunch_ = config->minBunch(); - maxBunch_ = config->maxBunch(); - bunchSpace_ = config->bunchSpace(); + void reload(int minBunch, int maxBunch, int bunchSpace) override { + minBunch_ = minBunch; + maxBunch_ = maxBunch; + bunchSpace_ = bunchSpace; } bool checkSignal(const edm::Event &e) override { diff --git a/SimGeneral/MixingModule/plugins/MixingWorkerBase.h b/SimGeneral/MixingModule/plugins/MixingWorkerBase.h index 471313ccf81ae..fa27db9edd746 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorkerBase.h +++ b/SimGeneral/MixingModule/plugins/MixingWorkerBase.h @@ -42,7 +42,7 @@ namespace edm { virtual void setSourceOffset(const unsigned int s) = 0; virtual void setTof() = 0; virtual void put(edm::Event &e) = 0; - virtual void reload(const edm::EventSetup &setup){}; + virtual void reload(int minBunch, int maxBunch, int bunchSpace){}; }; } // namespace edm diff --git a/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.cc b/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.cc index e1e7c0c3fd4b9..87643806f4f7c 100644 --- a/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.cc +++ b/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.cc @@ -60,7 +60,8 @@ namespace edm { bool playback = false; auto conf = std::make_shared("input", averageNumber, histoName, playback); - input_.reset(new edm::PileUp(iConfig.getParameter("input"), conf)); + input_ = std::make_unique( + iConfig.getParameter("input"), conf, consumesCollector(), false); dataStep2_ = iConfig.getParameter("dataStep2"); diff --git a/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.h b/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.h index dc8ff295987d8..a15802f97db76 100644 --- a/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.h +++ b/SimGeneral/MixingModule/plugins/SecSourceAnalyzer.h @@ -59,7 +59,7 @@ namespace edm { std::vector > vectorEventIDs_; - std::shared_ptr input_; + std::unique_ptr input_; std::vector TrueNumInteractions_[5]; InputTag tag_; From b9807e9683e52250b8f88bd25834cfb96efbedbf Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 16 Aug 2021 22:14:03 +0200 Subject: [PATCH 047/923] Migrate last pieces of EcalDigiProducer (and _Ph2) to esConsumes() --- .../EcalSRTools/interface/EcalDccWeightBuilder.h | 3 +++ .../EcalSRTools/src/EcalDccWeightBuilder.cc | 11 +++++------ .../EcalTPGTools/plugins/EcalTPGParamBuilder.cc | 16 ++++++---------- .../EcalTPGTools/plugins/EcalTPGParamBuilder.h | 7 +++++-- .../plugins/EcalUncalibRecHitWorkerGlobal.cc | 4 ++-- .../plugins/EcalUncalibRecHitWorkerGlobal.h | 2 +- .../plugins/EcalUncalibRecHitWorkerWeights.cc | 4 ++-- .../plugins/EcalUncalibRecHitWorkerWeights.h | 2 +- .../src/EcalTBWeightUncalibRecHitProducer.cc | 6 ++---- SimCalorimetry/EcalSimAlgos/interface/APDShape.h | 13 ++++++++----- SimCalorimetry/EcalSimAlgos/interface/EBShape.h | 13 ++++++++----- SimCalorimetry/EcalSimAlgos/interface/EEShape.h | 13 ++++++++----- SimCalorimetry/EcalSimAlgos/src/APDShape.cc | 9 ++++----- SimCalorimetry/EcalSimAlgos/src/EBShape.cc | 9 ++++----- SimCalorimetry/EcalSimAlgos/src/EEShape.cc | 9 ++++----- .../EcalSimAlgos/test/testEcalShape.cpp | 9 ++++----- .../EcalSimProducers/src/EcalDigiProducer.cc | 6 +++--- .../EcalSimProducers/src/EcalDigiProducer_Ph2.cc | 4 ++-- .../plugins/EcalMixingModuleValidation.cc | 4 ++-- 19 files changed, 74 insertions(+), 70 deletions(-) diff --git a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h index d5078129be939..028f3e718403c 100644 --- a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h +++ b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h @@ -128,6 +128,9 @@ class EcalDccWeightBuilder : public edm::EDAnalyzer { EcalIntercalibConstantMap emptyCalibMap_; std::map > encodedWeights_; + EBShape ebShape_; + EEShape eeShape_; + static const double weightScale_; const EcalElectronicsMapping* ecalElectronicsMap_; diff --git a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc index c27a662b64eb2..715971bd4f88b 100644 --- a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc +++ b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc @@ -59,7 +59,9 @@ EcalDccWeightBuilder::EcalDccWeightBuilder(edm::ParameterSet const& ps) dbTag_(ps.getParameter("dbTag")), dbVersion_(ps.getParameter("dbVersion")), sqlMode_(ps.getParameter("sqlMode")), - calibMap_(emptyCalibMap_) { + calibMap_(emptyCalibMap_), + ebShape_(consumesCollector()), + eeShape_(consumesCollector()) { if (mode_ == "weightsFromConfig") { imode_ = WEIGHTS_FROM_CONFIG; if (inputWeights_.size() != (unsigned)nDccWeights_) { @@ -157,15 +159,12 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve #endif try { - bool useDBShape = true; - EBShape ebShape(useDBShape); - EEShape eeShape(useDBShape); EcalShapeBase* pShape; if (it->subdetId() == EcalBarrel) { - pShape = &ebShape; + pShape = &ebShape_; } else if (it->subdetId() == EcalEndcap) { - pShape = &eeShape; + pShape = &eeShape_; } else { throw cms::Exception("EcalDccWeightBuilder") << "Bug found in " << __FILE__ << ":" << __LINE__ << ": " << "Got a detId which is neither tagged as ECAL Barrel " diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index a71e02e4214d1..dc8fba95a36fc 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -14,8 +14,6 @@ #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalSimParameterMap.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -53,7 +51,8 @@ EcalTPGParamBuilder::EcalTPGParamBuilder(edm::ParameterSet const& pSet) xtal_LSB_EE_(0), nSample_(5), complement2_(7), - useDBShape_(true) { + shapeEB_(consumesCollector()), // EBShape, EEShape are fetched now from DB (2018.05.22 K. Theofilatos) + shapeEE_(consumesCollector()) { ped_conf_id_ = 0; lin_conf_id_ = 0; lut_conf_id_ = 0; @@ -1610,13 +1609,10 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& const int NWEIGROUPS = 2; std::vector weights[NWEIGROUPS]; - bool useDBShape = useDBShape_; - EBShape shapeEB(useDBShape); - shapeEB.setEventSetup(evtSetup); // EBShape, EEShape are fetched now from DB (2018.05.22 K. Theofilatos) - EEShape shapeEE(useDBShape); - shapeEE.setEventSetup(evtSetup); // - weights[0] = computeWeights(shapeEB, hshapeEB); - weights[1] = computeWeights(shapeEE, hshapeEE); + shapeEB_.setEventSetup(evtSetup); + shapeEE_.setEventSetup(evtSetup); + weights[0] = computeWeights(shapeEB_, hshapeEB); + weights[1] = computeWeights(shapeEE_, hshapeEE); map dataset; diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h index 0484a330031f5..856ed9e91458d 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h @@ -41,6 +41,8 @@ #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include @@ -162,6 +164,9 @@ class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { //modif-alex 30/01/2012 std::map Transparency_Correction_; + EBShape shapeEB_; + EEShape shapeEE_; + std::ofstream* out_file_; std::ofstream* geomFile_; EcalTPGDBApp* db_; @@ -198,7 +203,5 @@ class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { Int_t* ntupleInts_; Char_t ntupleDet_[10]; Char_t ntupleCrate_[10]; - - bool useDBShape_; }; #endif diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.cc index e3166da872ffa..db365116bb28e 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.cc @@ -14,8 +14,8 @@ EcalUncalibRecHitWorkerGlobal::EcalUncalibRecHitWorkerGlobal(const edm::Paramete tokenGains_(c.esConsumes()), tokenGrps_(c.esConsumes()), tokenWgts_(c.esConsumes()), - testbeamEEShape(EEShape(true)), - testbeamEBShape(EBShape(true)), + testbeamEEShape(c), + testbeamEBShape(c), tokenSampleMask_(c.esConsumes()), tokenTimeCorrBias_(c.esConsumes()), tokenItime_(c.esConsumes()), diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.h b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.h index 8e206b4b883ec..cd213484f1c4a 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.h +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.h @@ -44,7 +44,7 @@ namespace edm { class EcalUncalibRecHitWorkerGlobal : public EcalUncalibRecHitWorkerRunOneDigiBase { public: EcalUncalibRecHitWorkerGlobal(const edm::ParameterSet&, edm::ConsumesCollector& c); - EcalUncalibRecHitWorkerGlobal() : testbeamEEShape(EEShape(true)), testbeamEBShape(EBShape(true)) { ; } + EcalUncalibRecHitWorkerGlobal() = default; // for EcalUncalibRecHitFillDescriptionWorkerFactory ~EcalUncalibRecHitWorkerGlobal() override{}; void set(const edm::EventSetup& es) override; diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.cc index eb6c666ac1a3b..20aaaf0b2ed39 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.cc @@ -15,8 +15,8 @@ EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights(const edm::Parame tokenGains_(c.esConsumes()), tokenGrps_(c.esConsumes()), tokenWgts_(c.esConsumes()), - testbeamEEShape(EEShape(true)), - testbeamEBShape(EBShape(true)) {} + testbeamEEShape(c), + testbeamEBShape(c) {} void EcalUncalibRecHitWorkerWeights::set(const edm::EventSetup& es) { gains_ = es.getHandle(tokenGains_); diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.h b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.h index 1e15db0941e67..af3602f076d39 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.h +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerWeights.h @@ -34,7 +34,7 @@ namespace edm { class EcalUncalibRecHitWorkerWeights : public EcalUncalibRecHitWorkerRunOneDigiBase { public: EcalUncalibRecHitWorkerWeights(const edm::ParameterSet&, edm::ConsumesCollector& c); - EcalUncalibRecHitWorkerWeights() : testbeamEEShape(EEShape(true)), testbeamEBShape(EBShape(true)) { ; } + EcalUncalibRecHitWorkerWeights() = default; // for EcalUncalibRecHitFillDescriptionWorkerFactory ~EcalUncalibRecHitWorkerWeights() override{}; void set(const edm::EventSetup& es) override; diff --git a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc index a86b4436c6c22..b83400d4156d2 100644 --- a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc +++ b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc @@ -46,10 +46,8 @@ #define DEBUG EcalTBWeightUncalibRecHitProducer::EcalTBWeightUncalibRecHitProducer(const edm::ParameterSet& ps) - : testbeamEEShape(EEShape( - false)), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(true)//EEShape(true) are used - testbeamEBShape(EBShape( - false)) // use false as argument if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) + : testbeamEEShape(), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(consumesCollector())//EEShape(consumesCollector()) are used + testbeamEBShape() // use default constructor if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) { EBdigiCollection_ = ps.getParameter("EBdigiCollection"); EEdigiCollection_ = ps.getParameter("EEdigiCollection"); diff --git a/SimCalorimetry/EcalSimAlgos/interface/APDShape.h b/SimCalorimetry/EcalSimAlgos/interface/APDShape.h index 814ef4b8fcd64..2b6135eb4666c 100644 --- a/SimCalorimetry/EcalSimAlgos/interface/APDShape.h +++ b/SimCalorimetry/EcalSimAlgos/interface/APDShape.h @@ -1,21 +1,24 @@ #ifndef EcalSimAlgos_APDShape_h #define EcalSimAlgos_APDShape_h +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h" class APDShape : public EcalShapeBase { public: - APDShape(bool useDB) : EcalShapeBase(useDB) { - if (!useDB) - buildMe(); - } // if useDB = true, then buildMe is executed when setEventSetup and DB conditions are available - // APDShape():EcalShapeBase(false){;} + // useDB = false + APDShape() : EcalShapeBase(false) { buildMe(); } + // useDB = true, buildMe is executed when setEventSetup and DB conditions are available + APDShape(edm::ConsumesCollector iC) : EcalShapeBase(true), espsToken_(iC.esConsumes()) {} protected: void fillShape(float& time_interval, double& m_thresh, EcalShapeBase::DVec& aVec, const edm::EventSetup* es) const override; + +private: + edm::ESGetToken espsToken_; }; #endif diff --git a/SimCalorimetry/EcalSimAlgos/interface/EBShape.h b/SimCalorimetry/EcalSimAlgos/interface/EBShape.h index 6a4e268e19bb2..478b3b421d28a 100644 --- a/SimCalorimetry/EcalSimAlgos/interface/EBShape.h +++ b/SimCalorimetry/EcalSimAlgos/interface/EBShape.h @@ -1,21 +1,24 @@ #ifndef EcalSimAlgos_EBShape_h #define EcalSimAlgos_EBShape_h +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h" class EBShape : public EcalShapeBase { public: - EBShape(bool useDB) : EcalShapeBase(useDB) { - if (!useDB) - buildMe(); - } // if useDB = true, then buildMe is executed when setEventSetup and DB conditions are available - //EBShape():EcalShapeBase(false){;} + // useDB = false + EBShape() : EcalShapeBase(false) { buildMe(); } + // useDB = true, buildMe is executed when setEventSetup and DB conditions are available + EBShape(edm::ConsumesCollector iC) : EcalShapeBase(true), espsToken_(iC.esConsumes()) {} protected: void fillShape(float& time_interval, double& m_thresh, EcalShapeBase::DVec& aVec, const edm::EventSetup* es) const override; + +private: + edm::ESGetToken espsToken_; }; #endif diff --git a/SimCalorimetry/EcalSimAlgos/interface/EEShape.h b/SimCalorimetry/EcalSimAlgos/interface/EEShape.h index 2ccf37bc9de64..a51bb9182a243 100644 --- a/SimCalorimetry/EcalSimAlgos/interface/EEShape.h +++ b/SimCalorimetry/EcalSimAlgos/interface/EEShape.h @@ -1,21 +1,24 @@ #ifndef EcalSimAlgos_EEShape_h #define EcalSimAlgos_EEShape_h +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h" class EEShape : public EcalShapeBase { public: - EEShape(bool useDB) : EcalShapeBase(useDB) { - if (!useDB) - buildMe(); - } // if useDB = true, then buildMe is executed when setEventSetup and DB conditions are available} - // EEShape():EcalShapeBase(false){;} + // useDB = false + EEShape() : EcalShapeBase(false) { buildMe(); } + // useDB = true, buildMe is executed when setEventSetup and DB conditions are available + EEShape(edm::ConsumesCollector iC) : EcalShapeBase(true), espsToken_(iC.esConsumes()) {} protected: void fillShape(float& time_interval, double& m_thresh, EcalShapeBase::DVec& aVec, const edm::EventSetup* es) const override; + +private: + edm::ESGetToken espsToken_; }; #endif diff --git a/SimCalorimetry/EcalSimAlgos/src/APDShape.cc b/SimCalorimetry/EcalSimAlgos/src/APDShape.cc index 8a66db4271fd7..d792d13b654e1 100644 --- a/SimCalorimetry/EcalSimAlgos/src/APDShape.cc +++ b/SimCalorimetry/EcalSimAlgos/src/APDShape.cc @@ -12,12 +12,11 @@ void APDShape::fillShape(float& time_interval, if (es == nullptr) { throw cms::Exception("EcalShapeBase:: DB conditions are not available, const edm::EventSetup* es == nullptr "); } - edm::ESHandle esps; - es->get().get(esps); + auto const& esps = es->getData(espsToken_); - aVec = esps->apd_shape; - time_interval = esps->time_interval; - m_thresh = esps->apd_thresh; + aVec = esps.apd_shape; + time_interval = esps.time_interval; + m_thresh = esps.apd_thresh; } else { m_thresh = 0.0; time_interval = 1.0; diff --git a/SimCalorimetry/EcalSimAlgos/src/EBShape.cc b/SimCalorimetry/EcalSimAlgos/src/EBShape.cc index 568938eab35f0..641239b225f40 100644 --- a/SimCalorimetry/EcalSimAlgos/src/EBShape.cc +++ b/SimCalorimetry/EcalSimAlgos/src/EBShape.cc @@ -10,12 +10,11 @@ void EBShape::fillShape(float& time_interval, if (es == nullptr) { throw cms::Exception("EcalShapeBase:: DB conditions are not available, const edm::EventSetup* es == nullptr "); } - edm::ESHandle esps; - es->get().get(esps); + auto const& esps = es->getData(espsToken_); - aVec = esps->barrel_shape; - time_interval = esps->time_interval; - m_thresh = esps->barrel_thresh; + aVec = esps.barrel_shape; + time_interval = esps.time_interval; + m_thresh = esps.barrel_thresh; } else // use old hardcoded arrays { diff --git a/SimCalorimetry/EcalSimAlgos/src/EEShape.cc b/SimCalorimetry/EcalSimAlgos/src/EEShape.cc index d193a51fbc75c..b3d8413a1b167 100644 --- a/SimCalorimetry/EcalSimAlgos/src/EEShape.cc +++ b/SimCalorimetry/EcalSimAlgos/src/EEShape.cc @@ -10,12 +10,11 @@ void EEShape::fillShape(float& time_interval, if (es == nullptr) { throw cms::Exception("EcalShapeBase:: DB conditions are not available, const edm::EventSetup* es == nullptr "); } - edm::ESHandle esps; - es->get().get(esps); + auto const& esps = es->getData(espsToken_); - aVec = esps->endcap_shape; - time_interval = esps->time_interval; - m_thresh = esps->endcap_thresh; + aVec = esps.endcap_shape; + time_interval = esps.time_interval; + m_thresh = esps.endcap_thresh; } else { m_thresh = 0.00025; time_interval = 1.0; diff --git a/SimCalorimetry/EcalSimAlgos/test/testEcalShape.cpp b/SimCalorimetry/EcalSimAlgos/test/testEcalShape.cpp index 10cba1998e487..bb12394a49e5c 100644 --- a/SimCalorimetry/EcalSimAlgos/test/testEcalShape.cpp +++ b/SimCalorimetry/EcalSimAlgos/test/testEcalShape.cpp @@ -19,11 +19,10 @@ int main() { const EcalSimParameterMap parameterMap; - bool useDBShape = - false; // for the purpose of testing the EcalShape class, doesn't need to (should not) fetch a shape from the DB but just to assume the testbeam one - const APDShape theAPDShape(useDBShape); - const EBShape theEBShape(useDBShape); - const EEShape theEEShape(useDBShape); + // for the purpose of testing the EcalShape class, doesn't need to (should not) fetch a shape from the DB but just to assume the testbeam one + const APDShape theAPDShape; + const EBShape theEBShape; + const EEShape theEEShape; const int nsamp = 500; // phase I hardcoded ECAL shapes arrays const int tconv = 10; // kNBinsPerNSec = 10 diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 57503f598b591..f2dbf4e0dcfd8 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -49,9 +49,9 @@ EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, // version for Pre-Mixing, for use outside of MixingModule EcalDigiProducer::EcalDigiProducer(const edm::ParameterSet ¶ms, edm::ConsumesCollector &iC) : DigiAccumulatorMixMod(), - m_APDShape(true), - m_EBShape(true), - m_EEShape(true), + m_APDShape(iC), + m_EBShape(iC), + m_EEShape(iC), m_ESShape(), m_EBdigiCollection(params.getParameter("EBdigiCollection")), m_EEdigiCollection(params.getParameter("EEdigiCollection")), diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc index f116d10f052b2..26b90a3f8e0f4 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc @@ -54,8 +54,8 @@ EcalDigiProducer_Ph2::EcalDigiProducer_Ph2(const edm::ParameterSet& params, // version for Pre-Mixing, for use outside of MixingModule EcalDigiProducer_Ph2::EcalDigiProducer_Ph2(const edm::ParameterSet& params, edm::ConsumesCollector& iC) : DigiAccumulatorMixMod(), - m_APDShape(true), - m_EBShape(true), + m_APDShape(iC), + m_EBShape(iC), m_EBdigiCollection(params.getParameter("EBdigiCollectionPh2")), diff --git a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc index 4581dfb837bfe..637c89c127324 100644 --- a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc +++ b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc @@ -72,8 +72,8 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet& */ theESShape = new ESShape(); - theEBShape = new EBShape(true); - theEEShape = new EEShape(true); + theEBShape = new EBShape(consumesCollector()); + theEEShape = new EEShape(consumesCollector()); theESResponse = new CaloHitResponse(theParameterMap, theESShape); theEBResponse = new CaloHitResponse(theParameterMap, theEBShape); From 71492b227066baa9dc9474bd4651f84acaf6f198 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 17 Aug 2021 02:51:28 +0200 Subject: [PATCH 048/923] Avoid raw 'new' in EcalMixingModuleValidation --- .../plugins/EcalMixingModuleValidation.cc | 42 +++++++++---------- .../plugins/EcalMixingModuleValidation.h | 14 +++---- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc index 637c89c127324..c0012e3ef40bc 100644 --- a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc +++ b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc @@ -49,16 +49,16 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet& doPhotostatistics = false; - theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel, - simHitToPhotoelectronsEndcap, - photoelectronsToAnalogBarrel, - photoelectronsToAnalogEndcap, - samplingFactor, - timePhase, - readoutFrameSize, - binOfMaximum, - doPhotostatistics, - syncPhase); + theParameterMap = std::make_unique(simHitToPhotoelectronsBarrel, + simHitToPhotoelectronsEndcap, + photoelectronsToAnalogBarrel, + photoelectronsToAnalogEndcap, + samplingFactor, + timePhase, + readoutFrameSize, + binOfMaximum, + doPhotostatistics, + syncPhase); //theEcalShape = new EcalShape(timePhase); //theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape); @@ -71,13 +71,13 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet& double ESMIPkeV = ps.getParameter("ESMIPkeV"); */ - theESShape = new ESShape(); - theEBShape = new EBShape(consumesCollector()); - theEEShape = new EEShape(consumesCollector()); + theESShape = std::make_unique(); + theEBShape = std::make_unique(consumesCollector()); + theEEShape = std::make_unique(consumesCollector()); - theESResponse = new CaloHitResponse(theParameterMap, theESShape); - theEBResponse = new CaloHitResponse(theParameterMap, theEBShape); - theEEResponse = new CaloHitResponse(theParameterMap, theEEShape); + theESResponse = std::make_unique(theParameterMap.get(), theESShape.get()); + theEBResponse = std::make_unique(theParameterMap.get(), theEBShape.get()); + theEEResponse = std::make_unique(theParameterMap.get(), theEEShape.get()); // double effwei = 1.; @@ -614,12 +614,12 @@ void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventS // ADC -> GeV Scale const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc); - EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); + EcalMGPAGainRatio defaultRatios; gainConv_[1] = 1.; - gainConv_[2] = defaultRatios->gain12Over6(); - gainConv_[3] = gainConv_[2] * (defaultRatios->gain6Over1()); - gainConv_[0] = gainConv_[2] * (defaultRatios->gain6Over1()); + gainConv_[2] = defaultRatios.gain12Over6(); + gainConv_[3] = gainConv_[2] * (defaultRatios.gain6Over1()); + gainConv_[0] = gainConv_[2] * (defaultRatios.gain6Over1()); LogDebug("EcalDigi") << " Gains conversions: " << "\n" @@ -627,8 +627,6 @@ void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventS << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3]; - delete defaultRatios; - const double barrelADCtoGeV_ = agc->getEBValue(); LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_; const double endcapADCtoGeV_ = agc->getEEValue(); diff --git a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h index 093ce2a4fc4c3..a565facebea8e 100644 --- a/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h +++ b/Validation/EcalDigis/plugins/EcalMixingModuleValidation.h @@ -149,16 +149,16 @@ class EcalMixingModuleValidation : public DQMOneEDAnalyzer<> { MonitorElement* meEEShapeRatio_; MonitorElement* meESShapeRatio_; - const EcalSimParameterMap* theParameterMap; + std::unique_ptr theParameterMap; //const CaloVShape * theEcalShape; - ESShape* theESShape; - EBShape* theEBShape; - EEShape* theEEShape; + std::unique_ptr theESShape; + std::unique_ptr theEBShape; + std::unique_ptr theEEShape; //CaloHitResponse * theEcalResponse; - CaloHitResponse* theESResponse; - CaloHitResponse* theEBResponse; - CaloHitResponse* theEEResponse; + std::unique_ptr theESResponse; + std::unique_ptr theEBResponse; + std::unique_ptr theEEResponse; void computeSDBunchDigi(const edm::EventSetup& eventSetup, const MixCollection& theHits, From 9ebd1a9e22216b26b5da733858084683fdd8645a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 17 Aug 2021 15:08:27 +0200 Subject: [PATCH 049/923] Call setEventSetup() only in Event functions in EcalDigiProducer and ..._Ph2 The call was already there for premixing. --- .../EcalSimProducers/interface/EcalDigiProducer.h | 1 - .../interface/EcalDigiProducer_Ph2.h | 1 - .../EcalSimProducers/src/EcalDigiProducer.cc | 14 +++----------- .../EcalSimProducers/src/EcalDigiProducer_Ph2.cc | 9 ++------- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h index a22511ae9f8ec..d20441acc87db 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h @@ -87,7 +87,6 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { void accumulate(PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override; void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override; void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override; - void beginRun(edm::Run const &run, edm::EventSetup const &setup) override; void setEBNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator); void setEENoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator); diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer_Ph2.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer_Ph2.h index 40132d66b04f9..61353791ae649 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer_Ph2.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer_Ph2.h @@ -64,7 +64,6 @@ class EcalDigiProducer_Ph2 : public DigiAccumulatorMixMod { void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override; void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; - void beginRun(edm::Run const& run, edm::EventSetup const& setup) override; void setEBNoiseSignalGenerator(EcalBaseSignalGenerator* noiseGenerator); diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index f2dbf4e0dcfd8..44b8a5f065db9 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -312,17 +312,15 @@ void EcalDigiProducer::accumulate(edm::Event const &e, edm::EventSetup const &ev // Step A: Get Inputs edm::Handle> ebHandle; if (m_doEB) { - m_EBShape.setEventSetup(eventSetup); // need to set the eventSetup here, otherwise pre-mixing - // module will not wrk - m_APDShape.setEventSetup(eventSetup); // + m_EBShape.setEventSetup(eventSetup); + m_APDShape.setEventSetup(eventSetup); edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); e.getByLabel(ebTag, ebHandle); } edm::Handle> eeHandle; if (m_doEE) { - m_EEShape.setEventSetup(eventSetup); // need to set the eventSetup here, otherwise pre-mixing - // module will not work + m_EEShape.setEventSetup(eventSetup); edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); e.getByLabel(eeTag, eeHandle); } @@ -572,9 +570,3 @@ void EcalDigiProducer::setESNoiseSignalGenerator(EcalBaseSignalGenerator *noiseG if (nullptr != m_ESDigitizer) m_ESDigitizer->setNoiseSignalGenerator(noiseGenerator); } - -void EcalDigiProducer::beginRun(edm::Run const &run, edm::EventSetup const &setup) { - m_EBShape.setEventSetup(setup); - m_EEShape.setEventSetup(setup); - m_APDShape.setEventSetup(setup); -} diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc index 26b90a3f8e0f4..b7caf657140f7 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer_Ph2.cc @@ -200,8 +200,8 @@ void EcalDigiProducer_Ph2::accumulate(edm::Event const& e, edm::EventSetup const // Step A: Get Inputs edm::Handle> ebHandle; - m_EBShape.setEventSetup(eventSetup); // need to set the eventSetup here, otherwise pre-mixing module will not wrk - m_APDShape.setEventSetup(eventSetup); // + m_EBShape.setEventSetup(eventSetup); + m_APDShape.setEventSetup(eventSetup); edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); e.getByLabel(ebTag, ebHandle); @@ -325,8 +325,3 @@ void EcalDigiProducer_Ph2::updateGeometry() { void EcalDigiProducer_Ph2::setEBNoiseSignalGenerator(EcalBaseSignalGenerator* noiseGenerator) { m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator); } - -void EcalDigiProducer_Ph2::beginRun(edm::Run const& run, edm::EventSetup const& setup) { - m_EBShape.setEventSetup(setup); - m_APDShape.setEventSetup(setup); -} From 4c277aa8bcd657bd10e6bcb5a514ad5232567d0b Mon Sep 17 00:00:00 2001 From: yuanchao Date: Fri, 20 Aug 2021 18:56:41 +0800 Subject: [PATCH 050/923] recover some headers as requested by Joosep Pata --- CommonTools/UtilAlgos/interface/MinSelector.h | 20 +++++ .../UtilAlgos/interface/OrPairSelector.h | 21 +++++ CommonTools/Utils/interface/LazyResult.h | 76 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100755 CommonTools/UtilAlgos/interface/MinSelector.h create mode 100755 CommonTools/UtilAlgos/interface/OrPairSelector.h create mode 100644 CommonTools/Utils/interface/LazyResult.h diff --git a/CommonTools/UtilAlgos/interface/MinSelector.h b/CommonTools/UtilAlgos/interface/MinSelector.h new file mode 100755 index 0000000000000..efa3d22ccca5d --- /dev/null +++ b/CommonTools/UtilAlgos/interface/MinSelector.h @@ -0,0 +1,20 @@ +#ifndef UtilAlgos_MinSelector_h +#define UtilAlgos_MinSelector_h +#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" +#include "CommonTools/Utils/interface/MinSelector.h" + +namespace reco { + namespace modules { + + template + struct ParameterAdapter > { + static MinSelector make( const edm::ParameterSet & cfg ) { + return MinSelector( cfg.template getParameter( "min" ) ); + } + }; + + } +} + +#endif + diff --git a/CommonTools/UtilAlgos/interface/OrPairSelector.h b/CommonTools/UtilAlgos/interface/OrPairSelector.h new file mode 100755 index 0000000000000..afea4fecf1847 --- /dev/null +++ b/CommonTools/UtilAlgos/interface/OrPairSelector.h @@ -0,0 +1,21 @@ +#ifndef UtilAlgos_OrPairSelector_h +#define UtilAlgos_OrPairSelector_h +#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" +#include "CommonTools/Utils/interface/OrPairSelector.h" + +namespace reco { + namespace modules { + + template + struct ParameterAdapter > { + static OrPairSelector make(const edm::ParameterSet & cfg) { + return OrPairSelector(modules::make(cfg.getParameter("cut1")), + modules::make(cfg.getParameter("cut2"))); + } + }; + + } +} + +#endif + diff --git a/CommonTools/Utils/interface/LazyResult.h b/CommonTools/Utils/interface/LazyResult.h new file mode 100644 index 0000000000000..e15dc6afd1cf2 --- /dev/null +++ b/CommonTools/Utils/interface/LazyResult.h @@ -0,0 +1,76 @@ +#ifndef CommonTools_Utils_LazyResult_h +#define CommonTools_Utils_LazyResult_h +// -*- C++ -*- +// +// Package: CommonTools/Utils +// Class : LazyResult +// +/**\class LazyResult LazyResult.h "CommonTools/Utils/interface/LazyResult.h" + Description: Wrapper around a function call for lazy execution. + + Usage: + // example: lazy addition + auto result = LazyResult(std::plus, x, x); + std::cout << result.value() << std::endl; + +Notes: + * The arguments for the delayed call are stored by reference (watch their + lifetime). + * The overhead in memory compared to just storing the result is small: one + reference per argument, one bool flag and a function pointer (on my system: + 1 byte for lambda function, 8 bytes for global function and 16 bytes for + member function due to possible index to virtual table). + +Implementation: + + * For the Args... we explicitly add const& (also in the the args_ tuple). + Otherwise, the arguments will be stored by value which comes with too much + overhead. This implies that the lifetime of the arguments passed to + LazyResult neet to live longer than the LazyResult instance. Function pointers + are small, so no need for const& to the Func. + * An alternative to using a ::value() member function to get the result could + be a cast operator: operator Result const &(). This might be pretty because + the result is automatically evaluated the first time you try to bind it to + a Result const &. I think this would however be too implicit and dangerous. + +*/ +// +// Original Author: Jonas Rembser +// Created: Mon, 14 Jun 2020 00:00:00 GMT +// + +#include +#include + +template +class LazyResult { +public: + using Result = typename std::invoke_result::type; + + LazyResult(Func func, Args const&... args) : func_(func), args_(args...) {} + + Result const& value() { + if (!evaluated_) { + evaluate(); + } + return result_; + } + +private: + void evaluate() { evaluateImpl(std::make_index_sequence{}); } + + template + void evaluateImpl(std::index_sequence) { + result_ = func_(std::get(args_)...); + evaluated_ = true; + } + + // having evaluated_ and the potentially small func_ together might + // save alignemnt bits (e.g. a lambda function is just 1 byte) + bool evaluated_ = false; + Func func_; + std::tuple args_; + Result result_; +}; + +#endif From 74f57dd04426590055737390256c059dbd26fa72 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Fri, 20 Aug 2021 19:02:48 +0800 Subject: [PATCH 051/923] recover some headers as requested by Joosep Pata --- CommonTools/Utils/interface/MinSelector.h | 19 +++++++++++++++++ CommonTools/Utils/interface/OrPairSelector.h | 22 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 CommonTools/Utils/interface/MinSelector.h create mode 100755 CommonTools/Utils/interface/OrPairSelector.h diff --git a/CommonTools/Utils/interface/MinSelector.h b/CommonTools/Utils/interface/MinSelector.h new file mode 100755 index 0000000000000..14e2fa5b23c3d --- /dev/null +++ b/CommonTools/Utils/interface/MinSelector.h @@ -0,0 +1,19 @@ +#ifndef RecoAlgos_MinSelector_h +#define RecoAlgos_MinSelector_h +/* \class MinSelector + * + * \author Luca Lista, INFN + * + * $Id: MinSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ + */ + +template +struct MinSelector { + MinSelector( T min ) : min_( min ) { } + bool operator()( T t ) const { return t >= min_; } + +private: + T min_; +}; + +#endif diff --git a/CommonTools/Utils/interface/OrPairSelector.h b/CommonTools/Utils/interface/OrPairSelector.h new file mode 100755 index 0000000000000..2619ee3378a2c --- /dev/null +++ b/CommonTools/Utils/interface/OrPairSelector.h @@ -0,0 +1,22 @@ +#ifndef CommonTools_Utils_OrPairSelector_h +#define CommonTools_Utils_OrPairSelector_h +/* \class OrPairSelector + * + * \author Luca Lista, INFN + * + * $Id: OrPairSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ + */ + +template +struct OrPairSelector { + OrPairSelector(const S1 & s1, const S2 & s2) : s1_(s1), s2_(s2) { } + template + bool operator()(const T1 & t1, const T2 & t2) const { + return s1_(t1) || s2_(t2); + } +private: + S1 s1_; + S2 s2_; +}; + +#endif From 06c1e3ee5022541e1369ae8d5a7e7d302df25294 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Fri, 20 Aug 2021 20:23:59 +0800 Subject: [PATCH 052/923] fixed code check errors on altered files --- CommonTools/UtilAlgos/interface/MinSelector.h | 13 ++++++------- CommonTools/UtilAlgos/interface/OrPairSelector.h | 15 +++++++-------- CommonTools/Utils/interface/MinSelector.h | 6 +++--- CommonTools/Utils/interface/OrPairSelector.h | 9 +++++---- 4 files changed, 21 insertions(+), 22 deletions(-) mode change 100755 => 100644 CommonTools/UtilAlgos/interface/MinSelector.h mode change 100755 => 100644 CommonTools/UtilAlgos/interface/OrPairSelector.h mode change 100755 => 100644 CommonTools/Utils/interface/MinSelector.h mode change 100755 => 100644 CommonTools/Utils/interface/OrPairSelector.h diff --git a/CommonTools/UtilAlgos/interface/MinSelector.h b/CommonTools/UtilAlgos/interface/MinSelector.h old mode 100755 new mode 100644 index efa3d22ccca5d..c92b27faa991c --- a/CommonTools/UtilAlgos/interface/MinSelector.h +++ b/CommonTools/UtilAlgos/interface/MinSelector.h @@ -5,16 +5,15 @@ namespace reco { namespace modules { - - template + + template struct ParameterAdapter > { - static MinSelector make( const edm::ParameterSet & cfg ) { - return MinSelector( cfg.template getParameter( "min" ) ); + static MinSelector make(const edm::ParameterSet& cfg) { + return MinSelector(cfg.template getParameter("min")); } }; - } -} + } // namespace modules +} // namespace reco #endif - diff --git a/CommonTools/UtilAlgos/interface/OrPairSelector.h b/CommonTools/UtilAlgos/interface/OrPairSelector.h old mode 100755 new mode 100644 index afea4fecf1847..8b87a4ccdabf1 --- a/CommonTools/UtilAlgos/interface/OrPairSelector.h +++ b/CommonTools/UtilAlgos/interface/OrPairSelector.h @@ -5,17 +5,16 @@ namespace reco { namespace modules { - - template + + template struct ParameterAdapter > { - static OrPairSelector make(const edm::ParameterSet & cfg) { - return OrPairSelector(modules::make(cfg.getParameter("cut1")), - modules::make(cfg.getParameter("cut2"))); + static OrPairSelector make(const edm::ParameterSet& cfg) { + return OrPairSelector(modules::make(cfg.getParameter("cut1")), + modules::make(cfg.getParameter("cut2"))); } }; - } -} + } // namespace modules +} // namespace reco #endif - diff --git a/CommonTools/Utils/interface/MinSelector.h b/CommonTools/Utils/interface/MinSelector.h old mode 100755 new mode 100644 index 14e2fa5b23c3d..810932963e388 --- a/CommonTools/Utils/interface/MinSelector.h +++ b/CommonTools/Utils/interface/MinSelector.h @@ -7,10 +7,10 @@ * $Id: MinSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ */ -template +template struct MinSelector { - MinSelector( T min ) : min_( min ) { } - bool operator()( T t ) const { return t >= min_; } + MinSelector(T min) : min_(min) {} + bool operator()(T t) const { return t >= min_; } private: T min_; diff --git a/CommonTools/Utils/interface/OrPairSelector.h b/CommonTools/Utils/interface/OrPairSelector.h old mode 100755 new mode 100644 index 2619ee3378a2c..afdd6da046a0f --- a/CommonTools/Utils/interface/OrPairSelector.h +++ b/CommonTools/Utils/interface/OrPairSelector.h @@ -7,13 +7,14 @@ * $Id: OrPairSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ */ -template +template struct OrPairSelector { - OrPairSelector(const S1 & s1, const S2 & s2) : s1_(s1), s2_(s2) { } - template - bool operator()(const T1 & t1, const T2 & t2) const { + OrPairSelector(const S1& s1, const S2& s2) : s1_(s1), s2_(s2) {} + template + bool operator()(const T1& t1, const T2& t2) const { return s1_(t1) || s2_(t2); } + private: S1 s1_; S2 s2_; From b465e7d2defbe4c601773b8ba996eeb9e0c6eeb3 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Fri, 20 Aug 2021 19:02:26 +0200 Subject: [PATCH 053/923] Fix material ordering --- .../DDCMS/interface/DDParsingContext.h | 6 +- .../plugins/dd4hep/DDDefinitions2Objects.cc | 6 +- .../interface/DDCoreToDDXMLOutput.h | 3 +- .../plugins/OutputDD4hepToDDL.cc | 5 +- .../src/DDCoreToDDXMLOutput.cc | 9 ++- .../data/PhaseI/v2/pixbarmaterial.xml | 64 +++++++++---------- .../Modules/v1/ppstrackerMaterials.xml | 60 ++++++++--------- 7 files changed, 78 insertions(+), 75 deletions(-) diff --git a/DetectorDescription/DDCMS/interface/DDParsingContext.h b/DetectorDescription/DDCMS/interface/DDParsingContext.h index 135571f0fa425..66acb4b1f2d0e 100644 --- a/DetectorDescription/DDCMS/interface/DDParsingContext.h +++ b/DetectorDescription/DDCMS/interface/DDParsingContext.h @@ -27,7 +27,8 @@ namespace cms { namespaces.emplace_back(""); if (makePayload) { rotRevMap.reserve(3000); - allCompMaterials.reserve(400); + compMaterialsVec.reserve(400); + compMaterialsRefs.reserve(400); } } @@ -84,7 +85,8 @@ namespace cms { std::vector namespaces; std::unordered_map> unresolvedMaterials; - std::unordered_map>> allCompMaterials; + std::vector> compMaterialsVec; + std::unordered_map> compMaterialsRefs; std::unordered_map> unresolvedVectors; std::unordered_map, diff --git a/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc b/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc index 08d81af2650c1..7b4f3897ec5db 100644 --- a/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc +++ b/DetectorDescription/DDCMS/plugins/dd4hep/DDDefinitions2Objects.cc @@ -603,6 +603,9 @@ void Converter::operator()(xml_h element) const { #endif + if (ns.context()->makePayload) { + ns.context()->compMaterialsVec.emplace_back(std::make_pair(nam, density)); + } for (composites.reset(); composites; ++composites) { xml_dim_t xfrac(composites); xml_dim_t xfrac_mat(xfrac.child(DD_CMU(rMaterial))); @@ -610,8 +613,7 @@ void Converter::operator()(xml_h element) const { string fracname = ns.realName(xfrac_mat.nameStr()); if (ns.context()->makePayload) { - ns.context()->allCompMaterials[nam].first = density; - ns.context()->allCompMaterials[nam].second.emplace_back( + ns.context()->compMaterialsRefs[nam].emplace_back( cms::DDParsingContext::CompositeMaterial(ns.prepend(fracname), fraction)); } TGeoMaterial* frac_mat = mgr.GetMaterial(fracname.c_str()); diff --git a/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h b/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h index 69c6ebf2ea5ac..7cde97a725962 100644 --- a/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h +++ b/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h @@ -43,8 +43,7 @@ struct DDCoreToDDXMLOutput { void element(const TGeoMaterial* element, std::ostream& xos); void material(const DDMaterial& material, std::ostream& xos); - void material( - const std::pair>>& material, + void material(const std::string& matName, double density, const std::vector& matRefs, std::ostream& xos); void rotation(const DDRotation& rotation, std::ostream& xos, const std::string& rotn = ""); diff --git a/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc b/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc index caa71771f1f6b..59ad0879f54dd 100644 --- a/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc +++ b/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc @@ -123,8 +123,9 @@ void OutputDD4hepToDDL::beginRun(const edm::Run &, edm::EventSetup const &es) { out.element(dynamic_cast(iter), *m_xos); } // Output composite materials - for (const auto &it : parsingContext->allCompMaterials) { - out.material(it, *m_xos); + for (const auto &it : parsingContext->compMaterialsVec) { + const std::string& matName = it.first; + out.material(matName, it.second, parsingContext->compMaterialsRefs[matName], *m_xos); } (*m_xos) << "" << std::endl; (*m_xos) << "" << std::endl; diff --git a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc index f99be33e89f6c..80d3a9c4263a3 100644 --- a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc +++ b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc @@ -611,15 +611,14 @@ void DDCoreToDDXMLOutput::material(const DDMaterial& material, std::ostream& xos } void DDCoreToDDXMLOutput::material( - const std::pair>>& material, + const std::string& matName, double density, const std::vector& matRefs, std::ostream& xos) { - xos << "" << std::endl; - auto compIter = material.second.second.begin(); - for (; compIter != material.second.second.end(); ++compIter) { + for (auto compIter = matRefs.begin(); compIter != matRefs.end(); ++compIter) { xos << "fraction << "\">" << std::endl; xos << "name << "\"/>" << std::endl; diff --git a/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml b/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml index 7e1020e1e40ac..872bc8761850c 100644 --- a/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml +++ b/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml @@ -32,6 +32,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -51,13 +81,13 @@ - + - + @@ -81,21 +111,6 @@ - - - - - - - - - - - - - - - @@ -105,21 +120,6 @@ - - - - - - - - - - - - - - - diff --git a/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml index 9ee4b14612bf3..be5ac14bcf300 100644 --- a/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml +++ b/Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml @@ -29,42 +29,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -113,6 +83,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 38fcafa90c573dabef0592d088a3aefe52fe17fc Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 20 Aug 2021 19:41:24 +0200 Subject: [PATCH 054/923] Add a possible AlCa stream for IsoTrackFilter useful for MC productions --- .../ALCARECOHcalCalIsoTrkFilterNoHLT_cff.py | 11 +++ .../test/AlCaIsoTrackFilterNoHLT_cfg.py | 93 +++++++++++++++++++ .../python/AlCaRecoStreams_cff.py | 11 +++ 3 files changed, 115 insertions(+) create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_cff.py new file mode 100644 index 0000000000000..f6be9f9e68800 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_cff.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +#------------------------------------------------ +#AlCaReco filtering for HCAL isotrk: +#------------------------------------------------ + +from Calibration.HcalAlCaRecoProducers.alcaIsoTracksFilter_cff import * + +seqALCARECOHcalCalIsoTrkFilterNoHLT = cms.Sequence(alcaIsoTracksFilter) + + diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py new file mode 100644 index 0000000000000..59b8090941980 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py @@ -0,0 +1,93 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 + +process = cms.Process('RECO',Run2_2018) + +# 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.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.AlCaRecoStreams_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/UL_1TeV_pion_gun_RAW_0_0.root', +# "root://cmseos.fnal.gov//eos/uscms/store/user/lpcrutgers/huiwang/HCAL/UL_DoublePion_E-50_RAW_noPU-2020-12-25/UL_1TeV_pion_gun_RAW_0_0.root" + ), + #skipEvents = cms.untracked.uint32(516), + secondaryFileNames = cms.untracked.vstring() +) + +process.options = cms.untracked.PSet( + +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('reco_MC nevts:100'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition +process.ALCARECOStreamHcalCalIsoTrkFilter = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalIsoTrkFilterNoHLT') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('ALCARECO'), + filterName = cms.untracked.string('ALCARECOHcalCalIsoTrkFilterNoHLT') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = process.OutALCARECOHcalCalIsoTrkFilter.outputCommands, + fileName = cms.untracked.string('PoolOutput.root'), +) + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '106X_upgrade2018_realistic_v11_L1v1', '') + +# Path and EndPath definitions +process.raw2digi_step = cms.Path(process.RawToDigi) +process.reconstruction_step = cms.Path(process.reconstruction) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.ALCARECOStreamHcalCalIsoTrkFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalIsoTrkFilter) + +# Schedule definition +process.schedule = cms.Schedule(process.raw2digi_step,process.reconstruction_step,process.pathALCARECOHcalCalIsoTrkFilterNoHLT,process.endjob_step,process.ALCARECOStreamHcalCalIsoTrkFilterOutPath) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +#Setup FWK for multithreaded +process.options.numberOfThreads=cms.untracked.uint32(1) +process.options.numberOfStreams=cms.untracked.uint32(0) +process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) + + +# 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/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index d1348f9e6ae95..3dfc8ef22cb0d 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -90,6 +90,7 @@ # HCAL isotrack from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrk_cff import * from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilter_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilterNoHLT_cff import * # HCAL noise from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalNoise_cff import * #HCAL calibration iterative PhiSym @@ -214,6 +215,7 @@ pathALCARECOHcalCalHOCosmics = cms.Path(seqALCARECOHcalCalHOCosmics) pathALCARECOHcalCalIsoTrk = cms.Path(seqALCARECOHcalCalIsoTrk*ALCARECOHcalCalIsoTrackDQM) pathALCARECOHcalCalIsoTrkFilter = cms.Path(seqALCARECOHcalCalIsoTrkFilter) +pathALCARECOHcalCalIsoTrkFilterNoHLT = cms.Path(seqALCARECOHcalCalIsoTrkFilterNoHLT) pathALCARECOHcalCalNoise = cms.Path(seqALCARECOHcalCalNoise) pathALCARECOHcalCalIterativePhiSym = cms.Path(seqALCARECOHcalCalIterativePhiSym*ALCARECOHcalCalIterativePhisymDQM) pathALCARECOHcalCalIsolatedBunchFilter = cms.Path(seqALCARECOHcalCalIsolatedBunchFilter) @@ -627,6 +629,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamHcalCalIsoTrkFilterNoHLT = cms.FilteredStream( + responsible = 'Sunanda Banerjee', + name = 'HcalCalIsoTrkFilterNoHLT', + paths = (pathALCARECOHcalCalIsoTrkFilterNoHLT), + content = OutALCARECOHcalCalIsoTrkFilter.outputCommands, + selectEvents = OutALCARECOHcalCalIsoTrkFilter.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamHcalCalNoise = cms.FilteredStream( responsible = 'Grigory Safronov', name = 'HcalCalNoise', From 6b876dfa4ba5a93d8d121a9f50145704b92d3fe0 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee Date: Sat, 21 Aug 2021 20:13:47 +0200 Subject: [PATCH 055/923] replace EDProducer with clone cfi and drop type spec --- .../PatAlgos/plugins/PATElectronProducer.cc | 4 +- .../PatAlgos/plugins/PATPhotonProducer.cc | 4 +- .../producersLayer1/electronProducer_cfi.py | 89 +++++++++---------- .../producersLayer1/photonProducer_cfi.py | 61 ++++++------- 4 files changed, 76 insertions(+), 82 deletions(-) diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index ad05429fab5a6..34712c9334355 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -1319,8 +1319,8 @@ void PATElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr electronIDSourcesPSet.setAllowAnything(); iDesc .addNode( - edm::ParameterDescription("electronIDSource", edm::InputTag(), true) xor - edm::ParameterDescription("electronIDSources", electronIDSourcesPSet, true)) + edm::ParameterDescription("electronIDSources", electronIDSourcesPSet, true) xor + edm::ParameterDescription("electronIDSource", edm::InputTag(), true)) ->setComment("input with electron ID variables"); // mini-iso diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index 0de95e311a2f2..108208c87f795 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -691,8 +691,8 @@ void PATPhotonProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip edm::ParameterSetDescription photonIDSourcesPSet; photonIDSourcesPSet.setAllowAnything(); iDesc - .addNode(edm::ParameterDescription("photonIDSource", edm::InputTag(), true) xor - edm::ParameterDescription("photonIDSources", photonIDSourcesPSet, true)) + .addNode(edm::ParameterDescription("photonIDSources", photonIDSourcesPSet, true) xor + edm::ParameterDescription("photonIDSource", edm::InputTag(), true)) ->setComment("input with photon ID variables"); // IsoDeposit configurables diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py index 07260783764c0..c4edcb674efe5 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py @@ -1,22 +1,21 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.PatAlgos.PATElectronProducer_cfi as _mod -patElectrons = cms.EDProducer("PATElectronProducer", +patElectrons = _mod.PATElectronProducer.clone( # input collection - electronSource = cms.InputTag("gedGsfElectrons"), + electronSource = "gedGsfElectrons", # use particle flow instead of std reco - useParticleFlow = cms.bool( False ), - pfElectronSource = cms.InputTag("particleFlow"), - pfCandidateMap = cms.InputTag("particleFlow:electrons"), - usePfCandidateMultiMap = cms.bool( False ), + pfElectronSource = "particleFlow", + pfCandidateMap = "particleFlow:electrons", # collections for mva input variables - addMVAVariables = cms.bool( True ), - reducedBarrelRecHitCollection = cms.InputTag("reducedEcalRecHitsEB"), - reducedEndcapRecHitCollection = cms.InputTag("reducedEcalRecHitsEE"), + addMVAVariables = True, + reducedBarrelRecHitCollection = "reducedEcalRecHitsEB", + reducedEndcapRecHitCollection = "reducedEcalRecHitsEE", # user data to add - userData = cms.PSet( + userData = dict( # add custom classes here userClasses = cms.PSet( src = cms.VInputTag('') @@ -34,25 +33,23 @@ src = cms.VInputTag('') ), # add "inline" functions here - userFunctions = cms.vstring(), - userFunctionLabels = cms.vstring() + userFunctions = [], + userFunctionLabels = [] ), - - # embedding of AOD items - embedGsfElectronCore = cms.bool(True), ## embed in AOD externally stored gsf electron core - embedGsfTrack = cms.bool(False), ## embed in AOD externally stored gsf track - embedSuperCluster = cms.bool(True), ## embed in AOD externally stored supercluster - embedPflowSuperCluster = cms.bool(True), ## embed in AOD externally stored supercluster - embedSeedCluster = cms.bool(True), ## embed in AOD externally stored the electron's seedcluster - embedBasicClusters = cms.bool(True), ## embed in AOD externally stored the electron's basic clusters - embedPreshowerClusters = cms.bool(True), ## embed in AOD externally stored the electron's preshower clusters - embedPflowBasicClusters = cms.bool(True), ## embed in AOD externally stored the electron's pflow basic clusters - embedPflowPreshowerClusters = cms.bool(True), ## embed in AOD externally stored the electron's pflow preshower clusters - embedPFCandidate = cms.bool(True), ## embed in AOD externally stored particle flow candidate - embedTrack = cms.bool(True), ## embed in AOD externally stored track (note: gsf electrons don't have a track) - embedRecHits = cms.bool(True), ## embed in AOD externally stored the RecHits - can be called from the PATElectronProducer + embedGsfElectronCore = True, ## embed in AOD externally stored gsf electron core + embedGsfTrack = False, ## embed in AOD externally stored gsf track + embedSuperCluster = True, ## embed in AOD externally stored supercluster + embedPflowSuperCluster = True, ## embed in AOD externally stored supercluster + embedSeedCluster = True, ## embed in AOD externally stored the electron's seedcluster + embedBasicClusters = True, ## embed in AOD externally stored the electron's basic clusters + embedPreshowerClusters = True, ## embed in AOD externally stored the electron's preshower clusters + embedPflowBasicClusters = True, ## embed in AOD externally stored the electron's pflow basic clusters + embedPflowPreshowerClusters = True, ## embed in AOD externally stored the electron's pflow preshower clusters + embedPFCandidate = True, ## embed in AOD externally stored particle flow candidate + embedTrack = True, ## embed in AOD externally stored track (note: gsf electrons don't have a track) + embedRecHits = True, ## embed in AOD externally stored the RecHits - can be called from the PATElectronProducer # embed IsoDeposits to recompute isolation isoDeposits = cms.PSet(), @@ -60,44 +57,44 @@ # user defined isolation variables the variables defined here will be accessible # via pat::Electron::userIsolation(IsolationKeys key) with the key as defined in # DataFormats/PatCandidates/interface/Isolation.h - userIsolation = cms.PSet(), + userIsolation = dict(), # electron ID - addElectronID = cms.bool(False), + addElectronID = False, electronIDSources = cms.PSet(), # mc matching - addGenMatch = cms.bool(True), - embedGenMatch = cms.bool(True), - genParticleMatch = cms.InputTag("electronMatch"), ## Association between electrons and generator particles + addGenMatch = True, + embedGenMatch = True, + genParticleMatch = "electronMatch", ## Association between electrons and generator particles # efficiencies - addEfficiencies = cms.bool(False), - efficiencies = cms.PSet(), + addEfficiencies = False, + efficiencies = dict(), # resolution configurables - addResolutions = cms.bool(False), - resolutions = cms.PSet(), + addResolutions = False, + resolutions = dict(), # high level selections - embedHighLevelSelection = cms.bool(True), - beamLineSrc = cms.InputTag("offlineBeamSpot"), - pvSrc = cms.InputTag("offlinePrimaryVertices"), + embedHighLevelSelection = True, + beamLineSrc = "offlineBeamSpot", + pvSrc = "offlinePrimaryVertices", # PFClusterIso - addPFClusterIso = cms.bool(False), - ecalPFClusterIsoMap = cms.InputTag(""), - hcalPFClusterIsoMap = cms.InputTag(""), - addPuppiIsolation = cms.bool(False), + addPFClusterIso = False, + ecalPFClusterIsoMap = "", + hcalPFClusterIsoMap = "", + addPuppiIsolation = False, # Compute and store Mini-Isolation. # Implemention and a description of parameters can be found in: # PhysicsTools/PatUtils/src/PFIsolation.cc # only works in miniaod, so set to True in miniAOD_tools.py - computeMiniIso = cms.bool(False), - pfCandsForMiniIso = cms.InputTag("packedPFCandidates"), + computeMiniIso = False, + pfCandsForMiniIso = "packedPFCandidates", # veto on candidates in deadcone only in endcap - miniIsoParamsE = cms.vdouble(0.05, 0.2, 10.0, 0.0, 0.015, 0.015, 0.08, 0.0, 0.0), - miniIsoParamsB = cms.vdouble(0.05, 0.2, 10.0, 0.0, 0.000, 0.000, 0.00, 0.0, 0.0), + miniIsoParamsE = [0.05, 0.2, 10.0, 0.0, 0.015, 0.015, 0.08, 0.0, 0.0], + miniIsoParamsB = [0.05, 0.2, 10.0, 0.0, 0.000, 0.000, 0.00, 0.0, 0.0], ) diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py index 7341373606edc..d1f189ccb0793 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py @@ -1,16 +1,14 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.PatAlgos.PATPhotonProducer_cfi as _mod -patPhotons = cms.EDProducer("PATPhotonProducer", +patPhotons = _mod.PATPhotonProducer.clone( # input collection - photonSource = cms.InputTag("gedPhotons"), - electronSource = cms.InputTag("gedGsfElectrons"), - beamLineSrc = cms.InputTag("offlineBeamSpot"), + photonSource = "gedPhotons", + electronSource = "gedGsfElectrons", + beamLineSrc = "offlineBeamSpot", - reducedBarrelRecHitCollection = cms.InputTag("reducedEcalRecHitsEB"), - reducedEndcapRecHitCollection = cms.InputTag("reducedEcalRecHitsEE"), - # user data to add - userData = cms.PSet( + userData = dict( # add custom classes here userClasses = cms.PSet( src = cms.VInputTag('') @@ -28,18 +26,17 @@ src = cms.VInputTag('') ), # add "inline" functions here - userFunctions = cms.vstring(), - userFunctionLabels = cms.vstring() + userFunctions = [], + userFunctionLabels = [] ), - # embedding of AOD items - embedSuperCluster = cms.bool(True), ## whether to embed in AOD externally stored supercluster - embedSeedCluster = cms.bool(True), ## embed in AOD externally stored the photon's seedcluster - embedBasicClusters = cms.bool(True), ## embed in AOD externally stored the photon's basic clusters - embedPreshowerClusters = cms.bool(True), ## embed in AOD externally stored the photon's preshower clusters - embedRecHits = cms.bool(True), ## embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer - saveRegressionData = cms.bool(True), ## save regression input variables + embedSuperCluster = True, ## whether to embed in AOD externally stored supercluster + embedSeedCluster = True, ## embed in AOD externally stored the photon's seedcluster + embedBasicClusters = True, ## embed in AOD externally stored the photon's basic clusters + embedPreshowerClusters = True, ## embed in AOD externally stored the photon's preshower clusters + embedRecHits = True, ## embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer + saveRegressionData = True, ## save regression input variables # embed IsoDeposits to recompute isolation isoDeposits = cms.PSet(), @@ -47,30 +44,30 @@ # user defined isolation variables the variables defined here will be accessible # via pat::Photon::userIsolation(IsolationKeys key) with the key as defined in # DataFormats/PatCandidates/interface/Isolation.h - userIsolation = cms.PSet( - #PFClusterEcalIso = cms.InputTag('electronEcalPFClusterIsolationProducer'), - #PFClusterHcalIso = cms.InputTag('electronHcalPFClusterIsolationProducer'), + userIsolation = dict( + #PFClusterEcalIso = 'electronEcalPFClusterIsolationProducer', + #PFClusterHcalIso = 'electronHcalPFClusterIsolationProducer', ), # photon ID - addPhotonID = cms.bool(False), + addPhotonID = False, photonIDSources = cms.PSet(), # mc matching - addGenMatch = cms.bool(True), - embedGenMatch = cms.bool(True), - genParticleMatch = cms.InputTag("photonMatch"), ## particles source to be used for the matching + addGenMatch = True, + embedGenMatch = True, + genParticleMatch = "photonMatch", ## particles source to be used for the matching # efficiencies - addEfficiencies = cms.bool(False), - efficiencies = cms.PSet(), + addEfficiencies = False, + efficiencies = dict(), # resolutions - addResolutions = cms.bool(False), - resolutions = cms.PSet(), + addResolutions = False, + resolutions = dict(), # PFClusterIso - addPFClusterIso = cms.bool(False), - ecalPFClusterIsoMap = cms.InputTag(""), - hcalPFClusterIsoMap = cms.InputTag(""), - addPuppiIsolation = cms.bool(False) + addPFClusterIso = False, + ecalPFClusterIsoMap = "", + hcalPFClusterIsoMap = "", + addPuppiIsolation = False ) From c865552e358407e481de67c5b230300a9f2cb8c0 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Sun, 22 Aug 2021 04:57:38 +0200 Subject: [PATCH 056/923] Create new v3 of pixbarmaterial.xml --- .../data/PhaseI/v2/pixbarmaterial.xml | 64 +- .../data/PhaseI/v3/pixbarmaterial.xml | 826 ++++++++++++++++++ 2 files changed, 858 insertions(+), 32 deletions(-) create mode 100644 Geometry/TrackerCommonData/data/PhaseI/v3/pixbarmaterial.xml diff --git a/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml b/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml index 872bc8761850c..7e1020e1e40ac 100644 --- a/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml +++ b/Geometry/TrackerCommonData/data/PhaseI/v2/pixbarmaterial.xml @@ -32,36 +32,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -81,13 +51,13 @@ - + - + @@ -111,6 +81,21 @@ + + + + + + + + + + + + + + + @@ -120,6 +105,21 @@ + + + + + + + + + + + + + + + diff --git a/Geometry/TrackerCommonData/data/PhaseI/v3/pixbarmaterial.xml b/Geometry/TrackerCommonData/data/PhaseI/v3/pixbarmaterial.xml new file mode 100644 index 0000000000000..872bc8761850c --- /dev/null +++ b/Geometry/TrackerCommonData/data/PhaseI/v3/pixbarmaterial.xml @@ -0,0 +1,826 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d289fa9644fdcd39a68581ddff00d4967a797569 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Sun, 22 Aug 2021 04:59:50 +0200 Subject: [PATCH 057/923] Update dictionary for new v3 pixbarmaterial.xml --- Configuration/Geometry/python/dict2021Geometry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index f90b5b8f4081e..c9f40d841b029 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -573,7 +573,7 @@ '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/v3/pixbarmaterial.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladder.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull0.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull1.xml', From 95b936cc5790c05d22fd9e0ed75dd0a7d52d0511 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Fri, 20 Aug 2021 20:40:55 +0200 Subject: [PATCH 058/923] Remove boost lexical_cast dependency in FWCore --- FWCore/Modules/src/EventContentAnalyzer.cc | 5 ----- FWCore/ParameterSet/src/types.cc | 5 ++--- FWCore/Services/plugins/ProcInfoFetcher.cc | 13 ++++++------- FWCore/Services/plugins/SimpleMemoryCheck.cc | 1 - FWCore/Utilities/src/ReleaseVersion.cc | 11 +++++------ 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/FWCore/Modules/src/EventContentAnalyzer.cc b/FWCore/Modules/src/EventContentAnalyzer.cc index 447bc64694335..ca813d12bd36d 100644 --- a/FWCore/Modules/src/EventContentAnalyzer.cc +++ b/FWCore/Modules/src/EventContentAnalyzer.cc @@ -436,11 +436,6 @@ namespace edm { for (nameMap::const_iterator it = cumulates_.begin(), itEnd = cumulates_.end(); it != itEnd; ++it) { LogAbsolute("EventContent") << std::setw(6) << it->second << " occurrences of key " << it->first << std::endl; } - - // Test boost::lexical_cast We don't need this right now so comment it out. - // int k = 137; - // std::string ktext = boost::lexical_cast(k); - // std::cout << "\nInteger " << k << " expressed as a string is |" << ktext << "|" << std::endl; } void EventContentAnalyzer::fillDescriptions(ConfigurationDescriptions& descriptions) { diff --git a/FWCore/ParameterSet/src/types.cc b/FWCore/ParameterSet/src/types.cc index d5b81cf890cec..84157a443d78a 100644 --- a/FWCore/ParameterSet/src/types.cc +++ b/FWCore/ParameterSet/src/types.cc @@ -8,7 +8,6 @@ #include "FWCore/ParameterSet/interface/types.h" -#include "boost/lexical_cast.hpp" #include "FWCore/ParameterSet/src/split.h" #include "FWCore/Utilities/interface/Parse.h" #include @@ -459,9 +458,9 @@ bool edm::decode(double& to, std::string const& from) { else { try { // std::cerr << "from:" << from << std::endl; - to = boost::lexical_cast(from); + to = std::stod(from); // std::cerr << "to:" << to << std::endl; - } catch (boost::bad_lexical_cast&) { + } catch (const std::invalid_argument&) { return false; } } diff --git a/FWCore/Services/plugins/ProcInfoFetcher.cc b/FWCore/Services/plugins/ProcInfoFetcher.cc index aac69f4e7d359..f493129c29cca 100644 --- a/FWCore/Services/plugins/ProcInfoFetcher.cc +++ b/FWCore/Services/plugins/ProcInfoFetcher.cc @@ -23,7 +23,6 @@ #include //#include #include -#include #include #include @@ -96,27 +95,27 @@ namespace { int getInt() { const char* t = getItem(); //std::cout <<"int '"<(t); + return std::stoi(t); } long getLong() { const char* t = getItem(); //std::cout <<"long '"<(t); + return std::stol(t); } unsigned int getUInt() { const char* t = getItem(); //std::cout <<"uint '"<(t); + return std::stoul(t); } unsigned long getULong() { const char* t = getItem(); //std::cout <<"ulong '"<(t); + return std::stoul(t); } unsigned long long getULongLong() { const char* t = getItem(); //std::cout <<"ulong '"<(t); + return std::stoull(t); } char getChar() { return *getItem(); } std::string getString() { return std::string(getItem()); } @@ -210,7 +209,7 @@ namespace edm { pinfo.num_threads >> pinfo.itrealvalue >> pinfo.starttime >> pinfo.vsize >> pinfo.rss >> pinfo.rlim >> pinfo.startcode >> pinfo.endcode >> pinfo.startstack >> pinfo.kstkesp >> pinfo.kstkeip >> pinfo.signal >> pinfo.blocked >> pinfo.sigignore >> pinfo.sigcatch >> pinfo.wchan; - } catch (boost::bad_lexical_cast& iE) { + } catch (const std::invalid_argument& iE) { LogWarning("ProcInfoFetcher") << "Parsing of Prof file failed:" << iE.what() << std::endl; return ProcInfo(); } diff --git a/FWCore/Services/plugins/SimpleMemoryCheck.cc b/FWCore/Services/plugins/SimpleMemoryCheck.cc index da81b98c76b39..8ed7fcd4de984 100644 --- a/FWCore/Services/plugins/SimpleMemoryCheck.cc +++ b/FWCore/Services/plugins/SimpleMemoryCheck.cc @@ -52,7 +52,6 @@ //#include #include //#include -#include #include #include diff --git a/FWCore/Utilities/src/ReleaseVersion.cc b/FWCore/Utilities/src/ReleaseVersion.cc index eefd8da07d4a4..4fd4c4bcbe9ff 100644 --- a/FWCore/Utilities/src/ReleaseVersion.cc +++ b/FWCore/Utilities/src/ReleaseVersion.cc @@ -1,7 +1,6 @@ #include "FWCore/Utilities/interface/ReleaseVersion.h" #include "boost/algorithm/string.hpp" -#include "boost/lexical_cast.hpp" #include #include @@ -33,17 +32,17 @@ namespace edm { /* if(parts.size() == 4) { if(releaseVersion.find("patch") != std::string::npos) { - patch_ = boost::lexical_cast(parts[3]); + patch_ = std::stoul(parts[3]); } else if(releaseVersion.find("pre") != std::string::npos) { - pre_ = boost::lexical_cast(parts[3]); + pre_ = std::stoul(parts[3]); } else { return; } } */ - major_ = boost::lexical_cast(parts[0]); - minor_ = boost::lexical_cast(parts[1]); - // point_ = boost::lexical_cast(parts[2]); + major_ = std::stoul(parts[0]); + minor_ = std::stoul(parts[1]); + // point_ = std::stoul(parts[2]); irregular_ = false; } catch (std::exception const&) { } From 293e880e6223f7bfc45a948f8ef91d152d58d749 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Mon, 23 Aug 2021 05:25:34 +0200 Subject: [PATCH 059/923] Code formatting --- .../OfflineDBLoader/interface/DDCoreToDDXMLOutput.h | 6 ++++-- .../OfflineDBLoader/plugins/OutputDD4hepToDDL.cc | 2 +- .../OfflineDBLoader/src/DDCoreToDDXMLOutput.cc | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h b/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h index 7cde97a725962..5531f71c90705 100644 --- a/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h +++ b/DetectorDescription/OfflineDBLoader/interface/DDCoreToDDXMLOutput.h @@ -43,8 +43,10 @@ struct DDCoreToDDXMLOutput { void element(const TGeoMaterial* element, std::ostream& xos); void material(const DDMaterial& material, std::ostream& xos); - void material(const std::string& matName, double density, const std::vector& matRefs, - std::ostream& xos); + void material(const std::string& matName, + double density, + const std::vector& matRefs, + std::ostream& xos); void rotation(const DDRotation& rotation, std::ostream& xos, const std::string& rotn = ""); void rotation(const dd4hep::Rotation3D& rotation, diff --git a/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc b/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc index 59ad0879f54dd..c54fa87f3a52f 100644 --- a/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc +++ b/DetectorDescription/OfflineDBLoader/plugins/OutputDD4hepToDDL.cc @@ -124,7 +124,7 @@ void OutputDD4hepToDDL::beginRun(const edm::Run &, edm::EventSetup const &es) { } // Output composite materials for (const auto &it : parsingContext->compMaterialsVec) { - const std::string& matName = it.first; + const std::string &matName = it.first; out.material(matName, it.second, parsingContext->compMaterialsRefs[matName], *m_xos); } (*m_xos) << "" << std::endl; diff --git a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc index 80d3a9c4263a3..273d807ef0040 100644 --- a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc +++ b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc @@ -610,12 +610,12 @@ void DDCoreToDDXMLOutput::material(const DDMaterial& material, std::ostream& xos } } -void DDCoreToDDXMLOutput::material( - const std::string& matName, double density, const std::vector& matRefs, - std::ostream& xos) { +void DDCoreToDDXMLOutput::material(const std::string& matName, + double density, + const std::vector& matRefs, + std::ostream& xos) { xos << "" << std::endl; for (auto compIter = matRefs.begin(); compIter != matRefs.end(); ++compIter) { From a29b802660ba4903ad7770806d60d3a2785fffad Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 23 Aug 2021 12:39:54 +0200 Subject: [PATCH 060/923] [Framework] Move publically used private headers in to interface dir --- .../Framework/{src => interface}/EventSetupRecordIOVQueue.h | 0 FWCore/Framework/interface/EventSetupsController.h | 4 ++-- FWCore/Framework/{src => interface}/NumberOfConcurrentIOVs.h | 0 FWCore/Framework/{src => interface}/SubProcess.h | 0 FWCore/Framework/interface/globalTransitionAsync.h | 2 +- FWCore/Framework/interface/streamTransitionAsync.h | 2 +- FWCore/Framework/src/EventProcessor.cc | 2 +- FWCore/Framework/src/EventSetupProvider.cc | 2 +- FWCore/Framework/src/EventSetupRecordIOVQueue.cc | 2 +- FWCore/Framework/src/NumberOfConcurrentIOVs.cc | 2 +- FWCore/Framework/src/Schedule.cc | 2 +- FWCore/Framework/src/ScheduleItems.cc | 2 +- FWCore/Framework/src/SubProcess.cc | 2 +- 13 files changed, 11 insertions(+), 11 deletions(-) rename FWCore/Framework/{src => interface}/EventSetupRecordIOVQueue.h (100%) rename FWCore/Framework/{src => interface}/NumberOfConcurrentIOVs.h (100%) rename FWCore/Framework/{src => interface}/SubProcess.h (100%) diff --git a/FWCore/Framework/src/EventSetupRecordIOVQueue.h b/FWCore/Framework/interface/EventSetupRecordIOVQueue.h similarity index 100% rename from FWCore/Framework/src/EventSetupRecordIOVQueue.h rename to FWCore/Framework/interface/EventSetupRecordIOVQueue.h diff --git a/FWCore/Framework/interface/EventSetupsController.h b/FWCore/Framework/interface/EventSetupsController.h index 6eb88662ab4a1..b5573bea01297 100644 --- a/FWCore/Framework/interface/EventSetupsController.h +++ b/FWCore/Framework/interface/EventSetupsController.h @@ -19,8 +19,8 @@ // #include "DataFormats/Provenance/interface/ParameterSetID.h" -#include "FWCore/Framework/src/EventSetupRecordIOVQueue.h" -#include "FWCore/Framework/src/NumberOfConcurrentIOVs.h" +#include "FWCore/Framework/interface/EventSetupRecordIOVQueue.h" +#include "FWCore/Framework/interface/NumberOfConcurrentIOVs.h" #include "FWCore/Utilities/interface/propagate_const.h" #include diff --git a/FWCore/Framework/src/NumberOfConcurrentIOVs.h b/FWCore/Framework/interface/NumberOfConcurrentIOVs.h similarity index 100% rename from FWCore/Framework/src/NumberOfConcurrentIOVs.h rename to FWCore/Framework/interface/NumberOfConcurrentIOVs.h diff --git a/FWCore/Framework/src/SubProcess.h b/FWCore/Framework/interface/SubProcess.h similarity index 100% rename from FWCore/Framework/src/SubProcess.h rename to FWCore/Framework/interface/SubProcess.h diff --git a/FWCore/Framework/interface/globalTransitionAsync.h b/FWCore/Framework/interface/globalTransitionAsync.h index c54b58af08e25..fd5f5abfaca89 100644 --- a/FWCore/Framework/interface/globalTransitionAsync.h +++ b/FWCore/Framework/interface/globalTransitionAsync.h @@ -19,7 +19,7 @@ // #include "FWCore/Framework/interface/Schedule.h" -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" diff --git a/FWCore/Framework/interface/streamTransitionAsync.h b/FWCore/Framework/interface/streamTransitionAsync.h index 31ec59805bd7f..3416cb64d3602 100644 --- a/FWCore/Framework/interface/streamTransitionAsync.h +++ b/FWCore/Framework/interface/streamTransitionAsync.h @@ -19,7 +19,7 @@ // #include "FWCore/Framework/interface/Schedule.h" -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 2e2ea5f735510..34de94d38becb 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -28,7 +28,7 @@ #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/ScheduleInfo.h" #include "FWCore/Framework/interface/ScheduleItems.h" -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/Framework/src/Breakpoints.h" diff --git a/FWCore/Framework/src/EventSetupProvider.cc b/FWCore/Framework/src/EventSetupProvider.cc index d20f767b2e169..77357e5c836b7 100644 --- a/FWCore/Framework/src/EventSetupProvider.cc +++ b/FWCore/Framework/src/EventSetupProvider.cc @@ -28,7 +28,7 @@ #include "FWCore/Framework/interface/ParameterSetIDHolder.h" #include "FWCore/Framework/interface/ESRecordsToProxyIndices.h" #include "FWCore/Framework/interface/EventSetupsController.h" -#include "FWCore/Framework/src/NumberOfConcurrentIOVs.h" +#include "FWCore/Framework/interface/NumberOfConcurrentIOVs.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Algorithms.h" diff --git a/FWCore/Framework/src/EventSetupRecordIOVQueue.cc b/FWCore/Framework/src/EventSetupRecordIOVQueue.cc index f102f0e06d058..7870a7b03eb12 100644 --- a/FWCore/Framework/src/EventSetupRecordIOVQueue.cc +++ b/FWCore/Framework/src/EventSetupRecordIOVQueue.cc @@ -7,7 +7,7 @@ // Author: W. David Dagenhart // Created: 22 Feb 2019 -#include "FWCore/Framework/src/EventSetupRecordIOVQueue.h" +#include "FWCore/Framework/interface/EventSetupRecordIOVQueue.h" #include "FWCore/Framework/interface/EventSetupRecordProvider.h" #include "FWCore/Concurrency/interface/WaitingTask.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/FWCore/Framework/src/NumberOfConcurrentIOVs.cc b/FWCore/Framework/src/NumberOfConcurrentIOVs.cc index c61b37d1de0a4..80ed3878b8d72 100644 --- a/FWCore/Framework/src/NumberOfConcurrentIOVs.cc +++ b/FWCore/Framework/src/NumberOfConcurrentIOVs.cc @@ -1,5 +1,5 @@ -#include "FWCore/Framework/src/NumberOfConcurrentIOVs.h" +#include "FWCore/Framework/interface/NumberOfConcurrentIOVs.h" #include "FWCore/Framework/interface/EventSetupProvider.h" #include "FWCore/Framework/interface/HCTypeTag.h" diff --git a/FWCore/Framework/src/Schedule.cc b/FWCore/Framework/src/Schedule.cc index a474c9b937200..8c30a26a14ddf 100644 --- a/FWCore/Framework/src/Schedule.cc +++ b/FWCore/Framework/src/Schedule.cc @@ -10,7 +10,7 @@ #include "FWCore/Common/interface/ProcessBlockHelper.h" #include "FWCore/Framework/interface/EDConsumerBase.h" #include "FWCore/Framework/src/OutputModuleDescription.h" -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/TriggerReport.h" #include "FWCore/Framework/src/TriggerTimingReport.h" diff --git a/FWCore/Framework/src/ScheduleItems.cc b/FWCore/Framework/src/ScheduleItems.cc index cb6abcf2b5c81..df0e1ad007131 100644 --- a/FWCore/Framework/src/ScheduleItems.cc +++ b/FWCore/Framework/src/ScheduleItems.cc @@ -10,7 +10,7 @@ #include "FWCore/Framework/interface/ExceptionActions.h" #include "FWCore/Framework/src/CommonParams.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "FWCore/Framework/interface/Schedule.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/interface/SignallingProductRegistry.h" diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 5aae9d47b243a..30840f4535d5b 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/src/SubProcess.h" +#include "FWCore/Framework/interface/SubProcess.h" #include "DataFormats/Common/interface/ThinnedAssociation.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" From 9611a88fbb051ad8b51dea11d2690d17c3a2313f Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 23 Aug 2021 15:07:20 +0200 Subject: [PATCH 061/923] Modify the analyzers to record muons not on event basis but on single muon basis --- .../HcalCalibAlgos/macros/CalibMonitor.C | 2 +- .../macros/HBHEMuonOfflineAnalyzer.C | 834 +++++++++--------- .../macros/HBHEMuonOfflineSimAnalyzer.C | 345 ++++---- .../plugins/HcalHBHEMuonAnalyzer.cc | 511 ++++++----- .../test/HcalHBHEMuonSimAnalyzer.cc | 98 +- .../python/isoTrackAlCaRecoAnalysis_cfg.py | 10 +- 6 files changed, 950 insertions(+), 850 deletions(-) diff --git a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C index 7b232b9ef9d83..4f02bdee4df30 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C +++ b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C @@ -1248,7 +1248,7 @@ void CalibMonitor::Loop() { fileout_.close(); std::cout << "Writes " << good << " events in the file " << outFileName_ << std::endl; } - std::cout << "Finds " << duplicate << " Duplicate events out of " << kount << " evnts in this file with p>10 Gev" + std::cout << "Finds " << duplicate << " Duplicate events out of " << kount << " events in this file with p>10 Gev" << std::endl; std::cout << "Number of selected events:" << std::endl; for (unsigned int k = 1; k < ps_.size(); ++k) diff --git a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C index 5f46b5b9e68a4..1fe3a6dcaf9cf 100644 --- a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C +++ b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C @@ -63,132 +63,132 @@ public: UInt_t LumiNumber; UInt_t BXNumber; UInt_t GoodVertex; - std::vector *PF_Muon; - std::vector *Global_Muon; - std::vector *Tracker_muon; - std::vector *MuonIsTight; - std::vector *MuonIsMedium; - std::vector *pt_of_muon; - std::vector *eta_of_muon; - std::vector *phi_of_muon; - std::vector *energy_of_muon; - std::vector *p_of_muon; - std::vector *muon_trkKink; - std::vector *muon_chi2LocalPosition; - std::vector *muon_segComp; - std::vector *TrackerLayer; - std::vector *NumPixelLayers; - std::vector *InnerTrackPixelHits; - std::vector *innerTrack; - std::vector *chiTracker; - std::vector *DxyTracker; - std::vector *DzTracker; - std::vector *innerTrackpt; - std::vector *innerTracketa; - std::vector *innerTrackphi; - std::vector *tight_validFraction; - std::vector *OuterTrack; - std::vector *OuterTrackPt; - std::vector *OuterTrackEta; - std::vector *OuterTrackPhi; - std::vector *OuterTrackChi; - std::vector *OuterTrackHits; - std::vector *OuterTrackRHits; - std::vector *GlobalTrack; - std::vector *GlobalTrckPt; - std::vector *GlobalTrckEta; - std::vector *GlobalTrckPhi; - std::vector *Global_Muon_Hits; - std::vector *MatchedStations; - std::vector *GlobTrack_Chi; - std::vector *Tight_LongitudinalImpactparameter; - std::vector *Tight_TransImpactparameter; - std::vector *IsolationR04; - std::vector *IsolationR03; - std::vector *ecal_3into3; - std::vector *hcal_3into3; - std::vector *tracker_3into3; - std::vector *matchedId; - std::vector *hcal_cellHot; - std::vector *ecal_3x3; - std::vector *hcal_1x1; - std::vector *ecal_detID; - std::vector *hcal_detID; - std::vector *ehcal_detID; - std::vector *hcal_ieta; - std::vector *hcal_iphi; - std::vector *hcal_edepth1; - std::vector *hcal_activeL1; - std::vector *hcal_edepthHot1; - std::vector *hcal_activeHotL1; - std::vector *hcal_edepthCorrect1; - std::vector *hcal_edepthHotCorrect1; - std::vector *hcal_cdepthHot1; - std::vector *hcal_cdepthHotBG1; - std::vector *hcal_depthMatch1; - std::vector *hcal_depthMatchHot1; - std::vector *hcal_edepth2; - std::vector *hcal_activeL2; - std::vector *hcal_edepthHot2; - std::vector *hcal_activeHotL2; - std::vector *hcal_edepthCorrect2; - std::vector *hcal_edepthHotCorrect2; - std::vector *hcal_cdepthHot2; - std::vector *hcal_cdepthHotBG2; - std::vector *hcal_depthMatch2; - std::vector *hcal_depthMatchHot2; - std::vector *hcal_edepth3; - std::vector *hcal_activeL3; - std::vector *hcal_edepthHot3; - std::vector *hcal_activeHotL3; - std::vector *hcal_edepthCorrect3; - std::vector *hcal_edepthHotCorrect3; - std::vector *hcal_cdepthHot3; - std::vector *hcal_cdepthHotBG3; - std::vector *hcal_depthMatch3; - std::vector *hcal_depthMatchHot3; - std::vector *hcal_edepth4; - std::vector *hcal_activeL4; - std::vector *hcal_edepthHot4; - std::vector *hcal_activeHotL4; - std::vector *hcal_edepthCorrect4; - std::vector *hcal_edepthHotCorrect4; - std::vector *hcal_cdepthHot4; - std::vector *hcal_cdepthHotBG4; - std::vector *hcal_depthMatch4; - std::vector *hcal_depthMatchHot4; - std::vector *hcal_edepth5; - std::vector *hcal_activeL5; - std::vector *hcal_edepthHot5; - std::vector *hcal_activeHotL5; - std::vector *hcal_edepthCorrect5; - std::vector *hcal_edepthHotCorrect5; - std::vector *hcal_cdepthHot5; - std::vector *hcal_cdepthHotBG5; - std::vector *hcal_depthMatch5; - std::vector *hcal_depthMatchHot5; - std::vector *hcal_edepth6; - std::vector *hcal_activeL6; - std::vector *hcal_edepthHot6; - std::vector *hcal_activeHotL6; - std::vector *hcal_edepthCorrect6; - std::vector *hcal_edepthHotCorrect6; - std::vector *hcal_cdepthHot6; - std::vector *hcal_cdepthHotBG6; - std::vector *hcal_depthMatch6; - std::vector *hcal_depthMatchHot6; - std::vector *hcal_edepth7; - std::vector *hcal_activeL7; - std::vector *hcal_edepthHot7; - std::vector *hcal_activeHotL7; - std::vector *hcal_edepthCorrect7; - std::vector *hcal_edepthHotCorrect7; - std::vector *hcal_cdepthHot7; - std::vector *hcal_cdepthHotBG7; - std::vector *hcal_depthMatch7; - std::vector *hcal_depthMatchHot7; - std::vector *activeLength; - std::vector *activeLengthHot; + bool PF_Muon; + bool Global_Muon; + bool Tracker_muon; + bool MuonIsTight; + bool MuonIsMedium; + double pt_of_muon; + double eta_of_muon; + double phi_of_muon; + double energy_of_muon; + double p_of_muon; + float muon_trkKink; + float muon_chi2LocalPosition; + float muon_segComp; + int TrackerLayer; + int NumPixelLayers; + int InnerTrackPixelHits; + bool innerTrack; + double chiTracker; + double DxyTracker; + double DzTracker; + double innerTrackpt; + double innerTracketa; + double innerTrackphi; + double tight_validFraction; + bool OuterTrack; + double OuterTrackPt; + double OuterTrackEta; + double OuterTrackPhi; + double OuterTrackChi; + int OuterTrackHits; + int OuterTrackRHits; + bool GlobalTrack; + double GlobalTrckPt; + double GlobalTrckEta; + double GlobalTrckPhi; + int Global_Muon_Hits; + int MatchedStations; + double GlobTrack_Chi; + double Tight_LongitudinalImpactparameter; + double Tight_TransImpactparameter; + double IsolationR04; + double IsolationR03; + double ecal_3into3; + double hcal_3into3; + double tracker_3into3; + bool matchedId; + bool hcal_cellHot; + double ecal_3x3; + double hcal_1x1; + unsigned int ecal_detID; + unsigned int hcal_detID; + unsigned int ehcal_detID; + int hcal_ieta; + int hcal_iphi; + double hcal_edepth1; + double hcal_activeL1; + double hcal_edepthHot1; + double hcal_activeHotL1; + double hcal_edepthCorrect1; + double hcal_edepthHotCorrect1; + double hcal_cdepthHot1; + double hcal_cdepthHotBG1; + bool hcal_depthMatch1; + bool hcal_depthMatchHot1; + double hcal_edepth2; + double hcal_activeL2; + double hcal_edepthHot2; + double hcal_activeHotL2; + double hcal_edepthCorrect2; + double hcal_edepthHotCorrect2; + double hcal_cdepthHot2; + double hcal_cdepthHotBG2; + bool hcal_depthMatch2; + bool hcal_depthMatchHot2; + double hcal_edepth3; + double hcal_activeL3; + double hcal_edepthHot3; + double hcal_activeHotL3; + double hcal_edepthCorrect3; + double hcal_edepthHotCorrect3; + double hcal_cdepthHot3; + double hcal_cdepthHotBG3; + bool hcal_depthMatch3; + bool hcal_depthMatchHot3; + double hcal_edepth4; + double hcal_activeL4; + double hcal_edepthHot4; + double hcal_activeHotL4; + double hcal_edepthCorrect4; + double hcal_edepthHotCorrect4; + double hcal_cdepthHot4; + double hcal_cdepthHotBG4; + bool hcal_depthMatch4; + bool hcal_depthMatchHot4; + double hcal_edepth5; + double hcal_activeL5; + double hcal_edepthHot5; + double hcal_activeHotL5; + double hcal_edepthCorrect5; + double hcal_edepthHotCorrect5; + double hcal_cdepthHot5; + double hcal_cdepthHotBG5; + bool hcal_depthMatch5; + bool hcal_depthMatchHot5; + double hcal_edepth6; + double hcal_activeL6; + double hcal_edepthHot6; + double hcal_activeHotL6; + double hcal_edepthCorrect6; + double hcal_edepthHotCorrect6; + double hcal_cdepthHot6; + double hcal_cdepthHotBG6; + bool hcal_depthMatch6; + bool hcal_depthMatchHot6; + double hcal_edepth7; + double hcal_activeL7; + double hcal_edepthHot7; + double hcal_activeHotL7; + double hcal_edepthCorrect7; + double hcal_edepthHotCorrect7; + double hcal_cdepthHot7; + double hcal_cdepthHotBG7; + bool hcal_depthMatch7; + bool hcal_depthMatchHot7; + double activeLength; + double activeLengthHot; std::vector *hltresults; std::vector *all_triggers; @@ -375,8 +375,7 @@ public: bool fillChain(TChain *chain, const char *inputFileList); bool readCorr(const char *rcorFileName); void bookHistograms(const char *); - bool getEnergy(unsigned int ml, - int dep, + bool getEnergy(int dep, double &enb, double &enu, double &enh, @@ -385,10 +384,10 @@ public: double &chgB, double &actL); void writeHistograms(); - bool looseMuon(unsigned int ml); - bool tightMuon(unsigned int ml); - bool softMuon(unsigned int ml); - bool mediumMuon2016(unsigned int ml); + bool looseMuon(); + bool tightMuon(); + bool softMuon(); + bool mediumMuon2016(); void etaPhiHcal(unsigned int detId, int &eta, int &phi, int &depth); void etaPhiEcal(unsigned int detId, int &type, int &zside, int &etaX, int &phiY, int &plane, int &strip); void calculateP(double pt, double eta, double &pM); @@ -862,225 +861,222 @@ void HBHEMuonOfflineAnalyzer::Loop() { if ((int)(Run_No) < runLo_ || (int)(Run_No) > runHi_) continue; if (debug_) - std::cout << "Run " << Run_No << " Event " << Event_No << " Muons " << pt_of_muon->size() << std::endl; + std::cout << "Run " << Run_No << " Event " << Event_No << " Muon pt " << pt_of_muon << std::endl; bool loose(false), soft(false), tight(false), pcut(false), ptcut(false); - for (unsigned int ml = 0; ml < pt_of_muon->size(); ml++) { - t_ene.clear(); - t_enec.clear(); - t_charge.clear(); - t_actln.clear(); - t_depth.clear(); + t_ene.clear(); + t_enec.clear(); + t_charge.clear(); + t_actln.clear(); + t_depth.clear(); - if (debug_) - std::cout << "ecal_det_id " << ecal_detID->at(ml) << std::endl; - - int typeEcal, etaXEcal, phiYEcal, zsideEcal, planeEcal, stripEcal; - etaPhiEcal(ecal_detID->at(ml), typeEcal, zsideEcal, etaXEcal, phiYEcal, planeEcal, stripEcal); - double etaEcal = (etaXEcal - 0.5) * zsideEcal; - double phiEcal = phiYEcal - 0.5; - - if (debug_) - std::cout << "hcal_det_id " << std::hex << hcal_detID->at(ml) << std::dec; - - int etaHcal, phiHcal, depthHcal; - etaPhiHcal(hcal_detID->at(ml), etaHcal, phiHcal, depthHcal); - - int eta = (etaHcal > 0) ? etaHcal - 1 : -(1 + etaHcal); - double etaXHcal = (etaHcal > 0) ? etaHcal - 0.5 : etaHcal + 0.5; - int nDepth = nDepthBins(eta + 1, phiHcal); - int nPhi = nPhiBins(eta + 1); - int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; - double phiYHcal = (phiHcal - 0.5); - t_ieta = etaHcal; - t_iphi = PHI; - t_p = p_of_muon->at(ml); - t_ediff = hcal_3into3->at(ml) - hcal_1x1->at(ml); - t_nvtx = GoodVertex; - if (p_of_muon->at(ml) > 20) - pcut = true; - if (pt_of_muon->at(ml) > 20) - ptcut = true; - if (looseMuon(ml)) - loose = true; - if (softMuon(ml)) - soft = true; - if (tightMuon(ml)) - tight = true; - - if (debug_) - std::cout << " etaHcal " << etaHcal << ":" << etaXHcal << " phiHcal " << phiHcal << ":" << phiYHcal << ":" - << PHI << " Depth " << nDepth << " Muon Pt " << pt_of_muon->at(ml) << " Isol " << IsolationR04->at(ml) - << std::endl; - - for (int cut = 0; cut < nCut_; ++cut) { - bool select(false); - if (cut == 0) - select = tightMuon(ml); - else if (cut == 1) - select = softMuon(ml); - else - select = looseMuon(ml); - - if (select && ((eta + 1) >= etaMin_) && ((eta + 1) <= etaMax_)) { - // h_P_Muon[cut]->Fill(p_of_muon->at(ml)); - h_Pt_Muon[cut]->Fill(pt_of_muon->at(ml)); - h_Eta_Muon[cut]->Fill(eta_of_muon->at(ml)); - h_Phi_Muon[cut]->Fill(phi_of_muon->at(ml)); - h_PF_Muon[cut]->Fill(PF_Muon->at(ml)); - h_GlobTrack_Chi[cut]->Fill(GlobTrack_Chi->at(ml)); - h_Global_Muon_Hits[cut]->Fill(Global_Muon_Hits->at(ml)); - h_MatchedStations[cut]->Fill(MatchedStations->at(ml)); - h_Tight_TransImpactparameter[cut]->Fill(Tight_TransImpactparameter->at(ml)); - h_Tight_LongitudinalImpactparameter[cut]->Fill(Tight_LongitudinalImpactparameter->at(ml)); - h_InnerTrackPixelHits[cut]->Fill(InnerTrackPixelHits->at(ml)); - h_TrackerLayer[cut]->Fill(TrackerLayer->at(ml)); - h_IsolationR04[cut]->Fill(IsolationR04->at(ml)); - h_Global_Muon[cut]->Fill(Global_Muon->at(ml)); - - h_TransImpactParameter[cut]->Fill(Tight_TransImpactparameter->at(ml)); - h_LongImpactParameter[cut]->Fill(Tight_LongitudinalImpactparameter->at(ml)); - - //in Phi Bins - if (((phi_of_muon->at(ml)) >= -1.5) || ((phi_of_muon->at(ml)) <= 0.5)) { - h_TransImpactParameterBin1[cut]->Fill(Tight_TransImpactparameter->at(ml)); - h_LongImpactParameterBin1[cut]->Fill(Tight_LongitudinalImpactparameter->at(ml)); - h_2D_Bin1[cut]->Fill(Tight_TransImpactparameter->at(ml), Tight_LongitudinalImpactparameter->at(ml)); - } + if (debug_) + std::cout << "ecal_det_id " << ecal_detID << std::endl; - if ((phi_of_muon->at(ml) > 0.5) || (phi_of_muon->at(ml) < -1.5)) { - h_TransImpactParameterBin2[cut]->Fill(Tight_TransImpactparameter->at(ml)); - h_LongImpactParameterBin2[cut]->Fill(Tight_LongitudinalImpactparameter->at(ml)); - h_2D_Bin2[cut]->Fill(Tight_TransImpactparameter->at(ml), Tight_LongitudinalImpactparameter->at(ml)); - } + int typeEcal, etaXEcal, phiYEcal, zsideEcal, planeEcal, stripEcal; + etaPhiEcal(ecal_detID, typeEcal, zsideEcal, etaXEcal, phiYEcal, planeEcal, stripEcal); + double etaEcal = (etaXEcal - 0.5) * zsideEcal; + double phiEcal = phiYEcal - 0.5; - h_ecal_energy[cut]->Fill(ecal_3into3->at(ml)); - h_3x3_ecal[cut]->Fill(ecal_3x3->at(ml)); - h_Eta_ecal[cut]->Fill(eta_of_muon->at(ml), ecal_3x3->at(ml)); - h_Phi_ecal[cut]->Fill(phi_of_muon->at(ml), ecal_3x3->at(ml)); - h_MuonHittingEcal[cut]->Fill(typeEcal); - if (typeEcal == 1) { - h_EtaX_ecal[cut]->Fill(etaEcal, ecal_3x3->at(ml)); - h_PhiY_ecal[cut]->Fill(phiEcal, ecal_3x3->at(ml)); - } + if (debug_) + std::cout << "hcal_det_id " << std::hex << hcal_detID << std::dec; + + int etaHcal, phiHcal, depthHcal; + etaPhiHcal(hcal_detID, etaHcal, phiHcal, depthHcal); + + int eta = (etaHcal > 0) ? etaHcal - 1 : -(1 + etaHcal); + double etaXHcal = (etaHcal > 0) ? etaHcal - 0.5 : etaHcal + 0.5; + int nDepth = nDepthBins(eta + 1, phiHcal); + int nPhi = nPhiBins(eta + 1); + int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; + double phiYHcal = (phiHcal - 0.5); + t_ieta = etaHcal; + t_iphi = PHI; + t_p = p_of_muon; + t_ediff = hcal_3into3 - hcal_1x1; + t_nvtx = GoodVertex; + if (p_of_muon > 20) + pcut = true; + if (pt_of_muon > 20) + ptcut = true; + if (looseMuon()) + loose = true; + if (softMuon()) + soft = true; + if (tightMuon()) + tight = true; - h_hcal_energy[cut]->Fill(hcal_3into3->at(ml)); - h_1x1_hcal[cut]->Fill(hcal_1x1->at(ml)); - h_EtaX_hcal[cut]->Fill(etaXHcal, hcal_1x1->at(ml)); - h_PhiY_hcal[cut]->Fill(phiYHcal, hcal_1x1->at(ml)); - h_HotCell[cut]->Fill(hcal_cellHot->at(ml)); - if (mergeDepth_) { - double en1(0), en2(0), energyFill(0), chargeS(0), chargeBG(0); - double enh(0), enc(0); - for (int dep = 0; dep < nDepth; ++dep) { - double enb(0), enu(0), eh0(0), ec0(0), chgS(0), chgB(0), actL(0); - getEnergy(ml, dep, enb, enu, eh0, ec0, chgS, chgB, actL); - en1 += ((useCorrect_) ? enu : enb); - en2 += ((useCorrect_) ? ec0 : eh0); - enh += (eh0); - enc += (ec0); - energyFill += (actL); - chargeS += (chgS); - chargeBG += (chgB); - } - int ind = (etaHcal > 0) ? indxEta[eta][0][PHI] : 1 + indxEta[eta][0][PHI]; - if (debug_) // || eta==15 || eta==17) - std::cout << "Matched Id " << matchedId->at(ml) << " Hot " << hcal_cellHot->at(ml) << " eta " << etaHcal - << ":" << eta << " phi " << phiHcal << ":" << PHI << " Index " << ind << " E " << en1 << ":" - << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " << chargeS << ":" - << chargeBG << std::endl; - if (!(matchedId->at(ml))) - continue; - if (hcal_cellHot->at(ml) == 1) { - if (energyFill > 0) { - h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - h_active_length_Fill[cut][ind]->Fill(energyFill); - h_p_muon_ineta[cut][ind]->Fill(p_of_muon->at(ml)); - h_charge_signal[cut][ind]->Fill(chargeS); - h_charge_bg[cut][ind]->Fill(chargeBG); - - t_ene.push_back(enh); - t_enec.push_back(enc); - t_charge.push_back(chargeS); - t_actln.push_back(energyFill); - t_depth.push_back(0); - - outtree_->Fill(); - } - } - } else { - bool fillTree(false); - for (int dep = 0; dep < nDepth; ++dep) { - if (debug_) - std::cout << "dep:" << dep << std::endl; - - double energyFill(0), chargeS(-9999), chargeBG(-9999); - double enh(-9999), enc(-9999), enb(0), enu(0); - bool ok1 = getEnergy(ml, dep, enb, enu, enh, enc, chargeS, chargeBG, energyFill); - double en1 = ((useCorrect_) ? enu : enb); - double en2 = ((useCorrect_) ? enc : enh); - if (debug_) - std::cout << "Hello in " << dep + 1 << " " << en1 << ":" << en2 << ":" << energyFill << std::endl; - - bool ok2 = ok1; - - if (debug_) - std::cout << "Before Index " << ok1 << ":" << ok2 << std::endl; - - int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; - if (debug_) // || eta==15 || eta==17) - std::cout << "Matched Id " << matchedId->at(ml) << " Hot " << hcal_cellHot->at(ml) << " eta " << etaHcal - << ":" << eta << " phi " << phiHcal << ":" << PHI << " depth " << dep << " Index " << ind - << " E " << en1 << ":" << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " - << chargeS << ":" << chargeBG << std::endl; - if (!(matchedId->at(ml))) - continue; - if (ok1) { - if (debug_) - std::cout << "enter ok1" << std::endl; - - if (hcal_cellHot->at(ml) == 1) { - if (energyFill > 0) { - h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - h_active_length_Fill[cut][ind]->Fill(energyFill); - h_p_muon_ineta[cut][ind]->Fill(p_of_muon->at(ml)); - h_charge_signal[cut][ind]->Fill(chargeS); - h_charge_bg[cut][ind]->Fill(chargeBG); - t_ene.push_back(enh); - t_enec.push_back(enc); - t_charge.push_back(chargeS); - t_actln.push_back(energyFill); - // added depth vector AmanKalsi - t_depth.push_back(dep); - fillTree = true; - } else { - t_ene.push_back(-999.0); - t_enec.push_back(-999.0); - t_charge.push_back(-999.0); - t_actln.push_back(-999.0); - t_depth.push_back(-999.0); - } - if (debug_) - std::cout << "enter hot cell" << std::endl; - } - } - - if (ok2) { - if (debug_) - std::cout << "enter ok2" << std::endl; - if (hcal_cellHot->at(ml) != 1) { - } - } - - if (debug_) - std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; - } - if (fillTree) - outtree_->Fill(); - } - } + if (debug_) + std::cout << " etaHcal " << etaHcal << ":" << etaXHcal << " phiHcal " << phiHcal << ":" << phiYHcal << ":" + << PHI << " Depth " << nDepth << " Muon Pt " << pt_of_muon << " Isol " << IsolationR04 + << std::endl; + + for (int cut = 0; cut < nCut_; ++cut) { + bool select(false); + if (cut == 0) + select = tightMuon(); + else if (cut == 1) + select = softMuon(); + else + select = looseMuon(); + + if (select && ((eta + 1) >= etaMin_) && ((eta + 1) <= etaMax_)) { + h_Pt_Muon[cut]->Fill(pt_of_muon); + h_Eta_Muon[cut]->Fill(eta_of_muon); + h_Phi_Muon[cut]->Fill(phi_of_muon); + h_PF_Muon[cut]->Fill(PF_Muon); + h_GlobTrack_Chi[cut]->Fill(GlobTrack_Chi); + h_Global_Muon_Hits[cut]->Fill(Global_Muon_Hits); + h_MatchedStations[cut]->Fill(MatchedStations); + h_Tight_TransImpactparameter[cut]->Fill(Tight_TransImpactparameter); + h_Tight_LongitudinalImpactparameter[cut]->Fill(Tight_LongitudinalImpactparameter); + h_InnerTrackPixelHits[cut]->Fill(InnerTrackPixelHits); + h_TrackerLayer[cut]->Fill(TrackerLayer); + h_IsolationR04[cut]->Fill(IsolationR04); + h_Global_Muon[cut]->Fill(Global_Muon); + + h_TransImpactParameter[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameter[cut]->Fill(Tight_LongitudinalImpactparameter); + + //in Phi Bins + if (((phi_of_muon) >= -1.5) || ((phi_of_muon) <= 0.5)) { + h_TransImpactParameterBin1[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameterBin1[cut]->Fill(Tight_LongitudinalImpactparameter); + h_2D_Bin1[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); + } + + if ((phi_of_muon > 0.5) || (phi_of_muon < -1.5)) { + h_TransImpactParameterBin2[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameterBin2[cut]->Fill(Tight_LongitudinalImpactparameter); + h_2D_Bin2[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); + } + + h_ecal_energy[cut]->Fill(ecal_3into3); + h_3x3_ecal[cut]->Fill(ecal_3x3); + h_Eta_ecal[cut]->Fill(eta_of_muon, ecal_3x3); + h_Phi_ecal[cut]->Fill(phi_of_muon, ecal_3x3); + h_MuonHittingEcal[cut]->Fill(typeEcal); + if (typeEcal == 1) { + h_EtaX_ecal[cut]->Fill(etaEcal, ecal_3x3); + h_PhiY_ecal[cut]->Fill(phiEcal, ecal_3x3); + } + + h_hcal_energy[cut]->Fill(hcal_3into3); + h_1x1_hcal[cut]->Fill(hcal_1x1); + h_EtaX_hcal[cut]->Fill(etaXHcal, hcal_1x1); + h_PhiY_hcal[cut]->Fill(phiYHcal, hcal_1x1); + h_HotCell[cut]->Fill(hcal_cellHot); + if (mergeDepth_) { + double en1(0), en2(0), energyFill(0), chargeS(0), chargeBG(0); + double enh(0), enc(0); + for (int dep = 0; dep < nDepth; ++dep) { + double enb(0), enu(0), eh0(0), ec0(0), chgS(0), chgB(0), actL(0); + getEnergy(dep, enb, enu, eh0, ec0, chgS, chgB, actL); + en1 += ((useCorrect_) ? enu : enb); + en2 += ((useCorrect_) ? ec0 : eh0); + enh += (eh0); + enc += (ec0); + energyFill += (actL); + chargeS += (chgS); + chargeBG += (chgB); + } + int ind = (etaHcal > 0) ? indxEta[eta][0][PHI] : 1 + indxEta[eta][0][PHI]; + if (debug_) // || eta==15 || eta==17) + std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal + << ":" << eta << " phi " << phiHcal << ":" << PHI << " Index " << ind << " E " << en1 << ":" + << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " << chargeS << ":" + << chargeBG << std::endl; + if (!(matchedId)) + continue; + if (hcal_cellHot == 1) { + if (energyFill > 0) { + h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + h_active_length_Fill[cut][ind]->Fill(energyFill); + h_p_muon_ineta[cut][ind]->Fill(p_of_muon); + h_charge_signal[cut][ind]->Fill(chargeS); + h_charge_bg[cut][ind]->Fill(chargeBG); + + t_ene.push_back(enh); + t_enec.push_back(enc); + t_charge.push_back(chargeS); + t_actln.push_back(energyFill); + t_depth.push_back(0); + + outtree_->Fill(); + } + } + } else { + bool fillTree(false); + for (int dep = 0; dep < nDepth; ++dep) { + if (debug_) + std::cout << "dep:" << dep << std::endl; + + double energyFill(0), chargeS(-9999), chargeBG(-9999); + double enh(-9999), enc(-9999), enb(0), enu(0); + bool ok1 = getEnergy(dep, enb, enu, enh, enc, chargeS, chargeBG, energyFill); + double en1 = ((useCorrect_) ? enu : enb); + double en2 = ((useCorrect_) ? enc : enh); + if (debug_) + std::cout << "Hello in " << dep + 1 << " " << en1 << ":" << en2 << ":" << energyFill << std::endl; + + bool ok2 = ok1; + + if (debug_) + std::cout << "Before Index " << ok1 << ":" << ok2 << std::endl; + + int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; + if (debug_) // || eta==15 || eta==17) + std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal + << ":" << eta << " phi " << phiHcal << ":" << PHI << " depth " << dep << " Index " << ind + << " E " << en1 << ":" << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " + << chargeS << ":" << chargeBG << std::endl; + if (!(matchedId)) + continue; + if (ok1) { + if (debug_) + std::cout << "enter ok1" << std::endl; + + if (hcal_cellHot == 1) { + if (energyFill > 0) { + h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + h_active_length_Fill[cut][ind]->Fill(energyFill); + h_p_muon_ineta[cut][ind]->Fill(p_of_muon); + h_charge_signal[cut][ind]->Fill(chargeS); + h_charge_bg[cut][ind]->Fill(chargeBG); + t_ene.push_back(enh); + t_enec.push_back(enc); + t_charge.push_back(chargeS); + t_actln.push_back(energyFill); + // added depth vector AmanKalsi + t_depth.push_back(dep); + fillTree = true; + } else { + t_ene.push_back(-999.0); + t_enec.push_back(-999.0); + t_charge.push_back(-999.0); + t_actln.push_back(-999.0); + t_depth.push_back(-999.0); + } + if (debug_) + std::cout << "enter hot cell" << std::endl; + } + } + + if (ok2) { + if (debug_) + std::cout << "enter ok2" << std::endl; + if (hcal_cellHot != 1) { + } + } + + if (debug_) + std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; + } + if (fillTree) + outtree_->Fill(); + } } } int evtype(0); @@ -1482,8 +1478,7 @@ void HBHEMuonOfflineAnalyzer::bookHistograms(const char *fname) { //output_file->cd(); } -bool HBHEMuonOfflineAnalyzer::getEnergy(unsigned int ml, - int dep, +bool HBHEMuonOfflineAnalyzer::getEnergy(int dep, double &enb, double &enu, double &enh, @@ -1494,78 +1489,73 @@ bool HBHEMuonOfflineAnalyzer::getEnergy(unsigned int ml, double cfac(1.0); bool flag(true); if (cFactor_) { - int ieta = hcal_ieta->at(ml); - int iphi = hcal_iphi->at(ml); + int ieta = hcal_ieta; + int iphi = hcal_iphi; unsigned int detId = getDetIdHBHE(ieta, iphi, dep + 1); cfac = getCorr(Run_No, detId); } if (dep == 0) { - enb = cfac * hcal_edepth1->at(ml); - enu = cfac * hcal_edepthCorrect1->at(ml); - enh = cfac * hcal_edepthHot1->at(ml); - enc = cfac * hcal_edepthHotCorrect1->at(ml); - chgS = hcal_cdepthHot1->at(ml); - actL = hcal_activeHotL1->at(ml); - chgB = hcal_cdepthHotBG1->at(ml); + enb = cfac * hcal_edepth1; + enu = cfac * hcal_edepthCorrect1; + enh = cfac * hcal_edepthHot1; + enc = cfac * hcal_edepthHotCorrect1; + chgS = hcal_cdepthHot1; + actL = hcal_activeHotL1; + chgB = hcal_cdepthHotBG1; } else if (dep == 1) { - enb = cfac * hcal_edepth2->at(ml); - enu = cfac * hcal_edepthCorrect2->at(ml); - enh = cfac * hcal_edepthHot2->at(ml); - enc = cfac * hcal_edepthHotCorrect2->at(ml); - chgS = hcal_cdepthHot2->at(ml); - actL = hcal_activeHotL2->at(ml); - chgB = hcal_cdepthHotBG2->at(ml); + enb = cfac * hcal_edepth2; + enu = cfac * hcal_edepthCorrect2; + enh = cfac * hcal_edepthHot2; + enc = cfac * hcal_edepthHotCorrect2; + chgS = hcal_cdepthHot2; + actL = hcal_activeHotL2; + chgB = hcal_cdepthHotBG2; } else if (dep == 2) { - enb = cfac * hcal_edepth3->at(ml); - enu = cfac * hcal_edepthCorrect3->at(ml); - enh = cfac * hcal_edepthHot3->at(ml); - enc = cfac * hcal_edepthHotCorrect3->at(ml); - chgS = hcal_cdepthHot3->at(ml); - actL = hcal_activeHotL3->at(ml); - chgB = hcal_cdepthHotBG3->at(ml); + enb = cfac * hcal_edepth3; + enu = cfac * hcal_edepthCorrect3; + enh = cfac * hcal_edepthHot3; + enc = cfac * hcal_edepthHotCorrect3; + chgS = hcal_cdepthHot3; + actL = hcal_activeHotL3; + chgB = hcal_cdepthHotBG3; } else if (dep == 3) { - enb = cfac * hcal_edepth4->at(ml); - enu = cfac * hcal_edepthCorrect4->at(ml); - enh = cfac * hcal_edepthHot4->at(ml); - enc = cfac * hcal_edepthHotCorrect4->at(ml); - chgS = hcal_cdepthHot4->at(ml); - actL = hcal_activeHotL4->at(ml); - chgB = hcal_cdepthHotBG4->at(ml); + enb = cfac * hcal_edepth4; + enu = cfac * hcal_edepthCorrect4; + enh = cfac * hcal_edepthHot4; + enc = cfac * hcal_edepthHotCorrect4; + chgS = hcal_cdepthHot4; + actL = hcal_activeHotL4; + chgB = hcal_cdepthHotBG4; } else if (dep == 4) { - if (hcal_edepthCorrect5->size() > ml) { - enb = cfac * hcal_edepth5->at(ml); - enu = cfac * hcal_edepthCorrect5->at(ml); - enh = cfac * hcal_edepthHot5->at(ml); - enc = cfac * hcal_edepthHotCorrect5->at(ml); - chgS = hcal_cdepthHot5->at(ml); - actL = hcal_activeHotL5->at(ml); - chgB = hcal_cdepthHotBG5->at(ml); - } else { - enb = enu = enh = enc = chgS = actL = chgB = 0; - flag = false; - } + enb = cfac * hcal_edepth5; + enu = cfac * hcal_edepthCorrect5; + enh = cfac * hcal_edepthHot5; + enc = cfac * hcal_edepthHotCorrect5; + chgS = hcal_cdepthHot5; + actL = hcal_activeHotL5; + chgB = hcal_cdepthHotBG5; } else if (dep == 5) { - if (hcal_edepthCorrect6->size() > ml) { - enb = cfac * hcal_edepth6->at(ml); - enu = cfac * hcal_edepthCorrect6->at(ml); - enh = cfac * hcal_edepthHot6->at(ml); - enc = cfac * hcal_edepthHotCorrect6->at(ml); - chgS = hcal_cdepthHot6->at(ml); - actL = hcal_activeHotL6->at(ml); - chgB = hcal_cdepthHotBG6->at(ml); + if (dep <= maxDepth_) { + enb = cfac * hcal_edepth6; + enu = cfac * hcal_edepthCorrect6; + enh = cfac * hcal_edepthHot6; + enc = cfac * hcal_edepthHotCorrect6; + chgS = hcal_cdepthHot6; + actL = hcal_activeHotL6; + chgB = hcal_cdepthHotBG6; } else { enb = enu = enh = enc = chgS = actL = chgB = 0; flag = false; } } else if (dep == 6) { - if (hcal_edepthCorrect7->size() > ml) { - enb = cfac * hcal_edepth7->at(ml); - enu = cfac * hcal_edepthCorrect7->at(ml); - enh = cfac * hcal_edepthHot7->at(ml); - enc = cfac * hcal_edepthHotCorrect7->at(ml); - chgS = hcal_cdepthHot7->at(ml); - actL = hcal_activeHotL7->at(ml); - chgB = hcal_cdepthHotBG7->at(ml); + if (dep <= maxDepth_) { + enb = cfac * hcal_edepth7; + enu = cfac * hcal_edepthCorrect7; + enh = cfac * hcal_edepthHot7; + enc = cfac * hcal_edepthHotCorrect7; + chgS = hcal_cdepthHot7; + actL = hcal_activeHotL7; + chgB = hcal_cdepthHotBG7; } else { enb = enu = enh = enc = chgS = actL = chgB = 0; flag = false; @@ -1577,10 +1567,10 @@ bool HBHEMuonOfflineAnalyzer::getEnergy(unsigned int ml, return flag; } -bool HBHEMuonOfflineAnalyzer::looseMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (mediumMuon2016(ml)) { - if (IsolationR04->at(ml) < 0.25) { +bool HBHEMuonOfflineAnalyzer::looseMuon() { + if (pt_of_muon > 20.) { + if (mediumMuon2016()) { + if (IsolationR04 < 0.25) { return true; } } @@ -1588,10 +1578,10 @@ bool HBHEMuonOfflineAnalyzer::looseMuon(unsigned int ml) { return false; } -bool HBHEMuonOfflineAnalyzer::softMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (mediumMuon2016(ml)) { - if (IsolationR03->at(ml) < 0.10) { +bool HBHEMuonOfflineAnalyzer::softMuon() { + if (pt_of_muon > 20.) { + if (mediumMuon2016()) { + if (IsolationR03 < 0.10) { return true; } } @@ -1599,10 +1589,10 @@ bool HBHEMuonOfflineAnalyzer::softMuon(unsigned int ml) { return false; } -bool HBHEMuonOfflineAnalyzer::tightMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (mediumMuon2016(ml)) { - if (IsolationR04->at(ml) < 0.15) { +bool HBHEMuonOfflineAnalyzer::tightMuon() { + if (pt_of_muon > 20.) { + if (mediumMuon2016()) { + if (IsolationR04 < 0.15) { return true; } } @@ -1610,15 +1600,15 @@ bool HBHEMuonOfflineAnalyzer::tightMuon(unsigned int ml) { return false; } -bool HBHEMuonOfflineAnalyzer::mediumMuon2016(unsigned int ml) { +bool HBHEMuonOfflineAnalyzer::mediumMuon2016() { bool medium16 = - (((PF_Muon->at(ml)) && (Global_Muon->at(ml) || Tracker_muon->at(ml))) && (tight_validFraction->at(ml) > 0.49)); + (((PF_Muon) && (Global_Muon || Tracker_muon)) && (tight_validFraction > 0.49)); if (!medium16) return medium16; - bool goodGlob = (Global_Muon->at(ml) && GlobTrack_Chi->at(ml) < 3 && muon_chi2LocalPosition->at(ml) < 12 && - muon_trkKink->at(ml) < 20); - medium16 = muon_segComp->at(ml) > (goodGlob ? 0.303 : 0.451); + bool goodGlob = (Global_Muon && GlobTrack_Chi < 3 && muon_chi2LocalPosition < 12 && + muon_trkKink < 20); + medium16 = muon_segComp > (goodGlob ? 0.303 : 0.451); return medium16; } diff --git a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C index 62bf6e1179919..d93444f040f8a 100644 --- a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C +++ b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C @@ -43,46 +43,46 @@ private: UInt_t Event_No; UInt_t LumiNumber; UInt_t BXNumber; - std::vector *pt_of_muon; - std::vector *eta_of_muon; - std::vector *phi_of_muon; - std::vector *p_of_muon; - std::vector *ecal_3x3; - std::vector *ecal_detID; - std::vector *hcal_1x1; - std::vector *matchedId; - std::vector *hcal_detID; - std::vector *hcal_cellHot; - std::vector *activeLength; - std::vector *hcal_edepth1; - std::vector *hcal_edepth2; - std::vector *hcal_edepth3; - std::vector *hcal_edepth4; - std::vector *hcal_activeL1; - std::vector *hcal_activeL2; - std::vector *hcal_activeL3; - std::vector *hcal_activeL4; - std::vector *activeLengthHot; - std::vector *hcal_edepthHot1; - std::vector *hcal_edepthHot2; - std::vector *hcal_edepthHot3; - std::vector *hcal_edepthHot4; - std::vector *hcal_activeHotL1; - std::vector *hcal_activeHotL2; - std::vector *hcal_activeHotL3; - std::vector *hcal_activeHotL4; - std::vector *hcal_edepth5; - std::vector *hcal_activeL5; - std::vector *hcal_edepthHot5; - std::vector *hcal_activeHotL5; - std::vector *hcal_edepth6; - std::vector *hcal_activeL6; - std::vector *hcal_edepthHot6; - std::vector *hcal_activeHotL6; - std::vector *hcal_edepth7; - std::vector *hcal_activeL7; - std::vector *hcal_edepthHot7; - std::vector *hcal_activeHotL7; + double pt_of_muon; + double eta_of_muon; + double phi_of_muon; + double p_of_muon; + double ecal_3x3; + unsigned int ecal_detID; + double hcal_1x1; + double matchedId; + unsigned int hcal_detID; + unsigned int hcal_cellHot; + double activeLength; + double hcal_edepth1; + double hcal_edepth2; + double hcal_edepth3; + double hcal_edepth4; + double hcal_activeL1; + double hcal_activeL2; + double hcal_activeL3; + double hcal_activeL4; + double activeLengthHot; + double hcal_edepthHot1; + double hcal_edepthHot2; + double hcal_edepthHot3; + double hcal_edepthHot4; + double hcal_activeHotL1; + double hcal_activeHotL2; + double hcal_activeHotL3; + double hcal_activeHotL4; + double hcal_edepth5; + double hcal_activeL5; + double hcal_edepthHot5; + double hcal_activeHotL5; + double hcal_edepth6; + double hcal_activeL6; + double hcal_edepthHot6; + double hcal_activeHotL6; + double hcal_edepth7; + double hcal_activeL7; + double hcal_edepthHot7; + double hcal_activeHotL7; TBranch *b_Run_No; //! TBranch *b_Event_No; //! @@ -147,9 +147,9 @@ public: std::vector firedTriggers; void BookHistograms(const char *); void WriteHistograms(); - bool LooseMuon(unsigned int ml); - bool tightMuon(unsigned int ml); - bool SoftMuon(unsigned int ml); + bool LooseMuon(); + bool tightMuon(); + bool SoftMuon(); void etaPhiHcal(unsigned int detId, int &eta, int &phi, int &depth); void etaPhiEcal(unsigned int detId, int &type, int &zside, int &etaX, int &phiY, int &plane, int &strip); void calculateP(double pt, double eta, double &pM); @@ -370,130 +370,125 @@ void HBHEMuonOfflineSimAnalyzer::Loop() { nb = fChain->GetEntry(jentry); nbytes += nb; - for (unsigned int ml = 0; ml < pt_of_muon->size(); ml++) { - if (debug_) { - std::cout << "ecal_det_id " << ecal_detID->at(ml) << std::endl; - std::cout << "hcal_det_id " << std::hex << hcal_detID->at(ml) << std::dec; - } - int etaHcal, phiHcal, depthHcal; - etaPhiHcal(hcal_detID->at(ml), etaHcal, phiHcal, depthHcal); - - int eta = (etaHcal > 0) ? (etaHcal - 1) : -(1 + etaHcal); - int nDepth = NDepthBins(eta + 1, phiHcal); - int nPhi = NPhiBins(eta + 1); + if (debug_) { + std::cout << "ecal_det_id " << ecal_detID << std::endl; + std::cout << "hcal_det_id " << std::hex << hcal_detID << std::dec; + } + int etaHcal, phiHcal, depthHcal; + etaPhiHcal(hcal_detID, etaHcal, phiHcal, depthHcal); - double phiYHcal = (phiHcal - 0.5); - if (debug_) - std::cout << "phiHcal" << phiHcal << " phiYHcal" << phiYHcal << std::endl; - - for (int cut = 0; cut < 3; ++cut) { - bool select(false); - if (cut == 0) - select = tightMuon(ml); - else if (cut == 1) - select = SoftMuon(ml); - else - select = LooseMuon(ml); - - if (select) { - // h_P_Muon[cut]->Fill(p_of_muon->at(ml)); - h_P_Muon[cut]->Fill(p_of_muon->at(ml)); - h_Pt_Muon[cut]->Fill(pt_of_muon->at(ml)); - h_Eta_Muon[cut]->Fill(eta_of_muon->at(ml)); - - double energyFill; - for (int dep = 0; dep < nDepth; ++dep) { - if (debug_) { - std::cout << "why on 15/2 only" << std::endl; - std::cout << "dep:" << dep << std::endl; - } - int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; - double en1(-9999), en2(-9999); - if (dep == 0) { - en1 = hcal_edepth1->at(ml); - en2 = hcal_edepthHot1->at(ml); - energyFill = (hcal_activeHotL1->at(ml) > 0) ? hcal_activeHotL1->at(ml) : 999; - - } else if (dep == 1) { - en1 = hcal_edepth2->at(ml); - en2 = hcal_edepthHot2->at(ml); - energyFill = (hcal_activeHotL2->at(ml) > 0) ? hcal_activeHotL2->at(ml) : 999; - if (debug_) - std::cout << "problem here.. lets see if it got printed\n"; - } else if (dep == 2) { - en1 = hcal_edepth3->at(ml); - en2 = hcal_edepthHot3->at(ml); - energyFill = (hcal_activeHotL3->at(ml) > 0) ? hcal_activeHotL3->at(ml) : 999; - } else if (dep == 3) { - en1 = hcal_edepth4->at(ml); - en2 = hcal_edepthHot4->at(ml); - if (debug_) - std::cout << "Hello in 4" << std::endl; - energyFill = (hcal_activeHotL4->at(ml) > 0) ? hcal_activeHotL4->at(ml) : 999; - } else if (dep == 4) { - en1 = hcal_edepth5->at(ml); - en2 = hcal_edepthHot5->at(ml); - energyFill = (hcal_activeHotL5->at(ml) > 0) ? hcal_activeHotL5->at(ml) : 999; - } else if (dep == 5) { - if (debug_) - std::cout << "Energy in depth 6 " << hcal_edepth6->size() << ":" << hcal_edepthHot6->size() - << std::endl; - en1 = (hcal_edepth6->size() > ml) ? hcal_edepth6->at(ml) : 0; - en2 = (hcal_edepthHot6->size() > ml) ? hcal_edepthHot6->at(ml) : 0; - energyFill = (hcal_activeHotL6->at(ml) > 0) ? hcal_activeHotL6->at(ml) : 999; - } else if (dep == 6) { - if (debug_) - std::cout << "Energy in depth 7 " << hcal_edepth7->size() << ":" << hcal_edepthHot7->size() - << std::endl; - en1 = (hcal_edepth7->size() > ml) ? hcal_edepth7->at(ml) : 0; - en2 = (hcal_edepthHot7->size() > ml) ? hcal_edepthHot7->at(ml) : 0; - energyFill = (hcal_activeHotL7->at(ml) > 0) ? hcal_activeHotL7->at(ml) : 999; - } - - if (debug_) { - std::cout << " Debug2" << std::endl; - std::cout << "ok1" << en1 << std::endl; - std::cout << "ok2" << en2 << std::endl; - } - bool ok1 = (en1 > -9999); - bool ok2 = (en2 > -9999); - - if (debug_) - std::cout << "Before Index" << std::endl; - - int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; - - if (debug_) { - std::cout << "ieta " << eta << "depth " << dep << "indxEta[eta][dep]:" << indxEta[eta][dep][PHI] - << std::endl; - std::cout << "index showing eta,depth:" << ind << std::endl; - std::cout << "etaHcal: " << etaHcal << " eta " << eta << " dep " << dep << " indx " << ind << std::endl; - } - if (!(matchedId->at(ml))) - continue; - if (ok1) { - if (debug_) - std::cout << "enter ok1" << std::endl; - if (hcal_cellHot->at(ml) == 1) { - if (en2 > 0) { - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - } - if (debug_) - std::cout << "enter hot cell" << std::endl; - } - } - - if (ok2) { - if (debug_) - std::cout << "enter ok2" << std::endl; - if (hcal_cellHot->at(ml) != 1) { - } - } - - if (debug_) - std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; - } - } + int eta = (etaHcal > 0) ? (etaHcal - 1) : -(1 + etaHcal); + int nDepth = NDepthBins(eta + 1, phiHcal); + int nPhi = NPhiBins(eta + 1); + + double phiYHcal = (phiHcal - 0.5); + if (debug_) + std::cout << "phiHcal" << phiHcal << " phiYHcal" << phiYHcal << std::endl; + + for (int cut = 0; cut < 3; ++cut) { + bool select(false); + if (cut == 0) + select = tightMuon(); + else if (cut == 1) + select = SoftMuon(); + else + select = LooseMuon(); + + if (select) { + // h_P_Muon[cut]->Fill(p_of_muon); + h_P_Muon[cut]->Fill(p_of_muon); + h_Pt_Muon[cut]->Fill(pt_of_muon); + h_Eta_Muon[cut]->Fill(eta_of_muon); + + double energyFill; + for (int dep = 0; dep < nDepth; ++dep) { + if (debug_) { + std::cout << "why on 15/2 only" << std::endl; + std::cout << "dep:" << dep << std::endl; + } + int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; + double en1(-9999), en2(-9999); + if (dep == 0) { + en1 = hcal_edepth1; + en2 = hcal_edepthHot1; + energyFill = (hcal_activeHotL1 > 0) ? hcal_activeHotL1 : 999; + } else if (dep == 1) { + en1 = hcal_edepth2; + en2 = hcal_edepthHot2; + energyFill = (hcal_activeHotL2 > 0) ? hcal_activeHotL2 : 999; + if (debug_) + std::cout << "problem here.. lets see if it got printed\n"; + } else if (dep == 2) { + en1 = hcal_edepth3; + en2 = hcal_edepthHot3; + energyFill = (hcal_activeHotL3 > 0) ? hcal_activeHotL3 : 999; + } else if (dep == 3) { + en1 = hcal_edepth4; + en2 = hcal_edepthHot4; + if (debug_) + std::cout << "Hello in 4" << std::endl; + energyFill = (hcal_activeHotL4 > 0) ? hcal_activeHotL4 : 999; + } else if (dep == 4) { + en1 = hcal_edepth5; + en2 = hcal_edepthHot5; + energyFill = (hcal_activeHotL5 > 0) ? hcal_activeHotL5 : 999; + } else if (dep == 5) { + if (debug_) + std::cout << "Energy in depth 6 " << maxDepth_ << ":" << hcal_edepth6 << ":" << hcal_edepthHot6 << std::endl; + en1 = (maxDepth_ > 5) ? hcal_edepth6 : 0; + en2 = (maxDepth_ > 5) ? hcal_edepthHot6 : 0; + energyFill = (hcal_activeHotL6 > 0) ? hcal_activeHotL6 : 999; + } else if (dep == 6) { + if (debug_) + std::cout << "Energy in depth 7 " << maxDepth_ << ":" < 6) ? hcal_edepth7 : 0; + en2 = (maxDepth_ > 6) ? hcal_edepthHot7 : 0; + energyFill = (hcal_activeHotL7 > 0) ? hcal_activeHotL7 : 999; + } + + if (debug_) { + std::cout << " Debug2" << std::endl; + std::cout << "ok1" << en1 << std::endl; + std::cout << "ok2" << en2 << std::endl; + } + bool ok1 = (en1 > -9999); + bool ok2 = (en2 > -9999); + + if (debug_) + std::cout << "Before Index" << std::endl; + + int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; + + if (debug_) { + std::cout << "ieta " << eta << "depth " << dep << "indxEta[eta][dep]:" << indxEta[eta][dep][PHI] + << std::endl; + std::cout << "index showing eta,depth:" << ind << std::endl; + std::cout << "etaHcal: " << etaHcal << " eta " << eta << " dep " << dep << " indx " << ind << std::endl; + } + if (!(matchedId)) + continue; + if (ok1) { + if (debug_) + std::cout << "enter ok1" << std::endl; + if (hcal_cellHot == 1) { + if (en2 > 0) { + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + } + if (debug_) + std::cout << "enter hot cell" << std::endl; + } + } + + if (ok2) { + if (debug_) + std::cout << "enter ok2" << std::endl; + if (hcal_cellHot != 1) { + } + } + + if (debug_) + std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; + } } } } @@ -729,9 +724,9 @@ void HBHEMuonOfflineSimAnalyzer::BookHistograms(const char *fname) { //output_file->cd(); } -bool HBHEMuonOfflineSimAnalyzer::LooseMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (fabs(eta_of_muon->at(ml)) <= 5.0) { +bool HBHEMuonOfflineSimAnalyzer::LooseMuon() { + if (pt_of_muon > 20.) { + if (fabs(eta_of_muon) <= 5.0) { return true; } } @@ -739,9 +734,9 @@ bool HBHEMuonOfflineSimAnalyzer::LooseMuon(unsigned int ml) { return false; } -bool HBHEMuonOfflineSimAnalyzer::SoftMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (fabs(eta_of_muon->at(ml)) <= 5.0) { +bool HBHEMuonOfflineSimAnalyzer::SoftMuon() { + if (pt_of_muon > 20.) { + if (fabs(eta_of_muon) <= 5.0) { return true; } } @@ -749,9 +744,9 @@ bool HBHEMuonOfflineSimAnalyzer::SoftMuon(unsigned int ml) { return false; } -bool HBHEMuonOfflineSimAnalyzer::tightMuon(unsigned int ml) { - if (pt_of_muon->at(ml) > 20.) { - if (fabs(eta_of_muon->at(ml)) <= 5.0) { +bool HBHEMuonOfflineSimAnalyzer::tightMuon() { + if (pt_of_muon > 20.) { + if (fabs(eta_of_muon) <= 5.0) { return true; } } diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc index 28cc1e077cc72..227b777d71312 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc @@ -130,37 +130,37 @@ class HcalHBHEMuonAnalyzer : public edm::one::EDAnalyzer muon_is_good_, muon_global_, muon_tracker_; - std::vector muon_is_tight_, muon_is_medium_; - std::vector ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_; - std::vector muon_trkKink, muon_chi2LocalPosition, muon_segComp; - std::vector trackerLayer_, numPixelLayers_, tight_PixelHits_; - std::vector innerTrack_, outerTrack_, globalTrack_; - std::vector chiTracker_, dxyTracker_, dzTracker_; - std::vector innerTrackpt_, innerTracketa_, innerTrackphi_; - std::vector tight_validFraction_, outerTrackChi_; - std::vector outerTrackPt_, outerTrackEta_, outerTrackPhi_; - std::vector outerTrackHits_, outerTrackRHits_; - std::vector globalTrckPt_, globalTrckEta_, globalTrckPhi_; - std::vector globalMuonHits_, matchedStat_; - std::vector chiGlobal_, tight_LongPara_, tight_TransImpara_; - std::vector isolationR04_, isolationR03_; - std::vector ecalEnergy_, hcalEnergy_, hoEnergy_; - std::vector matchedId_, hcalHot_; - std::vector ecal3x3Energy_, hcal1x1Energy_; - std::vector ecalDetId_, hcalDetId_, ehcalDetId_; - std::vector hcal_ieta_, hcal_iphi_; - std::vector hcalDepthEnergy_[depthMax_]; - std::vector hcalDepthActiveLength_[depthMax_]; - std::vector hcalDepthEnergyHot_[depthMax_]; - std::vector hcalDepthActiveLengthHot_[depthMax_]; - std::vector hcalDepthChargeHot_[depthMax_]; - std::vector hcalDepthChargeHotBG_[depthMax_]; - std::vector hcalDepthEnergyCorr_[depthMax_]; - std::vector hcalDepthEnergyHotCorr_[depthMax_]; - std::vector hcalDepthMatch_[depthMax_]; - std::vector hcalDepthMatchHot_[depthMax_]; - std::vector hcalActiveLength_, hcalActiveLengthHot_; + bool muon_is_good_, muon_global_, muon_tracker_; + bool muon_is_tight_, muon_is_medium_; + double ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_; + float muon_trkKink_, muon_chi2LocalPosition_, muon_segComp_; + int trackerLayer_, numPixelLayers_, tight_PixelHits_; + bool innerTrack_, outerTrack_, globalTrack_; + double chiTracker_, dxyTracker_, dzTracker_; + double innerTrackpt_, innerTracketa_, innerTrackphi_; + double tight_validFraction_, outerTrackChi_; + double outerTrackPt_, outerTrackEta_, outerTrackPhi_; + int outerTrackHits_, outerTrackRHits_; + double globalTrckPt_, globalTrckEta_, globalTrckPhi_; + int globalMuonHits_, matchedStat_; + double chiGlobal_, tight_LongPara_, tight_TransImpara_; + double isolationR04_, isolationR03_; + double ecalEnergy_, hcalEnergy_, hoEnergy_; + bool matchedId_, hcalHot_; + double ecal3x3Energy_, hcal1x1Energy_; + unsigned int ecalDetId_, hcalDetId_, ehcalDetId_; + int hcal_ieta_, hcal_iphi_; + double hcalDepthEnergy_[depthMax_]; + double hcalDepthActiveLength_[depthMax_]; + double hcalDepthEnergyHot_[depthMax_]; + double hcalDepthActiveLengthHot_[depthMax_]; + double hcalDepthChargeHot_[depthMax_]; + double hcalDepthChargeHotBG_[depthMax_]; + double hcalDepthEnergyCorr_[depthMax_]; + double hcalDepthEnergyHotCorr_[depthMax_]; + bool hcalDepthMatch_[depthMax_]; + bool hcalDepthMatchHot_[depthMax_]; + double hcalActiveLength_, hcalActiveLengthHot_; std::vector all_triggers_; std::vector hltresults_; @@ -260,6 +260,37 @@ HcalHBHEMuonAnalyzer::HcalHBHEMuonAnalyzer(const edm::ParameterSet& iConfig) void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { ++kount_; clearVectors(); + std::vector muon_is_good, muon_global, muon_tracker; + std::vector muon_is_tight, muon_is_medium; + std::vector ptGlob, etaGlob, phiGlob, energyMuon, pMuon; + std::vector muon_trkKink, muon_chi2LocalPosition, muon_segComp; + std::vector trackerLayer, numPixelLayers, tight_PixelHits; + std::vector innerTrack, outerTrack, globalTrack; + std::vector chiTracker, dxyTracker, dzTracker; + std::vector innerTrackpt, innerTracketa, innerTrackphi; + std::vector tight_validFraction, outerTrackChi; + std::vector outerTrackPt, outerTrackEta, outerTrackPhi; + std::vector outerTrackHits, outerTrackRHits; + std::vector globalTrckPt, globalTrckEta, globalTrckPhi; + std::vector globalMuonHits, matchedStat; + std::vector chiGlobal, tight_LongPara, tight_TransImpara; + std::vector isolationR04, isolationR03; + std::vector ecalEnergy, hcalEnergy, hoEnergy; + std::vector matchedId, hcalHot; + std::vector ecal3x3Energy, hcal1x1Energy; + std::vector ecalDetId, hcalDetId, ehcalDetId; + std::vector hcal_ieta, hcal_iphi; + std::vector hcalDepthEnergy[depthMax_]; + std::vector hcalDepthActiveLength[depthMax_]; + std::vector hcalDepthEnergyHot[depthMax_]; + std::vector hcalDepthActiveLengthHot[depthMax_]; + std::vector hcalDepthChargeHot[depthMax_]; + std::vector hcalDepthChargeHotBG[depthMax_]; + std::vector hcalDepthEnergyCorr[depthMax_]; + std::vector hcalDepthEnergyHotCorr[depthMax_]; + std::vector hcalDepthMatch[depthMax_]; + std::vector hcalDepthMatchHot[depthMax_]; + std::vector hcalActiveLength, hcalActiveLengthHot; runNumber_ = iEvent.id().run(); eventNumber_ = iEvent.id().event(); lumiNumber_ = iEvent.id().luminosityBlock(); @@ -272,12 +303,12 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet iEvent.getByToken(tok_trigRes_, _Triggers); #ifdef EDM_ML_DEBUG if ((verbosity_ / 10000) % 10 > 0) - edm::LogVerbatim("HBHEMuon") << "Size of all triggers " << all_triggers_.size() << std::endl; + edm::LogVerbatim("HBHEMuon") << "Size of all triggers " << all_triggers_.size(); #endif int Ntriggers = all_triggers_.size(); #ifdef EDM_ML_DEBUG if ((verbosity_ / 10000) % 10 > 0) - edm::LogVerbatim("HBHEMuon") << "Size of HLT MENU: " << _Triggers->size() << std::endl; + edm::LogVerbatim("HBHEMuon") << "Size of HLT MENU: " << _Triggers->size(); #endif if (_Triggers.isValid()) { const edm::TriggerNames& triggerNames_ = iEvent.triggerNames(*_Triggers); @@ -287,19 +318,19 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet int triggerSize = int(_Triggers->size()); #ifdef EDM_ML_DEBUG if ((verbosity_ / 10000) % 10 > 0) - edm::LogVerbatim("HBHEMuon") << "outside loop " << index[i] << "\ntriggerSize " << triggerSize << std::endl; + edm::LogVerbatim("HBHEMuon") << "outside loop " << index[i] << "\ntriggerSize " << triggerSize; #endif if (index[i] < triggerSize) { hltresults_.push_back(_Triggers->accept(index[i])); #ifdef EDM_ML_DEBUG if ((verbosity_ / 10000) % 10 > 0) edm::LogVerbatim("HBHEMuon") << "Trigger_info " << triggerSize << " triggerSize " << index[i] - << " trigger_index " << hltresults_.at(i) << " hltresult" << std::endl; + << " trigger_index " << hltresults_.at(i) << " hltresult"; #endif } else { if ((verbosity_ / 10000) % 10 > 0) edm::LogVerbatim("HBHEMuon") << "Requested HLT path \"" - << "\" does not exist\n"; + << "\" does not exist"; } } } @@ -331,7 +362,7 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet goodVertex_ = 0; if (!vtx.isValid()) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HBHEMuon") << "No Good Vertex found == Reject\n"; + edm::LogVerbatim("HBHEMuon") << "No Good Vertex found == Reject"; #endif return; } @@ -349,109 +380,109 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet bool accept(false); if (_Muon.isValid() && barrelRecHitsHandle.isValid() && endcapRecHitsHandle.isValid() && hbhe.isValid()) { for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { - muon_is_good_.push_back(RecMuon->isPFMuon()); - muon_global_.push_back(RecMuon->isGlobalMuon()); - muon_tracker_.push_back(RecMuon->isTrackerMuon()); - ptGlob_.push_back((RecMuon)->pt()); - etaGlob_.push_back(RecMuon->eta()); - phiGlob_.push_back(RecMuon->phi()); - energyMuon_.push_back(RecMuon->energy()); - pMuon_.push_back(RecMuon->p()); + muon_is_good.push_back(RecMuon->isPFMuon()); + muon_global.push_back(RecMuon->isGlobalMuon()); + muon_tracker.push_back(RecMuon->isTrackerMuon()); + ptGlob.push_back((RecMuon)->pt()); + etaGlob.push_back(RecMuon->eta()); + phiGlob.push_back(RecMuon->phi()); + energyMuon.push_back(RecMuon->energy()); + pMuon.push_back(RecMuon->p()); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HBHEMuon") << "Energy:" << RecMuon->energy() << " P:" << RecMuon->p() << std::endl; + edm::LogVerbatim("HBHEMuon") << "Energy:" << RecMuon->energy() << " P:" << RecMuon->p(); #endif - muon_is_tight_.push_back(muon::isTightMuon(*RecMuon, *firstGoodVertex)); - muon_is_medium_.push_back(muon::isMediumMuon(*RecMuon)); + muon_is_tight.push_back(muon::isTightMuon(*RecMuon, *firstGoodVertex)); + muon_is_medium.push_back(muon::isMediumMuon(*RecMuon)); muon_trkKink.push_back(RecMuon->combinedQuality().trkKink); muon_chi2LocalPosition.push_back(RecMuon->combinedQuality().chi2LocalPosition); muon_segComp.push_back(muon::segmentCompatibility(*RecMuon)); // acessing tracker hits info if (RecMuon->track().isNonnull()) { - trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement()); + trackerLayer.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement()); } else { - trackerLayer_.push_back(-1); + trackerLayer.push_back(-1); } if (RecMuon->innerTrack().isNonnull()) { - innerTrack_.push_back(true); - numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement()); - chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2()); - dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx))); - dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx))); - innerTrackpt_.push_back(RecMuon->innerTrack()->pt()); - innerTracketa_.push_back(RecMuon->innerTrack()->eta()); - innerTrackphi_.push_back(RecMuon->innerTrack()->phi()); - tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits()); - tight_validFraction_.push_back(RecMuon->innerTrack()->validFraction()); + innerTrack.push_back(true); + numPixelLayers.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement()); + chiTracker.push_back(RecMuon->innerTrack()->normalizedChi2()); + dxyTracker.push_back(fabs(RecMuon->innerTrack()->dxy(pvx))); + dzTracker.push_back(fabs(RecMuon->innerTrack()->dz(pvx))); + innerTrackpt.push_back(RecMuon->innerTrack()->pt()); + innerTracketa.push_back(RecMuon->innerTrack()->eta()); + innerTrackphi.push_back(RecMuon->innerTrack()->phi()); + tight_PixelHits.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits()); + tight_validFraction.push_back(RecMuon->innerTrack()->validFraction()); } else { - innerTrack_.push_back(false); - numPixelLayers_.push_back(0); - chiTracker_.push_back(0); - dxyTracker_.push_back(0); - dzTracker_.push_back(0); - innerTrackpt_.push_back(0); - innerTracketa_.push_back(0); - innerTrackphi_.push_back(0); - tight_PixelHits_.push_back(0); - tight_validFraction_.push_back(-99); + innerTrack.push_back(false); + numPixelLayers.push_back(0); + chiTracker.push_back(0); + dxyTracker.push_back(0); + dzTracker.push_back(0); + innerTrackpt.push_back(0); + innerTracketa.push_back(0); + innerTrackphi.push_back(0); + tight_PixelHits.push_back(0); + tight_validFraction.push_back(-99); } // outer track info if (RecMuon->outerTrack().isNonnull()) { - outerTrack_.push_back(true); - outerTrackPt_.push_back(RecMuon->outerTrack()->pt()); - outerTrackEta_.push_back(RecMuon->outerTrack()->eta()); - outerTrackPhi_.push_back(RecMuon->outerTrack()->phi()); - outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2()); - outerTrackHits_.push_back(RecMuon->outerTrack()->numberOfValidHits()); - outerTrackRHits_.push_back(RecMuon->outerTrack()->recHitsSize()); + outerTrack.push_back(true); + outerTrackPt.push_back(RecMuon->outerTrack()->pt()); + outerTrackEta.push_back(RecMuon->outerTrack()->eta()); + outerTrackPhi.push_back(RecMuon->outerTrack()->phi()); + outerTrackChi.push_back(RecMuon->outerTrack()->normalizedChi2()); + outerTrackHits.push_back(RecMuon->outerTrack()->numberOfValidHits()); + outerTrackRHits.push_back(RecMuon->outerTrack()->recHitsSize()); } else { - outerTrack_.push_back(false); - outerTrackPt_.push_back(0); - outerTrackEta_.push_back(0); - outerTrackPhi_.push_back(0); - outerTrackChi_.push_back(0); - outerTrackHits_.push_back(0); - outerTrackRHits_.push_back(0); + outerTrack.push_back(false); + outerTrackPt.push_back(0); + outerTrackEta.push_back(0); + outerTrackPhi.push_back(0); + outerTrackChi.push_back(0); + outerTrackHits.push_back(0); + outerTrackRHits.push_back(0); } // Tight Muon cuts if (RecMuon->globalTrack().isNonnull()) { - globalTrack_.push_back(true); - chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2()); - globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits()); - matchedStat_.push_back(RecMuon->numberOfMatchedStations()); - globalTrckPt_.push_back(RecMuon->globalTrack()->pt()); - globalTrckEta_.push_back(RecMuon->globalTrack()->eta()); - globalTrckPhi_.push_back(RecMuon->globalTrack()->phi()); - tight_TransImpara_.push_back(fabs(RecMuon->muonBestTrack()->dxy(pvx))); - tight_LongPara_.push_back(fabs(RecMuon->muonBestTrack()->dz(pvx))); + globalTrack.push_back(true); + chiGlobal.push_back(RecMuon->globalTrack()->normalizedChi2()); + globalMuonHits.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits()); + matchedStat.push_back(RecMuon->numberOfMatchedStations()); + globalTrckPt.push_back(RecMuon->globalTrack()->pt()); + globalTrckEta.push_back(RecMuon->globalTrack()->eta()); + globalTrckPhi.push_back(RecMuon->globalTrack()->phi()); + tight_TransImpara.push_back(fabs(RecMuon->muonBestTrack()->dxy(pvx))); + tight_LongPara.push_back(fabs(RecMuon->muonBestTrack()->dz(pvx))); } else { - globalTrack_.push_back(false); - chiGlobal_.push_back(0); - globalMuonHits_.push_back(0); - matchedStat_.push_back(0); - globalTrckPt_.push_back(0); - globalTrckEta_.push_back(0); - globalTrckPhi_.push_back(0); - tight_TransImpara_.push_back(0); - tight_LongPara_.push_back(0); + globalTrack.push_back(false); + chiGlobal.push_back(0); + globalMuonHits.push_back(0); + matchedStat.push_back(0); + globalTrckPt.push_back(0); + globalTrckEta.push_back(0); + globalTrckPhi.push_back(0); + tight_TransImpara.push_back(0); + tight_LongPara.push_back(0); } - isolationR04_.push_back( + isolationR04.push_back( ((RecMuon->pfIsolationR04().sumChargedHadronPt + std::max(0., RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 * RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt())); - isolationR03_.push_back( + isolationR03.push_back( ((RecMuon->pfIsolationR03().sumChargedHadronPt + std::max(0., RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt())); - ecalEnergy_.push_back(RecMuon->calEnergy().emS9); - hcalEnergy_.push_back(RecMuon->calEnergy().hadS9); - hoEnergy_.push_back(RecMuon->calEnergy().hoS9); + ecalEnergy.push_back(RecMuon->calEnergy().emS9); + hcalEnergy.push_back(RecMuon->calEnergy().hadS9); + hoEnergy.push_back(RecMuon->calEnergy().hoS9); double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0); double eHcalDepth[depthMax_], eHcalDepthHot[depthMax_]; @@ -476,9 +507,9 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet if ((RecMuon->p() > 10.0) && (trackID.okHCAL)) accept = true; - ecalDetId_.push_back((trackID.detIdECAL)()); - hcalDetId_.push_back((trackID.detIdHCAL)()); - ehcalDetId_.push_back((trackID.detIdEHCAL)()); + ecalDetId.push_back((trackID.detIdECAL)()); + hcalDetId.push_back((trackID.detIdHCAL)()); + ehcalDetId.push_back((trackID.detIdEHCAL)()); HcalDetId check; std::pair info = spr::propagateHCALBack(pTrack, geo_, bField, (((verbosity_ / 100) % 10 > 0))); @@ -750,31 +781,31 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet #endif } else { - ecalDetId_.push_back(0); - hcalDetId_.push_back(0); - ehcalDetId_.push_back(0); + ecalDetId.push_back(0); + hcalDetId.push_back(0); + ehcalDetId.push_back(0); } - matchedId_.push_back(tmpmatch); - ecal3x3Energy_.push_back(eEcal); - hcal1x1Energy_.push_back(eHcal); - hcal_ieta_.push_back(ieta); - hcal_iphi_.push_back(iphi); + matchedId.push_back(tmpmatch); + ecal3x3Energy.push_back(eEcal); + hcal1x1Energy.push_back(eHcal); + hcal_ieta.push_back(ieta); + hcal_iphi.push_back(iphi); for (int i = 0; i < depthMax_; ++i) { - hcalDepthEnergy_[i].push_back(eHcalDepth[i]); - hcalDepthActiveLength_[i].push_back(activeL[i]); - hcalDepthEnergyHot_[i].push_back(eHcalDepthHot[i]); - hcalDepthActiveLengthHot_[i].push_back(activeHotL[i]); - hcalDepthEnergyCorr_[i].push_back(eHcalDepthC[i]); - hcalDepthEnergyHotCorr_[i].push_back(eHcalDepthHotC[i]); - hcalDepthChargeHot_[i].push_back(cHcalDepthHot[i]); - hcalDepthChargeHotBG_[i].push_back(cHcalDepthHotBG[i]); - hcalDepthMatch_[i].push_back(matchDepth[i]); - hcalDepthMatchHot_[i].push_back(matchDepthHot[i]); + hcalDepthEnergy[i].push_back(eHcalDepth[i]); + hcalDepthActiveLength[i].push_back(activeL[i]); + hcalDepthEnergyHot[i].push_back(eHcalDepthHot[i]); + hcalDepthActiveLengthHot[i].push_back(activeHotL[i]); + hcalDepthEnergyCorr[i].push_back(eHcalDepthC[i]); + hcalDepthEnergyHotCorr[i].push_back(eHcalDepthHotC[i]); + hcalDepthChargeHot[i].push_back(cHcalDepthHot[i]); + hcalDepthChargeHotBG[i].push_back(cHcalDepthHotBG[i]); + hcalDepthMatch[i].push_back(matchDepth[i]); + hcalDepthMatchHot[i].push_back(matchDepthHot[i]); } - hcalActiveLength_.push_back(activeLengthTot); - hcalHot_.push_back(isHot); - hcalActiveLengthHot_.push_back(activeLengthHotTot); + hcalActiveLength.push_back(activeLengthTot); + hcalHot.push_back(isHot); + hcalActiveLengthHot.push_back(activeLengthHotTot); } } if (accept) { @@ -783,7 +814,77 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet edm::LogVerbatim("HBHEMuon") << "[" << i << "] ieta/iphi for entry to " << "HCAL has value of " << hcal_ieta_[i] << ":" << hcal_iphi_[i]; #endif - tree_->Fill(); + for (unsigned int k = 0; k < muon_is_good.size(); ++k) { + muon_is_good_ = muon_is_good[k]; + muon_global_ = muon_global[k]; + muon_tracker_ = muon_tracker[k]; + muon_is_tight_ = muon_is_tight[k]; + muon_is_medium_ = muon_is_medium[k]; + ptGlob_ = ptGlob[k]; + etaGlob_ = etaGlob[k]; + phiGlob_ = phiGlob[k]; + energyMuon_ = energyMuon[k]; + pMuon_ = pMuon[k]; + muon_trkKink_ = muon_trkKink[k]; + muon_chi2LocalPosition_ = muon_chi2LocalPosition[k]; + muon_segComp_ = muon_segComp[k]; + trackerLayer_ = trackerLayer[k]; + numPixelLayers_ = numPixelLayers[k]; + tight_PixelHits_ = tight_PixelHits[k]; + innerTrack_ = innerTrack[k]; + outerTrack_ = outerTrack[k]; + globalTrack_ = globalTrack[k]; + chiTracker_ = chiTracker[k]; + dxyTracker_ = dxyTracker[k]; + dzTracker_ = dzTracker[k]; + innerTrackpt_ = innerTrackpt[k]; + innerTracketa_ = innerTracketa[k]; + innerTrackphi_ = innerTrackphi[k]; + tight_validFraction_ = tight_validFraction[k]; + outerTrackChi_ = outerTrackChi[k]; + outerTrackPt_ = outerTrackPt[k]; + outerTrackEta_ = outerTrackEta[k]; + outerTrackPhi_ = outerTrackPhi[k]; + outerTrackHits_ = outerTrackHits[k]; + outerTrackRHits_ = outerTrackRHits[k]; + globalTrckPt_ = globalTrckPt[k]; + globalTrckEta_ = globalTrckEta[k]; + globalTrckPhi_ = globalTrckPhi[k]; + globalMuonHits_ = globalMuonHits[k]; + matchedStat_ = matchedStat[k]; + chiGlobal_ = chiGlobal[k]; + tight_LongPara_ = tight_LongPara[k]; + tight_TransImpara_ = tight_TransImpara[k]; + isolationR04_ = isolationR04[k]; + isolationR03_ = isolationR03[k]; + ecalEnergy_ = ecalEnergy[k]; + hcalEnergy_ = hcalEnergy[k]; + hoEnergy_ = hoEnergy[k]; + matchedId_ = matchedId[k]; + hcalHot_ = hcalHot[k]; + ecal3x3Energy_ = ecal3x3Energy[k]; + hcal1x1Energy_ = hcal1x1Energy[k]; + ecalDetId_ = ecalDetId[k]; + hcalDetId_ = hcalDetId[k]; + ehcalDetId_ = ehcalDetId[k]; + hcal_ieta_ = hcal_ieta[k]; + hcal_iphi_ = hcal_iphi[k]; + for (int i = 0; i < depthMax_; ++i) { + hcalDepthEnergy_[i] = hcalDepthEnergy[i][k]; + hcalDepthActiveLength_[i] = hcalDepthActiveLength[i][k]; + hcalDepthEnergyHot_[i] = hcalDepthEnergyHot[i][k]; + hcalDepthActiveLengthHot_[i] = hcalDepthActiveLengthHot[i][k]; + hcalDepthChargeHot_[i] = hcalDepthChargeHot[i][k]; + hcalDepthChargeHotBG_[i] = hcalDepthChargeHotBG[i][k]; + hcalDepthEnergyCorr_[i] = hcalDepthEnergyCorr[i][k]; + hcalDepthEnergyHotCorr_[i] = hcalDepthEnergyHotCorr[i][k]; + hcalDepthMatch_[i] = hcalDepthMatch[i][k]; + hcalDepthMatchHot_[i] = hcalDepthMatchHot[i][k]; + } + hcalActiveLength_ = hcalActiveLength[k]; + hcalActiveLengthHot_ = hcalActiveLengthHot[k]; + tree_->Fill(); + } } } @@ -805,9 +906,9 @@ void HcalHBHEMuonAnalyzer::beginJob() { tree_->Branch("phi_of_muon", &phiGlob_); tree_->Branch("energy_of_muon", &energyMuon_); tree_->Branch("p_of_muon", &pMuon_); - tree_->Branch("muon_trkKink", &muon_trkKink); - tree_->Branch("muon_chi2LocalPosition", &muon_chi2LocalPosition); - tree_->Branch("muon_segComp", &muon_segComp); + tree_->Branch("muon_trkKink", &muon_trkKink_); + tree_->Branch("muon_chi2LocalPosition", &muon_chi2LocalPosition_); + tree_->Branch("muon_segComp", &muon_segComp_); tree_->Branch("TrackerLayer", &trackerLayer_); tree_->Branch("NumPixelLayers", &numPixelLayers_); @@ -998,78 +1099,78 @@ void HcalHBHEMuonAnalyzer::clearVectors() { bxNumber_ = -99999; goodVertex_ = -99999; - muon_is_good_.clear(); - muon_global_.clear(); - muon_tracker_.clear(); - ptGlob_.clear(); - etaGlob_.clear(); - phiGlob_.clear(); - energyMuon_.clear(); - pMuon_.clear(); - muon_trkKink.clear(); - muon_chi2LocalPosition.clear(); - muon_segComp.clear(); - muon_is_tight_.clear(); - muon_is_medium_.clear(); - - trackerLayer_.clear(); - numPixelLayers_.clear(); - tight_PixelHits_.clear(); - innerTrack_.clear(); - chiTracker_.clear(); - dxyTracker_.clear(); - dzTracker_.clear(); - innerTrackpt_.clear(); - innerTracketa_.clear(); - innerTrackphi_.clear(); - tight_validFraction_.clear(); - - outerTrack_.clear(); - outerTrackPt_.clear(); - outerTrackEta_.clear(); - outerTrackPhi_.clear(); - outerTrackHits_.clear(); - outerTrackRHits_.clear(); - outerTrackChi_.clear(); - - globalTrack_.clear(); - globalTrckPt_.clear(); - globalTrckEta_.clear(); - globalTrckPhi_.clear(); - globalMuonHits_.clear(); - matchedStat_.clear(); - chiGlobal_.clear(); - tight_LongPara_.clear(); - tight_TransImpara_.clear(); - - isolationR04_.clear(); - isolationR03_.clear(); - ecalEnergy_.clear(); - hcalEnergy_.clear(); - hoEnergy_.clear(); - matchedId_.clear(); - hcalHot_.clear(); - ecal3x3Energy_.clear(); - hcal1x1Energy_.clear(); - ecalDetId_.clear(); - hcalDetId_.clear(); - ehcalDetId_.clear(); - hcal_ieta_.clear(); - hcal_iphi_.clear(); + muon_is_good_ = 0; + muon_global_ = 0; + muon_tracker_ = 0; + ptGlob_ = 0; + etaGlob_ = 0; + phiGlob_ = 0; + energyMuon_ = 0; + pMuon_ = 0; + muon_trkKink_ = 0; + muon_chi2LocalPosition_ = 0; + muon_segComp_ = 0; + muon_is_tight_ = 0; + muon_is_medium_ = 0; + + trackerLayer_ = 0; + numPixelLayers_ = 0; + tight_PixelHits_ = 0; + innerTrack_ = 0; + chiTracker_ = 0; + dxyTracker_ = 0; + dzTracker_ = 0; + innerTrackpt_ = 0; + innerTracketa_ = 0; + innerTrackphi_ = 0; + tight_validFraction_ = 0; + + outerTrack_ = 0; + outerTrackPt_ = 0; + outerTrackEta_ = 0; + outerTrackPhi_ = 0; + outerTrackHits_ = 0; + outerTrackRHits_ = 0; + outerTrackChi_ = 0; + + globalTrack_ = 0; + globalTrckPt_ = 0; + globalTrckEta_ = 0; + globalTrckPhi_ = 0; + globalMuonHits_ = 0; + matchedStat_ = 0; + chiGlobal_ = 0; + tight_LongPara_ = 0; + tight_TransImpara_ = 0; + + isolationR04_ = 0; + isolationR03_ = 0; + ecalEnergy_ = 0; + hcalEnergy_ = 0; + hoEnergy_ = 0; + matchedId_ = 0; + hcalHot_ = 0; + ecal3x3Energy_ = 0; + hcal1x1Energy_ = 0; + ecalDetId_ = 0; + hcalDetId_ = 0; + ehcalDetId_ = 0; + hcal_ieta_ = 0; + hcal_iphi_ = 0; for (int i = 0; i < maxDepth_; ++i) { - hcalDepthEnergy_[i].clear(); - hcalDepthActiveLength_[i].clear(); - hcalDepthEnergyHot_[i].clear(); - hcalDepthActiveLengthHot_[i].clear(); - hcalDepthChargeHot_[i].clear(); - hcalDepthChargeHotBG_[i].clear(); - hcalDepthEnergyCorr_[i].clear(); - hcalDepthEnergyHotCorr_[i].clear(); - hcalDepthMatch_[i].clear(); - hcalDepthMatchHot_[i].clear(); + hcalDepthEnergy_[i] = 0; + hcalDepthActiveLength_[i] = 0; + hcalDepthEnergyHot_[i] = 0; + hcalDepthActiveLengthHot_[i] = 0; + hcalDepthChargeHot_[i] = 0; + hcalDepthChargeHotBG_[i] = 0; + hcalDepthEnergyCorr_[i] = 0; + hcalDepthEnergyHotCorr_[i] = 0; + hcalDepthMatch_[i] = 0; + hcalDepthMatchHot_[i] = 0; } - hcalActiveLength_.clear(); - hcalActiveLengthHot_.clear(); + hcalActiveLength_ = 0; + hcalActiveLengthHot_ = 0; hltresults_.clear(); } diff --git a/Calibration/HcalCalibAlgos/test/HcalHBHEMuonSimAnalyzer.cc b/Calibration/HcalCalibAlgos/test/HcalHBHEMuonSimAnalyzer.cc index dd01494dd59cc..f80acf41fb231 100644 --- a/Calibration/HcalCalibAlgos/test/HcalHBHEMuonSimAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/test/HcalHBHEMuonSimAnalyzer.cc @@ -83,15 +83,15 @@ class HcalHBHEMuonSimAnalyzer : public edm::one::EDAnalyzer ptGlob_, etaGlob_, phiGlob_, pMuon_; - std::vector ecal3x3Energy_, hcal1x1Energy_; - std::vector ecalDetId_, hcalDetId_, hcalHot_; - std::vector matchedId_; - std::vector hcalDepthEnergy_[depthMax_]; - std::vector hcalDepthActiveLength_[depthMax_]; - std::vector hcalDepthEnergyHot_[depthMax_]; - std::vector hcalDepthActiveLengthHot_[depthMax_]; - std::vector hcalActiveLength_, hcalActiveLengthHot_; + double ptGlob_, etaGlob_, phiGlob_, pMuon_; + double ecal3x3Energy_, hcal1x1Energy_; + unsigned int ecalDetId_, hcalDetId_, hcalHot_; + double matchedId_; + double hcalDepthEnergy_[depthMax_]; + double hcalDepthActiveLength_[depthMax_]; + double hcalDepthEnergyHot_[depthMax_]; + double hcalDepthActiveLengthHot_[depthMax_]; + double hcalActiveLength_, hcalActiveLengthHot_; }; HcalHBHEMuonSimAnalyzer::HcalHBHEMuonSimAnalyzer(const edm::ParameterSet& iConfig) { @@ -188,6 +188,16 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_); const HcalTopology* theHBHETopology = &iSetup.getData(tok_topo_); + std::vector ptGlob, etaGlob, phiGlob, pMuon; + std::vector ecal3x3Energy, hcal1x1Energy; + std::vector ecalDetId, hcalDetId, hcalHot; + std::vector matchedId; + std::vector hcalDepthEnergy[depthMax_]; + std::vector hcalDepthActiveLength[depthMax_]; + std::vector hcalDepthEnergyHot[depthMax_]; + std::vector hcalDepthActiveLengthHot[depthMax_]; + std::vector hcalActiveLength, hcalActiveLengthHot; + // Loop over all SimTracks for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) { if ((std::abs(simTrkItr->type()) == idMuon_) && (simTrkItr->vertIndex() == 0) && @@ -223,10 +233,10 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event if (trkD.okHCAL) { // Muon properties spr::trackAtOrigin tkvx = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug); - ptGlob_.push_back(tkvx.momentum.perp()); - etaGlob_.push_back(tkvx.momentum.eta()); - phiGlob_.push_back(tkvx.momentum.phi()); - pMuon_.push_back(tkvx.momentum.mag()); + ptGlob.push_back(tkvx.momentum.perp()); + etaGlob.push_back(tkvx.momentum.eta()); + phiGlob.push_back(tkvx.momentum.phi()); + pMuon.push_back(tkvx.momentum.mag()); #ifdef EDM_ML_DEBUG if ((verbosity_ % 10) > 0) edm::LogVerbatim("HBHEMuon") << "Track at vertex " << tkvx.ok << " position " << tkvx.position << " Momentum " @@ -320,24 +330,43 @@ void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::Event edm::LogVerbatim("HBHEMuon") << "Depth " << k << " E " << eHcalDepth[k] << ":" << eHcalDepthHot[k]; } #endif - matchedId_.push_back(tmpmatch); - ecal3x3Energy_.push_back(eEcal); - ecalDetId_.push_back(isoCell.rawId()); - hcal1x1Energy_.push_back(eHcal); - hcalDetId_.push_back(closestCell.rawId()); + matchedId.push_back(tmpmatch); + ecal3x3Energy.push_back(eEcal); + ecalDetId.push_back(isoCell.rawId()); + hcal1x1Energy.push_back(eHcal); + hcalDetId.push_back(closestCell.rawId()); for (int k = 0; k < depthMax_; ++k) { - hcalDepthEnergy_[k].push_back(eHcalDepth[k]); - hcalDepthActiveLength_[k].push_back(activeL[k]); - hcalDepthEnergyHot_[k].push_back(eHcalDepthHot[k]); - hcalDepthActiveLengthHot_[k].push_back(activeHotL[k]); + hcalDepthEnergy[k].push_back(eHcalDepth[k]); + hcalDepthActiveLength[k].push_back(activeL[k]); + hcalDepthEnergyHot[k].push_back(eHcalDepthHot[k]); + hcalDepthActiveLengthHot[k].push_back(activeHotL[k]); } - hcalHot_.push_back(isHot); - hcalActiveLengthHot_.push_back(activeLengthHotTot); + hcalHot.push_back(isHot); + hcalActiveLengthHot.push_back(activeLengthHotTot); } } } - if (!hcalHot_.empty()) + for (unsigned int k = 0; k < hcalHot.size(); ++k) { + ptGlob_ = ptGlob[k]; + etaGlob_ = etaGlob[k]; + phiGlob_ = phiGlob[k]; + pMuon_ = pMuon[k]; + ecal3x3Energy_ = ecal3x3Energy[k]; + hcal1x1Energy_ = hcal1x1Energy[k]; + ecalDetId_ = ecalDetId[k]; + hcalDetId_ = hcalDetId[k]; + hcalHot_ = hcalHot[k]; + matchedId_ = matchedId[k]; + for (int i = 0; i < depthMax_; ++i) { + hcalDepthEnergy_[i] = hcalDepthEnergy[k][i]; + hcalDepthActiveLength_[i] = hcalDepthActiveLength[k][i]; + hcalDepthEnergyHot_[i] = hcalDepthEnergyHot[k][i]; + hcalDepthActiveLengthHot_[i] = hcalDepthActiveLengthHot[k][i]; + } + hcalActiveLength_ = hcalActiveLength[k]; + hcalActiveLengthHot_ = hcalActiveLengthHot[k]; tree_->Fill(); + } } void HcalHBHEMuonSimAnalyzer::beginJob() { @@ -402,25 +431,6 @@ void HcalHBHEMuonSimAnalyzer::clearVectors() { eventNumber_ = -99999; lumiNumber_ = -99999; bxNumber_ = -99999; - - ptGlob_.clear(); - etaGlob_.clear(); - phiGlob_.clear(); - pMuon_.clear(); - matchedId_.clear(); - ecal3x3Energy_.clear(); - ecalDetId_.clear(); - hcal1x1Energy_.clear(); - hcalDetId_.clear(); - hcalHot_.clear(); - hcalActiveLength_.clear(); - hcalActiveLengthHot_.clear(); - for (int k = 0; k < depthMax_; ++k) { - hcalDepthEnergy_[k].clear(); - hcalDepthActiveLength_[k].clear(); - hcalDepthEnergyHot_[k].clear(); - hcalDepthActiveLengthHot_[k].clear(); - } } unsigned int HcalHBHEMuonSimAnalyzer::matchId(const HcalDetId& id1, const HcalDetId& id2) { diff --git a/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py index 882f4211b8a46..d5da71a52ddc9 100644 --- a/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py +++ b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py @@ -1,12 +1,13 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 -process = cms.Process("ANALYSIS",Run2_2017) +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("ANALYSIS",Run2_2018) process.load("FWCore.MessageService.MessageLogger_cfi") process.load('Configuration.StandardSequences.Services_cff') process.load("Configuration.StandardSequences.GeometryRecoDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.autoCond import autoCond process.GlobalTag.globaltag=autoCond['run2_mc'] @@ -27,13 +28,16 @@ process.towerMakerAll.AllowMissingInputs = True process.load('Calibration.HcalCalibAlgos.HcalIsoTrkAnalyzer_cff') +process.HcalIsoTrkAnalyzer.triggers = [] +process.HcalIsoTrkAnalyzer.useRaw = 0 # 2 for Raw +process.HcalIsoTrkAnalyzer.ignoreTriggers = True process.HcalIsoTrkAnalyzer.processName = 'HLTNew1' process.HcalIsoTrkAnalyzer.producerName = 'ALCAISOTRACK' process.HcalIsoTrkAnalyzer.moduleName = 'IsoProd' process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( - 'file:/afs/cern.ch/work/g/gwalia/calib/dqm/test_29_04/CMSSW_7_5_0_pre2/src/Calibration/HcalCalibAlgos/test/PoolOutput.root' + 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/ALCARECO_MC.root' ) ) From 80f5b4c72041818f1c97ef70c2f4927b2af35c43 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 23 Aug 2021 15:24:56 +0200 Subject: [PATCH 062/923] Code check --- .../macros/HBHEMuonOfflineAnalyzer.C | 348 +++++++++--------- .../macros/HBHEMuonOfflineSimAnalyzer.C | 202 +++++----- .../plugins/HcalHBHEMuonAnalyzer.cc | 96 ++--- 3 files changed, 316 insertions(+), 330 deletions(-) diff --git a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C index 1fe3a6dcaf9cf..f90c379bea2e0 100644 --- a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C +++ b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C @@ -375,14 +375,7 @@ public: bool fillChain(TChain *chain, const char *inputFileList); bool readCorr(const char *rcorFileName); void bookHistograms(const char *); - bool getEnergy(int dep, - double &enb, - double &enu, - double &enh, - double &enc, - double &chgS, - double &chgB, - double &actL); + bool getEnergy(int dep, double &enb, double &enu, double &enh, double &enc, double &chgS, double &chgB, double &actL); void writeHistograms(); bool looseMuon(); bool tightMuon(); @@ -907,176 +900,175 @@ void HBHEMuonOfflineAnalyzer::Loop() { tight = true; if (debug_) - std::cout << " etaHcal " << etaHcal << ":" << etaXHcal << " phiHcal " << phiHcal << ":" << phiYHcal << ":" - << PHI << " Depth " << nDepth << " Muon Pt " << pt_of_muon << " Isol " << IsolationR04 - << std::endl; + std::cout << " etaHcal " << etaHcal << ":" << etaXHcal << " phiHcal " << phiHcal << ":" << phiYHcal << ":" << PHI + << " Depth " << nDepth << " Muon Pt " << pt_of_muon << " Isol " << IsolationR04 << std::endl; for (int cut = 0; cut < nCut_; ++cut) { bool select(false); if (cut == 0) - select = tightMuon(); + select = tightMuon(); else if (cut == 1) - select = softMuon(); + select = softMuon(); else - select = looseMuon(); + select = looseMuon(); if (select && ((eta + 1) >= etaMin_) && ((eta + 1) <= etaMax_)) { - h_Pt_Muon[cut]->Fill(pt_of_muon); - h_Eta_Muon[cut]->Fill(eta_of_muon); - h_Phi_Muon[cut]->Fill(phi_of_muon); - h_PF_Muon[cut]->Fill(PF_Muon); - h_GlobTrack_Chi[cut]->Fill(GlobTrack_Chi); - h_Global_Muon_Hits[cut]->Fill(Global_Muon_Hits); - h_MatchedStations[cut]->Fill(MatchedStations); - h_Tight_TransImpactparameter[cut]->Fill(Tight_TransImpactparameter); - h_Tight_LongitudinalImpactparameter[cut]->Fill(Tight_LongitudinalImpactparameter); - h_InnerTrackPixelHits[cut]->Fill(InnerTrackPixelHits); - h_TrackerLayer[cut]->Fill(TrackerLayer); - h_IsolationR04[cut]->Fill(IsolationR04); - h_Global_Muon[cut]->Fill(Global_Muon); - - h_TransImpactParameter[cut]->Fill(Tight_TransImpactparameter); - h_LongImpactParameter[cut]->Fill(Tight_LongitudinalImpactparameter); - - //in Phi Bins - if (((phi_of_muon) >= -1.5) || ((phi_of_muon) <= 0.5)) { - h_TransImpactParameterBin1[cut]->Fill(Tight_TransImpactparameter); - h_LongImpactParameterBin1[cut]->Fill(Tight_LongitudinalImpactparameter); - h_2D_Bin1[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); - } - - if ((phi_of_muon > 0.5) || (phi_of_muon < -1.5)) { - h_TransImpactParameterBin2[cut]->Fill(Tight_TransImpactparameter); - h_LongImpactParameterBin2[cut]->Fill(Tight_LongitudinalImpactparameter); - h_2D_Bin2[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); - } - - h_ecal_energy[cut]->Fill(ecal_3into3); - h_3x3_ecal[cut]->Fill(ecal_3x3); - h_Eta_ecal[cut]->Fill(eta_of_muon, ecal_3x3); - h_Phi_ecal[cut]->Fill(phi_of_muon, ecal_3x3); - h_MuonHittingEcal[cut]->Fill(typeEcal); - if (typeEcal == 1) { - h_EtaX_ecal[cut]->Fill(etaEcal, ecal_3x3); - h_PhiY_ecal[cut]->Fill(phiEcal, ecal_3x3); - } - - h_hcal_energy[cut]->Fill(hcal_3into3); - h_1x1_hcal[cut]->Fill(hcal_1x1); - h_EtaX_hcal[cut]->Fill(etaXHcal, hcal_1x1); - h_PhiY_hcal[cut]->Fill(phiYHcal, hcal_1x1); - h_HotCell[cut]->Fill(hcal_cellHot); - if (mergeDepth_) { - double en1(0), en2(0), energyFill(0), chargeS(0), chargeBG(0); - double enh(0), enc(0); - for (int dep = 0; dep < nDepth; ++dep) { - double enb(0), enu(0), eh0(0), ec0(0), chgS(0), chgB(0), actL(0); - getEnergy(dep, enb, enu, eh0, ec0, chgS, chgB, actL); - en1 += ((useCorrect_) ? enu : enb); - en2 += ((useCorrect_) ? ec0 : eh0); - enh += (eh0); - enc += (ec0); - energyFill += (actL); - chargeS += (chgS); - chargeBG += (chgB); - } - int ind = (etaHcal > 0) ? indxEta[eta][0][PHI] : 1 + indxEta[eta][0][PHI]; - if (debug_) // || eta==15 || eta==17) - std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal - << ":" << eta << " phi " << phiHcal << ":" << PHI << " Index " << ind << " E " << en1 << ":" - << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " << chargeS << ":" - << chargeBG << std::endl; - if (!(matchedId)) - continue; - if (hcal_cellHot == 1) { - if (energyFill > 0) { - h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - h_active_length_Fill[cut][ind]->Fill(energyFill); - h_p_muon_ineta[cut][ind]->Fill(p_of_muon); - h_charge_signal[cut][ind]->Fill(chargeS); - h_charge_bg[cut][ind]->Fill(chargeBG); - - t_ene.push_back(enh); - t_enec.push_back(enc); - t_charge.push_back(chargeS); - t_actln.push_back(energyFill); - t_depth.push_back(0); - - outtree_->Fill(); - } - } - } else { - bool fillTree(false); - for (int dep = 0; dep < nDepth; ++dep) { - if (debug_) - std::cout << "dep:" << dep << std::endl; - - double energyFill(0), chargeS(-9999), chargeBG(-9999); - double enh(-9999), enc(-9999), enb(0), enu(0); - bool ok1 = getEnergy(dep, enb, enu, enh, enc, chargeS, chargeBG, energyFill); - double en1 = ((useCorrect_) ? enu : enb); - double en2 = ((useCorrect_) ? enc : enh); - if (debug_) - std::cout << "Hello in " << dep + 1 << " " << en1 << ":" << en2 << ":" << energyFill << std::endl; - - bool ok2 = ok1; - - if (debug_) - std::cout << "Before Index " << ok1 << ":" << ok2 << std::endl; - - int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; - if (debug_) // || eta==15 || eta==17) - std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal - << ":" << eta << " phi " << phiHcal << ":" << PHI << " depth " << dep << " Index " << ind - << " E " << en1 << ":" << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " - << chargeS << ":" << chargeBG << std::endl; - if (!(matchedId)) - continue; - if (ok1) { - if (debug_) - std::cout << "enter ok1" << std::endl; - - if (hcal_cellHot == 1) { - if (energyFill > 0) { - h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - h_active_length_Fill[cut][ind]->Fill(energyFill); - h_p_muon_ineta[cut][ind]->Fill(p_of_muon); - h_charge_signal[cut][ind]->Fill(chargeS); - h_charge_bg[cut][ind]->Fill(chargeBG); - t_ene.push_back(enh); - t_enec.push_back(enc); - t_charge.push_back(chargeS); - t_actln.push_back(energyFill); - // added depth vector AmanKalsi - t_depth.push_back(dep); - fillTree = true; - } else { - t_ene.push_back(-999.0); - t_enec.push_back(-999.0); - t_charge.push_back(-999.0); - t_actln.push_back(-999.0); - t_depth.push_back(-999.0); - } - if (debug_) - std::cout << "enter hot cell" << std::endl; - } - } - - if (ok2) { - if (debug_) - std::cout << "enter ok2" << std::endl; - if (hcal_cellHot != 1) { - } - } - - if (debug_) - std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; - } - if (fillTree) - outtree_->Fill(); - } + h_Pt_Muon[cut]->Fill(pt_of_muon); + h_Eta_Muon[cut]->Fill(eta_of_muon); + h_Phi_Muon[cut]->Fill(phi_of_muon); + h_PF_Muon[cut]->Fill(PF_Muon); + h_GlobTrack_Chi[cut]->Fill(GlobTrack_Chi); + h_Global_Muon_Hits[cut]->Fill(Global_Muon_Hits); + h_MatchedStations[cut]->Fill(MatchedStations); + h_Tight_TransImpactparameter[cut]->Fill(Tight_TransImpactparameter); + h_Tight_LongitudinalImpactparameter[cut]->Fill(Tight_LongitudinalImpactparameter); + h_InnerTrackPixelHits[cut]->Fill(InnerTrackPixelHits); + h_TrackerLayer[cut]->Fill(TrackerLayer); + h_IsolationR04[cut]->Fill(IsolationR04); + h_Global_Muon[cut]->Fill(Global_Muon); + + h_TransImpactParameter[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameter[cut]->Fill(Tight_LongitudinalImpactparameter); + + //in Phi Bins + if (((phi_of_muon) >= -1.5) || ((phi_of_muon) <= 0.5)) { + h_TransImpactParameterBin1[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameterBin1[cut]->Fill(Tight_LongitudinalImpactparameter); + h_2D_Bin1[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); + } + + if ((phi_of_muon > 0.5) || (phi_of_muon < -1.5)) { + h_TransImpactParameterBin2[cut]->Fill(Tight_TransImpactparameter); + h_LongImpactParameterBin2[cut]->Fill(Tight_LongitudinalImpactparameter); + h_2D_Bin2[cut]->Fill(Tight_TransImpactparameter, Tight_LongitudinalImpactparameter); + } + + h_ecal_energy[cut]->Fill(ecal_3into3); + h_3x3_ecal[cut]->Fill(ecal_3x3); + h_Eta_ecal[cut]->Fill(eta_of_muon, ecal_3x3); + h_Phi_ecal[cut]->Fill(phi_of_muon, ecal_3x3); + h_MuonHittingEcal[cut]->Fill(typeEcal); + if (typeEcal == 1) { + h_EtaX_ecal[cut]->Fill(etaEcal, ecal_3x3); + h_PhiY_ecal[cut]->Fill(phiEcal, ecal_3x3); + } + + h_hcal_energy[cut]->Fill(hcal_3into3); + h_1x1_hcal[cut]->Fill(hcal_1x1); + h_EtaX_hcal[cut]->Fill(etaXHcal, hcal_1x1); + h_PhiY_hcal[cut]->Fill(phiYHcal, hcal_1x1); + h_HotCell[cut]->Fill(hcal_cellHot); + if (mergeDepth_) { + double en1(0), en2(0), energyFill(0), chargeS(0), chargeBG(0); + double enh(0), enc(0); + for (int dep = 0; dep < nDepth; ++dep) { + double enb(0), enu(0), eh0(0), ec0(0), chgS(0), chgB(0), actL(0); + getEnergy(dep, enb, enu, eh0, ec0, chgS, chgB, actL); + en1 += ((useCorrect_) ? enu : enb); + en2 += ((useCorrect_) ? ec0 : eh0); + enh += (eh0); + enc += (ec0); + energyFill += (actL); + chargeS += (chgS); + chargeBG += (chgB); + } + int ind = (etaHcal > 0) ? indxEta[eta][0][PHI] : 1 + indxEta[eta][0][PHI]; + if (debug_) // || eta==15 || eta==17) + std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal << ":" << eta + << " phi " << phiHcal << ":" << PHI << " Index " << ind << " E " << en1 << ":" << en2 << ":" + << enh << ":" << enc << " L " << energyFill << " Charge " << chargeS << ":" << chargeBG + << std::endl; + if (!(matchedId)) + continue; + if (hcal_cellHot == 1) { + if (energyFill > 0) { + h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + h_active_length_Fill[cut][ind]->Fill(energyFill); + h_p_muon_ineta[cut][ind]->Fill(p_of_muon); + h_charge_signal[cut][ind]->Fill(chargeS); + h_charge_bg[cut][ind]->Fill(chargeBG); + + t_ene.push_back(enh); + t_enec.push_back(enc); + t_charge.push_back(chargeS); + t_actln.push_back(energyFill); + t_depth.push_back(0); + + outtree_->Fill(); + } + } + } else { + bool fillTree(false); + for (int dep = 0; dep < nDepth; ++dep) { + if (debug_) + std::cout << "dep:" << dep << std::endl; + + double energyFill(0), chargeS(-9999), chargeBG(-9999); + double enh(-9999), enc(-9999), enb(0), enu(0); + bool ok1 = getEnergy(dep, enb, enu, enh, enc, chargeS, chargeBG, energyFill); + double en1 = ((useCorrect_) ? enu : enb); + double en2 = ((useCorrect_) ? enc : enh); + if (debug_) + std::cout << "Hello in " << dep + 1 << " " << en1 << ":" << en2 << ":" << energyFill << std::endl; + + bool ok2 = ok1; + + if (debug_) + std::cout << "Before Index " << ok1 << ":" << ok2 << std::endl; + + int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; + if (debug_) // || eta==15 || eta==17) + std::cout << "Matched Id " << matchedId << " Hot " << hcal_cellHot << " eta " << etaHcal << ":" << eta + << " phi " << phiHcal << ":" << PHI << " depth " << dep << " Index " << ind << " E " << en1 + << ":" << en2 << ":" << enh << ":" << enc << " L " << energyFill << " Charge " << chargeS << ":" + << chargeBG << std::endl; + if (!(matchedId)) + continue; + if (ok1) { + if (debug_) + std::cout << "enter ok1" << std::endl; + + if (hcal_cellHot == 1) { + if (energyFill > 0) { + h_Hot_MuonEnergy_hcal_HotCell[cut][ind]->Fill(en2); + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + h_active_length_Fill[cut][ind]->Fill(energyFill); + h_p_muon_ineta[cut][ind]->Fill(p_of_muon); + h_charge_signal[cut][ind]->Fill(chargeS); + h_charge_bg[cut][ind]->Fill(chargeBG); + t_ene.push_back(enh); + t_enec.push_back(enc); + t_charge.push_back(chargeS); + t_actln.push_back(energyFill); + // added depth vector AmanKalsi + t_depth.push_back(dep); + fillTree = true; + } else { + t_ene.push_back(-999.0); + t_enec.push_back(-999.0); + t_charge.push_back(-999.0); + t_actln.push_back(-999.0); + t_depth.push_back(-999.0); + } + if (debug_) + std::cout << "enter hot cell" << std::endl; + } + } + + if (ok2) { + if (debug_) + std::cout << "enter ok2" << std::endl; + if (hcal_cellHot != 1) { + } + } + + if (debug_) + std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; + } + if (fillTree) + outtree_->Fill(); + } } } int evtype(0); @@ -1478,14 +1470,8 @@ void HBHEMuonOfflineAnalyzer::bookHistograms(const char *fname) { //output_file->cd(); } -bool HBHEMuonOfflineAnalyzer::getEnergy(int dep, - double &enb, - double &enu, - double &enh, - double &enc, - double &chgS, - double &chgB, - double &actL) { +bool HBHEMuonOfflineAnalyzer::getEnergy( + int dep, double &enb, double &enu, double &enh, double &enc, double &chgS, double &chgB, double &actL) { double cfac(1.0); bool flag(true); if (cFactor_) { @@ -1601,13 +1587,11 @@ bool HBHEMuonOfflineAnalyzer::tightMuon() { } bool HBHEMuonOfflineAnalyzer::mediumMuon2016() { - bool medium16 = - (((PF_Muon) && (Global_Muon || Tracker_muon)) && (tight_validFraction > 0.49)); + bool medium16 = (((PF_Muon) && (Global_Muon || Tracker_muon)) && (tight_validFraction > 0.49)); if (!medium16) return medium16; - bool goodGlob = (Global_Muon && GlobTrack_Chi < 3 && muon_chi2LocalPosition < 12 && - muon_trkKink < 20); + bool goodGlob = (Global_Muon && GlobTrack_Chi < 3 && muon_chi2LocalPosition < 12 && muon_trkKink < 20); medium16 = muon_segComp > (goodGlob ? 0.303 : 0.451); return medium16; } diff --git a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C index d93444f040f8a..46ef4652d2786 100644 --- a/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C +++ b/Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineSimAnalyzer.C @@ -371,8 +371,8 @@ void HBHEMuonOfflineSimAnalyzer::Loop() { nbytes += nb; if (debug_) { - std::cout << "ecal_det_id " << ecal_detID << std::endl; - std::cout << "hcal_det_id " << std::hex << hcal_detID << std::dec; + std::cout << "ecal_det_id " << ecal_detID << std::endl; + std::cout << "hcal_det_id " << std::hex << hcal_detID << std::dec; } int etaHcal, phiHcal, depthHcal; etaPhiHcal(hcal_detID, etaHcal, phiHcal, depthHcal); @@ -380,7 +380,7 @@ void HBHEMuonOfflineSimAnalyzer::Loop() { int eta = (etaHcal > 0) ? (etaHcal - 1) : -(1 + etaHcal); int nDepth = NDepthBins(eta + 1, phiHcal); int nPhi = NPhiBins(eta + 1); - + double phiYHcal = (phiHcal - 0.5); if (debug_) std::cout << "phiHcal" << phiHcal << " phiYHcal" << phiYHcal << std::endl; @@ -388,107 +388,109 @@ void HBHEMuonOfflineSimAnalyzer::Loop() { for (int cut = 0; cut < 3; ++cut) { bool select(false); if (cut == 0) - select = tightMuon(); + select = tightMuon(); else if (cut == 1) - select = SoftMuon(); + select = SoftMuon(); else - select = LooseMuon(); + select = LooseMuon(); if (select) { - // h_P_Muon[cut]->Fill(p_of_muon); - h_P_Muon[cut]->Fill(p_of_muon); - h_Pt_Muon[cut]->Fill(pt_of_muon); - h_Eta_Muon[cut]->Fill(eta_of_muon); - - double energyFill; - for (int dep = 0; dep < nDepth; ++dep) { - if (debug_) { - std::cout << "why on 15/2 only" << std::endl; - std::cout << "dep:" << dep << std::endl; - } - int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; - double en1(-9999), en2(-9999); - if (dep == 0) { - en1 = hcal_edepth1; - en2 = hcal_edepthHot1; - energyFill = (hcal_activeHotL1 > 0) ? hcal_activeHotL1 : 999; - } else if (dep == 1) { - en1 = hcal_edepth2; - en2 = hcal_edepthHot2; - energyFill = (hcal_activeHotL2 > 0) ? hcal_activeHotL2 : 999; - if (debug_) - std::cout << "problem here.. lets see if it got printed\n"; - } else if (dep == 2) { - en1 = hcal_edepth3; - en2 = hcal_edepthHot3; - energyFill = (hcal_activeHotL3 > 0) ? hcal_activeHotL3 : 999; - } else if (dep == 3) { - en1 = hcal_edepth4; - en2 = hcal_edepthHot4; - if (debug_) - std::cout << "Hello in 4" << std::endl; - energyFill = (hcal_activeHotL4 > 0) ? hcal_activeHotL4 : 999; - } else if (dep == 4) { - en1 = hcal_edepth5; - en2 = hcal_edepthHot5; - energyFill = (hcal_activeHotL5 > 0) ? hcal_activeHotL5 : 999; - } else if (dep == 5) { - if (debug_) - std::cout << "Energy in depth 6 " << maxDepth_ << ":" << hcal_edepth6 << ":" << hcal_edepthHot6 << std::endl; - en1 = (maxDepth_ > 5) ? hcal_edepth6 : 0; - en2 = (maxDepth_ > 5) ? hcal_edepthHot6 : 0; - energyFill = (hcal_activeHotL6 > 0) ? hcal_activeHotL6 : 999; - } else if (dep == 6) { - if (debug_) - std::cout << "Energy in depth 7 " << maxDepth_ << ":" < 6) ? hcal_edepth7 : 0; - en2 = (maxDepth_ > 6) ? hcal_edepthHot7 : 0; - energyFill = (hcal_activeHotL7 > 0) ? hcal_activeHotL7 : 999; - } - - if (debug_) { - std::cout << " Debug2" << std::endl; - std::cout << "ok1" << en1 << std::endl; - std::cout << "ok2" << en2 << std::endl; - } - bool ok1 = (en1 > -9999); - bool ok2 = (en2 > -9999); - - if (debug_) - std::cout << "Before Index" << std::endl; - - int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; - - if (debug_) { - std::cout << "ieta " << eta << "depth " << dep << "indxEta[eta][dep]:" << indxEta[eta][dep][PHI] - << std::endl; - std::cout << "index showing eta,depth:" << ind << std::endl; - std::cout << "etaHcal: " << etaHcal << " eta " << eta << " dep " << dep << " indx " << ind << std::endl; - } - if (!(matchedId)) - continue; - if (ok1) { - if (debug_) - std::cout << "enter ok1" << std::endl; - if (hcal_cellHot == 1) { - if (en2 > 0) { - h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); - } - if (debug_) - std::cout << "enter hot cell" << std::endl; - } - } - - if (ok2) { - if (debug_) - std::cout << "enter ok2" << std::endl; - if (hcal_cellHot != 1) { - } - } - - if (debug_) - std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; - } + // h_P_Muon[cut]->Fill(p_of_muon); + h_P_Muon[cut]->Fill(p_of_muon); + h_Pt_Muon[cut]->Fill(pt_of_muon); + h_Eta_Muon[cut]->Fill(eta_of_muon); + + double energyFill; + for (int dep = 0; dep < nDepth; ++dep) { + if (debug_) { + std::cout << "why on 15/2 only" << std::endl; + std::cout << "dep:" << dep << std::endl; + } + int PHI = (nPhi > 36) ? (phiHcal - 1) : (phiHcal - 1) / 2; + double en1(-9999), en2(-9999); + if (dep == 0) { + en1 = hcal_edepth1; + en2 = hcal_edepthHot1; + energyFill = (hcal_activeHotL1 > 0) ? hcal_activeHotL1 : 999; + } else if (dep == 1) { + en1 = hcal_edepth2; + en2 = hcal_edepthHot2; + energyFill = (hcal_activeHotL2 > 0) ? hcal_activeHotL2 : 999; + if (debug_) + std::cout << "problem here.. lets see if it got printed\n"; + } else if (dep == 2) { + en1 = hcal_edepth3; + en2 = hcal_edepthHot3; + energyFill = (hcal_activeHotL3 > 0) ? hcal_activeHotL3 : 999; + } else if (dep == 3) { + en1 = hcal_edepth4; + en2 = hcal_edepthHot4; + if (debug_) + std::cout << "Hello in 4" << std::endl; + energyFill = (hcal_activeHotL4 > 0) ? hcal_activeHotL4 : 999; + } else if (dep == 4) { + en1 = hcal_edepth5; + en2 = hcal_edepthHot5; + energyFill = (hcal_activeHotL5 > 0) ? hcal_activeHotL5 : 999; + } else if (dep == 5) { + if (debug_) + std::cout << "Energy in depth 6 " << maxDepth_ << ":" << hcal_edepth6 << ":" << hcal_edepthHot6 + << std::endl; + en1 = (maxDepth_ > 5) ? hcal_edepth6 : 0; + en2 = (maxDepth_ > 5) ? hcal_edepthHot6 : 0; + energyFill = (hcal_activeHotL6 > 0) ? hcal_activeHotL6 : 999; + } else if (dep == 6) { + if (debug_) + std::cout << "Energy in depth 7 " << maxDepth_ << ":" << hcal_edepth7 << ":" << hcal_edepthHot7 + << std::endl; + en1 = (maxDepth_ > 6) ? hcal_edepth7 : 0; + en2 = (maxDepth_ > 6) ? hcal_edepthHot7 : 0; + energyFill = (hcal_activeHotL7 > 0) ? hcal_activeHotL7 : 999; + } + + if (debug_) { + std::cout << " Debug2" << std::endl; + std::cout << "ok1" << en1 << std::endl; + std::cout << "ok2" << en2 << std::endl; + } + bool ok1 = (en1 > -9999); + bool ok2 = (en2 > -9999); + + if (debug_) + std::cout << "Before Index" << std::endl; + + int ind = (etaHcal > 0) ? indxEta[eta][dep][PHI] : 1 + indxEta[eta][dep][PHI]; + + if (debug_) { + std::cout << "ieta " << eta << "depth " << dep << "indxEta[eta][dep]:" << indxEta[eta][dep][PHI] + << std::endl; + std::cout << "index showing eta,depth:" << ind << std::endl; + std::cout << "etaHcal: " << etaHcal << " eta " << eta << " dep " << dep << " indx " << ind << std::endl; + } + if (!(matchedId)) + continue; + if (ok1) { + if (debug_) + std::cout << "enter ok1" << std::endl; + if (hcal_cellHot == 1) { + if (en2 > 0) { + h_Hot_MuonEnergy_hcal_HotCell_VsActiveLength[cut][ind]->Fill(en2 / energyFill); + } + if (debug_) + std::cout << "enter hot cell" << std::endl; + } + } + + if (ok2) { + if (debug_) + std::cout << "enter ok2" << std::endl; + if (hcal_cellHot != 1) { + } + } + + if (debug_) + std::cout << "ETA \t" << eta << "DEPTH \t" << dep << std::endl; + } } } } diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc index 227b777d71312..c67a36cab4b87 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc @@ -815,7 +815,7 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet << "HCAL has value of " << hcal_ieta_[i] << ":" << hcal_iphi_[i]; #endif for (unsigned int k = 0; k < muon_is_good.size(); ++k) { - muon_is_good_ = muon_is_good[k]; + muon_is_good_ = muon_is_good[k]; muon_global_ = muon_global[k]; muon_tracker_ = muon_tracker[k]; muon_is_tight_ = muon_is_tight[k]; @@ -825,61 +825,61 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet phiGlob_ = phiGlob[k]; energyMuon_ = energyMuon[k]; pMuon_ = pMuon[k]; - muon_trkKink_ = muon_trkKink[k]; + muon_trkKink_ = muon_trkKink[k]; muon_chi2LocalPosition_ = muon_chi2LocalPosition[k]; muon_segComp_ = muon_segComp[k]; - trackerLayer_ = trackerLayer[k]; - numPixelLayers_ = numPixelLayers[k]; + trackerLayer_ = trackerLayer[k]; + numPixelLayers_ = numPixelLayers[k]; tight_PixelHits_ = tight_PixelHits[k]; - innerTrack_ = innerTrack[k]; - outerTrack_ = outerTrack[k]; + innerTrack_ = innerTrack[k]; + outerTrack_ = outerTrack[k]; globalTrack_ = globalTrack[k]; - chiTracker_ = chiTracker[k]; - dxyTracker_ = dxyTracker[k]; + chiTracker_ = chiTracker[k]; + dxyTracker_ = dxyTracker[k]; dzTracker_ = dzTracker[k]; - innerTrackpt_ = innerTrackpt[k]; - innerTracketa_ = innerTracketa[k]; + innerTrackpt_ = innerTrackpt[k]; + innerTracketa_ = innerTracketa[k]; innerTrackphi_ = innerTrackphi[k]; - tight_validFraction_ = tight_validFraction[k]; + tight_validFraction_ = tight_validFraction[k]; outerTrackChi_ = outerTrackChi[k]; - outerTrackPt_ = outerTrackPt[k]; - outerTrackEta_ = outerTrackEta[k]; + outerTrackPt_ = outerTrackPt[k]; + outerTrackEta_ = outerTrackEta[k]; outerTrackPhi_ = outerTrackPhi[k]; - outerTrackHits_ = outerTrackHits[k]; + outerTrackHits_ = outerTrackHits[k]; outerTrackRHits_ = outerTrackRHits[k]; - globalTrckPt_ = globalTrckPt[k]; + globalTrckPt_ = globalTrckPt[k]; globalTrckEta_ = globalTrckEta[k]; globalTrckPhi_ = globalTrckPhi[k]; - globalMuonHits_ = globalMuonHits[k]; + globalMuonHits_ = globalMuonHits[k]; matchedStat_ = matchedStat[k]; - chiGlobal_ = chiGlobal[k]; - tight_LongPara_ = tight_LongPara[k]; + chiGlobal_ = chiGlobal[k]; + tight_LongPara_ = tight_LongPara[k]; tight_TransImpara_ = tight_TransImpara[k]; - isolationR04_ = isolationR04[k]; + isolationR04_ = isolationR04[k]; isolationR03_ = isolationR03[k]; - ecalEnergy_ = ecalEnergy[k]; - hcalEnergy_ = hcalEnergy[k]; + ecalEnergy_ = ecalEnergy[k]; + hcalEnergy_ = hcalEnergy[k]; hoEnergy_ = hoEnergy[k]; - matchedId_ = matchedId[k]; + matchedId_ = matchedId[k]; hcalHot_ = hcalHot[k]; - ecal3x3Energy_ = ecal3x3Energy[k]; + ecal3x3Energy_ = ecal3x3Energy[k]; hcal1x1Energy_ = hcal1x1Energy[k]; - ecalDetId_ = ecalDetId[k]; - hcalDetId_ = hcalDetId[k]; + ecalDetId_ = ecalDetId[k]; + hcalDetId_ = hcalDetId[k]; ehcalDetId_ = ehcalDetId[k]; - hcal_ieta_ = hcal_ieta[k]; + hcal_ieta_ = hcal_ieta[k]; hcal_iphi_ = hcal_iphi[k]; for (int i = 0; i < depthMax_; ++i) { - hcalDepthEnergy_[i] = hcalDepthEnergy[i][k]; - hcalDepthActiveLength_[i] = hcalDepthActiveLength[i][k]; - hcalDepthEnergyHot_[i] = hcalDepthEnergyHot[i][k]; - hcalDepthActiveLengthHot_[i] = hcalDepthActiveLengthHot[i][k]; - hcalDepthChargeHot_[i] = hcalDepthChargeHot[i][k]; - hcalDepthChargeHotBG_[i] = hcalDepthChargeHotBG[i][k]; - hcalDepthEnergyCorr_[i] = hcalDepthEnergyCorr[i][k]; - hcalDepthEnergyHotCorr_[i] = hcalDepthEnergyHotCorr[i][k]; - hcalDepthMatch_[i] = hcalDepthMatch[i][k]; - hcalDepthMatchHot_[i] = hcalDepthMatchHot[i][k]; + hcalDepthEnergy_[i] = hcalDepthEnergy[i][k]; + hcalDepthActiveLength_[i] = hcalDepthActiveLength[i][k]; + hcalDepthEnergyHot_[i] = hcalDepthEnergyHot[i][k]; + hcalDepthActiveLengthHot_[i] = hcalDepthActiveLengthHot[i][k]; + hcalDepthChargeHot_[i] = hcalDepthChargeHot[i][k]; + hcalDepthChargeHotBG_[i] = hcalDepthChargeHotBG[i][k]; + hcalDepthEnergyCorr_[i] = hcalDepthEnergyCorr[i][k]; + hcalDepthEnergyHotCorr_[i] = hcalDepthEnergyHotCorr[i][k]; + hcalDepthMatch_[i] = hcalDepthMatch[i][k]; + hcalDepthMatchHot_[i] = hcalDepthMatchHot[i][k]; } hcalActiveLength_ = hcalActiveLength[k]; hcalActiveLengthHot_ = hcalActiveLengthHot[k]; @@ -1099,9 +1099,9 @@ void HcalHBHEMuonAnalyzer::clearVectors() { bxNumber_ = -99999; goodVertex_ = -99999; - muon_is_good_ = 0; - muon_global_ = 0; - muon_tracker_ = 0; + muon_is_good_ = false; + muon_global_ = false; + muon_tracker_ = false; ptGlob_ = 0; etaGlob_ = 0; phiGlob_ = 0; @@ -1110,13 +1110,13 @@ void HcalHBHEMuonAnalyzer::clearVectors() { muon_trkKink_ = 0; muon_chi2LocalPosition_ = 0; muon_segComp_ = 0; - muon_is_tight_ = 0; - muon_is_medium_ = 0; + muon_is_tight_ = false; + muon_is_medium_ = false; trackerLayer_ = 0; numPixelLayers_ = 0; tight_PixelHits_ = 0; - innerTrack_ = 0; + innerTrack_ = false; chiTracker_ = 0; dxyTracker_ = 0; dzTracker_ = 0; @@ -1125,7 +1125,7 @@ void HcalHBHEMuonAnalyzer::clearVectors() { innerTrackphi_ = 0; tight_validFraction_ = 0; - outerTrack_ = 0; + outerTrack_ = false; outerTrackPt_ = 0; outerTrackEta_ = 0; outerTrackPhi_ = 0; @@ -1133,7 +1133,7 @@ void HcalHBHEMuonAnalyzer::clearVectors() { outerTrackRHits_ = 0; outerTrackChi_ = 0; - globalTrack_ = 0; + globalTrack_ = false; globalTrckPt_ = 0; globalTrckEta_ = 0; globalTrckPhi_ = 0; @@ -1148,8 +1148,8 @@ void HcalHBHEMuonAnalyzer::clearVectors() { ecalEnergy_ = 0; hcalEnergy_ = 0; hoEnergy_ = 0; - matchedId_ = 0; - hcalHot_ = 0; + matchedId_ = false; + hcalHot_ = false; ecal3x3Energy_ = 0; hcal1x1Energy_ = 0; ecalDetId_ = 0; @@ -1166,8 +1166,8 @@ void HcalHBHEMuonAnalyzer::clearVectors() { hcalDepthChargeHotBG_[i] = 0; hcalDepthEnergyCorr_[i] = 0; hcalDepthEnergyHotCorr_[i] = 0; - hcalDepthMatch_[i] = 0; - hcalDepthMatchHot_[i] = 0; + hcalDepthMatch_[i] = false; + hcalDepthMatchHot_[i] = false; } hcalActiveLength_ = 0; hcalActiveLengthHot_ = 0; From 5fdc25f4028e454bfa6c50c648ca3436183be6fd Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 15:30:10 -0500 Subject: [PATCH 063/923] Add helper functions to print out a detid in format ME(+/-)S/R/C/L, e.g. ME+1/1/1/1 --- DataFormats/MuonDetId/interface/CSCDetId.h | 6 ++++++ DataFormats/MuonDetId/src/CSCDetId.cc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/DataFormats/MuonDetId/interface/CSCDetId.h b/DataFormats/MuonDetId/interface/CSCDetId.h index 16336125a8422..bcbba04a9c684 100644 --- a/DataFormats/MuonDetId/interface/CSCDetId.h +++ b/DataFormats/MuonDetId/interface/CSCDetId.h @@ -249,6 +249,12 @@ class CSCDetId : public DetId { static std::string chamberName(int endcap, int station, int ring, int chamber); static std::string chamberName(int iChamberType); std::string chamberName() const; + /** + * Returns the layer name in the format + * ME$sign$station/$ring/$chamber/$layer. Example: ME+1/1/9/1 + */ + static std::string layerName(int endcap, int station, int ring, int chamber, int layer); + std::string layerName() const; private: /** diff --git a/DataFormats/MuonDetId/src/CSCDetId.cc b/DataFormats/MuonDetId/src/CSCDetId.cc index d2eb1f886a355..94a6cc1c1453a 100644 --- a/DataFormats/MuonDetId/src/CSCDetId.cc +++ b/DataFormats/MuonDetId/src/CSCDetId.cc @@ -76,6 +76,11 @@ std::string CSCDetId::chamberName(int endcap, int station, int ring, int chamber return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber); } +std::string CSCDetId::layerName(int endcap, int station, int ring, int chamber, int layer) { + const std::string eSign = endcap == 1 ? "+" : "-"; + return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber) + "/" + std::to_string(layer); +} + std::string CSCDetId::chamberName(int chamberType) { // ME1a, ME1b, ME12, ME13, ME21, ME22, ME31, ME32, ME41, ME42 const unsigned stations[10] = {1, 1, 1, 1, 2, 2, 3, 3, 4, 4}; @@ -85,6 +90,8 @@ std::string CSCDetId::chamberName(int chamberType) { std::string CSCDetId::chamberName() const { return chamberName(endcap(), station(), ring(), chamber()); } +std::string CSCDetId::layerName() const { return layerName(endcap(), station(), ring(), chamber(), layer()); } + std::ostream& operator<<(std::ostream& os, const CSCDetId& id) { // Note that there is no endl to end the output From c045b423abc973d33ae6677dca112fc9df440f76 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 15:31:53 -0500 Subject: [PATCH 064/923] Add packing unit test --- EventFilter/CSCRawToDigi/test/BuildFile.xml | 6 + .../test/CSCPackerUnpackerUnitTest.cc | 564 ++++++++++++++++++ .../testPackingUnpackingPreTriggers_cfg.py | 104 ++++ 3 files changed, 674 insertions(+) create mode 100644 EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc create mode 100644 EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py diff --git a/EventFilter/CSCRawToDigi/test/BuildFile.xml b/EventFilter/CSCRawToDigi/test/BuildFile.xml index f6cec9d11ccfc..c5e80ffceec72 100644 --- a/EventFilter/CSCRawToDigi/test/BuildFile.xml +++ b/EventFilter/CSCRawToDigi/test/BuildFile.xml @@ -1,3 +1,9 @@ + + + + + + diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc new file mode 100644 index 0000000000000..67f20eddb71c7 --- /dev/null +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -0,0 +1,564 @@ +#include "FWCore/Framework/interface/ConsumesCollector.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/Utilities/interface/EDGetToken.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" +#include "Geometry/CSCGeometry/interface/CSCGeometry.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h" + +#include +#include + +class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { +public: + explicit CSCPackerUnpackerUnitTest(const edm::ParameterSet&); + ~CSCPackerUnpackerUnitTest() override {} + + void analyze(const edm::Event&, const edm::EventSetup&) override; + + // Fill parameters descriptions + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyzeChamber(const CSCDetId& cscId, + const CSCWireDigiCollection& wd, + const CSCWireDigiCollection& wdu, + const CSCStripDigiCollection& sd, + const CSCStripDigiCollection& sdu, + const CSCComparatorDigiCollection& cd, + const CSCComparatorDigiCollection& cdu, + const CSCALCTDigiCollection& alct, + const CSCCLCTDigiCollection& clct, + const CSCCLCTPreTriggerDigiCollection& pre, + const CSCCorrelatedLCTDigiCollection& lct) const; + + // the return value indicates the number of failed tests + unsigned analyzeALCT(const CSCDetId& cscDetId, + const CSCWireDigiCollection& wires, + const CSCWireDigiCollection& wires_unpacked, + const CSCALCTDigiCollection& alcts) const; + unsigned analyzeCLCT(const CSCDetId& cscDetId, + const CSCComparatorDigiCollection& comparators, + const CSCComparatorDigiCollection& comparators_unpacked, + const CSCCLCTDigiCollection& clcts) const; + unsigned analyzePreCLCT(const CSCDetId& cscDetId, + const CSCStripDigiCollection& strips, + const CSCStripDigiCollection& strips_unpacked, + const CSCCLCTPreTriggerDigiCollection& preclcts) const; + + // helper functions + template + unsigned nDigis(const CSCDetId& cscId, const DIGICollection& digis) const; + + template + unsigned nDigisLayer(const CSCDetId& cscId, const DIGICollection& digis) const; + + unsigned nDigisCFEB(const CSCDetId& cscId, + const CSCStripDigiCollection& digis, int cfeb) const; + + unsigned nDigisCFEBLayer(const CSCDetId& cscId, + const CSCStripDigiCollection& digis, int cfeb) const; + + unsigned getNCFEBs(unsigned type) const; + + int alctWindowMin_; + int alctWindowMax_; + int clctWindowMin_; + int clctWindowMax_; + int preTriggerWindowMin_; + int preTriggerWindowMax_; + unsigned formatVersion_; + bool packEverything_; + bool usePreTriggers_; + bool packByCFEB_; + bool testALCT_; + bool testCLCT_; + bool testPreCLCT_; + + edm::EDGetTokenT wd_token_; + edm::EDGetTokenT wd_unpacked_token_; + edm::EDGetTokenT sd_token_; + edm::EDGetTokenT sd_unpacked_token_; + edm::EDGetTokenT cd_token_; + edm::EDGetTokenT cd_unpacked_token_; + edm::EDGetTokenT al_token_; + edm::EDGetTokenT cl_token_; + edm::EDGetTokenT clpre_token_; + edm::EDGetTokenT co_token_; +}; + +CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& conf) : + alctWindowMin_(conf.getParameter("alctWindowMin")), + alctWindowMax_(conf.getParameter("alctWindowMax")), + clctWindowMin_(conf.getParameter("clctWindowMin")), + clctWindowMax_(conf.getParameter("clctWindowMax")), + preTriggerWindowMin_(conf.getParameter("preTriggerWindowMin")), + preTriggerWindowMax_(conf.getParameter("preTriggerWindowMax")), + formatVersion_(conf.getParameter("formatVersion")), + packEverything_(conf.getParameter("packEverything")), + usePreTriggers_(conf.getParameter("usePreTriggers")), + packByCFEB_(conf.getParameter("packByCFEB")), + testALCT_(conf.getParameter("testALCT")), + testCLCT_(conf.getParameter("testCLCT")), + testPreCLCT_(conf.getParameter("testPreCLCT")), + wd_token_(consumes(conf.getParameter("wireTag"))), + wd_unpacked_token_(consumes(conf.getParameter("wireUnpackedTag"))), + sd_token_(consumes(conf.getParameter("stripTag"))), + sd_unpacked_token_(consumes(conf.getParameter("stripUnpackedTag"))), + cd_token_(consumes(conf.getParameter("comparatorTag"))), + cd_unpacked_token_(consumes(conf.getParameter("comparatorUnpackedTag"))), + al_token_(consumes(conf.getParameter("alctTag"))), + cl_token_(consumes(conf.getParameter("clctTag"))), + clpre_token_(consumes(conf.getParameter("clctpreTag"))), + co_token_(consumes(conf.getParameter("corrclctTag"))) +{ +} + +void CSCPackerUnpackerUnitTest::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + // digi collections + desc.add("wireTag", edm::InputTag("simMuonCSCDigis", "MuonCSCWireDigi")); + desc.add("stripTag", edm::InputTag("simMuonCSCDigis", "MuonCSCStripDigi")); + desc.add("comparatorTag", edm::InputTag("simMuonCSCDigis", "MuonCSCComparatorDigi")); + // DAQ collections + desc.add("wireUnpackedTag", edm::InputTag("muonCSCDigis", "MuonCSCWireDigi")); + desc.add("stripUnpackedTag", edm::InputTag("muonCSCDigis", "MuonCSCStripDigi")); + desc.add("comparatorUnpackedTag", edm::InputTag("muonCSCDigis", "MuonCSCComparatorDigi")); + // trigger collections + desc.add("alctTag", edm::InputTag("simCscTriggerPrimitiveDigis")); + desc.add("clctTag", edm::InputTag("simCscTriggerPrimitiveDigis")); + desc.add("clctpreTag", edm::InputTag("simCscTriggerPrimitiveDigis")); + desc.add("corrclctTag", edm::InputTag("simCscTriggerPrimitiveDigis")); + // readout windows + desc.add("alctWindowMin", -3); + desc.add("alctWindowMax", 3); + desc.add("clctWindowMin", -3); + desc.add("clctWindowMax", 3); + desc.add("preTriggerWindowMin", -3); + desc.add("preTriggerWindowMax", 1); + desc.add("formatVersion", 2005); + // enable functions + desc.add("testALCT", true); + desc.add("testCLCT", true); + desc.add("testPreCLCT", true); + desc.add("usePreTriggers", true); + desc.add("packEverything", false); + desc.add("packByCFEB", true); + descriptions.add("cscPackerUnpackerUnitTestDef", desc); +} + +void CSCPackerUnpackerUnitTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + // handles, tokens + edm::Handle wires; + iEvent.getByToken(wd_token_, wires); + + edm::Handle wires_unpacked; + iEvent.getByToken(wd_unpacked_token_, wires_unpacked); + + edm::Handle strips; + iEvent.getByToken(sd_token_, strips); + + edm::Handle strips_unpacked; + iEvent.getByToken(sd_unpacked_token_, strips_unpacked); + + edm::Handle comparators; + iEvent.getByToken(cd_token_, comparators); + + edm::Handle comparators_unpacked; + iEvent.getByToken(cd_unpacked_token_, comparators_unpacked); + + edm::Handle alcts; + iEvent.getByToken(al_token_, alcts); + + edm::Handle clcts; + iEvent.getByToken(cl_token_, clcts); + + edm::Handle preclcts; + iEvent.getByToken(clpre_token_, preclcts); + + edm::Handle lcts; + iEvent.getByToken(co_token_, lcts); + + const int min_endcap = CSCDetId::minEndcapId(); + const int max_endcap = CSCDetId::maxEndcapId(); + const int min_station = CSCDetId::minStationId(); + const int max_station = CSCDetId::maxStationId(); + const int min_sector = CSCTriggerNumbering::minTriggerSectorId(); + const int max_sector = CSCTriggerNumbering::maxTriggerSectorId(); + const int min_subsector = CSCTriggerNumbering::minTriggerSubSectorId(); + const int max_subsector = CSCTriggerNumbering::maxTriggerSubSectorId(); + const int min_chamber = CSCTriggerNumbering::minTriggerCscId(); + const int max_chamber = CSCTriggerNumbering::maxTriggerCscId(); + + for (int endc = min_endcap; endc <= max_endcap; endc++) { + for (int stat = min_station; stat <= max_station; stat++) { + int numsubs = ((stat == 1) ? max_subsector : 1); + for (int sect = min_sector; sect <= max_sector; sect++) { + for (int subs = min_subsector; subs <= numsubs; subs++) { + for (int cham = min_chamber; cham <= max_chamber; cham++) { + int ring = CSCTriggerNumbering::ringFromTriggerLabels(stat, cham); + + // actual chamber number =/= trigger chamber number + int chid = CSCTriggerNumbering::chamberFromTriggerLabels(sect, subs, stat, cham); + + // 0th layer means whole chamber. + CSCDetId cscDetId(endc, stat, ring, chid, 0); + + analyzeChamber(cscDetId, + *wires, + *wires_unpacked, + *strips, + *strips_unpacked, + *comparators, + *comparators_unpacked, + *alcts, + *clcts, + *preclcts, + *lcts); + } + } + } + } + } +} + +void CSCPackerUnpackerUnitTest::analyzeChamber(const CSCDetId& cscDetId, + const CSCWireDigiCollection& wires, + const CSCWireDigiCollection& wires_unpacked, + const CSCStripDigiCollection& strips, + const CSCStripDigiCollection& strips_unpacked, + const CSCComparatorDigiCollection& comparators, + const CSCComparatorDigiCollection& comparators_unpacked, + const CSCALCTDigiCollection& alcts, + const CSCCLCTDigiCollection& clcts, + const CSCCLCTPreTriggerDigiCollection& preclcts, + const CSCCorrelatedLCTDigiCollection& lcts) const { + if (testALCT_) { + const unsigned nFailedTestsALCT = analyzeALCT(cscDetId, wires, wires_unpacked, alcts); + if (nFailedTestsALCT) { + edm::LogWarning("CSCPackerUnpackerUnitTest") + << nFailedTestsALCT << " ALCT test(s) failed in " << cscDetId.chamberName(); + } + } + + if (testCLCT_) { + const unsigned nFailedTestsCLCT = analyzeCLCT(cscDetId, comparators, comparators_unpacked, clcts); + if (nFailedTestsCLCT) { + edm::LogWarning("CSCPackerUnpackerUnitTest") + << nFailedTestsCLCT << " CLCT test(s) failed in " << cscDetId.chamberName(); + } + } + + if (testPreCLCT_) { + const unsigned nFailedTestsPreCLCT = analyzePreCLCT(cscDetId, strips, strips_unpacked, preclcts); + if (nFailedTestsPreCLCT) { + edm::LogWarning("CSCPackerUnpackerUnitTest") + << nFailedTestsPreCLCT << " PreCLCT test(s) failed in " << cscDetId.chamberName(); + } + } +} + +unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, + const CSCWireDigiCollection& wires, + const CSCWireDigiCollection& wires_unpacked, + const CSCALCTDigiCollection& alcts) const { + + unsigned numWireDigis = nDigis(cscDetId, wires); + // no simulated wire digis means that all tests pass + if (numWireDigis == 0) { + return 0; + } + + // readout condition for wires: L1A + ALCT + const bool me1abCheck = formatVersion_ == 2013; + bool hasALCT = + CSCDigiToRawAccept::accept(cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck); + + unsigned numWireDigisUnpacked = nDigis(cscDetId, wires_unpacked); + + unsigned testsFailed = 0; + + // these tests are only done when the trigger/pretriggers are enabled + if (!packEverything_ and usePreTriggers_) { + + // test 1: check that an ALCT in this chamber kept the wire digis + if (hasALCT) { + if (numWireDigisUnpacked == 0) { + testsFailed++; + edm::LogWarning("analyzeALCT::Test1Failure") + << "hasALCT " << hasALCT << " numWireDigisUnpacked " << numWireDigisUnpacked << " " << cscDetId.chamberName(); + } + } + + // test 2: check no wire digis were kept if there was no ALCT + if (numWireDigisUnpacked != 0) { + if (!hasALCT) { + testsFailed++; + edm::LogWarning("analyzeALCT::Test2Failure") + << "hasALCT " << hasALCT << " numWireDigisUnpacked " << numWireDigisUnpacked << " " << cscDetId.chamberName(); + } + } + } + + // test 3: count the number of wire digis before and after unpacking + if (numWireDigis < numWireDigisUnpacked) { + testsFailed++; + edm::LogWarning("analyzeALCT::Test3Failure") << "numWireDigis " << numWireDigis << " numWireDigisUnpacked " + << numWireDigisUnpacked << " " << cscDetId.chamberName(); + } + + return testsFailed; +} + +unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, + const CSCComparatorDigiCollection& comparators, + const CSCComparatorDigiCollection& comparators_unpacked, + const CSCCLCTDigiCollection& clcts) const { + + unsigned numCompDigis = nDigis(cscDetId, comparators); + // no simulated comparator digis means that all tests pass + if (numCompDigis == 0) { + return 0; + } + + // readout condition for comparators in (O)TMB; L1A + CLCT + const bool me1abCheck = formatVersion_ == 2013; + bool hasCLCT = + CSCDigiToRawAccept::accept(cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck); + + unsigned numCompDigisUnpacked = nDigis(cscDetId, comparators_unpacked); + + unsigned testsFailed = 0; + + // these tests are only done when the trigger/pretriggers are enabled + if (!packEverything_ and usePreTriggers_) { + + // test 1: check that an CLCT in this chamber kept the comp digis + if (hasCLCT) { + if (numCompDigisUnpacked == 0) { + testsFailed++; + edm::LogWarning("analyzeCLCT::Test1Failure") + << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " << numCompDigisUnpacked << " " << cscDetId.chamberName(); + } + } + + // test 2: check no comp digis were kept if there was no CLCT + if (numCompDigisUnpacked != 0) { + if (!hasCLCT) { + testsFailed++; + edm::LogWarning("analyzeCLCT::Test2Failure") + << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " << numCompDigisUnpacked << " " << cscDetId.chamberName(); + } + } + } + + // test 3: count the number of comp digis before and after unpacking + if (numCompDigis < numCompDigisUnpacked) { + testsFailed++; + edm::LogWarning("analyzeCLCT::Test3Failure") << "numCompDigis " << numCompDigis << " numCompDigisUnpacked " + << numCompDigisUnpacked << " " << cscDetId.chamberName(); + } + + return testsFailed; +} + +unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, + const CSCStripDigiCollection& strips, + const CSCStripDigiCollection& strips_unpacked, + const CSCCLCTPreTriggerDigiCollection& preclcts) const { + unsigned numStripDigis = nDigis(cscDetId, strips); + // no simulated strip digis means that all tests pass + if (numStripDigis == 0) { + return 0; + } + + // determine where the pretriggers are + std::vector preTriggerInCFEB; + preTriggerInCFEB.resize(CSCConstants::MAX_CFEBS_RUN2); + + // readout condition for strips: L1A + preCLCT in CFEB + const bool me1abCheck = formatVersion_ == 2013; + bool hasPreCLCT = CSCDigiToRawAccept::accept(cscDetId, preclcts, preTriggerWindowMin_, preTriggerWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck, preTriggerInCFEB); + + unsigned testsFailed = 0; + + unsigned nStripDigis = nDigis(cscDetId, strips); + unsigned nStripDigisUnpacked = nDigis(cscDetId, strips_unpacked); + + // these tests are only done when the trigger/pretriggers are enabled + if (!packEverything_ and usePreTriggers_) { + + // Test when NOT packing by CFEB + if (!packByCFEB_) { + + // test 1: check that a PreCLCT in this chamber kept the strip digis + if (hasPreCLCT) { + if (nStripDigisUnpacked == 0) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test1Failure") + << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " + << nStripDigisUnpacked << " " << cscDetId.chamberName(); + } + } + + // test 2: check no strip digis were kept if there was no PreCLCT + if (nStripDigisUnpacked != 0) { + if (!hasPreCLCT) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test2Failure") + << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " + << nStripDigisUnpacked << " " << cscDetId.chamberName(); + } + } + + // test 3: count the number of strip digis before and after unpacking + if (nStripDigis < nStripDigisUnpacked) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test3Failure") + << ": numStripDigis " << nStripDigis << " numStripDigisUnpacked " + << nStripDigisUnpacked << " " << cscDetId.chamberName(); + } + } + + // Test when packing by CFEBs + else { + + // tests are performed for each CFEB + for (unsigned i = 0; i < CSCConstants::MAX_CFEBS_RUN2; i++) { + // only do the tests for the CFEBs in this chamber (4,5,7) + if (i >= getNCFEBs(cscDetId.iChamberType() - 1)) + continue; + + unsigned nStripDigisCFEB = nDigisCFEB(cscDetId, strips, i); + + unsigned nStripDigisUnpackedCFEB = nDigisCFEB(cscDetId, strips_unpacked, i); + + // test 1: check that a PreCLCT in this chamber kept the strip digis + if (preTriggerInCFEB[i]) { + if (nStripDigisUnpackedCFEB == 0) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test1Failure") + << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " + << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); + } + } + + // test 2: check no strip digis were kept if there was no PreCLCT + if (nStripDigisUnpackedCFEB != 0) { + if (!preTriggerInCFEB[i]) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test2Failure") + << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " + << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); + } + } + + // test 3: count the number of strip digis before and after unpacking + if (nStripDigisCFEB < nStripDigisUnpackedCFEB) { + testsFailed++; + edm::LogWarning("analyzePreCLCT::Test3Failure") + << "CFEB " << i << ": numStripDigisCFEB " << nStripDigisCFEB << " numStripDigisUnpackedCFEB " + << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); + } + } + } + } + + return testsFailed; +} + +template +unsigned CSCPackerUnpackerUnitTest::nDigis(const CSCDetId& detid, const DIGICollection& digis) const { + unsigned nDigis = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + + CSCDetId ldetid(detid.endcap(), detid.station(), detid.ring(), detid.chamber(), i_layer + 1); + nDigis += nDigisLayer(ldetid, digis); + + if (detid.station() == 1 and detid.ring() == 1) { + CSCDetId ldetid_me1a(detid.endcap(), detid.station(), 4, detid.chamber(), i_layer + 1); + nDigis += nDigisLayer(ldetid_me1a, digis); + } + } + return nDigis; +} + +template +unsigned CSCPackerUnpackerUnitTest::nDigisLayer(const CSCDetId& cscId, const DIGICollection& digis) const { + unsigned nDigis = 0; + auto digiRange = digis.get(cscId); + for (auto digiItr = digiRange.first; digiItr != digiRange.second; ++digiItr) { + nDigis++; + } + return nDigis; +} + +unsigned CSCPackerUnpackerUnitTest::nDigisCFEB(const CSCDetId& detid, + const CSCStripDigiCollection& digis, + int cfeb) const { + unsigned nDigis = 0; + + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + // ME1/A case + if (detid.station() == 1 and detid.ring() == 1 and cfeb >=4) { + CSCDetId ldetid(detid.endcap(), detid.station(), 4, detid.chamber(), i_layer + 1); + nDigis += nDigisCFEBLayer(ldetid, digis, cfeb); + } + // all other cases + else { + CSCDetId ldetid(detid.endcap(), detid.station(), detid.ring(), detid.chamber(), i_layer + 1); + nDigis += nDigisCFEBLayer(ldetid, digis, cfeb); + } + } + return nDigis; +} + +unsigned CSCPackerUnpackerUnitTest::nDigisCFEBLayer(const CSCDetId& cscId, + const CSCStripDigiCollection& digis, + int cfeb) const { + unsigned nDigis = 0; + auto digiRange = digis.get(cscId); + for (auto digiItr = digiRange.first; digiItr != digiRange.second; ++digiItr) { + CSCStripDigi digi = *digiItr; + int cfb = digi.getCFEB(); + if (cscId.station() == 1 and cscId.ring() == 4) { + cfb += CSCConstants::NUM_CFEBS_ME1B; + } + if (cfeb == cfb){ + nDigis++; + } + } + return nDigis; +} + +unsigned CSCPackerUnpackerUnitTest::getNCFEBs(unsigned type) const { + const unsigned cfebs[10] = {CSCConstants::NUM_CFEBS_ME1A_UNGANGED, + CSCConstants::NUM_CFEBS_ME11_UNGANGED, + CSCConstants::NUM_CFEBS_ME12, + CSCConstants::NUM_CFEBS_ME13, + CSCConstants::NUM_CFEBS_ME21, + CSCConstants::NUM_CFEBS_ME22, + CSCConstants::NUM_CFEBS_ME31, + CSCConstants::NUM_CFEBS_ME32, + CSCConstants::NUM_CFEBS_ME41, + CSCConstants::NUM_CFEBS_ME42}; + return cfebs[type]; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(CSCPackerUnpackerUnitTest); diff --git a/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py new file mode 100644 index 0000000000000..1739bff613c02 --- /dev/null +++ b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py @@ -0,0 +1,104 @@ +from __future__ import print_function + +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Run3_cff import Run3 + +from FWCore.ParameterSet.VarParsing import VarParsing +options = VarParsing('analysis') +options.parseArguments() + +## process def +process = cms.Process("TEST", Run3) +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.StandardSequences.GeometrySimDB_cff') +process.load("Configuration/StandardSequences/GeometryRecoDB_cff") +process.load("Configuration/StandardSequences/MagneticField_cff") +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('IOMC.EventVertexGenerators.VtxSmearedRun3RoundOptics25ns13TeVLowSigmaZ_cfi') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load("EventFilter.CSCRawToDigi.cscUnpacker_cfi") +process.load("EventFilter.CSCRawToDigi.cscPacker_cfi") +process.load("EventFilter.CSCRawToDigi.cscPackerUnpackerUnitTestDef_cfi") +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +process.source = cms.Source("EmptySource") + +## global tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + +process.XMLFromDBSource.label = cms.string("Extended") +process.genstepfilter.triggerConditions=cms.vstring("generation_step") + +process.generator = cms.EDFilter( + "Pythia8PtGun", + PGunParameters = cms.PSet( + AddAntiParticle = cms.bool(True), + MaxEta = cms.double(2.4), + MaxPhi = cms.double(3.14159265359), + MaxPt = cms.double(1000.1), + MinEta = cms.double(0.9), + MinPhi = cms.double(-3.14159265359), + MinPt = cms.double(1.9), + ParticleID = cms.vint32(-13) + ), + PythiaParameters = cms.PSet( + parameterSets = cms.vstring() + ), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1), + psethack = cms.string('single mu pt 1') +) + + +process.FEVTDEBUGHLToutput = cms.OutputModule( + "PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM-DIGI-RAW'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step1.root'), + outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.mix.digitizers = cms.PSet(process.theDigitizersValid) + +process.muonCSCDigis.InputObjects = "cscpacker:CSCRawData" + +process.cscPackerUnpackerUnitTestDef.usePreTriggers = process.cscpacker.usePreTriggers +process.cscPackerUnpackerUnitTestDef.packEverything = process.cscpacker.packEverything +process.cscPackerUnpackerUnitTestDef.formatVersion = process.cscpacker.formatVersion +process.cscPackerUnpackerUnitTestDef.useCSCShowers = process.cscpacker.useCSCShowers + +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.simMuonGEMPadDigis * process.simMuonGEMPadDigiClusters * process.simCscTriggerPrimitiveDigis) +process.testPackUnpack_step = cms.Path(process.cscpacker * process.muonCSCDigis * process.cscPackerUnpackerUnitTestDef) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput) + +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step, process.testPackUnpack_step, process.endjob_step) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.generator) From c37a335bf19a5a5f9c2ce9150066ab3191f4ed0b Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 15:33:29 -0500 Subject: [PATCH 065/923] Put accept conditions in a static class --- .../interface/CSCDigiToRawAccept.h | 85 +++++++++++++++ EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc | 101 ++---------------- .../CSCRawToDigi/src/CSCDigiToRawAccept.cc | 83 ++++++++++++++ 3 files changed, 179 insertions(+), 90 deletions(-) create mode 100644 EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h create mode 100644 EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc diff --git a/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h new file mode 100644 index 0000000000000..bf1604a13a287 --- /dev/null +++ b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h @@ -0,0 +1,85 @@ +#ifndef EventFilter_CSCRawToDigi_CSCDigiToRawAccept_h +#define EventFilter_CSCRawToDigi_CSCDigiToRawAccept_h + +/** \class CSCDigiToRawAccept + * + * Static class with conditions to accept CSC digis in the Digi-to-Raw step + * + * \author Sven Dildick - Rice + */ + +#include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" + +class CSCDigiToRawAccept { +public: + // takes layer ID, converts to chamber ID, switching ME1A to ME11 + static CSCDetId chamberID(const CSCDetId& cscDetId); + + /* Was there a trigger primitive in the BX range between bxMin and bxMax? + The nominalBX argument is 3 for ALCTs and 7 for CLCTs. This is subtracted + from the object BX before we check if it is in the BX range. + + The argument me1abCheck checks for triggers in ME1/1 when they have ring number equal to 4. + In simulation this should never be the case. Triggers in ME1/1 should always be assigned with + ring number equal to 1. Distinguishing CLCTs in ME1/a and ME1/b is done with the CLCT half-strip, + or CLCT CFEB. + */ + template + static bool accept( + const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck = false); + + // older implementation for CLCT pretrigger objects that only have BX information + static bool accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck); + + // newer implementation for CLCT pretrigger objects that have BX and CFEB information + static bool accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerDigiCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck, + std::vector& preTriggerInCFEB); +}; + +template +bool CSCDigiToRawAccept::accept( + const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck) { + if (bxMin == -999) + return true; + CSCDetId chamberId = chamberID(cscId); + typename LCTCollection::Range lctRange = lcts.get(chamberId); + bool result = false; + for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = lctItr->getBX() - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + result = true; + break; + } + } + + bool me1 = cscId.station() == 1 && cscId.ring() == 1; + //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases: + //wire selective readout requires at least one (A)LCT in the full chamber + if (me1 && result == false && me1abCheck) { + CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0); + lctRange = lcts.get(me1aId); + for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = lctItr->getBX() - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + result = true; + break; + } + } + } + return result; +} + +#endif diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index 5e9d5848491af..4d5cc2e1456d7 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -7,6 +7,7 @@ #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h" #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" @@ -25,87 +26,6 @@ using namespace edm; using namespace std; -namespace cscd2r { - /// takes layer ID, converts to chamber ID, switching ME1A to ME11 - CSCDetId chamberID(const CSCDetId& cscDetId) { - CSCDetId chamberId = cscDetId.chamberId(); - if (chamberId.ring() == 4) { - chamberId = CSCDetId(chamberId.endcap(), chamberId.station(), 1, chamberId.chamber(), 0); - } - return chamberId; - } - - template - bool accept( - const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck = false) { - if (bxMin == -999) - return true; - CSCDetId chamberId = chamberID(cscId); - typename LCTCollection::Range lctRange = lcts.get(chamberId); - bool result = false; - for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = lctItr->getBX() - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - - bool me1 = cscId.station() == 1 && cscId.ring() == 1; - //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases: - //wire selective readout requires at least one (A)LCT in the full chamber - if (me1 && result == false && me1abCheck) { - CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0); - lctRange = lcts.get(me1aId); - for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = lctItr->getBX() - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - } - - return result; - } - - // need to specialize for pretriggers, since they don't have a getBX() - template <> - bool accept(const CSCDetId& cscId, - const CSCCLCTPreTriggerCollection& lcts, - int bxMin, - int bxMax, - int nominalBX, - bool me1abCheck) { - if (bxMin == -999) - return true; - CSCDetId chamberId = chamberID(cscId); - CSCCLCTPreTriggerCollection::Range lctRange = lcts.get(chamberId); - bool result = false; - for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = *lctItr - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - bool me1a = cscId.station() == 1 && cscId.ring() == 4; - if (me1a && result == false && me1abCheck) { - //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds - lctRange = lcts.get(cscId); - for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = *lctItr - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - } - return result; - } - -} // namespace cscd2r - CSCDigiToRaw::CSCDigiToRaw(const edm::ParameterSet& pset) : alctWindowMin_(pset.getParameter("alctWindowMin")), alctWindowMax_(pset.getParameter("alctWindowMax")), @@ -121,7 +41,7 @@ CSCDigiToRaw::CSCDigiToRaw(const edm::ParameterSet& pset) usePreTriggers_(pset.getParameter("usePreTriggers")) {} CSCEventData& CSCDigiToRaw::findEventData(const CSCDetId& cscDetId, FindEventDataInfo& info) const { - CSCDetId chamberId = cscd2r::chamberID(cscDetId); + CSCDetId chamberId = CSCDigiToRawAccept::chamberID(cscDetId); // find the entry into the map map::iterator chamberMapItr = info.theChamberDataMap.find(chamberId); if (chamberMapItr == info.theChamberDataMap.end()) { @@ -160,12 +80,13 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, // pretrigger flag must be set and the pretrigger collection must be nonzero! const bool usePreTriggers = usePreTriggers_ and preTriggers != nullptr; if (!usePreTriggers || packEverything_ || - (usePreTriggers && cscd2r::accept(cscDetId, - *preTriggerDigis, - preTriggerWindowMin_, - preTriggerWindowMax_, - CSCConstants::CLCT_CENTRAL_BX, - me1abCheck))) { + (usePreTriggers && CSCDigiToRawAccept::accept(cscDetId, + *preTriggerDigis, + preTriggerWindowMin_, + preTriggerWindowMax_, + CSCConstants::CLCT_CENTRAL_BX, + me1abCheck, + preTriggerInCFEB))) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); bool zplus = (cscDetId.endcap() == 1); bool me1b = (cscDetId.station() == 1) && (cscDetId.ring() == 1); @@ -217,7 +138,7 @@ void CSCDigiToRaw::add(const CSCWireDigiCollection& wireDigis, CSCDetId cscDetId = (*j).first; bool me1abCheck = fedInfo.formatVersion_ == 2013; if (packEverything_ || - cscd2r::accept( + CSCDigiToRawAccept::accept( cscDetId, alctDigis, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck)) { CSCEventData& cscData = findEventData(cscDetId, fedInfo); std::vector::const_iterator digiItr = (*j).second.first; @@ -238,7 +159,7 @@ void CSCDigiToRaw::add(const CSCComparatorDigiCollection& comparatorDigis, CSCEventData& cscData = findEventData(cscDetId, fedInfo); bool me1abCheck = fedInfo.formatVersion_ == 2013; if (packEverything_ || - cscd2r::accept( + CSCDigiToRawAccept::accept( cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck)) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc new file mode 100644 index 0000000000000..46452dab512f2 --- /dev/null +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc @@ -0,0 +1,83 @@ +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h" + +CSCDetId CSCDigiToRawAccept::chamberID(const CSCDetId& cscDetId) { + CSCDetId chamberId = cscDetId.chamberId(); + if (chamberId.ring() == 4) { + chamberId = CSCDetId(chamberId.endcap(), chamberId.station(), 1, chamberId.chamber(), 0); + } + return chamberId; +} + +// older function for pretriggers BX objects +bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck) { + if (bxMin == -999) + return true; + CSCDetId chamberId = chamberID(cscId); + CSCCLCTPreTriggerCollection::Range lctRange = lcts.get(chamberId); + bool result = false; + for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = *lctItr - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + result = true; + break; + } + } + bool me1a = cscId.station() == 1 && cscId.ring() == 4; + if (me1a && result == false && me1abCheck) { + //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds + lctRange = lcts.get(cscId); + for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = *lctItr - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + result = true; + break; + } + } + } + return result; +} + +bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerDigiCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck, + std::vector& preTriggerInCFEB) { + if (bxMin == -999) + return true; + + bool atLeastOnePreTrigger = false; + + CSCDetId chamberId = chamberID(cscId); + CSCCLCTPreTriggerDigiCollection::Range lctRange = lcts.get(chamberId); + bool result = false; + for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = lctItr->getBX() - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + atLeastOnePreTrigger = true; + // save the location of all pretriggers + preTriggerInCFEB[lctItr->getCFEB()] = true; + } + } + bool me1a = cscId.station() == 1 && cscId.ring() == 4; + if (me1a && result == false && me1abCheck) { + //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds + lctRange = lcts.get(cscId); + for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = lctItr->getBX() - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + atLeastOnePreTrigger = true; + // save the location of all pretriggers + preTriggerInCFEB[lctItr->getCFEB()] = true; + } + } + } + return atLeastOnePreTrigger; +} From a62583ca3fb1f40bf55aa1e0e57599dffbd2ea4a Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 15:36:02 -0500 Subject: [PATCH 066/923] Add option to pack CSC Strip digis by CFEB. --- .../CSCRawToDigi/interface/CSCDigiToRaw.h | 1 + .../plugins/CSCDigiToRawModule.cc | 1 + EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h b/EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h index 54720901e5596..582ff89f7b4fb 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h +++ b/EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h @@ -81,6 +81,7 @@ class CSCDigiToRaw { uint16_t formatVersion_; bool packEverything_; bool usePreTriggers_; + bool packByCFEB_; }; #endif diff --git a/EventFilter/CSCRawToDigi/plugins/CSCDigiToRawModule.cc b/EventFilter/CSCRawToDigi/plugins/CSCDigiToRawModule.cc index f82b010362024..e6d3db41fa416 100644 --- a/EventFilter/CSCRawToDigi/plugins/CSCDigiToRawModule.cc +++ b/EventFilter/CSCRawToDigi/plugins/CSCDigiToRawModule.cc @@ -105,6 +105,7 @@ void CSCDigiToRawModule::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("usePreTriggers", true)->setComment("Set to false if CSCCLCTPreTrigger digis are not available"); desc.add("packEverything", false) ->setComment("Set to true to disable trigger-related constraints on readout data"); + desc.add("packByCFEB", false)->setComment("Pack strip digis using CFEB info"); desc.add("useGEMs", false)->setComment("Pack GEM trigger data"); desc.add("useCSCShowers", false)->setComment("Pack CSC shower trigger data"); diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index 4d5cc2e1456d7..ff9ca6fd3584b 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -38,7 +38,8 @@ CSCDigiToRaw::CSCDigiToRaw(const edm::ParameterSet& pset) // don't check for consistency with trig primitives // overrides usePreTriggers packEverything_(pset.getParameter("packEverything")), - usePreTriggers_(pset.getParameter("usePreTriggers")) {} + usePreTriggers_(pset.getParameter("usePreTriggers")), + packByCFEB_(pset.getParameter("packByCFEB")) {} CSCEventData& CSCDigiToRaw::findEventData(const CSCDetId& cscDetId, FindEventDataInfo& info) const { CSCDetId chamberId = CSCDigiToRawAccept::chamberID(cscDetId); @@ -77,6 +78,11 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, // only digitize if there are pre-triggers bool me1abCheck = fedInfo.formatVersion_ == 2013; + + // determine where the pretriggers are + std::vector preTriggerInCFEB; + preTriggerInCFEB.resize(CSCConstants::MAX_CFEBS_RUN2); + // pretrigger flag must be set and the pretrigger collection must be nonzero! const bool usePreTriggers = usePreTriggers_ and preTriggers != nullptr; if (!usePreTriggers || packEverything_ || @@ -98,6 +104,17 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, for (; digiItr != last; ++digiItr) { CSCStripDigi digi = *digiItr; int strip = digi.getStrip(); + int cfeb = digi.getCFEB(); + // CSC strip digis in ME1/a have CFEB number 0, 1, or 2 + // But a pretrigger in ME1/a has CFEB number 4, 5, or 6 (+4) + if (me1a) + cfeb += CSCConstants::NUM_CFEBS_ME1B ; + + // At this point, if we are packing by CFEBs and there is no + // pretrigger in this CFEB, ignore this strip digi + if (packByCFEB_ and not preTriggerInCFEB[cfeb]) + continue; + // From LS1 on ME1a strips are unganged if (fedInfo.formatVersion_ == 2013) { if (me1a && zplus) { From 5bce31c24780f2418735c1fd9015491a0ab9a45e Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 15:56:36 -0500 Subject: [PATCH 067/923] Add interface for future CSC showers --- .../test/CSCPackerUnpackerUnitTest.cc | 23 ++++++++++++++++--- .../testPackingUnpackingPreTriggers_cfg.py | 5 ++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc index 67f20eddb71c7..f03cf4df74373 100644 --- a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -16,6 +16,7 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" @@ -45,7 +46,8 @@ class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { const CSCALCTDigiCollection& alct, const CSCCLCTDigiCollection& clct, const CSCCLCTPreTriggerDigiCollection& pre, - const CSCCorrelatedLCTDigiCollection& lct) const; + const CSCCorrelatedLCTDigiCollection& lct, + const CSCShowerDigiCollection* showers) const; // the return value indicates the number of failed tests unsigned analyzeALCT(const CSCDetId& cscDetId, @@ -85,6 +87,7 @@ class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { unsigned formatVersion_; bool packEverything_; bool usePreTriggers_; + bool useCSCShowers_; bool packByCFEB_; bool testALCT_; bool testCLCT_; @@ -100,6 +103,7 @@ class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { edm::EDGetTokenT cl_token_; edm::EDGetTokenT clpre_token_; edm::EDGetTokenT co_token_; + edm::EDGetTokenT shower_token; }; CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& conf) : @@ -112,6 +116,7 @@ CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& co formatVersion_(conf.getParameter("formatVersion")), packEverything_(conf.getParameter("packEverything")), usePreTriggers_(conf.getParameter("usePreTriggers")), + useCSCShowers_(conf.getParameter("useCSCShowers")), packByCFEB_(conf.getParameter("packByCFEB")), testALCT_(conf.getParameter("testALCT")), testCLCT_(conf.getParameter("testCLCT")), @@ -127,6 +132,9 @@ CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& co clpre_token_(consumes(conf.getParameter("clctpreTag"))), co_token_(consumes(conf.getParameter("corrclctTag"))) { + if (useCSCShowers_) { + shower_token = consumes(conf.getParameter("showerDigiTag")); + } } void CSCPackerUnpackerUnitTest::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -144,6 +152,7 @@ void CSCPackerUnpackerUnitTest::fillDescriptions(edm::ConfigurationDescriptions& desc.add("clctTag", edm::InputTag("simCscTriggerPrimitiveDigis")); desc.add("clctpreTag", edm::InputTag("simCscTriggerPrimitiveDigis")); desc.add("corrclctTag", edm::InputTag("simCscTriggerPrimitiveDigis")); + desc.add("showerDigiTag", edm::InputTag("simCscTriggerPrimitiveDigis")); // readout windows desc.add("alctWindowMin", -3); desc.add("alctWindowMax", 3); @@ -158,6 +167,7 @@ void CSCPackerUnpackerUnitTest::fillDescriptions(edm::ConfigurationDescriptions& desc.add("testPreCLCT", true); desc.add("usePreTriggers", true); desc.add("packEverything", false); + desc.add("useCSCShowers", false); desc.add("packByCFEB", true); descriptions.add("cscPackerUnpackerUnitTestDef", desc); } @@ -194,6 +204,11 @@ void CSCPackerUnpackerUnitTest::analyze(const edm::Event& iEvent, const edm::Eve edm::Handle lcts; iEvent.getByToken(co_token_, lcts); + const CSCShowerDigiCollection* cscShowerDigisPtr = nullptr; + if (useCSCShowers_) { + cscShowerDigisPtr = &iEvent.get(shower_token); + } + const int min_endcap = CSCDetId::minEndcapId(); const int max_endcap = CSCDetId::maxEndcapId(); const int min_station = CSCDetId::minStationId(); @@ -229,7 +244,8 @@ void CSCPackerUnpackerUnitTest::analyze(const edm::Event& iEvent, const edm::Eve *alcts, *clcts, *preclcts, - *lcts); + *lcts, + cscShowerDigisPtr); } } } @@ -247,7 +263,8 @@ void CSCPackerUnpackerUnitTest::analyzeChamber(const CSCDetId& cscDetId, const CSCALCTDigiCollection& alcts, const CSCCLCTDigiCollection& clcts, const CSCCLCTPreTriggerDigiCollection& preclcts, - const CSCCorrelatedLCTDigiCollection& lcts) const { + const CSCCorrelatedLCTDigiCollection& lcts, + const CSCShowerDigiCollection* showers) const { if (testALCT_) { const unsigned nFailedTestsALCT = analyzeALCT(cscDetId, wires, wires_unpacked, alcts); if (nFailedTestsALCT) { diff --git a/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py index 1739bff613c02..756a3b2ecfe44 100644 --- a/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py +++ b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py @@ -12,8 +12,8 @@ process.load("FWCore.MessageService.MessageLogger_cfi") process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.StandardSequences.GeometrySimDB_cff') -process.load("Configuration/StandardSequences/GeometryRecoDB_cff") -process.load("Configuration/StandardSequences/MagneticField_cff") +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('GeneratorInterface.Core.genFilterSummary_cff') @@ -81,6 +81,7 @@ process.muonCSCDigis.InputObjects = "cscpacker:CSCRawData" +## specification of the test with the packer expert settings process.cscPackerUnpackerUnitTestDef.usePreTriggers = process.cscpacker.usePreTriggers process.cscPackerUnpackerUnitTestDef.packEverything = process.cscpacker.packEverything process.cscPackerUnpackerUnitTestDef.formatVersion = process.cscpacker.formatVersion From a61608d33cbb3262a4749512611dd6144fac75d6 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 16:25:09 -0500 Subject: [PATCH 068/923] Leave out counting strip digis in tests --- .../test/CSCPackerUnpackerUnitTest.cc | 19 ------------------- .../testPackingUnpackingPreTriggers_cfg.py | 3 +-- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc index f03cf4df74373..b13bbdd775cfa 100644 --- a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -414,7 +414,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, unsigned testsFailed = 0; - unsigned nStripDigis = nDigis(cscDetId, strips); unsigned nStripDigisUnpacked = nDigis(cscDetId, strips_unpacked); // these tests are only done when the trigger/pretriggers are enabled @@ -442,14 +441,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, << nStripDigisUnpacked << " " << cscDetId.chamberName(); } } - - // test 3: count the number of strip digis before and after unpacking - if (nStripDigis < nStripDigisUnpacked) { - testsFailed++; - edm::LogWarning("analyzePreCLCT::Test3Failure") - << ": numStripDigis " << nStripDigis << " numStripDigisUnpacked " - << nStripDigisUnpacked << " " << cscDetId.chamberName(); - } } // Test when packing by CFEBs @@ -461,8 +452,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, if (i >= getNCFEBs(cscDetId.iChamberType() - 1)) continue; - unsigned nStripDigisCFEB = nDigisCFEB(cscDetId, strips, i); - unsigned nStripDigisUnpackedCFEB = nDigisCFEB(cscDetId, strips_unpacked, i); // test 1: check that a PreCLCT in this chamber kept the strip digis @@ -484,14 +473,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); } } - - // test 3: count the number of strip digis before and after unpacking - if (nStripDigisCFEB < nStripDigisUnpackedCFEB) { - testsFailed++; - edm::LogWarning("analyzePreCLCT::Test3Failure") - << "CFEB " << i << ": numStripDigisCFEB " << nStripDigisCFEB << " numStripDigisUnpackedCFEB " - << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); - } } } } diff --git a/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py index 756a3b2ecfe44..5e5ff059620d9 100644 --- a/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py +++ b/EventFilter/CSCRawToDigi/test/testPackingUnpackingPreTriggers_cfg.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run3_cff import Run3 @@ -84,6 +82,7 @@ ## specification of the test with the packer expert settings process.cscPackerUnpackerUnitTestDef.usePreTriggers = process.cscpacker.usePreTriggers process.cscPackerUnpackerUnitTestDef.packEverything = process.cscpacker.packEverything +process.cscPackerUnpackerUnitTestDef.packByCFEB = process.cscpacker.packByCFEB process.cscPackerUnpackerUnitTestDef.formatVersion = process.cscpacker.formatVersion process.cscPackerUnpackerUnitTestDef.useCSCShowers = process.cscpacker.useCSCShowers From 8a1f05c5893e6f6f872c369d36218a564178cfea Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 4 Aug 2021 16:56:26 -0500 Subject: [PATCH 069/923] Code format. Code checks --- DataFormats/MuonDetId/src/CSCDetId.cc | 3 +- EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc | 2 +- .../test/CSCPackerUnpackerUnitTest.cc | 128 +++++++++--------- 3 files changed, 64 insertions(+), 69 deletions(-) diff --git a/DataFormats/MuonDetId/src/CSCDetId.cc b/DataFormats/MuonDetId/src/CSCDetId.cc index 94a6cc1c1453a..ec02ed72097c8 100644 --- a/DataFormats/MuonDetId/src/CSCDetId.cc +++ b/DataFormats/MuonDetId/src/CSCDetId.cc @@ -78,7 +78,8 @@ std::string CSCDetId::chamberName(int endcap, int station, int ring, int chamber std::string CSCDetId::layerName(int endcap, int station, int ring, int chamber, int layer) { const std::string eSign = endcap == 1 ? "+" : "-"; - return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber) + "/" + std::to_string(layer); + return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber) + "/" + + std::to_string(layer); } std::string CSCDetId::chamberName(int chamberType) { diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index ff9ca6fd3584b..a9c6e564ce63e 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -108,7 +108,7 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, // CSC strip digis in ME1/a have CFEB number 0, 1, or 2 // But a pretrigger in ME1/a has CFEB number 4, 5, or 6 (+4) if (me1a) - cfeb += CSCConstants::NUM_CFEBS_ME1B ; + cfeb += CSCConstants::NUM_CFEBS_ME1B; // At this point, if we are packing by CFEBs and there is no // pretrigger in this CFEB, ignore this strip digi diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc index b13bbdd775cfa..b37ceea036f54 100644 --- a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -70,11 +70,9 @@ class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { template unsigned nDigisLayer(const CSCDetId& cscId, const DIGICollection& digis) const; - unsigned nDigisCFEB(const CSCDetId& cscId, - const CSCStripDigiCollection& digis, int cfeb) const; + unsigned nDigisCFEB(const CSCDetId& cscId, const CSCStripDigiCollection& digis, int cfeb) const; - unsigned nDigisCFEBLayer(const CSCDetId& cscId, - const CSCStripDigiCollection& digis, int cfeb) const; + unsigned nDigisCFEBLayer(const CSCDetId& cscId, const CSCStripDigiCollection& digis, int cfeb) const; unsigned getNCFEBs(unsigned type) const; @@ -106,32 +104,32 @@ class CSCPackerUnpackerUnitTest : public edm::one::EDAnalyzer<> { edm::EDGetTokenT shower_token; }; -CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& conf) : - alctWindowMin_(conf.getParameter("alctWindowMin")), - alctWindowMax_(conf.getParameter("alctWindowMax")), - clctWindowMin_(conf.getParameter("clctWindowMin")), - clctWindowMax_(conf.getParameter("clctWindowMax")), - preTriggerWindowMin_(conf.getParameter("preTriggerWindowMin")), - preTriggerWindowMax_(conf.getParameter("preTriggerWindowMax")), - formatVersion_(conf.getParameter("formatVersion")), - packEverything_(conf.getParameter("packEverything")), - usePreTriggers_(conf.getParameter("usePreTriggers")), - useCSCShowers_(conf.getParameter("useCSCShowers")), - packByCFEB_(conf.getParameter("packByCFEB")), - testALCT_(conf.getParameter("testALCT")), - testCLCT_(conf.getParameter("testCLCT")), - testPreCLCT_(conf.getParameter("testPreCLCT")), - wd_token_(consumes(conf.getParameter("wireTag"))), - wd_unpacked_token_(consumes(conf.getParameter("wireUnpackedTag"))), - sd_token_(consumes(conf.getParameter("stripTag"))), - sd_unpacked_token_(consumes(conf.getParameter("stripUnpackedTag"))), - cd_token_(consumes(conf.getParameter("comparatorTag"))), - cd_unpacked_token_(consumes(conf.getParameter("comparatorUnpackedTag"))), - al_token_(consumes(conf.getParameter("alctTag"))), - cl_token_(consumes(conf.getParameter("clctTag"))), - clpre_token_(consumes(conf.getParameter("clctpreTag"))), - co_token_(consumes(conf.getParameter("corrclctTag"))) -{ +CSCPackerUnpackerUnitTest::CSCPackerUnpackerUnitTest(const edm::ParameterSet& conf) + : alctWindowMin_(conf.getParameter("alctWindowMin")), + alctWindowMax_(conf.getParameter("alctWindowMax")), + clctWindowMin_(conf.getParameter("clctWindowMin")), + clctWindowMax_(conf.getParameter("clctWindowMax")), + preTriggerWindowMin_(conf.getParameter("preTriggerWindowMin")), + preTriggerWindowMax_(conf.getParameter("preTriggerWindowMax")), + formatVersion_(conf.getParameter("formatVersion")), + packEverything_(conf.getParameter("packEverything")), + usePreTriggers_(conf.getParameter("usePreTriggers")), + useCSCShowers_(conf.getParameter("useCSCShowers")), + packByCFEB_(conf.getParameter("packByCFEB")), + testALCT_(conf.getParameter("testALCT")), + testCLCT_(conf.getParameter("testCLCT")), + testPreCLCT_(conf.getParameter("testPreCLCT")), + wd_token_(consumes(conf.getParameter("wireTag"))), + wd_unpacked_token_(consumes(conf.getParameter("wireUnpackedTag"))), + sd_token_(consumes(conf.getParameter("stripTag"))), + sd_unpacked_token_(consumes(conf.getParameter("stripUnpackedTag"))), + cd_token_(consumes(conf.getParameter("comparatorTag"))), + cd_unpacked_token_( + consumes(conf.getParameter("comparatorUnpackedTag"))), + al_token_(consumes(conf.getParameter("alctTag"))), + cl_token_(consumes(conf.getParameter("clctTag"))), + clpre_token_(consumes(conf.getParameter("clctpreTag"))), + co_token_(consumes(conf.getParameter("corrclctTag"))) { if (useCSCShowers_) { shower_token = consumes(conf.getParameter("showerDigiTag")); } @@ -269,7 +267,7 @@ void CSCPackerUnpackerUnitTest::analyzeChamber(const CSCDetId& cscDetId, const unsigned nFailedTestsALCT = analyzeALCT(cscDetId, wires, wires_unpacked, alcts); if (nFailedTestsALCT) { edm::LogWarning("CSCPackerUnpackerUnitTest") - << nFailedTestsALCT << " ALCT test(s) failed in " << cscDetId.chamberName(); + << nFailedTestsALCT << " ALCT test(s) failed in " << cscDetId.chamberName(); } } @@ -277,7 +275,7 @@ void CSCPackerUnpackerUnitTest::analyzeChamber(const CSCDetId& cscDetId, const unsigned nFailedTestsCLCT = analyzeCLCT(cscDetId, comparators, comparators_unpacked, clcts); if (nFailedTestsCLCT) { edm::LogWarning("CSCPackerUnpackerUnitTest") - << nFailedTestsCLCT << " CLCT test(s) failed in " << cscDetId.chamberName(); + << nFailedTestsCLCT << " CLCT test(s) failed in " << cscDetId.chamberName(); } } @@ -285,7 +283,7 @@ void CSCPackerUnpackerUnitTest::analyzeChamber(const CSCDetId& cscDetId, const unsigned nFailedTestsPreCLCT = analyzePreCLCT(cscDetId, strips, strips_unpacked, preclcts); if (nFailedTestsPreCLCT) { edm::LogWarning("CSCPackerUnpackerUnitTest") - << nFailedTestsPreCLCT << " PreCLCT test(s) failed in " << cscDetId.chamberName(); + << nFailedTestsPreCLCT << " PreCLCT test(s) failed in " << cscDetId.chamberName(); } } } @@ -294,7 +292,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, const CSCWireDigiCollection& wires, const CSCWireDigiCollection& wires_unpacked, const CSCALCTDigiCollection& alcts) const { - unsigned numWireDigis = nDigis(cscDetId, wires); // no simulated wire digis means that all tests pass if (numWireDigis == 0) { @@ -303,8 +300,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, // readout condition for wires: L1A + ALCT const bool me1abCheck = formatVersion_ == 2013; - bool hasALCT = - CSCDigiToRawAccept::accept(cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck); + bool hasALCT = CSCDigiToRawAccept::accept( + cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck); unsigned numWireDigisUnpacked = nDigis(cscDetId, wires_unpacked); @@ -312,13 +309,12 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, // these tests are only done when the trigger/pretriggers are enabled if (!packEverything_ and usePreTriggers_) { - // test 1: check that an ALCT in this chamber kept the wire digis if (hasALCT) { if (numWireDigisUnpacked == 0) { testsFailed++; - edm::LogWarning("analyzeALCT::Test1Failure") - << "hasALCT " << hasALCT << " numWireDigisUnpacked " << numWireDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzeALCT::Test1Failure") << "hasALCT " << hasALCT << " numWireDigisUnpacked " + << numWireDigisUnpacked << " " << cscDetId.chamberName(); } } @@ -326,8 +322,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, if (numWireDigisUnpacked != 0) { if (!hasALCT) { testsFailed++; - edm::LogWarning("analyzeALCT::Test2Failure") - << "hasALCT " << hasALCT << " numWireDigisUnpacked " << numWireDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzeALCT::Test2Failure") << "hasALCT " << hasALCT << " numWireDigisUnpacked " + << numWireDigisUnpacked << " " << cscDetId.chamberName(); } } } @@ -346,7 +342,6 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, const CSCComparatorDigiCollection& comparators, const CSCComparatorDigiCollection& comparators_unpacked, const CSCCLCTDigiCollection& clcts) const { - unsigned numCompDigis = nDigis(cscDetId, comparators); // no simulated comparator digis means that all tests pass if (numCompDigis == 0) { @@ -355,8 +350,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, // readout condition for comparators in (O)TMB; L1A + CLCT const bool me1abCheck = formatVersion_ == 2013; - bool hasCLCT = - CSCDigiToRawAccept::accept(cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck); + bool hasCLCT = CSCDigiToRawAccept::accept( + cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck); unsigned numCompDigisUnpacked = nDigis(cscDetId, comparators_unpacked); @@ -364,13 +359,12 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, // these tests are only done when the trigger/pretriggers are enabled if (!packEverything_ and usePreTriggers_) { - // test 1: check that an CLCT in this chamber kept the comp digis if (hasCLCT) { if (numCompDigisUnpacked == 0) { testsFailed++; - edm::LogWarning("analyzeCLCT::Test1Failure") - << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " << numCompDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzeCLCT::Test1Failure") << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " + << numCompDigisUnpacked << " " << cscDetId.chamberName(); } } @@ -378,8 +372,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, if (numCompDigisUnpacked != 0) { if (!hasCLCT) { testsFailed++; - edm::LogWarning("analyzeCLCT::Test2Failure") - << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " << numCompDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzeCLCT::Test2Failure") << "hasCLCT " << hasCLCT << " numCompDigisUnpacked " + << numCompDigisUnpacked << " " << cscDetId.chamberName(); } } } @@ -388,7 +382,7 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, if (numCompDigis < numCompDigisUnpacked) { testsFailed++; edm::LogWarning("analyzeCLCT::Test3Failure") << "numCompDigis " << numCompDigis << " numCompDigisUnpacked " - << numCompDigisUnpacked << " " << cscDetId.chamberName(); + << numCompDigisUnpacked << " " << cscDetId.chamberName(); } return testsFailed; @@ -410,7 +404,13 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, // readout condition for strips: L1A + preCLCT in CFEB const bool me1abCheck = formatVersion_ == 2013; - bool hasPreCLCT = CSCDigiToRawAccept::accept(cscDetId, preclcts, preTriggerWindowMin_, preTriggerWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck, preTriggerInCFEB); + bool hasPreCLCT = CSCDigiToRawAccept::accept(cscDetId, + preclcts, + preTriggerWindowMin_, + preTriggerWindowMax_, + CSCConstants::CLCT_CENTRAL_BX, + me1abCheck, + preTriggerInCFEB); unsigned testsFailed = 0; @@ -418,17 +418,14 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, // these tests are only done when the trigger/pretriggers are enabled if (!packEverything_ and usePreTriggers_) { - // Test when NOT packing by CFEB if (!packByCFEB_) { - // test 1: check that a PreCLCT in this chamber kept the strip digis if (hasPreCLCT) { if (nStripDigisUnpacked == 0) { testsFailed++; - edm::LogWarning("analyzePreCLCT::Test1Failure") - << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " - << nStripDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzePreCLCT::Test1Failure") << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " + << nStripDigisUnpacked << " " << cscDetId.chamberName(); } } @@ -436,16 +433,14 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, if (nStripDigisUnpacked != 0) { if (!hasPreCLCT) { testsFailed++; - edm::LogWarning("analyzePreCLCT::Test2Failure") - << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " - << nStripDigisUnpacked << " " << cscDetId.chamberName(); + edm::LogWarning("analyzePreCLCT::Test2Failure") << "preTrigger " << hasPreCLCT << " nStripDigisUnpacked " + << nStripDigisUnpacked << " " << cscDetId.chamberName(); } } } // Test when packing by CFEBs else { - // tests are performed for each CFEB for (unsigned i = 0; i < CSCConstants::MAX_CFEBS_RUN2; i++) { // only do the tests for the CFEBs in this chamber (4,5,7) @@ -459,8 +454,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, if (nStripDigisUnpackedCFEB == 0) { testsFailed++; edm::LogWarning("analyzePreCLCT::Test1Failure") - << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " - << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); + << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " + << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); } } @@ -469,8 +464,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, if (!preTriggerInCFEB[i]) { testsFailed++; edm::LogWarning("analyzePreCLCT::Test2Failure") - << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " - << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); + << "CFEB " << i << "preTriggerInCFEB " << preTriggerInCFEB[i] << " nStripDigisUnpackedCFEB " + << nStripDigisUnpackedCFEB << " " << cscDetId.chamberName(); } } } @@ -484,7 +479,6 @@ template unsigned CSCPackerUnpackerUnitTest::nDigis(const CSCDetId& detid, const DIGICollection& digis) const { unsigned nDigis = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - CSCDetId ldetid(detid.endcap(), detid.station(), detid.ring(), detid.chamber(), i_layer + 1); nDigis += nDigisLayer(ldetid, digis); @@ -513,7 +507,7 @@ unsigned CSCPackerUnpackerUnitTest::nDigisCFEB(const CSCDetId& detid, for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { // ME1/A case - if (detid.station() == 1 and detid.ring() == 1 and cfeb >=4) { + if (detid.station() == 1 and detid.ring() == 1 and cfeb >= 4) { CSCDetId ldetid(detid.endcap(), detid.station(), 4, detid.chamber(), i_layer + 1); nDigis += nDigisCFEBLayer(ldetid, digis, cfeb); } @@ -537,7 +531,7 @@ unsigned CSCPackerUnpackerUnitTest::nDigisCFEBLayer(const CSCDetId& cscId, if (cscId.station() == 1 and cscId.ring() == 4) { cfb += CSCConstants::NUM_CFEBS_ME1B; } - if (cfeb == cfb){ + if (cfeb == cfb) { nDigis++; } } From ff8a96f180e836abb4b666c79427776fd5ed7c7a Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Fri, 6 Aug 2021 12:32:23 -0500 Subject: [PATCH 070/923] Put functions in a namespace --- .../interface/CSCDigiToRawAccept.h | 91 +++++++++---------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h index bf1604a13a287..485b90a9bd857 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h +++ b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h @@ -13,10 +13,10 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" -class CSCDigiToRawAccept { -public: +namespace CSCDigiToRawAccept { + // takes layer ID, converts to chamber ID, switching ME1A to ME11 - static CSCDetId chamberID(const CSCDetId& cscDetId); + CSCDetId chamberID(const CSCDetId& cscDetId); /* Was there a trigger primitive in the BX range between bxMin and bxMax? The nominalBX argument is 3 for ALCTs and 7 for CLCTs. This is subtracted @@ -28,49 +28,12 @@ class CSCDigiToRawAccept { or CLCT CFEB. */ template - static bool accept( - const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck = false); - - // older implementation for CLCT pretrigger objects that only have BX information - static bool accept(const CSCDetId& cscId, - const CSCCLCTPreTriggerCollection& lcts, - int bxMin, - int bxMax, - int nominalBX, - bool me1abCheck); - - // newer implementation for CLCT pretrigger objects that have BX and CFEB information - static bool accept(const CSCDetId& cscId, - const CSCCLCTPreTriggerDigiCollection& lcts, - int bxMin, - int bxMax, - int nominalBX, - bool me1abCheck, - std::vector& preTriggerInCFEB); -}; - -template -bool CSCDigiToRawAccept::accept( - const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck) { - if (bxMin == -999) - return true; - CSCDetId chamberId = chamberID(cscId); - typename LCTCollection::Range lctRange = lcts.get(chamberId); - bool result = false; - for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = lctItr->getBX() - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - - bool me1 = cscId.station() == 1 && cscId.ring() == 1; - //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases: - //wire selective readout requires at least one (A)LCT in the full chamber - if (me1 && result == false && me1abCheck) { - CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0); - lctRange = lcts.get(me1aId); + bool accept(const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck) { + if (bxMin == -999) + return true; + CSCDetId chamberId = chamberID(cscId); + typename LCTCollection::Range lctRange = lcts.get(chamberId); + bool result = false; for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { int bx = lctItr->getBX() - nominalBX; if (bx >= bxMin && bx <= bxMax) { @@ -78,8 +41,40 @@ bool CSCDigiToRawAccept::accept( break; } } + + bool me1 = cscId.station() == 1 && cscId.ring() == 1; + //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases: + //wire selective readout requires at least one (A)LCT in the full chamber + if (me1 && result == false && me1abCheck) { + CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0); + lctRange = lcts.get(me1aId); + for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { + int bx = lctItr->getBX() - nominalBX; + if (bx >= bxMin && bx <= bxMax) { + result = true; + break; + } + } + } + return result; } - return result; -} + + // older implementation for CLCT pretrigger objects that only have BX information + bool accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck); + + // newer implementation for CLCT pretrigger objects that have BX and CFEB information + bool accept(const CSCDetId& cscId, + const CSCCLCTPreTriggerDigiCollection& lcts, + int bxMin, + int bxMax, + int nominalBX, + bool me1abCheck, + std::vector& preTriggerInCFEB); +}; // namespace CSCDigiToRawAccept #endif From 970578e0191217378d360cbbbf93d169ea0b8373 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Tue, 10 Aug 2021 12:22:27 -0500 Subject: [PATCH 071/923] Fix typo --- EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc index 46452dab512f2..6b60035c340e2 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc @@ -57,7 +57,6 @@ bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, CSCDetId chamberId = chamberID(cscId); CSCCLCTPreTriggerDigiCollection::Range lctRange = lcts.get(chamberId); - bool result = false; for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { int bx = lctItr->getBX() - nominalBX; if (bx >= bxMin && bx <= bxMax) { @@ -67,7 +66,7 @@ bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, } } bool me1a = cscId.station() == 1 && cscId.ring() == 4; - if (me1a && result == false && me1abCheck) { + if (me1a && !atLeastOnePreTrigger && me1abCheck) { //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds lctRange = lcts.get(cscId); for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { From 78e336b00702b52007fb197aa8829f07e07e2c10 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 23 Aug 2021 16:59:22 +0200 Subject: [PATCH 072/923] Make unique material names as default for all Run3 scenarios --- Configuration/Geometry/README.md | 14 ++-- .../Geometry/python/dict2021Geometry.py | 15 ++-- .../data/dd4hep/cmsExtendedGeometry2021.xml | 82 +++++++++---------- ...ExtendedGeometry2021FlatMinus05Percent.xml | 80 +++++++++--------- ...ExtendedGeometry2021FlatMinus10Percent.xml | 80 +++++++++--------- ...sExtendedGeometry2021FlatPlus05Percent.xml | 80 +++++++++--------- ...sExtendedGeometry2021FlatPlus10Percent.xml | 80 +++++++++--------- .../cmsExtendedGeometry2021ZeroMaterial.xml | 80 +++++++++--------- ...edGeometry2021FlatMinus05PercentXML_cfi.py | 80 +++++++++--------- ...edGeometry2021FlatMinus10PercentXML_cfi.py | 80 +++++++++--------- ...dedGeometry2021FlatPlus05PercentXML_cfi.py | 80 +++++++++--------- ...dedGeometry2021FlatPlus10PercentXML_cfi.py | 80 +++++++++--------- .../python/cmsExtendedGeometry2021XML_cfi.py | 82 +++++++++---------- ...ExtendedGeometry2021ZeroMaterialXML_cfi.py | 80 +++++++++--------- 14 files changed, 486 insertions(+), 507 deletions(-) diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index eda01e110afeb..a8c1dea16db2d 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -23,20 +23,22 @@ PPS: * P3: 2021 baseline (same as P2 but removing common materials) * P4: 2021 baseline (same as P2 or P3 but using the same Vacuum) * P5: new Run3 detectors +* P6: Same as P5 but with unique names for materials The script also handles the common and forward elements of the geometry: * O3: 2021 baseline * O4: as O3, but with zero material * O5: as O3, but with trackermaterial removed (they are in T5, T6, T7, T8) +* O6: Replaces O3 as baseline to rmove duplicate material definition * F1: 2021 baseline Several detector combinations have been generated: -* 2021 = T3+C1+M1+P4+O3+F1 -* 2021ZeroMaterial = T4+C1+M1+P4+O4+F1 -* 2021FlatMinus05Percent = T5+C1+M1+P4+O5+F1 -* 2021FlatMinus10Percent = T6+C1+M1+P4+O5+F1 -* 2021FlatPlus05Percent = T7+C1+M1+P4+O5+F1 -* 2021FlatPlus10Percent = T8+C1+M1+P4+O5+F1 +* 2021 = T3+C1+M1+P6+O6+F1 +* 2021ZeroMaterial = T4+C1+M1+P6+O4+F1 +* 2021FlatMinus05Percent = T5+C1+M1+P6+O5+F1 +* 2021FlatMinus10Percent = T6+C1+M1+P6+O5+F1 +* 2021FlatPlus05Percent = T7+C1+M1+P6+O5+F1 +* 2021FlatPlus10Percent = T8+C1+M1+P6+O5+F1 # Phase 2 Geometries diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 0c4a301809036..6fdf042f905ea 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -2599,12 +2599,13 @@ allDicts = [ commonDict, trackerDict, caloDict, muonDict, forwardDict, ppsDict ] detectorVersionDict = { - ("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", + ("O6","T3","C1","M1","F1","P6") : "2021", + ("O4","T4","C1","M1","F1","P6") : "2021ZeroMaterial", + ("O5","T5","C1","M1","F1","P6") : "2021FlatMinus05Percent", + ("O5","T6","C1","M1","F1","P6") : "2021FlatMinus10Percent", + ("O5","T7","C1","M1","F1","P6") : "2021FlatPlus05Percent", + ("O5","T8","C1","M1","F1","P6") : "2021FlatPlus10Percent", } -deprecatedSubdets = set([ "T1", "T2", "O1", "O2", "P1", "P2", "P3", "P4" ]) +deprecatedSubdets = set([ "T1", "T2", "O1", "O2", "O3", "P1", "P2", "P3", + "P4", "P5" ]) diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml index 47d2c724c6356..7e43b537e9595 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -4,7 +4,7 @@ - + @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml index 1a722a1b65c5b..525be1e4e7264 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus05Percent.xml @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml index 29fd1a1ca1975..82bde8e4551b1 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatMinus10Percent.xml @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml index d49782e5d80bf..a9427b197d39b 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus05Percent.xml @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml index 7bc4e3cffcc9a..ad0c052cb673e 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021FlatPlus10Percent.xml @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml index b84e9e4d3c0f2..a6d645f71cd3b 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021ZeroMaterial.xml @@ -261,35 +261,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -310,20 +308,20 @@ - - - - - - - - + + + + + + + + - + @@ -340,13 +338,13 @@ - + - - - + + + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py index f1b316338916f..47c97877cce62 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus05PercentXML_cfi.py @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py index cfe93eb6c66e4..e1ae94c3c4542 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py index 52af7764ef58f..f428caa2944a6 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py index 234a5c798fa82..6526a5d00febd 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py index 0f9eded3f30b4..09e627234f5d7 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -5,7 +5,7 @@ XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials/2021/v2/materials.xml', + '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', @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py index 7c99d1bb6c6e5..df12abc056279 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021ZeroMaterialXML_cfi.py @@ -264,35 +264,33 @@ 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.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', @@ -313,20 +311,20 @@ '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.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/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/v1/CTPPS_Timing_Horizontal_Pot.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', @@ -343,13 +341,13 @@ '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/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/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/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', From 4e59935cd667dc7685a07f4edc8b48d46d8606a6 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Mon, 23 Aug 2021 10:07:16 -0500 Subject: [PATCH 073/923] Remove now obsolete me1abCheck --- .../interface/CSCDigiToRawAccept.h | 30 +++------------- EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc | 15 +++----- .../CSCRawToDigi/src/CSCDigiToRawAccept.cc | 34 ++----------------- .../test/CSCPackerUnpackerUnitTest.cc | 8 ++--- 4 files changed, 12 insertions(+), 75 deletions(-) diff --git a/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h index 485b90a9bd857..9eae22fef42c7 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h +++ b/EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h @@ -22,13 +22,12 @@ namespace CSCDigiToRawAccept { The nominalBX argument is 3 for ALCTs and 7 for CLCTs. This is subtracted from the object BX before we check if it is in the BX range. - The argument me1abCheck checks for triggers in ME1/1 when they have ring number equal to 4. - In simulation this should never be the case. Triggers in ME1/1 should always be assigned with - ring number equal to 1. Distinguishing CLCTs in ME1/a and ME1/b is done with the CLCT half-strip, + Triggers in ME1/1 should always be assigned with ring number equal to 1. + Distinguishing CLCTs in ME1/a and ME1/b is done with the CLCT half-strip, or CLCT CFEB. */ template - bool accept(const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck) { + bool accept(const CSCDetId& cscId, const LCTCollection& lcts, int bxMin, int bxMax, int nominalBX) { if (bxMin == -999) return true; CSCDetId chamberId = chamberID(cscId); @@ -41,31 +40,11 @@ namespace CSCDigiToRawAccept { break; } } - - bool me1 = cscId.station() == 1 && cscId.ring() == 1; - //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases: - //wire selective readout requires at least one (A)LCT in the full chamber - if (me1 && result == false && me1abCheck) { - CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0); - lctRange = lcts.get(me1aId); - for (typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = lctItr->getBX() - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - } return result; } // older implementation for CLCT pretrigger objects that only have BX information - bool accept(const CSCDetId& cscId, - const CSCCLCTPreTriggerCollection& lcts, - int bxMin, - int bxMax, - int nominalBX, - bool me1abCheck); + bool accept(const CSCDetId& cscId, const CSCCLCTPreTriggerCollection& lcts, int bxMin, int bxMax, int nominalBX); // newer implementation for CLCT pretrigger objects that have BX and CFEB information bool accept(const CSCDetId& cscId, @@ -73,7 +52,6 @@ namespace CSCDigiToRawAccept { int bxMin, int bxMax, int nominalBX, - bool me1abCheck, std::vector& preTriggerInCFEB); }; // namespace CSCDigiToRawAccept diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index a9c6e564ce63e..343cd9eff7874 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -77,8 +77,6 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, CSCDetId cscDetId = (*j).first; // only digitize if there are pre-triggers - bool me1abCheck = fedInfo.formatVersion_ == 2013; - // determine where the pretriggers are std::vector preTriggerInCFEB; preTriggerInCFEB.resize(CSCConstants::MAX_CFEBS_RUN2); @@ -91,7 +89,6 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, preTriggerWindowMin_, preTriggerWindowMax_, CSCConstants::CLCT_CENTRAL_BX, - me1abCheck, preTriggerInCFEB))) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); bool zplus = (cscDetId.endcap() == 1); @@ -153,10 +150,8 @@ void CSCDigiToRaw::add(const CSCWireDigiCollection& wireDigis, add(alctDigis, fedInfo); for (CSCWireDigiCollection::DigiRangeIterator j = wireDigis.begin(); j != wireDigis.end(); ++j) { CSCDetId cscDetId = (*j).first; - bool me1abCheck = fedInfo.formatVersion_ == 2013; - if (packEverything_ || - CSCDigiToRawAccept::accept( - cscDetId, alctDigis, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck)) { + if (packEverything_ || CSCDigiToRawAccept::accept( + cscDetId, alctDigis, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX)) { CSCEventData& cscData = findEventData(cscDetId, fedInfo); std::vector::const_iterator digiItr = (*j).second.first; std::vector::const_iterator last = (*j).second.second; @@ -174,10 +169,8 @@ void CSCDigiToRaw::add(const CSCComparatorDigiCollection& comparatorDigis, for (auto const& j : comparatorDigis) { CSCDetId cscDetId = j.first; CSCEventData& cscData = findEventData(cscDetId, fedInfo); - bool me1abCheck = fedInfo.formatVersion_ == 2013; - if (packEverything_ || - CSCDigiToRawAccept::accept( - cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck)) { + if (packEverything_ || CSCDigiToRawAccept::accept( + cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX)) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); /* diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc index 6b60035c340e2..07d190e4e9730 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRawAccept.cc @@ -10,12 +10,8 @@ CSCDetId CSCDigiToRawAccept::chamberID(const CSCDetId& cscDetId) { } // older function for pretriggers BX objects -bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, - const CSCCLCTPreTriggerCollection& lcts, - int bxMin, - int bxMax, - int nominalBX, - bool me1abCheck) { +bool CSCDigiToRawAccept::accept( + const CSCDetId& cscId, const CSCCLCTPreTriggerCollection& lcts, int bxMin, int bxMax, int nominalBX) { if (bxMin == -999) return true; CSCDetId chamberId = chamberID(cscId); @@ -28,18 +24,6 @@ bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, break; } } - bool me1a = cscId.station() == 1 && cscId.ring() == 4; - if (me1a && result == false && me1abCheck) { - //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds - lctRange = lcts.get(cscId); - for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = *lctItr - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - result = true; - break; - } - } - } return result; } @@ -48,7 +32,6 @@ bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, int bxMin, int bxMax, int nominalBX, - bool me1abCheck, std::vector& preTriggerInCFEB) { if (bxMin == -999) return true; @@ -65,18 +48,5 @@ bool CSCDigiToRawAccept::accept(const CSCDetId& cscId, preTriggerInCFEB[lctItr->getCFEB()] = true; } } - bool me1a = cscId.station() == 1 && cscId.ring() == 4; - if (me1a && !atLeastOnePreTrigger && me1abCheck) { - //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds - lctRange = lcts.get(cscId); - for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) { - int bx = lctItr->getBX() - nominalBX; - if (bx >= bxMin && bx <= bxMax) { - atLeastOnePreTrigger = true; - // save the location of all pretriggers - preTriggerInCFEB[lctItr->getCFEB()] = true; - } - } - } return atLeastOnePreTrigger; } diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc index b37ceea036f54..416bb64aaacb4 100644 --- a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -299,9 +299,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, } // readout condition for wires: L1A + ALCT - const bool me1abCheck = formatVersion_ == 2013; bool hasALCT = CSCDigiToRawAccept::accept( - cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck); + cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX); unsigned numWireDigisUnpacked = nDigis(cscDetId, wires_unpacked); @@ -349,9 +348,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, } // readout condition for comparators in (O)TMB; L1A + CLCT - const bool me1abCheck = formatVersion_ == 2013; bool hasCLCT = CSCDigiToRawAccept::accept( - cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck); + cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX); unsigned numCompDigisUnpacked = nDigis(cscDetId, comparators_unpacked); @@ -403,13 +401,11 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, preTriggerInCFEB.resize(CSCConstants::MAX_CFEBS_RUN2); // readout condition for strips: L1A + preCLCT in CFEB - const bool me1abCheck = formatVersion_ == 2013; bool hasPreCLCT = CSCDigiToRawAccept::accept(cscDetId, preclcts, preTriggerWindowMin_, preTriggerWindowMax_, CSCConstants::CLCT_CENTRAL_BX, - me1abCheck, preTriggerInCFEB); unsigned testsFailed = 0; From 45a1877761564baad1c4f8c7e6bbbf0bf1576551 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Mon, 23 Aug 2021 10:16:02 -0500 Subject: [PATCH 074/923] Code format --- .../test/CSCPackerUnpackerUnitTest.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc index 416bb64aaacb4..323b0edb9c44d 100644 --- a/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc +++ b/EventFilter/CSCRawToDigi/test/CSCPackerUnpackerUnitTest.cc @@ -299,8 +299,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeALCT(const CSCDetId& cscDetId, } // readout condition for wires: L1A + ALCT - bool hasALCT = CSCDigiToRawAccept::accept( - cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX); + bool hasALCT = + CSCDigiToRawAccept::accept(cscDetId, alcts, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX); unsigned numWireDigisUnpacked = nDigis(cscDetId, wires_unpacked); @@ -348,8 +348,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzeCLCT(const CSCDetId& cscDetId, } // readout condition for comparators in (O)TMB; L1A + CLCT - bool hasCLCT = CSCDigiToRawAccept::accept( - cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX); + bool hasCLCT = + CSCDigiToRawAccept::accept(cscDetId, clcts, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX); unsigned numCompDigisUnpacked = nDigis(cscDetId, comparators_unpacked); @@ -401,12 +401,8 @@ unsigned CSCPackerUnpackerUnitTest::analyzePreCLCT(const CSCDetId& cscDetId, preTriggerInCFEB.resize(CSCConstants::MAX_CFEBS_RUN2); // readout condition for strips: L1A + preCLCT in CFEB - bool hasPreCLCT = CSCDigiToRawAccept::accept(cscDetId, - preclcts, - preTriggerWindowMin_, - preTriggerWindowMax_, - CSCConstants::CLCT_CENTRAL_BX, - preTriggerInCFEB); + bool hasPreCLCT = CSCDigiToRawAccept::accept( + cscDetId, preclcts, preTriggerWindowMin_, preTriggerWindowMax_, CSCConstants::CLCT_CENTRAL_BX, preTriggerInCFEB); unsigned testsFailed = 0; From 01f1c7949fac614d03ff732246445bebce19abd1 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 23 Aug 2021 10:39:57 -0500 Subject: [PATCH 075/923] Fix infrequent deadlock in edm::ThreadHandoff Need to hold the lock until call to `wait` to avoid the possiblility of a deadlock. --- SimG4Core/Application/src/ThreadHandoff.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SimG4Core/Application/src/ThreadHandoff.cc b/SimG4Core/Application/src/ThreadHandoff.cc index fda990f21f02b..16db02c60df89 100644 --- a/SimG4Core/Application/src/ThreadHandoff.cc +++ b/SimG4Core/Application/src/ThreadHandoff.cc @@ -97,13 +97,13 @@ ThreadHandoff::~ThreadHandoff() { // 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(); + //need to hold lock until wait to avoid both threads + // being stuck in wait std::unique_lock lck(theThis->m_mutex); + theThis->m_loopReady = true; + theThis->m_threadHandoff.notify_one(); + do { theThis->m_toRun = nullptr; theThis->m_threadHandoff.wait(lck, [theThis]() { return nullptr != theThis->m_toRun; }); From 9bc49316e3cffee0c076788c77e779c3e678948a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 23 Aug 2021 18:29:27 +0200 Subject: [PATCH 076/923] Rearrange the files and collapse .h files in SimCalorimetry/HcalTrigPrimProducers --- .../{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/HcalTTPDigiProducer.cc | 47 +++++++++- .../{src => plugins}/HcalTTPTriggerRecord.cc | 25 +++++- .../HcalTrigPrimDigiProducer.cc | 85 +++++++++++++++++-- .../src/HcalTTPDigiProducer.h | 42 --------- .../src/HcalTTPTriggerRecord.h | 23 ----- .../src/HcalTrigPrimDigiProducer.h | 75 ---------------- .../HcalTrigPrimProducers/src/SealModule.cc | 9 -- 8 files changed, 147 insertions(+), 163 deletions(-) rename SimCalorimetry/HcalTrigPrimProducers/{ => plugins}/BuildFile.xml (58%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTTPDigiProducer.cc (83%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTTPTriggerRecord.cc (68%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTrigPrimDigiProducer.cc (82%) delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/SealModule.cc diff --git a/SimCalorimetry/HcalTrigPrimProducers/BuildFile.xml b/SimCalorimetry/HcalTrigPrimProducers/plugins/BuildFile.xml similarity index 58% rename from SimCalorimetry/HcalTrigPrimProducers/BuildFile.xml rename to SimCalorimetry/HcalTrigPrimProducers/plugins/BuildFile.xml index 5c6583262a0f2..f472228c37b8c 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/BuildFile.xml +++ b/SimCalorimetry/HcalTrigPrimProducers/plugins/BuildFile.xml @@ -2,4 +2,6 @@ - + + + diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPDigiProducer.cc similarity index 83% rename from SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc rename to SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPDigiProducer.cc index e7b2dababc8ee..0aae21b4a88e7 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPDigiProducer.cc @@ -1,12 +1,48 @@ -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h" - -#include "DataFormats/HcalDigi/interface/HFDataFrame.h" +#include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalDigi/interface/HFDataFrame.h" #include "DataFormats/Common/interface/Handle.h" +#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 "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" + #include +class HcalTTPDigiProducer : public edm::stream::EDProducer<> { +public: + explicit HcalTTPDigiProducer(const edm::ParameterSet& ps); + ~HcalTTPDigiProducer() override = default; + + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + bool isMasked(HcalDetId id); + bool decision(int nP, int nM, int bit); + + edm::EDGetTokenT tok_hf_; + edm::ESGetToken tok_tpgCoder_; + std::vector maskedChannels_; + std::string bit_[4]; + int calc_[4]; + int nHits_[4], nHFp_[4], nHFm_[4]; + char pReq_[4], mReq_[4], pmLogic_[4]; + int id_, samples_, presamples_; + int fwAlgo_; + int iEtaMin_, iEtaMax_; + unsigned int threshold_; + + int SoI_; + + static const int inputs_[]; +}; + // DO NOT MODIFY: Mapping between iphi (array index) and TTP input (value) for HF const int HcalTTPDigiProducer::inputs_[] = {30, 66, 4, 44, 4, 44, 0, 68, 0, 68, 16, 48, 16, 48, 6, 46, 6, 46, 2, 70, 2, 70, 18, 50, 18, 50, 12, 40, 12, 40, 8, 52, 8, 52, 20, 36, @@ -183,3 +219,8 @@ void HcalTTPDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSet // Step E: Put outputs into event e.put(std::move(ttpResult)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalTTPDigiProducer); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPTriggerRecord.cc similarity index 68% rename from SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc rename to SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPTriggerRecord.cc index 654b906aa5516..233835c2bec07 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTTPTriggerRecord.cc @@ -1,9 +1,25 @@ -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h" - +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalDigi/interface/HcalTTPDigi.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtTechnicalTriggerRecord.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#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" + +class HcalTTPTriggerRecord : public edm::stream::EDProducer<> { +public: + explicit HcalTTPTriggerRecord(const edm::ParameterSet& ps); + ~HcalTTPTriggerRecord() override; + + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + edm::EDGetTokenT tok_ttp_; + std::vector ttpBits_; + std::vector names_; +}; HcalTTPTriggerRecord::HcalTTPTriggerRecord(const edm::ParameterSet& ps) { tok_ttp_ = consumes(ps.getParameter("ttpDigiCollection")); @@ -48,3 +64,8 @@ void HcalTTPTriggerRecord::produce(edm::Event& e, const edm::EventSetup& eventSe output->setGtTechnicalTrigger(vecTT); e.put(std::move(output)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalTTPTriggerRecord); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc similarity index 82% rename from SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc rename to SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc index 7bbb904fc7e8f..e41bf424126b5 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc @@ -1,18 +1,82 @@ -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" +#include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h" +#include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalLutMetadata.h" +#include "CondFormats/HcalObjects/interface/HcalTPChannelParameters.h" +#include "CondFormats/DataRecord/interface/HcalLutMetadataRcd.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" #include "DataFormats/HcalDigi/interface/HFDataFrame.h" #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h" -#include "FWCore/Framework/interface/MakerMacros.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h" -#include "CondFormats/HcalObjects/interface/HcalTPChannelParameters.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h" #include +#include + +class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { +public: + explicit HcalTrigPrimDigiProducer(const edm::ParameterSet& ps); + ~HcalTrigPrimDigiProducer() override {} + + /**Produces the EDM products,*/ + void beginRun(const edm::Run& r, const edm::EventSetup& c) override; + void produce(edm::Event& e, const edm::EventSetup& c) override; + +private: + HcalTriggerPrimitiveAlgo theAlgo_; + + /// input tags for HCAL digis + std::vector inputLabel_; + std::vector inputUpgradeLabel_; + // this seems a strange way of doing things + edm::EDGetTokenT tok_hbhe_up_; + edm::EDGetTokenT tok_hf_up_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hf_; + + bool overrideDBweightsAndFilterHE_; + bool overrideDBweightsAndFilterHB_; + + /// input tag for FEDRawDataCollection + edm::InputTag inputTagFEDRaw_; + edm::EDGetTokenT tok_raw_; + double MinLongEnergy_, MinShortEnergy_, LongShortSlope_, LongShortOffset_; + + bool runZS_; + + bool runFrontEndFormatError_; + + bool upgrade_; + bool legacy_; + + bool HFEMB_; + edm::ParameterSet LongShortCut_; + edm::ESGetToken tok_tpgCoder_; + edm::ESGetToken tok_tpgTranscoder_; + edm::ESGetToken tok_lutMetadata_; + edm::ESGetToken tok_trigTowerGeom_; + edm::ESGetToken tok_hcalTopo_; + edm::ESGetToken tok_dbService_; + edm::ESGetToken tok_dbService_beginRun_; +}; HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) : theAlgo_(ps.getParameter("peakFilter"), @@ -335,3 +399,8 @@ void HcalTrigPrimDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup // Step D: Put outputs into event iEvent.put(std::move(result)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalTrigPrimDigiProducer); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h deleted file mode 100644 index 1f774624aee59..0000000000000 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef HcalTrigPrimProducers_HcalTTPDigiProducer_h -#define HcalTrigPrimProducers_HcalTTPDigiProducer_h - -#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 "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" - -class HcalTTPDigiProducer : public edm::stream::EDProducer<> { -public: - explicit HcalTTPDigiProducer(const edm::ParameterSet& ps); - ~HcalTTPDigiProducer() override = default; - - void produce(edm::Event& e, const edm::EventSetup& c) override; - -private: - bool isMasked(HcalDetId id); - bool decision(int nP, int nM, int bit); - - edm::EDGetTokenT tok_hf_; - edm::ESGetToken tok_tpgCoder_; - std::vector maskedChannels_; - std::string bit_[4]; - int calc_[4]; - int nHits_[4], nHFp_[4], nHFm_[4]; - char pReq_[4], mReq_[4], pmLogic_[4]; - int id_, samples_, presamples_; - int fwAlgo_; - int iEtaMin_, iEtaMax_; - unsigned int threshold_; - - int SoI_; - - static const int inputs_[]; -}; - -#endif diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h deleted file mode 100644 index a7e4f00a9bb31..0000000000000 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef HcalTrigPrimProducers_HcalTTPTriggerRecord_h -#define HcalTrigPrimProducers_HcalTTPTriggerRecord_h - -#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/HcalDigi/interface/HcalDigiCollections.h" - -class HcalTTPTriggerRecord : public edm::stream::EDProducer<> { -public: - explicit HcalTTPTriggerRecord(const edm::ParameterSet& ps); - ~HcalTTPTriggerRecord() override; - - void produce(edm::Event& e, const edm::EventSetup& c) override; - -private: - edm::EDGetTokenT tok_ttp_; - std::vector ttpBits_; - std::vector names_; -}; - -#endif diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h deleted file mode 100644 index 814aaea4ff824..0000000000000 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef HcalTrigPrimDigiProducer_h -#define HcalTrigPrimDigiProducer_h - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" -#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" -#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CondFormats/HcalObjects/interface/HcalLutMetadata.h" -#include "CondFormats/DataRecord/interface/HcalLutMetadataRcd.h" -#include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" - -#include - -class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { -public: - explicit HcalTrigPrimDigiProducer(const edm::ParameterSet& ps); - ~HcalTrigPrimDigiProducer() override {} - - /**Produces the EDM products,*/ - void beginRun(const edm::Run& r, const edm::EventSetup& c) override; - void produce(edm::Event& e, const edm::EventSetup& c) override; - -private: - HcalTriggerPrimitiveAlgo theAlgo_; - - /// input tags for HCAL digis - std::vector inputLabel_; - std::vector inputUpgradeLabel_; - // this seems a strange way of doing things - edm::EDGetTokenT tok_hbhe_up_; - edm::EDGetTokenT tok_hf_up_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_hf_; - - bool overrideDBweightsAndFilterHE_; - bool overrideDBweightsAndFilterHB_; - - /// input tag for FEDRawDataCollection - edm::InputTag inputTagFEDRaw_; - edm::EDGetTokenT tok_raw_; - double MinLongEnergy_, MinShortEnergy_, LongShortSlope_, LongShortOffset_; - - bool runZS_; - - bool runFrontEndFormatError_; - - bool upgrade_; - bool legacy_; - - bool HFEMB_; - edm::ParameterSet LongShortCut_; - edm::ESGetToken tok_tpgCoder_; - edm::ESGetToken tok_tpgTranscoder_; - edm::ESGetToken tok_lutMetadata_; - edm::ESGetToken tok_trigTowerGeom_; - edm::ESGetToken tok_hcalTopo_; - edm::ESGetToken tok_dbService_; - edm::ESGetToken tok_dbService_beginRun_; -}; - -#endif diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/SealModule.cc b/SimCalorimetry/HcalTrigPrimProducers/src/SealModule.cc deleted file mode 100644 index a76931c8cdbf6..0000000000000 --- a/SimCalorimetry/HcalTrigPrimProducers/src/SealModule.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h" -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h" -#include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h" - -DEFINE_FWK_MODULE(HcalTrigPrimDigiProducer); -DEFINE_FWK_MODULE(HcalTTPDigiProducer); -DEFINE_FWK_MODULE(HcalTTPTriggerRecord); From 37da860e4f11c7649a055bebbacdbe45171398f3 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 23 Aug 2021 19:19:41 +0200 Subject: [PATCH 077/923] catch std::exception --- FWCore/ParameterSet/src/types.cc | 2 +- FWCore/Services/plugins/ProcInfoFetcher.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FWCore/ParameterSet/src/types.cc b/FWCore/ParameterSet/src/types.cc index 84157a443d78a..abcfd9316a167 100644 --- a/FWCore/ParameterSet/src/types.cc +++ b/FWCore/ParameterSet/src/types.cc @@ -460,7 +460,7 @@ bool edm::decode(double& to, std::string const& from) { // std::cerr << "from:" << from << std::endl; to = std::stod(from); // std::cerr << "to:" << to << std::endl; - } catch (const std::invalid_argument&) { + } catch (const std::exception&) { return false; } } diff --git a/FWCore/Services/plugins/ProcInfoFetcher.cc b/FWCore/Services/plugins/ProcInfoFetcher.cc index f493129c29cca..83d270b2aba85 100644 --- a/FWCore/Services/plugins/ProcInfoFetcher.cc +++ b/FWCore/Services/plugins/ProcInfoFetcher.cc @@ -209,7 +209,7 @@ namespace edm { pinfo.num_threads >> pinfo.itrealvalue >> pinfo.starttime >> pinfo.vsize >> pinfo.rss >> pinfo.rlim >> pinfo.startcode >> pinfo.endcode >> pinfo.startstack >> pinfo.kstkesp >> pinfo.kstkeip >> pinfo.signal >> pinfo.blocked >> pinfo.sigignore >> pinfo.sigcatch >> pinfo.wchan; - } catch (const std::invalid_argument& iE) { + } catch (const std::exception& iE) { LogWarning("ProcInfoFetcher") << "Parsing of Prof file failed:" << iE.what() << std::endl; return ProcInfo(); } From c3e719bff2710560e524a4636d8c605457c08db6 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 23 Aug 2021 20:00:28 +0200 Subject: [PATCH 078/923] Migrate PPSSimTrackProducer to esConsumes() --- .../plugins/PPSSimTrackProducer.cc | 36 ++++--------------- .../interface/OpticalFunctionsTransport.h | 15 ++++---- .../interface/ProtonTransport.h | 11 +++--- .../src/OpticalFunctionsTransport.cc | 13 +++---- .../PPSProtonTransport/src/ProtonTransport.cc | 8 ++--- 5 files changed, 31 insertions(+), 52 deletions(-) diff --git a/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc b/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc index 020b4b1edaeab..346d75e952658 100644 --- a/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc +++ b/SimPPS/PPSSimTrackProducer/plugins/PPSSimTrackProducer.cc @@ -24,7 +24,6 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -49,18 +48,16 @@ class PPSSimTrackProducer : public edm::stream::EDProducer<> { public: explicit PPSSimTrackProducer(const edm::ParameterSet&); - ~PPSSimTrackProducer() override; + ~PPSSimTrackProducer() override = default; //static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginStream(edm::StreamID) override; void produce(edm::Event&, const edm::EventSetup&) override; - void endStream() override; // ----------member data --------------------------- bool m_verbosity; - ProtonTransport* theTransporter; + ProtonTransport theTransporter; edm::InputTag m_InTag; edm::EDGetTokenT m_InTagToken; @@ -79,11 +76,8 @@ class PPSSimTrackProducer : public edm::stream::EDProducer<> { // // constructors and destructor // -PPSSimTrackProducer::PPSSimTrackProducer(const edm::ParameterSet& iConfig) { - //now do what ever other initialization is needed - // TransportHector - theTransporter = new ProtonTransport(iConfig); - +PPSSimTrackProducer::PPSSimTrackProducer(const edm::ParameterSet& iConfig) + : theTransporter(iConfig, consumesCollector()) { m_InTag = iConfig.getParameter("HepMCProductLabel"); m_InTagToken = consumes(m_InTag); @@ -103,15 +97,6 @@ PPSSimTrackProducer::PPSSimTrackProducer(const edm::ParameterSet& iConfig) { } } -PPSSimTrackProducer::~PPSSimTrackProducer() { - // do anything here that needs to be done at destruction time - // (e.g. close files, deallocate resources etc.) - if (theTransporter) { - delete theTransporter; - theTransporter = nullptr; - } -} - // // member functions // @@ -143,8 +128,8 @@ void PPSSimTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe evt = new HepMC::GenEvent(HepMCEvt->GetEvent()->signal_process_id(), HepMCEvt->GetEvent()->event_number()); - theTransporter->process(HepMCEvt->GetEvent(), iSetup, engine); - theTransporter->addPartToHepMC(HepMCEvt->GetEvent(), evt); + theTransporter.process(HepMCEvt->GetEvent(), iSetup, engine); + theTransporter.addPartToHepMC(HepMCEvt->GetEvent(), evt); if (m_verbosity) evt->print(); @@ -155,7 +140,7 @@ void PPSSimTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe iEvent.put(std::move(newProduct)); unique_ptr NewCorrespondenceMap(new edm::LHCTransportLinkContainer()); - edm::LHCTransportLinkContainer thisLink(theTransporter->getCorrespondenceMap()); + edm::LHCTransportLinkContainer thisLink(theTransporter.getCorrespondenceMap()); (*NewCorrespondenceMap).swap(thisLink); if (m_verbosity) { @@ -169,13 +154,6 @@ void PPSSimTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe // in fact, it MUST NOT be delete here, as a protection is missing in above package edm::LogVerbatim("ProtonTransportEventProcessing") << "produce end "; } -// The methods below are pure virtual, so it needs to be implemented even if not used -// -// ------------ method called once each stream before processing any runs, lumis or events ------------ -void PPSSimTrackProducer::beginStream(edm::StreamID) {} - -// ------------ method called once each stream after processing all runs, lumis and events ------------ -void PPSSimTrackProducer::endStream() {} // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ /* to be done */ diff --git a/SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h b/SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h index d1d596ef0b4c9..32bc9a1a4da93 100644 --- a/SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h +++ b/SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h @@ -6,7 +6,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSBeamParameters.h" #include "CondFormats/PPSObjects/interface/LHCInterpolatedOpticalFunctionsSetCollection.h" #include "CondFormats/RunInfo/interface/LHCInfo.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 "FWCore/MessageLogger/interface/MessageLogger.h" @@ -21,7 +21,7 @@ class OpticalFunctionsTransport : public BaseProtonTransport { public: - OpticalFunctionsTransport(const edm::ParameterSet& ps); + OpticalFunctionsTransport(const edm::ParameterSet& ps, edm::ConsumesCollector iC); ~OpticalFunctionsTransport() override{}; void process(const HepMC::GenEvent* ev, const edm::EventSetup& es, CLHEP::HepRandomEngine* engine) override; @@ -29,12 +29,13 @@ class OpticalFunctionsTransport : public BaseProtonTransport { private: bool transportProton(const HepMC::GenParticle*); - std::string lhcInfoLabel_; - std::string opticsLabel_; + edm::ESGetToken lhcInfoToken_; + edm::ESGetToken beamParametersToken_; + edm::ESGetToken opticsToken_; - edm::ESHandle lhcInfo_; - edm::ESHandle beamParameters_; - edm::ESHandle opticalFunctions_; + const LHCInfo* lhcInfo_; + const CTPPSBeamParameters* beamParameters_; + const LHCInterpolatedOpticalFunctionsSetCollection* opticalFunctions_; unsigned int optFunctionId45_; unsigned int optFunctionId56_; diff --git a/SimTransport/PPSProtonTransport/interface/ProtonTransport.h b/SimTransport/PPSProtonTransport/interface/ProtonTransport.h index a4f848125890a..5806eef323af6 100644 --- a/SimTransport/PPSProtonTransport/interface/ProtonTransport.h +++ b/SimTransport/PPSProtonTransport/interface/ProtonTransport.h @@ -1,5 +1,6 @@ #ifndef PROTONTRANSPORT #define PROTONTRANSPORT +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "HepMC/GenEvent.h" @@ -7,15 +8,13 @@ #include "SimDataFormats/Forward/interface/LHCTransportLink.h" #include "SimTransport/PPSProtonTransport/interface/BaseProtonTransport.h" +#include #include class ProtonTransport { public: - ProtonTransport(const edm::ParameterSet& iConfig); - ~ProtonTransport() { - if (instance_) - delete instance_; - }; + ProtonTransport(const edm::ParameterSet& iConfig, edm::ConsumesCollector iC); + ~ProtonTransport() = default; std::vector& getCorrespondenceMap() { return instance_->getCorrespondenceMap(); } void process(const HepMC::GenEvent* ev, const edm::EventSetup& es, CLHEP::HepRandomEngine* engine) { @@ -24,6 +23,6 @@ class ProtonTransport { void addPartToHepMC(const HepMC::GenEvent* iev, HepMC::GenEvent* ev) { instance_->addPartToHepMC(iev, ev); } private: - BaseProtonTransport* instance_; + std::unique_ptr instance_; }; #endif diff --git a/SimTransport/PPSProtonTransport/src/OpticalFunctionsTransport.cc b/SimTransport/PPSProtonTransport/src/OpticalFunctionsTransport.cc index 64d27cbd72b5c..237becae2e709 100644 --- a/SimTransport/PPSProtonTransport/src/OpticalFunctionsTransport.cc +++ b/SimTransport/PPSProtonTransport/src/OpticalFunctionsTransport.cc @@ -1,10 +1,11 @@ #include "SimTransport/PPSProtonTransport/interface/OpticalFunctionsTransport.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" -OpticalFunctionsTransport::OpticalFunctionsTransport(const edm::ParameterSet& iConfig) +OpticalFunctionsTransport::OpticalFunctionsTransport(const edm::ParameterSet& iConfig, edm::ConsumesCollector iC) : BaseProtonTransport(iConfig), - lhcInfoLabel_(iConfig.getParameter("lhcInfoLabel")), - opticsLabel_(iConfig.getParameter("opticsLabel")), + lhcInfoToken_(iC.esConsumes(edm::ESInputTag("", iConfig.getParameter("lhcInfoLabel")))), + beamParametersToken_(iC.esConsumes()), + opticsToken_(iC.esConsumes(edm::ESInputTag("", iConfig.getParameter("opticsLabel")))), useEmpiricalApertures_(iConfig.getParameter("useEmpiricalApertures")), empiricalAperture45_xi0_int_(iConfig.getParameter("empiricalAperture45_xi0_int")), empiricalAperture45_xi0_slp_(iConfig.getParameter("empiricalAperture45_xi0_slp")), @@ -22,9 +23,9 @@ void OpticalFunctionsTransport::process(const HepMC::GenEvent* evt, CLHEP::HepRandomEngine* _engine) { this->clear(); - iSetup.get().get(lhcInfoLabel_, lhcInfo_); - iSetup.get().get(beamParameters_); - iSetup.get().get(opticsLabel_, opticalFunctions_); + lhcInfo_ = &iSetup.getData(lhcInfoToken_); + beamParameters_ = &iSetup.getData(beamParametersToken_); + opticalFunctions_ = &iSetup.getData(opticsToken_); // Choose the optical function corresponding to the first station ono each side (it is in lhc ref. frame) optFunctionId45_ = 0; diff --git a/SimTransport/PPSProtonTransport/src/ProtonTransport.cc b/SimTransport/PPSProtonTransport/src/ProtonTransport.cc index 2ea07aeff94db..ba8c5a3e33a91 100644 --- a/SimTransport/PPSProtonTransport/src/ProtonTransport.cc +++ b/SimTransport/PPSProtonTransport/src/ProtonTransport.cc @@ -8,17 +8,17 @@ #include #include -ProtonTransport::ProtonTransport(const edm::ParameterSet &iConfig) : instance_(nullptr) { +ProtonTransport::ProtonTransport(const edm::ParameterSet &iConfig, edm::ConsumesCollector iC) { std::string transportMethod_ = iConfig.getParameter("TransportMethod"); for (auto &c : transportMethod_) c = toupper(c); // just to on the safe side if (transportMethod_ == "HECTOR") { - instance_ = new HectorTransport(iConfig); + instance_ = std::make_unique(iConfig); } else if (transportMethod_ == "TOTEM") { - instance_ = new TotemTransport(iConfig); + instance_ = std::make_unique(iConfig); } else if (transportMethod_ == "OPTICALFUNCTIONS") { - instance_ = new OpticalFunctionsTransport(iConfig); + instance_ = std::make_unique(iConfig, iC); } else { throw cms::Exception("ProtonTransport") << "Unknow transport method. Is must be either HECTOR, TOTEM or OPTICALFUNCTIONS (case insensitive)"; From f5a1bc505b2d0e9d58942540a9e63f6419dfa73d Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Wed, 21 Jul 2021 15:55:25 -0500 Subject: [PATCH 079/923] Fix an issue with the track parameter digitization. Add a new function to test the output of the digitize and undigitize functions. Convert from global to local phi during construction and setting of parameters and allow the TTTrack class to make use of this function from the base class. Finally, add some code to unit test the TTTrack_TrackWord; specifically the digitize and undigitize functions. --- DataFormats/L1TrackTrigger/BuildFile.xml | 1 + .../L1TrackTrigger/interface/TTTrack.h | 25 +++++- .../interface/TTTrack_TrackWord.h | 88 ++++++++++++++----- .../L1TrackTrigger/src/TTTrack_TrackWord.cc | 50 ++++++++++- DataFormats/L1TrackTrigger/test/BuildFile.xml | 10 +++ .../test/TestDataFormatsTTTrackTrackWord.cc | 31 +++++++ .../testDataFormatsTTTrackTrackWord_cfg.py | 14 +++ .../test/L1TrackObjectNtupleMaker.cc | 12 +++ 8 files changed, 199 insertions(+), 32 deletions(-) create mode 100644 DataFormats/L1TrackTrigger/test/BuildFile.xml create mode 100644 DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc create mode 100644 DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py diff --git a/DataFormats/L1TrackTrigger/BuildFile.xml b/DataFormats/L1TrackTrigger/BuildFile.xml index 4cec83b885a91..7cd37080c5417 100644 --- a/DataFormats/L1TrackTrigger/BuildFile.xml +++ b/DataFormats/L1TrackTrigger/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/DataFormats/L1TrackTrigger/interface/TTTrack.h b/DataFormats/L1TrackTrigger/interface/TTTrack.h index f5e46805bd50f..8428d694ac779 100644 --- a/DataFormats/L1TrackTrigger/interface/TTTrack.h +++ b/DataFormats/L1TrackTrigger/interface/TTTrack.h @@ -105,6 +105,9 @@ class TTTrack : public TTTrack_TrackWord { /// Track phi double phi() const; + /// Local track phi (within the sector) + double localPhi() const; + /// Track tanL double tanL() const; @@ -313,6 +316,11 @@ double TTTrack::phi() const { return thePhi_; } +template +double TTTrack::localPhi() const { + return TTTrack_TrackWord::localPhi(thePhi_, thePhiSector_); +} + template double TTTrack::d0() const { return theD0_; @@ -441,9 +449,17 @@ void TTTrack::setTrackWordBits() { // missing conversion of global phi to difference from sector center phi if (theChi2_Z_ < 0) { - setTrackWord( - valid, theMomentum_, thePOCA_, theRInv_, chi2Red(), 0, chi2BendRed(), theHitPattern_, mvaQuality, mvaOther); - + setTrackWord(valid, + theMomentum_, + thePOCA_, + theRInv_, + theChi2_, + 0, + theStubPtConsistency_, + theHitPattern_, + mvaQuality, + mvaOther, + thePhiSector_); } else { setTrackWord(valid, theMomentum_, @@ -454,7 +470,8 @@ void TTTrack::setTrackWordBits() { chi2BendRed(), theHitPattern_, mvaQuality, - mvaOther); + mvaOther, + thePhiSector_); } return; } diff --git a/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h b/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h index 81208788ec947..4b37a6b63a46b 100644 --- a/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h +++ b/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h @@ -15,15 +15,23 @@ #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/Math/interface/deltaPhi.h" #include #include #include #include +#include +#include #include #include +namespace tttrack_trackword { + void infoTestDigitizationScheme( + const unsigned int, const double, const double, const unsigned int, const double, const unsigned int); +} + class TTTrack_TrackWord { public: // ----------constants, enums and typedefs --------- @@ -96,6 +104,10 @@ class TTTrack_TrackWord { static constexpr std::array bendChi2Bins = { {0.0, 0.75, 1.0, 1.5, 2.25, 3.5, 5.0, 20.0}}; + // Sector constants + static constexpr unsigned int nSectors = 9; + static constexpr double sectorWidth = (2. * M_PI) / nSectors; + // Track flags typedef ap_uint valid_t; // valid bit @@ -130,10 +142,11 @@ class TTTrack_TrackWord { double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther); + unsigned int mvaOther, + unsigned int sector); TTTrack_TrackWord(unsigned int valid, unsigned int rInv, - unsigned int phi0, + unsigned int phi0, // local phi unsigned int tanl, unsigned int z0, unsigned int d0, @@ -201,11 +214,11 @@ class TTTrack_TrackWord { // These functions return the unpacked and converted values // These functions return real numbers converted from the digitized quantities by unpacking the 96-bit track word bool getValid() const { return getValidWord().to_bool(); } - double getRinv() const { return unpackSignedValue(getRinvBits(), TrackBitWidths::kRinvSize, stepRinv); } - double getPhi() const { return unpackSignedValue(getPhiBits(), TrackBitWidths::kPhiSize, stepPhi0); } - double getTanl() const { return unpackSignedValue(getTanlBits(), TrackBitWidths::kTanlSize, stepTanL); } - double getZ0() const { return unpackSignedValue(getZ0Bits(), TrackBitWidths::kZ0Size, stepZ0); } - double getD0() const { return unpackSignedValue(getD0Bits(), TrackBitWidths::kD0Size, stepD0); } + double getRinv() const { return undigitizeSignedValue(getRinvBits(), TrackBitWidths::kRinvSize, stepRinv); } + double getPhi() const { return undigitizeSignedValue(getPhiBits(), TrackBitWidths::kPhiSize, stepPhi0); } + double getTanl() const { return undigitizeSignedValue(getTanlBits(), TrackBitWidths::kTanlSize, stepTanL); } + double getZ0() const { return undigitizeSignedValue(getZ0Bits(), TrackBitWidths::kZ0Size, stepZ0); } + double getD0() const { return undigitizeSignedValue(getD0Bits(), TrackBitWidths::kD0Size, stepD0); } double getChi2RPhi() const { return chi2RPhiBins[getChi2RPhiBits()]; } double getChi2RZ() const { return chi2RZBins[getChi2RZBits()]; } double getBendChi2() const { return bendChi2Bins[getBendChi2Bits()]; } @@ -223,11 +236,12 @@ class TTTrack_TrackWord { double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther); + unsigned int mvaOther, + unsigned int sector); void setTrackWord(unsigned int valid, unsigned int rInv, - unsigned int phi0, + unsigned int phi0, // local phi unsigned int tanl, unsigned int z0, unsigned int d0, @@ -240,7 +254,7 @@ class TTTrack_TrackWord { void setTrackWord(ap_uint valid, ap_uint rInv, - ap_uint phi0, + ap_uint phi0, // local phi ap_uint tanl, ap_uint z0, ap_uint d0, @@ -251,16 +265,36 @@ class TTTrack_TrackWord { ap_uint mvaQuality, ap_uint mvaOther); + // ----------member functions (testers) ------------ + bool singleDigitizationSchemeTest(const double floatingPointValue, const unsigned int nBits, const double lsb) const; + void testDigitizationScheme() const; + +protected: + // ----------protected member functions ------------ + float localPhi(float globalPhi, unsigned int sector) const { + return reco::deltaPhi(globalPhi, (sector * sectorWidth)); + } + private: // ----------private member functions -------------- unsigned int digitizeSignedValue(double value, unsigned int nBits, double lsb) const { - unsigned int digitized_value = std::floor(std::abs(value) / lsb); - unsigned int digitized_maximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign - if (digitized_value > digitized_maximum) - digitized_value = digitized_maximum; - if (value < 0) - digitized_value = (1 << nBits) - digitized_value; // two's complement encoding - return digitized_value; + // Digitize the incoming value + int digitizedValue = std::floor(value / lsb); + + // Calculate the maxmum possible positive value given an output of nBits in size + int digitizedMaximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign + int digitizedMinimum = -1. * (digitizedMaximum + 1); + + // Saturate the digitized value + digitizedValue = std::clamp(digitizedValue, digitizedMinimum, digitizedMaximum); + + // Do the two's compliment encoding + unsigned int twosValue = digitizedValue; + if (digitizedValue < 0) { + twosValue += (1 << nBits); + } + + return twosValue; } template @@ -269,14 +303,20 @@ class TTTrack_TrackWord { return (up - bins.begin() - 1); } - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + double undigitizeSignedValue(unsigned int twosValue, unsigned int nBits, double lsb) const { + // Check that none of the bits above the nBits-1 bit, in a range of [0, nBits-1], are set. + // This makes sure that it isn't possible for the value represented by `twosValue` to be + // any bigger than ((1 << nBits) - 1). + assert((twosValue >> nBits) == 0); + + // Convert from twos compliment to C++ signed integer (normal digitized value) + int digitizedValue = twosValue; + if (twosValue & (1 << (nBits - 1))) { // check if the twosValue is negative + digitizedValue -= (1 << nBits); } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + + // Convert to floating point value + return (double(digitizedValue) + 0.5) * lsb; } // ----------member data --------------------------- diff --git a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc index 48031bc8fc514..0b1420d2ca09f 100644 --- a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc +++ b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc @@ -11,6 +11,20 @@ /////// #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +void tttrack_trackword::infoTestDigitizationScheme(const unsigned int nBits, + const double lsb, + const double floatingPointValue, + const unsigned int digitizedSignedValue, + const double undigitizedSignedValue, + const unsigned int redigitizedSignedValue) { + edm::LogInfo("TTTrack_TrackWord") << "testDigitizationScheme: (nBits, lsb) = (" << nBits << ", " << lsb << ")\n" + << "Floating point value = " << floatingPointValue + << "\tDigitized value = " << digitizedSignedValue + << "\tUn-digitized value = " << undigitizedSignedValue + << "\tRe-digitized value = " << redigitizedSignedValue; +} //Constructor - turn track parameters into 96-bit word TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, @@ -22,8 +36,9 @@ TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther) { - setTrackWord(valid, momentum, POCA, rInv, chi2RPhi, chi2RZ, bendChi2, hitPattern, mvaQuality, mvaOther); + unsigned int mvaOther, + unsigned int sector) { + setTrackWord(valid, momentum, POCA, rInv, chi2RPhi, chi2RZ, bendChi2, hitPattern, mvaQuality, mvaOther, sector); } TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, @@ -51,9 +66,10 @@ void TTTrack_TrackWord::setTrackWord(unsigned int valid, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther) { + unsigned int mvaOther, + unsigned int sector) { // first, derive quantities to be packed - float rPhi = momentum.phi(); // this needs to be phi relative to center of sector **** + float rPhi = localPhi(momentum.phi(), sector); // this needs to be phi relative to the center of the sector float rTanl = momentum.z() / momentum.perp(); float rZ0 = POCA.z(); float rD0 = POCA.perp(); @@ -176,3 +192,29 @@ void TTTrack_TrackWord::setTrackWord( trackWord_.set(b, valid[b - offset]); } } + +bool TTTrack_TrackWord::singleDigitizationSchemeTest(const double floatingPointValue, + const unsigned int nBits, + const double lsb) const { + unsigned int digitizedSignedValue = digitizeSignedValue(floatingPointValue, nBits, lsb); + double undigitizedSignedValue = undigitizeSignedValue(digitizedSignedValue, nBits, lsb); + unsigned int redigitizedSignedValue = digitizeSignedValue(undigitizedSignedValue, nBits, lsb); + tttrack_trackword::infoTestDigitizationScheme( + nBits, lsb, floatingPointValue, digitizedSignedValue, undigitizedSignedValue, redigitizedSignedValue); + return (std::abs(floatingPointValue - undigitizedSignedValue) <= (lsb / 2.0)) && + (digitizedSignedValue == redigitizedSignedValue); +} + +void TTTrack_TrackWord::testDigitizationScheme() const { + /* + Expected output: + testDigitizationScheme: Floating point value = -4 Digitized value = 4 Un-digitized value = -3.5 + testDigitizationScheme: Floating point value = 3 Digitized value = 3 Un-digitized value = 3.5 + testDigitizationScheme: Floating point value = -3.5 Digitized value = 9 Un-digitized value = -3.25 + testDigitizationScheme: Floating point value = 3.5 Digitized value = 7 Un-digitized value = 3.75 + */ + assert(singleDigitizationSchemeTest(-4.0, 3, 1.0)); + assert(singleDigitizationSchemeTest(3.0, 3, 1.0)); + assert(singleDigitizationSchemeTest(-3.5, 4, 0.5)); + assert(singleDigitizationSchemeTest(3.5, 4, 0.5)); +} diff --git a/DataFormats/L1TrackTrigger/test/BuildFile.xml b/DataFormats/L1TrackTrigger/test/BuildFile.xml new file mode 100644 index 0000000000000..2e2e4ad4f5bb4 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/BuildFile.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc b/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc new file mode 100644 index 0000000000000..14709bc605514 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc @@ -0,0 +1,31 @@ +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "DataFormats/TestObjects/interface/ToyProducts.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" + +#include + +namespace trackwordtest { + class TTTrackTrackWordDummyOneAnalyzer : public edm::EDAnalyzer { + public: + explicit TTTrackTrackWordDummyOneAnalyzer(const edm::ParameterSet&) {} + ~TTTrackTrackWordDummyOneAnalyzer() {} + + void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { + TTTrack_TrackWord tw; + tw.testDigitizationScheme(); + } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + //to ensure distinct cfi names + descriptions.addWithDefaultLabel(desc); + } + }; +} // namespace trackwordtest + +using trackwordtest::TTTrackTrackWordDummyOneAnalyzer; +DEFINE_FWK_MODULE(TTTrackTrackWordDummyOneAnalyzer); \ No newline at end of file diff --git a/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py b/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py new file mode 100644 index 0000000000000..227d9a0e740c2 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Test") + +process.source = cms.Source("EmptySource") + +process.maxEvents.input = 1 + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.INFO.limit = cms.untracked.int32(1000000000) + +process.dummyAna = cms.EDAnalyzer("TTTrackTrackWordDummyOneAnalyzer") + +process.p = cms.Path(process.dummyAna) \ No newline at end of file diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc index 248ba209914db..d2acda970d4bd 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc @@ -207,6 +207,7 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { std::vector* m_trk_pt; std::vector* m_trk_eta; std::vector* m_trk_phi; + std::vector* m_trk_phi_local; std::vector* m_trk_d0; // (filled if nFitPar==5, else 999) std::vector* m_trk_z0; std::vector* m_trk_chi2; @@ -237,6 +238,7 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { std::vector* m_trkExt_pt; std::vector* m_trkExt_eta; std::vector* m_trkExt_phi; + std::vector* m_trkExt_phi_local; std::vector* m_trkExt_d0; // (filled if nFitPar==5, else 999) std::vector* m_trkExt_z0; std::vector* m_trkExt_chi2; @@ -499,6 +501,7 @@ void L1TrackObjectNtupleMaker::beginJob() { m_trk_pt = new std::vector; m_trk_eta = new std::vector; m_trk_phi = new std::vector; + m_trk_phi_local = new std::vector; m_trk_z0 = new std::vector; m_trk_d0 = new std::vector; m_trk_chi2 = new std::vector; @@ -528,6 +531,7 @@ void L1TrackObjectNtupleMaker::beginJob() { m_trkExt_pt = new std::vector; m_trkExt_eta = new std::vector; m_trkExt_phi = new std::vector; + m_trkExt_phi_local = new std::vector; m_trkExt_z0 = new std::vector; m_trkExt_d0 = new std::vector; m_trkExt_chi2 = new std::vector; @@ -687,6 +691,7 @@ void L1TrackObjectNtupleMaker::beginJob() { eventTree->Branch("trk_pt", &m_trk_pt); eventTree->Branch("trk_eta", &m_trk_eta); eventTree->Branch("trk_phi", &m_trk_phi); + eventTree->Branch("trk_phi_local", &m_trk_phi_local); eventTree->Branch("trk_d0", &m_trk_d0); eventTree->Branch("trk_z0", &m_trk_z0); eventTree->Branch("trk_chi2", &m_trk_chi2); @@ -723,6 +728,7 @@ void L1TrackObjectNtupleMaker::beginJob() { eventTree->Branch("trkExt_pt", &m_trkExt_pt); eventTree->Branch("trkExt_eta", &m_trkExt_eta); eventTree->Branch("trkExt_phi", &m_trkExt_phi); + eventTree->Branch("trkExt_phi_local", &m_trkExt_phi_local); eventTree->Branch("trkExt_d0", &m_trkExt_d0); eventTree->Branch("trkExt_z0", &m_trkExt_z0); eventTree->Branch("trkExt_chi2", &m_trkExt_chi2); @@ -935,6 +941,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even m_trk_pt->clear(); m_trk_eta->clear(); m_trk_phi->clear(); + m_trk_phi_local->clear(); m_trk_d0->clear(); m_trk_z0->clear(); m_trk_chi2->clear(); @@ -965,6 +972,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even m_trkExt_pt->clear(); m_trkExt_eta->clear(); m_trkExt_phi->clear(); + m_trkExt_phi_local->clear(); m_trkExt_d0->clear(); m_trkExt_z0->clear(); m_trkExt_chi2->clear(); @@ -1346,6 +1354,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even float tmp_trk_pt = iterL1Track->momentum().perp(); float tmp_trk_eta = iterL1Track->momentum().eta(); float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_phi_local = iterL1Track->localPhi(); float tmp_trk_z0 = iterL1Track->z0(); //cm int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 @@ -1438,6 +1447,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even m_trk_pt->push_back(tmp_trk_pt); m_trk_eta->push_back(tmp_trk_eta); m_trk_phi->push_back(tmp_trk_phi); + m_trk_phi_local->push_back(tmp_trk_phi_local); m_trk_z0->push_back(tmp_trk_z0); if (tmp_trk_nFitPars == 5) m_trk_d0->push_back(tmp_trk_d0); @@ -1527,6 +1537,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even float tmp_trk_pt = iterL1Track->momentum().perp(); float tmp_trk_eta = iterL1Track->momentum().eta(); float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_phi_local = iterL1Track->localPhi(); float tmp_trk_z0 = iterL1Track->z0(); //cm int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 @@ -1619,6 +1630,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even m_trkExt_pt->push_back(tmp_trk_pt); m_trkExt_eta->push_back(tmp_trk_eta); m_trkExt_phi->push_back(tmp_trk_phi); + m_trkExt_phi_local->push_back(tmp_trk_phi_local); m_trkExt_z0->push_back(tmp_trk_z0); if (tmp_trk_nFitPars == 5) m_trkExt_d0->push_back(tmp_trk_d0); From 9b195809db69293bb06e902ba80214f52bd3a03b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 23 Aug 2021 21:37:39 +0200 Subject: [PATCH 080/923] Migrate RPDigiProducer to esConsumes() --- .../plugins/DeadChannelsManager.cc | 2 +- .../RPDigiProducer/plugins/DeadChannelsManager.h | 6 ++---- SimPPS/RPDigiProducer/plugins/RPDigiProducer.cc | 16 +++++++--------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.cc b/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.cc index 6070c61e181d7..1d622017a8a5c 100644 --- a/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.cc +++ b/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.cc @@ -8,7 +8,7 @@ DeadChannelsManager::DeadChannelsManager() { analysisMaskPresent = false; } -DeadChannelsManager::DeadChannelsManager(edm::ESHandle _analysisMask) { +DeadChannelsManager::DeadChannelsManager(const TotemAnalysisMask* _analysisMask) { analysisMask = _analysisMask; analysisMaskPresent = true; } diff --git a/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.h b/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.h index e0d29c3ff1f52..a3edfa3a9e563 100644 --- a/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.h +++ b/SimPPS/RPDigiProducer/plugins/DeadChannelsManager.h @@ -1,7 +1,6 @@ #ifndef SimPPS_RPDigiProducer_DEAD_CHANNELS_MANAGER #define SimPPS_RPDigiProducer_DEAD_CHANNELS_MANAGER -#include "FWCore/Framework/interface/ESHandle.h" #include "SimPPS/RPDigiProducer/interface/RPSimTypes.h" #include "CondFormats/PPSObjects/interface/TotemAnalysisMask.h" @@ -13,7 +12,7 @@ */ class DeadChannelsManager { private: - edm::ESHandle analysisMask; + const TotemAnalysisMask* analysisMask; bool analysisMaskPresent; //this variable indicates whether analysisMask is present or not public: @@ -21,7 +20,7 @@ class DeadChannelsManager { * This constructor allows us to set analysisMask. The analysisMask can be read from * EventSetup. */ - DeadChannelsManager(edm::ESHandle analysisMask); + DeadChannelsManager(const TotemAnalysisMask* analysisMask); DeadChannelsManager(); /** * This function answers the question whether given channel is dead or not. @@ -37,7 +36,6 @@ class DeadChannelsManager { */ bool isChannelDead(RPDetId detectorId, unsigned short stripNumber); void displayMap(); - static uint32_t rawToDecId(uint32_t raw); }; #endif diff --git a/SimPPS/RPDigiProducer/plugins/RPDigiProducer.cc b/SimPPS/RPDigiProducer/plugins/RPDigiProducer.cc index 5a2d2fbc63ca4..fbe48e8eb2080 100644 --- a/SimPPS/RPDigiProducer/plugins/RPDigiProducer.cc +++ b/SimPPS/RPDigiProducer/plugins/RPDigiProducer.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" @@ -53,7 +52,7 @@ namespace CLHEP { class RPDigiProducer : public edm::EDProducer { public: explicit RPDigiProducer(const edm::ParameterSet&); - ~RPDigiProducer() override; + ~RPDigiProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); @@ -85,6 +84,7 @@ class RPDigiProducer : public edm::EDProducer { bool simulateDeadChannels; edm::EDGetTokenT> tokenCrossingFrameTotemRP; + edm::ESGetToken tokenAnalysisMask; }; RPDigiProducer::RPDigiProducer(const edm::ParameterSet& conf) : conf_(conf) { @@ -102,12 +102,11 @@ RPDigiProducer::RPDigiProducer(const edm::ParameterSet& conf) : conf_(conf) { "simulateDeadChannels")) { //check if "simulateDeadChannels" variable is defined in configuration file simulateDeadChannels = conf.getParameter("simulateDeadChannels"); } + if (simulateDeadChannels) { + tokenAnalysisMask = esConsumes(); + } } -RPDigiProducer::~RPDigiProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} // // member functions // @@ -201,9 +200,8 @@ void RPDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) void RPDigiProducer::beginRun(const edm::Run& beginrun, const edm::EventSetup& es) { // get analysis mask to mask channels if (simulateDeadChannels) { - edm::ESHandle analysisMask; - es.get().get(analysisMask); - deadChannelsManager = DeadChannelsManager(analysisMask); //set analysisMask in deadChannelsManager + //set analysisMask in deadChannelsManager + deadChannelsManager = DeadChannelsManager(&es.getData(tokenAnalysisMask)); } } From 039b5eb17135c07a276d2ccb86b0bf49a66f4e09 Mon Sep 17 00:00:00 2001 From: Jack Sisson Date: Fri, 25 Jun 2021 11:03:47 -0500 Subject: [PATCH 081/923] Added plugin SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc and related changes --- .../SiPixelPhase1OfflineDQM_harvesting_cff.py | 4 +- .../SiPixelPhase1OfflineDQM_source_cff.py | 1 + .../plugins/SiPixelPhase1EfficiencyExtras.cc | 268 ++++++++++++++++++ .../SiPixelPhase1EfficiencyExtras_cfi.py | 9 + .../SiPixelPhase1TrackEfficiency_cfi.py | 18 +- 5 files changed, 295 insertions(+), 5 deletions(-) create mode 100644 DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc create mode 100644 DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py index 8fa1f33308eb0..0e23e659b60bd 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py @@ -16,10 +16,12 @@ + SiPixelPhase1SummaryOffline + SiPixelBarycenterOffline + SiPixelPhase1ResidualsExtra + + SiPixelPhase1EfficiencyExtras ) siPixelPhase1OfflineDQM_harvesting_cosmics = siPixelPhase1OfflineDQM_harvesting.copyAndExclude([ - SiPixelPhase1TrackEfficiencyHarvester, + SiPixelPhase1TrackEfficiencyHarvester, + SiPixelPhase1EfficiencyExtras, ]) siPixelPhase1OfflineDQM_harvesting_cosmics.replace(RunQTests_offline, RunQTests_cosmics) diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py index a4131f6752cb0..21d7470e345d9 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py @@ -27,6 +27,7 @@ from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import * +from DQM.SiPixelPhase1Track.SiPixelPhase1EfficiencyExtras_cfi import * PerModule.enabled = False IsOffline.enabled=True diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc new file mode 100644 index 0000000000000..2154cb404d83b --- /dev/null +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc @@ -0,0 +1,268 @@ +// -*- C++ -*- +// +// Package: SiPixelPhase1EfficiencyExtras +// Class: SiPixelPhase1EfficiencyExtras +// +/**\class + + Description: Create the Phase 1 extra efficiency trend plots + + Implementation: + +*/ +// +// Original Author: Jack Sisson, Julie Hogan +// Created: 7 July, 2021 +// +// + +// Framework +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// DQM Framework +#include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" +// Geometry +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +// DataFormats +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" +#include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" +// +#include +#include +#include +#include +#include + +using namespace std; +using namespace edm; + +class SiPixelPhase1EfficiencyExtras : public DQMEDHarvester { +public: + explicit SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& conf); + ~SiPixelPhase1EfficiencyExtras() override; + +protected: + void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override; + + void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override; + + std::string effFolderName_; + std::string vtxFolderName_; + std::string instLumiFolderName_; + +private: + edm::ParameterSet conf_; +}; + +SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& iConfig) : conf_(iConfig) { + LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras: Hello!" << endl; + effFolderName_ = conf_.getParameter("EffFolderName"); + vtxFolderName_ = conf_.getParameter("VtxFolderName"); + instLumiFolderName_ = conf_.getParameter("InstLumiFolderName"); +} + +SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) + LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras: Destructor" << endl; +} + +void SiPixelPhase1EfficiencyExtras::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) {} + +//------------------------------------------------------------------ +// Method called for every event +//------------------------------------------------------------------ +void SiPixelPhase1EfficiencyExtras::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + iBooker.setCurrentFolder(effFolderName_); + + //Get the existing histos + MonitorElement* vtx_v_lumi = iGetter.get(vtxFolderName_ + "/NumberOfGoodPVtxVsLS_GenTk"); + + MonitorElement* scalLumi_v_lumi = iGetter.get(instLumiFolderName_ + "/lumiVsLS"); + + MonitorElement* eff_v_lumi_forward = + iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXDisk_PXForward"); + + MonitorElement* eff_v_lumi_barrel = + iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXLayer_PXBarrel"); + + //set up some booleans that will tell us which graphs to create + bool createNvtx = true; + bool createInstLumi = true; + + //check which of the MEs exist and respond appropriately + if (!eff_v_lumi_forward) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no hitefficiency_per_Lumisection_per_PXDisk_PXForward ME is available in " << effFolderName_ << std::endl; + return; + } + if (!eff_v_lumi_barrel) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no hitefficiency_per_Lumisection_per_PXLayer_PXBarrel ME is available in " << effFolderName_ << std::endl; + return; + } + if (!vtx_v_lumi) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no NumberOfGoodPVtxVsLS_GenTK ME is available in " << vtxFolderName_ << std::endl; + createNvtx = false; + } + if (!scalLumi_v_lumi) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no lumiVsLS ME is available in " << instLumiFolderName_ << std::endl; + createInstLumi = false; + } + + //If the existing MEs are empty, set the boolean to skip booking + if (vtx_v_lumi && vtx_v_lumi->getEntries() == 0) + createNvtx = false; + if (scalLumi_v_lumi && scalLumi_v_lumi->getEntries() == 0) + createInstLumi = false; + + double eff = 0.0; + + //Will pass if nvtx ME exists and is not empty + if (createNvtx) { + //Book new histos + MonitorElement* eff_v_vtx_barrel = + iBooker.book2D("hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel", + "hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel; meanNvtx; PXLayer", + 500, + 0, + 100, + 3, + .5, + 3.5); + + MonitorElement* eff_v_vtx_forward = + iBooker.book2D("hitefficiency_per_meanNvtx_per_PXDisk_PXForward", + "hitefficiency_per_meanNvtx_per_PXDisk_PXForward; meanNvtx; PXDisk", + 500, + 0, + 100, + 7, + -3.5, + 3.5); + + //initialize variables + int numLumiNvtx = int(vtx_v_lumi->getNbinsX()); + double nvtx = 0.0; + int binNumVtx = 0; + + //For loop to loop through lumisections + for (int iLumi = 1; iLumi < numLumiNvtx - 1; iLumi++) { + //get the meanNvtx for each lumi + nvtx = vtx_v_lumi->getBinContent(iLumi); + + //Filter out useless iterations + if (nvtx != 0) { + //Grab the bin number for the nvtx + binNumVtx = eff_v_vtx_barrel->getTH2F()->FindBin(nvtx); + + //loop through the layers + for (int iLayer = 1; iLayer < 8; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_vtx_forward->setBinContent(binNumVtx, iLayer, eff); + } + + //loop through the layers + for (int iLayer = 1; iLayer < 5; iLayer++) { + //get the efficiency for each lumi at each layer + eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); + + //set the efficiency + eff_v_vtx_barrel->setBinContent(binNumVtx, iLayer, eff); + } + } + } + } + // Will pass if InstLumi ME exists and is not empty + if (createInstLumi) { + //Get the max value of inst lumi for plot + int yMax2 = scalLumi_v_lumi->getTProfile()->GetMaximum(); + yMax2 = yMax2 + yMax2 * .1; + + //Book new histos + MonitorElement* eff_v_scalLumi_barrel = + iBooker.book2D("hitefficiency_per_scalLumi_per_PXLayer_PXBarrel", + "hitefficiency_per_scalLumi_per_PXLayer_PXBarrel; scal inst lumi E30; PXLayer", + 500, + 0, + yMax2, + 3, + .5, + 3.5); + + MonitorElement* eff_v_scalLumi_forward = + iBooker.book2D("hitefficiency_per_scalLumi_per_PXDisk_PXForward", + "hitefficiency_per_scalLumi_per_PXDisk_PXForward; scal inst lumi E30; PXDisk", + 500, + 0, + yMax2, + 7, + -3.5, + 3.5); + + //initialize variables + int numLumiScal = int(scalLumi_v_lumi->getNbinsX()); + double scalLumi = 0.0; + int binNumScal = 0; + + //For loop to loop through lumisections + for (int iLumi = 1; iLumi < numLumiScal - 1; iLumi++) { + //get the inst lumi for each lumi + scalLumi = scalLumi_v_lumi->getBinContent(iLumi); + + //Filter out useless iterations + if (scalLumi != 0) { + //Grab the bin number for the inst lumi + binNumScal = eff_v_scalLumi_barrel->getTH2F()->FindBin(scalLumi); + + //loop through the layers + for (int iLayer = 1; iLayer < 8; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_scalLumi_forward->setBinContent(binNumScal, iLayer, eff); + } + + //loop through the layers + for (int iLayer = 1; iLayer < 5; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_scalLumi_barrel->setBinContent(binNumScal, iLayer, eff); + } + } + } + } else + return; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(SiPixelPhase1EfficiencyExtras); diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py new file mode 100644 index 0000000000000..ae66b29b0a15e --- /dev/null +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + + +SiPixelPhase1EfficiencyExtras = DQMEDHarvester("SiPixelPhase1EfficiencyExtras", + EffFolderName = cms.string('PixelPhase1/Tracks/'), + VtxFolderName = cms.string('Tracking/TrackParameters/generalTracks/GeneralProperties/'), + InstLumiFolderName = cms.string('HLT/LumiMonitoring/') +) diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py index 9c2fa7ce0aec6..2b43529e72d7f 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py @@ -74,9 +74,8 @@ xlabel = "#valid/(#valid+#missing)", dimensions = 1, specs = VPSet( - #2D profile maps per layer StandardSpecification2DProfile, - + #profiles per layer and shell Specification(PerLadder).groupBy("PXBarrel/Shell/PXLayer/SignedLadder") .reduce("MEAN") @@ -94,9 +93,20 @@ Specification().groupBy("PXForward/PXDisk") .reduce("MEAN") .groupBy("PXForward", "EXTEND_X") - .save() + .save(), - #StandardSpecificationPixelmapProfile + Specification(PerLayer2D) + .groupBy("PXBarrel/PXLayer/Lumisection") + .groupBy("PXBarrel/PXLayer", "EXTEND_X") + .groupBy("PXBarrel", "EXTEND_Y") + .reduce("MEAN") + .save(), + Specification(PerLayer2D) + .groupBy("PXForward/PXDisk/Lumisection") + .groupBy("PXForward/PXDisk", "EXTEND_X") + .groupBy("PXForward", "EXTEND_Y") + .reduce("MEAN") + .save(), ) ) From 0e9bc6b023bc4617711c5d61e20fd79c882663dd Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 23 Aug 2021 23:47:33 +0200 Subject: [PATCH 082/923] Migrate ESZeroSuppressionProducer to esConsumes() --- .../interface/ESZeroSuppressionProducer.h | 13 +++++----- .../src/ESZeroSuppressionProducer.cc | 26 ++++++++----------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h b/SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h index 8fbdc0d52770f..cbce8def69262 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h +++ b/SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h @@ -26,14 +26,13 @@ class ESZeroSuppressionProducer : public edm::stream::EDProducer<> { void produce(edm::Event &event, const edm::EventSetup &eventSetup) override; private: - std::string digiProducer_; - std::string ESdigiCollection_; - std::string ESZSdigiCollection_; + const std::string digiProducer_; + const std::string ESdigiCollection_; + const std::string ESZSdigiCollection_; - edm::ESHandle esthresholds_; - edm::ESHandle espeds_; - - edm::EDGetTokenT ES_token; + const edm::EDGetTokenT ES_token; + const edm::ESGetToken esthresholdsToken_; + const edm::ESGetToken espedsToken_; }; #endif diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc b/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc index 91d1a07a0f85f..4c168d120dd21 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc +++ b/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc @@ -2,27 +2,23 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h" -ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet &ps) { - digiProducer_ = ps.getParameter("digiProducer"); - ESdigiCollection_ = ps.getParameter("ESdigiCollection"); - ESZSdigiCollection_ = ps.getParameter("ESZSdigiCollection"); - +ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet &ps) : + digiProducer_(ps.getParameter("digiProducer")), + ESdigiCollection_(ps.getParameter("ESdigiCollection")), + ESZSdigiCollection_(ps.getParameter("ESZSdigiCollection")), + ES_token(consumes(edm::InputTag(digiProducer_))), + esthresholdsToken_(esConsumes()), + espedsToken_(esConsumes()) { produces(ESZSdigiCollection_); - - ES_token = consumes(edm::InputTag(digiProducer_)); - ; } ESZeroSuppressionProducer::~ESZeroSuppressionProducer() {} void ESZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { - eventSetup.get().get(esthresholds_); - const ESThresholds *thresholds = esthresholds_.product(); - - eventSetup.get().get(espeds_); - const ESPedestals *pedestals = espeds_.product(); + const ESThresholds& thresholds = eventSetup.getData(esthresholdsToken_); + const ESPedestals& pedestals = eventSetup.getData(espedsToken_); - float ts2Threshold = thresholds->getTS2Threshold(); + float ts2Threshold = thresholds.getTS2Threshold(); edm::Handle ESDigis; @@ -39,7 +35,7 @@ void ESZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSetup for (ESDigiCollection::const_iterator i(ESDigis->begin()); i != ESDigis->end(); ++i) { ESDataFrame dataframe = (*i); - ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id()); + ESPedestals::const_iterator it_ped = pedestals.find(dataframe.id()); if (dataframe.sample(1).adc() > (ts2Threshold + it_ped->getMean())) { // std::cout< Date: Mon, 23 Aug 2021 23:58:18 +0200 Subject: [PATCH 083/923] Switch T3 to a different pxibarmaterial.xml --- Configuration/Geometry/python/dict2021Geometry.py | 2 +- Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml | 2 +- Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 6fdf042f905ea..6461b92b41d59 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -601,7 +601,7 @@ '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/v3/pixbarmaterial.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladder.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull0.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull1.xml', diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml index 7e43b537e9595..e4f8afe1ef8e4 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -39,7 +39,7 @@ - + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py index 09e627234f5d7..e5b7bdb572d2d 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -40,7 +40,7 @@ '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/v3/pixbarmaterial.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladder.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull0.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull1.xml', From 370f7fcc9a59eb7466ad5535ae4d9a347e150b26 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Tue, 24 Aug 2021 00:10:13 +0200 Subject: [PATCH 084/923] Remove dict2021Geometry.py from this PR --- Configuration/Geometry/python/dict2021Geometry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index c9f40d841b029..f90b5b8f4081e 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -573,7 +573,7 @@ '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/v3/pixbarmaterial.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', From ca07bd757fd7d6484ebcb4f462e98a459962dcb4 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Tue, 24 Aug 2021 08:47:49 +0200 Subject: [PATCH 085/923] resolve conflicts --- .../SiStripPlugins/test/testSiStripPayloadInspector.cpp | 2 +- CondCore/Utilities/src/PayloadInspector.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 012152eb49e39..152e3b755061a 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) { std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline"; cond::Time_t start = static_cast(132440); cond::Time_t end = static_cast(285368); - boost::python::dict inputs; + py::dict inputs; edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl; diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index 8df6d785274e4..cb08ecd10b5cd 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -75,10 +75,10 @@ namespace cond { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - boost::python::tuple entry = boost::python::extract(tagsWithTimeBoundaries[i]); - std::string tagName = boost::python::extract(entry[0]); - std::string time0s = boost::python::extract(entry[1]); - std::string time1s = boost::python::extract(entry[2]); + boost::python::tuple entry = tagsWithTimeBoundaries[i].cast(); + std::string tagName = entry[0].cast(); + std::string time0s = entry[1].cast(); + std::string time1s = entry[2].cast(); cond::Time_t time0 = std::stoull(time0s); cond::Time_t time1 = std::stoull(time1s); tags[i] = std::make_tuple(tagName, time0, time1); From 6bc85e65ec7ccdbb77e05b424c96f261be675a6c Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Tue, 24 Aug 2021 09:21:22 +0200 Subject: [PATCH 086/923] apply coding rules --- .../SiPixelRecHits/interface/pixelCPEforGPU.h | 23 +++++++++---------- .../SiPixelRecHits/src/PixelCPEFast.cc | 16 ++++++------- .../plugins/BrokenLineFitOnGPU.h | 4 ++-- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h index cee2626025116..a67da35572a1d 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h @@ -16,13 +16,11 @@ namespace CPEFastParametrisation { // From https://cmssdt.cern.ch/dxr/CMSSW/source/CondFormats/SiPixelTransient/src/SiPixelGenError.cc#485-486 // qbin: int (0-4) describing the charge of the cluster // [0: 1.5 smallest charge, bin4-> largest charge // whereas in CondFormats/SiPixelTransient/src/SiPixelGenError.cc it is the opposite - // so we reverse the bin here -> GenErrorQBins - 1 - bin - cp.status[ic].qBin = GenErrorQBins - 1 - bin; + // so we reverse the bin here -> kGenErrorQBins - 1 - bin + cp.status[ic].qBin = CPEFastParametrisation::kGenErrorQBins - 1 - bin; cp.status[ic].isOneX = isOneX; cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX; cp.status[ic].isOneY = isOneY; @@ -369,8 +368,8 @@ namespace pixelCPEforGPU { auto xoff = -float(phase1PixelTopology::xOffset) * comParams.thePitchX; int low_value = 0; - int high_value = NumErrorBins - 1; - int bin_value = float(NumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff); + int high_value = CPEFastParametrisation::kNumErrorBins - 1; + int bin_value = float(CPEFastParametrisation::kNumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff); // return estimated bin value truncated to [0, 15] int jx = std::clamp(bin_value, low_value, high_value); diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 7d686ccde26e2..b690cc7b8ad32 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -209,7 +209,7 @@ void PixelCPEFast::fillParamsForGpu() { // sample xerr as function of position auto const xoff = float(phase1PixelTopology::xOffset) * commonParamsGPU_.thePitchX; - for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { + for (int ix = 0; ix < CPEFastParametrisation::kNumErrorBins; ++ix) { auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f); auto gvx = p.theOrigin.x() - x; auto gvy = p.theOrigin.y(); @@ -225,7 +225,7 @@ void PixelCPEFast::fillParamsForGpu() { #ifdef EDM_ML_DEBUG // sample yerr as function of position auto const yoff = float(phase1PixelTopology::yOffset) * commonParamsGPU_.thePitchY; - for (int ix = 0; ix < CPEFastParametrisation::NumErrorBins; ++ix) { + for (int ix = 0; ix < CPEFastParametrisation::kNumErrorBins; ++ix) { auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f); auto gvx = p.theOrigin.x() + 40.f * commonParamsGPU_.thePitchY; auto gvy = p.theOrigin.y() - y; @@ -244,7 +244,7 @@ void PixelCPEFast::fillParamsForGpu() { auto aveCB = cp.cotbeta; // sample x by charge - int qbin = CPEFastParametrisation::GenErrorQBins; // low charge + int qbin = CPEFastParametrisation::kGenErrorQBins; // low charge int k = 0; for (int qclus = 1000; qclus < 200000; qclus += 1000) { errorFromTemplates(p, cp, qclus); @@ -260,16 +260,16 @@ void PixelCPEFast::fillParamsForGpu() { << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2 << std::endl; #endif // EDM_ML_DEBUG } - assert(k <= CPEFastParametrisation::GenErrorQBins); + assert(k <= CPEFastParametrisation::kGenErrorQBins); // fill the rest (sometimes bin 4 is missing) - for (int kk = k; kk < CPEFastParametrisation::GenErrorQBins; ++kk) { + for (int kk = k; kk < CPEFastParametrisation::kGenErrorQBins; ++kk) { g.xfact[kk] = g.xfact[k - 1]; g.yfact[kk] = g.yfact[k - 1]; g.minCh[kk] = g.minCh[k - 1]; } auto detx = 1.f / g.xfact[0]; auto dety = 1.f / g.yfact[0]; - for (int kk = 0; kk < CPEFastParametrisation::GenErrorQBins; ++kk) { + for (int kk = 0; kk < CPEFastParametrisation::kGenErrorQBins; ++kk) { g.xfact[kk] *= detx; g.yfact[kk] *= dety; } @@ -277,9 +277,9 @@ void PixelCPEFast::fillParamsForGpu() { float ys = 8.f - 4.f; // apperent bias of half pixel (see plot) // plot: https://indico.cern.ch/event/934821/contributions/3974619/attachments/2091853/3515041/DigilessReco.pdf page 25 // sample yerr as function of "size" - for (int iy = 0; iy < CPEFastParametrisation::NumErrorBins; ++iy) { + for (int iy = 0; iy < CPEFastParametrisation::kNumErrorBins; ++iy) { ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3) - if (CPEFastParametrisation::NumErrorBins - 1 == iy) + if (CPEFastParametrisation::kNumErrorBins - 1 == iy) ys += 8.f; // last bin for "overflow" // cp.cotalpha = ys*(commonParamsGPU_.thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below) cp.cotbeta = std::copysign(ys * (commonParamsGPU_.thePitchY / (8.f * thickness)), aveCB); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h index dafafa6b47a55..d572c8010cdfb 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/BrokenLineFitOnGPU.h @@ -90,7 +90,7 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, #ifdef YERR_FROM_DC auto const &dp = hhp->cpeParams().detParams(hhp->detectorIndex(hit)); auto status = hhp->status(hit); - int qbin = CPEFastParametrisation::GenErrorQBins - 1 - status.qBin; + int qbin = CPEFastParametrisation::kGenErrorQBins - 1 - status.qBin; assert(qbin >= 0 && qbin < 5); bool nok = (status.isBigY | status.isOneY); // compute cotanbeta and use it to recompute error @@ -99,7 +99,7 @@ __global__ void kernel_BLFastFit(Tuples const *__restrict__ foundNtuplets, int bin = int(cb * (float(phase1PixelTopology::pixelThickess) / float(phase1PixelTopology::pixelPitchY)) * 8.f) - 4; int low_value = 0; - int high_value = CPEFastParametrisation::NumErrorBins - 1; + int high_value = CPEFastParametrisation::kNumErrorBins - 1; // return estimated bin value truncated to [0, 15] bin = std::clamp(bin, low_value, high_value); float yerr = dp.sigmay[bin] * 1.e-4f; // toCM From 7ee467ad0b5f90e0cd191301a2592ace73de1775 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee Date: Tue, 24 Aug 2021 09:42:43 +0200 Subject: [PATCH 087/923] delete the unused parameter in config instead of modifying the source c code --- PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc | 4 ++-- PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc | 4 ++-- .../PatAlgos/python/producersLayer1/electronProducer_cfi.py | 1 + .../PatAlgos/python/producersLayer1/photonProducer_cfi.py | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index 34712c9334355..ad05429fab5a6 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -1319,8 +1319,8 @@ void PATElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr electronIDSourcesPSet.setAllowAnything(); iDesc .addNode( - edm::ParameterDescription("electronIDSources", electronIDSourcesPSet, true) xor - edm::ParameterDescription("electronIDSource", edm::InputTag(), true)) + edm::ParameterDescription("electronIDSource", edm::InputTag(), true) xor + edm::ParameterDescription("electronIDSources", electronIDSourcesPSet, true)) ->setComment("input with electron ID variables"); // mini-iso diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index 108208c87f795..0de95e311a2f2 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -691,8 +691,8 @@ void PATPhotonProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip edm::ParameterSetDescription photonIDSourcesPSet; photonIDSourcesPSet.setAllowAnything(); iDesc - .addNode(edm::ParameterDescription("photonIDSources", photonIDSourcesPSet, true) xor - edm::ParameterDescription("photonIDSource", edm::InputTag(), true)) + .addNode(edm::ParameterDescription("photonIDSource", edm::InputTag(), true) xor + edm::ParameterDescription("photonIDSources", photonIDSourcesPSet, true)) ->setComment("input with photon ID variables"); // IsoDeposit configurables diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py index c4edcb674efe5..c7c2222d302b6 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/electronProducer_cfi.py @@ -98,3 +98,4 @@ miniIsoParamsB = [0.05, 0.2, 10.0, 0.0, 0.000, 0.000, 0.00, 0.0, 0.0], ) +del patElectrons.electronIDSource diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py b/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py index d1f189ccb0793..b587063146f8a 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/photonProducer_cfi.py @@ -71,3 +71,4 @@ hcalPFClusterIsoMap = "", addPuppiIsolation = False ) +del patPhotons.photonIDSource From 9e32e5f3813dc7ff5519e9c8d2680304b2dc066c Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 23 Jul 2021 09:10:25 +0200 Subject: [PATCH 088/923] add dqm harvested file opening capability in legacyiohelper --- DQMServices/Core/interface/LegacyIOHelper.h | 44 +++++++++- DQMServices/Core/src/LegacyIOHelper.cc | 96 +++++++++++++++++++++ 2 files changed, 138 insertions(+), 2 deletions(-) diff --git a/DQMServices/Core/interface/LegacyIOHelper.h b/DQMServices/Core/interface/LegacyIOHelper.h index 0a08fc05d2739..c4d5375de09d7 100644 --- a/DQMServices/Core/interface/LegacyIOHelper.h +++ b/DQMServices/Core/interface/LegacyIOHelper.h @@ -2,7 +2,17 @@ #define DQMSERVICES_CORE_LEGACYIOHELPER_H #include "DQMServices/Core/interface/DQMStore.h" - +#include +#include +#include "TFile.h" +#include "TROOT.h" +#include "TKey.h" +#include "TClass.h" +#include "TSystem.h" +#include "TBufferFile.h" +#include +#include +#include // This class encapsulates the TDirectory based file format used for DQMGUI // uploads and many other use cases. // This should be part of `DQMFileSaver`, however since DQMServices/Components @@ -16,8 +26,14 @@ class LegacyIOHelper { // use internal type here since we call this from the DQMStore itself. typedef dqm::implementation::DQMStore DQMStore; typedef dqm::legacy::MonitorElement MonitorElement; - LegacyIOHelper(DQMStore* dqmstore) : dbe_(dqmstore){}; + typedef dqm::harvesting::DQMStore HDQMStore; + typedef dqm::harvesting::MonitorElement HMonitorElement; + + using MEMap = std::set; + + LegacyIOHelper(DQMStore* dqmstore) : dbe_(dqmstore){}; + LegacyIOHelper(HDQMStore* hdqmstore) : dbe_(hdqmstore){}; // Replace or append to `filename`, a TDirectory ROOT file. If a run number // is passed, the paths are rewritten to the "Run Summary" format used by // DQMGUI. The run number does not affect which MEs are saved; this code only @@ -32,9 +48,33 @@ class LegacyIOHelper { bool saveall = true, std::string const& fileupdate = "RECREATE"); + bool open(std::string const& filename, + std::string const& path = "", + uint32_t const run = 0); + private: + template + void getMEName(T* h, const std::string& toppath, std::string& meName){ + std::ostringstream fullpath; + fullpath << gDirectory->GetPath() << "/" << h->GetName(); + std::string dirpath = fullpath.str(); + // Search for the substring in string + size_t pos = dirpath.find(toppath); + if (pos != std::string::npos) { + dirpath.erase(pos, toppath.length()); + } + std::string rsummary = "/Run summary"; + pos = dirpath.find(rsummary); + if (pos != std::string::npos) { + dirpath.erase(pos, rsummary.length()); + } + std::cout << dirpath << std::endl; + meName = dirpath; + } + bool readdir(TDirectory *dir, const std::string& toppath); bool createDirectoryIfNeededAndCd(const std::string& path); DQMStore* dbe_; + MEMap data_; }; #endif diff --git a/DQMServices/Core/src/LegacyIOHelper.cc b/DQMServices/Core/src/LegacyIOHelper.cc index 3e5e6831bc884..1a0da021b7842 100644 --- a/DQMServices/Core/src/LegacyIOHelper.cc +++ b/DQMServices/Core/src/LegacyIOHelper.cc @@ -164,3 +164,99 @@ bool LegacyIOHelper::createDirectoryIfNeededAndCd(const std::string &path) { return true; } + +bool LegacyIOHelper::readdir(TDirectory *dir, const std::string& toppath) { + TDirectory *dirsav = gDirectory; + //cout << "Inside:" << gDirectory->GetPath() << std::endl; + TIter next(dir->GetListOfKeys()); + TKey *key; + while ((key = (TKey*)next())) { + if (key->IsFolder()) { + //cout << key->GetName() << std::endl; + dir->cd(key->GetName()); + TDirectory *subdir = gDirectory; + readdir(subdir, toppath); + dirsav->cd(); + continue; + } else { + TClass *cl = gROOT->GetClass(key->GetClassName()); + std::string meName; + if(cl->InheritsFrom("TProfile")) { + TProfile *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile(meName, h)); + } + } + else if(cl->InheritsFrom("TProfile2D")) { + TProfile2D *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile2D(meName, h)); + } + } + else if(cl->InheritsFrom("TH1F")) { + TH1F *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1D(meName, h)); + } + } + else if(cl->InheritsFrom("TH1S")) { + TH1S *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1S(meName, h)); + } + } + else if(cl->InheritsFrom("TH1D")) { + TH1D *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1DD(meName, h)); + } + } + else if(cl->InheritsFrom("TH2F")) { + TH2F *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2D(meName, h)); + } + } + else if(cl->InheritsFrom("TH2S")) { + TH2S *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2S(meName, h)); + } + } + else if(cl->InheritsFrom("TH2D")) { + TH2D *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2DD(meName, h)); + } + } + else if(cl->InheritsFrom("TH3F")) { + TH3F *h = key->ReadObject(); + if(h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book3D(meName, h)); + } + } + + } + } + if(!data_.empty()) return true; + return false; +} + +bool LegacyIOHelper::open(std::string const& filename, std::string const& path, uint32_t const run){ + TFile* f1 = TFile::Open(filename.c_str()); + if(!f1) return false; + std::ostringstream toppath; + toppath << filename << ":/DQMData/Run " << run << "/"; + std::string dirpath = toppath.str(); + std::cout << dirpath << std::endl; + return readdir(f1, dirpath); +} From ea51f5641494b66c946d3f0bb98e1977f0a64d91 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 23 Jul 2021 09:11:03 +0200 Subject: [PATCH 089/923] use legacy io helper in sistripofflineDQM --- DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc index e3b51fcba6dfa..530eaeded91c0 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc @@ -37,6 +37,7 @@ //Run Info #include "CondFormats/RunInfo/interface/RunInfo.h" +#include "DQMServices/Core/interface/LegacyIOHelper.h" #include #include @@ -202,8 +203,10 @@ bool SiStripOfflineDQM::openInputFile(DQMStore& dqm_store) { if (inputFileName_.empty()) return false; edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_; - dqm_store.open(inputFileName_, false); - return true; + dqm::harvesting::DQMStore* temp = dynamic_cast(&dqm_store); + LegacyIOHelper leo(temp); + return leo.open(inputFileName_); + //return true; } #include "FWCore/Framework/interface/MakerMacros.h" From 5a920000738a2c80e56b8a7c5e2457297c7c084c Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 20 Aug 2021 10:00:44 +0200 Subject: [PATCH 090/923] close input file after cloning histos --- DQMServices/Core/interface/LegacyIOHelper.h | 2 +- DQMServices/Core/src/LegacyIOHelper.cc | 31 ++++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/DQMServices/Core/interface/LegacyIOHelper.h b/DQMServices/Core/interface/LegacyIOHelper.h index c4d5375de09d7..4bab9eb1937a6 100644 --- a/DQMServices/Core/interface/LegacyIOHelper.h +++ b/DQMServices/Core/interface/LegacyIOHelper.h @@ -68,7 +68,7 @@ class LegacyIOHelper { if (pos != std::string::npos) { dirpath.erase(pos, rsummary.length()); } - std::cout << dirpath << std::endl; + //std::cout << dirpath << std::endl; meName = dirpath; } bool readdir(TDirectory *dir, const std::string& toppath); diff --git a/DQMServices/Core/src/LegacyIOHelper.cc b/DQMServices/Core/src/LegacyIOHelper.cc index 1a0da021b7842..c389e73b0b9d3 100644 --- a/DQMServices/Core/src/LegacyIOHelper.cc +++ b/DQMServices/Core/src/LegacyIOHelper.cc @@ -182,63 +182,72 @@ bool LegacyIOHelper::readdir(TDirectory *dir, const std::string& toppath) { TClass *cl = gROOT->GetClass(key->GetClassName()); std::string meName; if(cl->InheritsFrom("TProfile")) { - TProfile *h = key->ReadObject(); + TProfile *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->bookProfile(meName, h)); } } else if(cl->InheritsFrom("TProfile2D")) { - TProfile2D *h = key->ReadObject(); + TProfile2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->bookProfile2D(meName, h)); } } else if(cl->InheritsFrom("TH1F")) { - TH1F *h = key->ReadObject(); + TH1F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book1D(meName, h)); } } else if(cl->InheritsFrom("TH1S")) { - TH1S *h = key->ReadObject(); + TH1S *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book1S(meName, h)); } } else if(cl->InheritsFrom("TH1D")) { - TH1D *h = key->ReadObject(); + TH1D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book1DD(meName, h)); } } else if(cl->InheritsFrom("TH2F")) { - TH2F *h = key->ReadObject(); + TH2F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book2D(meName, h)); } } else if(cl->InheritsFrom("TH2S")) { - TH2S *h = key->ReadObject(); + TH2S *h =dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book2S(meName, h)); } } else if(cl->InheritsFrom("TH2D")) { - TH2D *h = key->ReadObject(); + TH2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book2DD(meName, h)); } } else if(cl->InheritsFrom("TH3F")) { - TH3F *h = key->ReadObject(); + TH3F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(0); if(h) { getMEName(h, toppath, meName); data_.insert(dbe_->book3D(meName, h)); @@ -258,5 +267,7 @@ bool LegacyIOHelper::open(std::string const& filename, std::string const& path, toppath << filename << ":/DQMData/Run " << run << "/"; std::string dirpath = toppath.str(); std::cout << dirpath << std::endl; - return readdir(f1, dirpath); + bool flag = readdir(f1, dirpath); + f1->Close(); + return flag; } From 1942df79e0254ae4f46f1c1476b6fba2041ba0e9 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 20 Aug 2021 18:37:26 +0200 Subject: [PATCH 091/923] reset residuals mean map name for summary file creation --- DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc b/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc index d9da603bbc8fc..c31818d04f2ff 100644 --- a/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc +++ b/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc @@ -150,6 +150,9 @@ void SiStripTrackerMapCreator::createForOffline(const edm::ParameterSet& tkmapPs << " with range set to 0.0 - 1.0"; trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".svg"); trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".png", 4500, 2400); + // reset the map name to ResidualsMean to restore the + // correct behaviour for the summary file creation + map_type = "ResidualsMean"; } else { edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_; From 91d5f5328f83681adcd72e538e851b4368c2360d Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 16 Aug 2021 17:19:55 +0200 Subject: [PATCH 092/923] add unit test for SiStripDQM_OfflineTkMap --- DQM/SiStripMonitorClient/test/BuildFile.xml | 4 ++++ DQM/SiStripMonitorClient/test/TestDriver.cpp | 2 ++ .../test/test_SiStripDQM_OfflineTkMap.sh | 14 ++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 DQM/SiStripMonitorClient/test/BuildFile.xml create mode 100644 DQM/SiStripMonitorClient/test/TestDriver.cpp create mode 100755 DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh diff --git a/DQM/SiStripMonitorClient/test/BuildFile.xml b/DQM/SiStripMonitorClient/test/BuildFile.xml new file mode 100644 index 0000000000000..9d51043d4d848 --- /dev/null +++ b/DQM/SiStripMonitorClient/test/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/DQM/SiStripMonitorClient/test/TestDriver.cpp b/DQM/SiStripMonitorClient/test/TestDriver.cpp new file mode 100644 index 0000000000000..2f0e0c40064da --- /dev/null +++ b/DQM/SiStripMonitorClient/test/TestDriver.cpp @@ -0,0 +1,2 @@ +#include "FWCore/Utilities/interface/TestHelper.h" +RUNTEST() diff --git a/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh new file mode 100755 index 0000000000000..8d71811739e19 --- /dev/null +++ b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh @@ -0,0 +1,14 @@ +#!/bin/bash +function die { echo $1: status $2; exit $2; } +GT=`echo ${@} | python3 -c 'import Configuration.AlCa.autoCond as AC;print(AC.autoCond["run3_data_prompt"])'` +RUN="319176" +DQMFILE="/store/group/comm_dqm/DQMGUI_data/Run2018/ZeroBias/R0003191xx/DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root" +COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $DQMFILE` +STATUS=$? +echo "xrdfs command status = "$STATUS +if [ $STATUS -eq 0 ]; then + echo "Using file ${DQMFILE} and run ${RUN}. Running in ${LOCAL_TEST_DIR}." + (cmsRun "${LOCAL_TEST_DIR}/SiStripDQM_OfflineTkMap_Template_cfg_DB.py" globalTag="$GT" runNumber="$RUN" dqmFile=" root://cms-xrd-global.cern.ch//$DQMFILE" detIdInfoFile="file.root") || die 'failed running SiStripDQM_OfflineTkMap_Template_cfg_DB.py' $? +else + die "SKIPPING test, file ${DQMFILE} not found" 0 +fi From e8bbed6f5689cb1fdb95a408daf6b4d9b732e003 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 20 Aug 2021 18:46:26 +0200 Subject: [PATCH 093/923] code-format & code-check & clean-up --- .../plugins/SiStripOfflineDQM.cc | 4 +- DQMServices/Core/interface/LegacyIOHelper.h | 29 ++-- DQMServices/Core/src/LegacyIOHelper.cc | 156 +++++++++--------- 3 files changed, 90 insertions(+), 99 deletions(-) diff --git a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc index 530eaeded91c0..6c9c29a82de8e 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc @@ -200,13 +200,13 @@ void SiStripOfflineDQM::endJob() { } bool SiStripOfflineDQM::openInputFile(DQMStore& dqm_store) { - if (inputFileName_.empty()) + if (inputFileName_.empty()) { return false; + } edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_; dqm::harvesting::DQMStore* temp = dynamic_cast(&dqm_store); LegacyIOHelper leo(temp); return leo.open(inputFileName_); - //return true; } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DQMServices/Core/interface/LegacyIOHelper.h b/DQMServices/Core/interface/LegacyIOHelper.h index 4bab9eb1937a6..ada1adbbd5ed9 100644 --- a/DQMServices/Core/interface/LegacyIOHelper.h +++ b/DQMServices/Core/interface/LegacyIOHelper.h @@ -2,17 +2,17 @@ #define DQMSERVICES_CORE_LEGACYIOHELPER_H #include "DQMServices/Core/interface/DQMStore.h" -#include -#include +#include +#include #include "TFile.h" #include "TROOT.h" #include "TKey.h" #include "TClass.h" #include "TSystem.h" #include "TBufferFile.h" -#include -#include -#include +#include +#include +#include // This class encapsulates the TDirectory based file format used for DQMGUI // uploads and many other use cases. // This should be part of `DQMFileSaver`, however since DQMServices/Components @@ -27,13 +27,13 @@ class LegacyIOHelper { typedef dqm::implementation::DQMStore DQMStore; typedef dqm::legacy::MonitorElement MonitorElement; - typedef dqm::harvesting::DQMStore HDQMStore; - typedef dqm::harvesting::MonitorElement HMonitorElement; + typedef dqm::harvesting::DQMStore HarvestedDQMStore; + typedef dqm::harvesting::MonitorElement HarvestedMonitorElement; - using MEMap = std::set; + using MEMap = std::set; LegacyIOHelper(DQMStore* dqmstore) : dbe_(dqmstore){}; - LegacyIOHelper(HDQMStore* hdqmstore) : dbe_(hdqmstore){}; + LegacyIOHelper(HarvestedDQMStore* hdqmstore) : dbe_(hdqmstore){}; // Replace or append to `filename`, a TDirectory ROOT file. If a run number // is passed, the paths are rewritten to the "Run Summary" format used by // DQMGUI. The run number does not affect which MEs are saved; this code only @@ -48,13 +48,11 @@ class LegacyIOHelper { bool saveall = true, std::string const& fileupdate = "RECREATE"); - bool open(std::string const& filename, - std::string const& path = "", - uint32_t const run = 0); + bool open(std::string const& filename, std::string const& path = "", uint32_t const run = 0); private: - template - void getMEName(T* h, const std::string& toppath, std::string& meName){ + template + void getMEName(T* h, const std::string& toppath, std::string& meName) { std::ostringstream fullpath; fullpath << gDirectory->GetPath() << "/" << h->GetName(); std::string dirpath = fullpath.str(); @@ -68,10 +66,9 @@ class LegacyIOHelper { if (pos != std::string::npos) { dirpath.erase(pos, rsummary.length()); } - //std::cout << dirpath << std::endl; meName = dirpath; } - bool readdir(TDirectory *dir, const std::string& toppath); + bool readdir(TDirectory* dir, const std::string& toppath); bool createDirectoryIfNeededAndCd(const std::string& path); DQMStore* dbe_; MEMap data_; diff --git a/DQMServices/Core/src/LegacyIOHelper.cc b/DQMServices/Core/src/LegacyIOHelper.cc index c389e73b0b9d3..fd484a86729e6 100644 --- a/DQMServices/Core/src/LegacyIOHelper.cc +++ b/DQMServices/Core/src/LegacyIOHelper.cc @@ -1,4 +1,5 @@ #include "DQMServices/Core/interface/LegacyIOHelper.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -165,14 +166,14 @@ bool LegacyIOHelper::createDirectoryIfNeededAndCd(const std::string &path) { return true; } -bool LegacyIOHelper::readdir(TDirectory *dir, const std::string& toppath) { +bool LegacyIOHelper::readdir(TDirectory *dir, const std::string &toppath) { TDirectory *dirsav = gDirectory; - //cout << "Inside:" << gDirectory->GetPath() << std::endl; + LogDebug("LegacyIOHelper") << "Inside:" << gDirectory->GetPath() << std::endl; TIter next(dir->GetListOfKeys()); TKey *key; - while ((key = (TKey*)next())) { + while ((key = (TKey *)next())) { if (key->IsFolder()) { - //cout << key->GetName() << std::endl; + LogDebug("LegacyIOHelper") << key->GetName() << std::endl; dir->cd(key->GetName()); TDirectory *subdir = gDirectory; readdir(subdir, toppath); @@ -181,92 +182,85 @@ bool LegacyIOHelper::readdir(TDirectory *dir, const std::string& toppath) { } else { TClass *cl = gROOT->GetClass(key->GetClassName()); std::string meName; - if(cl->InheritsFrom("TProfile")) { - TProfile *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->bookProfile(meName, h)); - } + if (cl->InheritsFrom("TProfile")) { + TProfile *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile(meName, h)); + } + } else if (cl->InheritsFrom("TProfile2D")) { + TProfile2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile2D(meName, h)); + } + } else if (cl->InheritsFrom("TH1F")) { + TH1F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1D(meName, h)); + } + } else if (cl->InheritsFrom("TH1S")) { + TH1S *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1S(meName, h)); + } + } else if (cl->InheritsFrom("TH1D")) { + TH1D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1DD(meName, h)); + } + } else if (cl->InheritsFrom("TH2F")) { + TH2F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2D(meName, h)); + } + } else if (cl->InheritsFrom("TH2S")) { + TH2S *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2S(meName, h)); + } + } else if (cl->InheritsFrom("TH2D")) { + TH2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2DD(meName, h)); + } + } else if (cl->InheritsFrom("TH3F")) { + TH3F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book3D(meName, h)); + } } - else if(cl->InheritsFrom("TProfile2D")) { - TProfile2D *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->bookProfile2D(meName, h)); - } - } - else if(cl->InheritsFrom("TH1F")) { - TH1F *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book1D(meName, h)); - } - } - else if(cl->InheritsFrom("TH1S")) { - TH1S *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book1S(meName, h)); - } - } - else if(cl->InheritsFrom("TH1D")) { - TH1D *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book1DD(meName, h)); - } - } - else if(cl->InheritsFrom("TH2F")) { - TH2F *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book2D(meName, h)); - } - } - else if(cl->InheritsFrom("TH2S")) { - TH2S *h =dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book2S(meName, h)); - } - } - else if(cl->InheritsFrom("TH2D")) { - TH2D *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book2DD(meName, h)); - } - } - else if(cl->InheritsFrom("TH3F")) { - TH3F *h = dynamic_cast(key->ReadObject()->Clone()); - h->SetDirectory(0); - if(h) { - getMEName(h, toppath, meName); - data_.insert(dbe_->book3D(meName, h)); - } - } - } } - if(!data_.empty()) return true; + if (!data_.empty()) + return true; return false; } -bool LegacyIOHelper::open(std::string const& filename, std::string const& path, uint32_t const run){ - TFile* f1 = TFile::Open(filename.c_str()); - if(!f1) return false; +bool LegacyIOHelper::open(std::string const &filename, std::string const &path, uint32_t const run) { + TFile *f1 = TFile::Open(filename.c_str()); + if (!f1) + return false; std::ostringstream toppath; toppath << filename << ":/DQMData/Run " << run << "/"; std::string dirpath = toppath.str(); - std::cout << dirpath << std::endl; + edm::LogPrint("LegacyIOHelper") << dirpath << std::endl; bool flag = readdir(f1, dirpath); f1->Close(); return flag; From 48a7b8d62591e657c187c9aa1abf3321758d5174 Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Tue, 24 Aug 2021 10:57:27 +0200 Subject: [PATCH 094/923] fixed some edge-cases in HLT-Patatrack customisations --- .../python/customizeHLTforPatatrack.py | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py index 218b95007672c..f85e11f5f08ac 100644 --- a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py +++ b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py @@ -97,8 +97,7 @@ 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 + # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTDoLocalPixelSequence = cms.Sequence() @@ -225,11 +224,10 @@ def customisePixelLocalReconstruction(process): # customisation for running the "Patatrack" pixel track reconstruction def customisePixelTrackReconstruction(process): - if not 'HLTRecoPixelTracksSequence' in process.__dict__: + if not all(seq in process.__dict__ for seq in ['HLTRecoPixelTracksSequence', 'HLTRecopixelvertexingSequence']): return process - - # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases + # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTRecoPixelTracksSequence = cms.Sequence() process.HLTRecopixelvertexingSequence = cms.Sequence() @@ -347,15 +345,16 @@ def customisePixelTrackReconstruction(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__: + hasHLTEcalPreshowerSeq = any(seq in process.__dict__ for seq in ['HLTDoFullUnpackingEgammaEcalMFSequence', 'HLTDoFullUnpackingEgammaEcalSequence']) + if not (hasHLTEcalPreshowerSeq or 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence' in process.__dict__): return process + # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases - # 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() + if hasHLTEcalPreshowerSeq: + process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence() + process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence() # Event Setup @@ -501,22 +500,22 @@ def customiseEcalLocalReconstruction(process): 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 + if hasHLTEcalPreshowerSeq: + 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.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask) - process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( - process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, - process.HLTPreshowerTask) + process.HLTDoFullUnpackingEgammaEcalTask = cms.Task( + process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, + process.HLTPreshowerTask) - process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence( - process.HLTDoFullUnpackingEgammaEcalTask) - - process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence( - process.HLTDoFullUnpackingEgammaEcalTask) + process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence( + process.HLTDoFullUnpackingEgammaEcalTask) + process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence( + process.HLTDoFullUnpackingEgammaEcalTask) # done return process @@ -524,13 +523,14 @@ def customiseEcalLocalReconstruction(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__: + hasHLTDoLocalHcalSeq = 'HLTDoLocalHcalSequence' in process.__dict__ + if not (hasHLTDoLocalHcalSeq or 'HLTStoppedHSCPLocalHcalReco' in process.__dict__): return process + # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases - # FIXME replace the Sequences with empty ones to avoid exanding them during the (re)definition of Modules and EDAliases - - process.HLTDoLocalHcalSequence = cms.Sequence() + if hasHLTDoLocalHcalSeq: + process.HLTDoLocalHcalSequence = cms.Sequence() process.HLTStoppedHSCPLocalHcalReco = cms.Sequence() @@ -603,19 +603,19 @@ def customiseHcalLocalReconstruction(process): # 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) + if hasHLTDoLocalHcalSeq: + 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 @@ -635,13 +635,15 @@ def customiseHcalLocalReconstruction(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 + if 'hltPixelTracksCUDA' in process.__dict__: + # 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 + if 'hltPixelTracksSoA' in process.__dict__: + # configure CPU pixel tracks for triplets + process.hltPixelTracksSoA.cpu.minHitsPerNtuplet = 3 + process.hltPixelTracksSoA.cpu.includeJumpingForwardDoublets = True # done return process From 22407accf404ccb6ef15131d8e646ed290225015 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Tue, 24 Aug 2021 11:41:31 +0200 Subject: [PATCH 095/923] fixes --- CondCore/Utilities/src/CondDBFetch.cc.rej | 13 ------------- CondCore/Utilities/src/PayloadInspector.cc | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 CondCore/Utilities/src/CondDBFetch.cc.rej diff --git a/CondCore/Utilities/src/CondDBFetch.cc.rej b/CondCore/Utilities/src/CondDBFetch.cc.rej deleted file mode 100644 index 2528fb80fbcf6..0000000000000 --- a/CondCore/Utilities/src/CondDBFetch.cc.rej +++ /dev/null @@ -1,13 +0,0 @@ ---- CondCore/Utilities/src/CondDBFetch.cc -+++ CondCore/Utilities/src/CondDBFetch.cc -@@ -344,9 +344,7 @@ - std::string payloadTypeName; - bool found = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo); - if (!found) -- throwException( -- "Payload with id " + payloadId + " has not been found in the database.", -- "fetch"); -+ throwException("Payload with id " + payloadId + " has not been found in the database.", "fetch"); - return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr); - } - diff --git a/CondCore/Utilities/src/PayloadInspector.cc b/CondCore/Utilities/src/PayloadInspector.cc index cb08ecd10b5cd..e6987122d4a12 100644 --- a/CondCore/Utilities/src/PayloadInspector.cc +++ b/CondCore/Utilities/src/PayloadInspector.cc @@ -75,7 +75,7 @@ namespace cond { std::vector > tags; tags.resize(nt); for (size_t i = 0; i < nt; i++) { - boost::python::tuple entry = tagsWithTimeBoundaries[i].cast(); + py::tuple entry = tagsWithTimeBoundaries[i].cast(); std::string tagName = entry[0].cast(); std::string time0s = entry[1].cast(); std::string time1s = entry[2].cast(); From 69e510a3156e69bcb950010e0fafa9b0f81e29aa Mon Sep 17 00:00:00 2001 From: Mariana Date: Tue, 24 Aug 2021 12:08:01 +0200 Subject: [PATCH 096/923] applied suggested changes --- HLTrigger/special/plugins/HLTPPSCalFilter.cc | 64 +++++++++----------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/HLTrigger/special/plugins/HLTPPSCalFilter.cc b/HLTrigger/special/plugins/HLTPPSCalFilter.cc index aa0d3038c4d1c..f650ac9224ea7 100644 --- a/HLTrigger/special/plugins/HLTPPSCalFilter.cc +++ b/HLTrigger/special/plugins/HLTPPSCalFilter.cc @@ -38,13 +38,13 @@ class HLTPPSCalFilter : public edm::global::EDFilter<> { bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; private: - edm::InputTag pixelLocalTrackInputTag_; // Input tag identifying the pixel detector - edm::EDGetTokenT> pixelLocalTrackToken_; + const edm::InputTag pixelLocalTrackInputTag_; // Input tag identifying the pixel detector + const edm::EDGetTokenT> pixelLocalTrackToken_; - int minTracks_; - int maxTracks_; + const int minTracks_; + const int maxTracks_; - bool do_express_; + const bool do_express_; }; void HLTPPSCalFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -66,17 +66,15 @@ void HLTPPSCalFilter::fillDescriptions(edm::ConfigurationDescriptions& descripti HLTPPSCalFilter::HLTPPSCalFilter(const edm::ParameterSet& iConfig) : pixelLocalTrackInputTag_(iConfig.getParameter("pixelLocalTrackInputTag")), pixelLocalTrackToken_(consumes>(pixelLocalTrackInputTag_)), - minTracks_(iConfig.getParameter("minTracks")), maxTracks_(iConfig.getParameter("maxTracks")), - do_express_(iConfig.getParameter("do_express")) {} bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { // Helper tool to count valid tracks const auto valid_trks = [](const auto& trk) { return trk.isValid(); }; - // maps for assigning filter pass / fail + // map for assigning filter pass / fail std::unordered_map pixel_filter_; // pixel map definition @@ -86,34 +84,32 @@ bool HLTPPSCalFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event pixel_filter_[CTPPSPixelDetId(1, 2, 3)] = false; // filter on pixels (2017+) selection - if (!pixel_filter_.empty()) { - edm::Handle> pixelTracks; - iEvent.getByToken(pixelLocalTrackToken_, pixelTracks); - - for (const auto& rpv : *pixelTracks) { - if (pixel_filter_.count(rpv.id) == 0) { - continue; - } - // assume pass condition if there is at least one track - pixel_filter_.at(rpv.id) = true; - - // count number of valid tracks - const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); - // fail condition if ntrks not within minTracks, maxTracks values - if (minTracks_ > 0 && ntrks < minTracks_) - pixel_filter_.at(rpv.id) = false; - if (maxTracks_ > 0 && ntrks > maxTracks_) - pixel_filter_.at(rpv.id) = false; - } + edm::Handle> pixelTracks; + iEvent.getByToken(pixelLocalTrackToken_, pixelTracks); - // compilation of filter conditions - if (do_express_) { - return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || - (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); - } else { - return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || - (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); + for (const auto& rpv : *pixelTracks) { + if (pixel_filter_.count(rpv.id) == 0) { + continue; } + // assume pass condition if there is at least one track + pixel_filter_.at(rpv.id) = true; + + // count number of valid tracks + const auto ntrks = std::count_if(rpv.begin(), rpv.end(), valid_trks); + // fail condition if ntrks not within minTracks, maxTracks values + if (minTracks_ > 0 && ntrks < minTracks_) + pixel_filter_.at(rpv.id) = false; + if (maxTracks_ > 0 && ntrks > maxTracks_) + pixel_filter_.at(rpv.id) = false; + } + + // compilation of filter conditions + if (do_express_) { + return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || + (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) && pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); + } else { + return (pixel_filter_.at(CTPPSPixelDetId(0, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(0, 2, 3))) || + (pixel_filter_.at(CTPPSPixelDetId(1, 0, 3)) || pixel_filter_.at(CTPPSPixelDetId(1, 2, 3))); } return false; From e397a38176cf322204ce5ba6ed57c8774cc1a876 Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Tue, 24 Aug 2021 14:21:32 +0200 Subject: [PATCH 097/923] support for PixelTracksSeq-only case in customisePixelLocalReconstruction --- .../python/customizeHLTforPatatrack.py | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py index f85e11f5f08ac..89987dd8320f9 100644 --- a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py +++ b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py @@ -224,13 +224,16 @@ def customisePixelLocalReconstruction(process): # customisation for running the "Patatrack" pixel track reconstruction def customisePixelTrackReconstruction(process): - if not all(seq in process.__dict__ for seq in ['HLTRecoPixelTracksSequence', 'HLTRecopixelvertexingSequence']): + if not 'HLTRecoPixelTracksSequence' in process.__dict__: return process + hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__ + # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases process.HLTRecoPixelTracksSequence = cms.Sequence() - process.HLTRecopixelvertexingSequence = cms.Sequence() + if hasHLTPixelVertexReco: + process.HLTRecopixelvertexingSequence = cms.Sequence() # Modules and EDAliases @@ -282,35 +285,36 @@ def customisePixelTrackReconstruction(process): # referenced in process.HLTRecopixelvertexingTask + if hasHLTPixelVertexReco: - # 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 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" + # 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" - ) + # 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 @@ -325,17 +329,18 @@ def customisePixelTrackReconstruction(process): 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) + if hasHLTPixelVertexReco: + 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 From 3c65031d9f584a9d1574e272d7b3d472096ead5a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 15:46:52 +0200 Subject: [PATCH 098/923] Complete migration of EcalSelectiveReadoutProducer to esConsumes --- .../EcalSelectiveReadoutSuppressor.h | 9 ++- .../src/EcalSelectiveReadoutSuppressor.cc | 56 +++++++++---------- .../interface/EcalSelectiveReadoutProducer.h | 5 +- .../src/EcalSelectiveReadoutProducer.cc | 36 ++++++------ .../src/ESZeroSuppressionProducer.cc | 18 +++--- 5 files changed, 66 insertions(+), 58 deletions(-) diff --git a/SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h b/SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h index c839c15b62add..a96a1fc01d431 100644 --- a/SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h +++ b/SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h @@ -7,6 +7,7 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadout.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -14,13 +15,17 @@ #include +class CaloGeometryRecord; + class EcalSelectiveReadoutSuppressor { public: /** Construtor. * @param params configuration from python file * @param settings configuration from condition DB */ - EcalSelectiveReadoutSuppressor(const edm::ParameterSet& params, const EcalSRSettings* settings); + EcalSelectiveReadoutSuppressor(const edm::ParameterSet& params, edm::ConsumesCollector iC); + + void setSettings(const EcalSRSettings* settings); enum { BARREL, ENDCAP }; @@ -304,5 +309,7 @@ class EcalSelectiveReadoutSuppressor { /** Number of produced events */ int ievt_; + + edm::ESGetToken geoToken_; }; #endif diff --git a/SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadoutSuppressor.cc b/SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadoutSuppressor.cc index acb524a5da956..73e4eedd060c4 100644 --- a/SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadoutSuppressor.cc +++ b/SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadoutSuppressor.cc @@ -4,8 +4,6 @@ #include "DataFormats/EcalDigi/interface/EBDataFrame.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" - // Geometry #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" @@ -29,13 +27,8 @@ using namespace std; const int EcalSelectiveReadoutSuppressor::nFIRTaps = 6; EcalSelectiveReadoutSuppressor::EcalSelectiveReadoutSuppressor(const edm::ParameterSet& params, - const EcalSRSettings* settings) - : ttThresOnCompressedEt_(false), ievt_(0) { - firstFIRSample = settings->ecalDccZs1stSample_[0]; - weights = settings->dccNormalizedWeights_[0]; - symetricZS = settings->symetricZS_[0]; - actions_ = settings->actions_; - + edm::ConsumesCollector iC) + : ttThresOnCompressedEt_(false), ievt_(0), geoToken_(iC.esConsumes()) { int defTtf = params.getParameter("defaultTtf"); if (defTtf < 0 || defTtf > 7) { throw cms::Exception("InvalidParameter") << "Value of EcalSelectiveReadoutProducer module parameter defaultTtf, " @@ -44,6 +37,29 @@ EcalSelectiveReadoutSuppressor::EcalSelectiveReadoutSuppressor(const edm::Parame defaultTtf_ = (EcalSelectiveReadout::ttFlag_t)defTtf; } + trigPrimBypass_ = params.getParameter("trigPrimBypass"); + trigPrimBypassMode_ = params.getParameter("trigPrimBypassMode"); + trigPrimBypassWithPeakFinder_ = params.getParameter("trigPrimBypassWithPeakFinder"); + trigPrimBypassLTH_ = params.getParameter("trigPrimBypassLTH"); + trigPrimBypassHTH_ = params.getParameter("trigPrimBypassHTH"); + if (trigPrimBypass_) { + edm::LogWarning("Digitization") << "Beware a simplified trigger primitive " + "computation is used for the ECAL selective readout"; + if (trigPrimBypassMode_ != 0 && trigPrimBypassMode_ != 1) { + throw cms::Exception("InvalidParameter") + << "Invalid value for EcalSelectiveReadoutProducer parameter 'trigPrimBypassMode_'." + " Valid values are 0 and 1.\n"; + } + ttThresOnCompressedEt_ = (trigPrimBypassMode_ == 1); + } +} + +void EcalSelectiveReadoutSuppressor::setSettings(const EcalSRSettings* settings) { + firstFIRSample = settings->ecalDccZs1stSample_[0]; + weights = settings->dccNormalizedWeights_[0]; + symetricZS = settings->symetricZS_[0]; + actions_ = settings->actions_; + //online configuration has only 4 actions flags, the 4 'forced' flags being the same with the force //bit set to 1. Extends the actions vector for case of online-type configuration: if (actions_.size() == 4) { @@ -76,21 +92,6 @@ EcalSelectiveReadoutSuppressor::EcalSelectiveReadoutSuppressor(const edm::Parame settings->srpLowInterestChannelZS_[ee], settings->srpHighInterestChannelZS_[eb], settings->srpHighInterestChannelZS_[ee]); - trigPrimBypass_ = params.getParameter("trigPrimBypass"); - trigPrimBypassMode_ = params.getParameter("trigPrimBypassMode"); - trigPrimBypassWithPeakFinder_ = params.getParameter("trigPrimBypassWithPeakFinder"); - trigPrimBypassLTH_ = params.getParameter("trigPrimBypassLTH"); - trigPrimBypassHTH_ = params.getParameter("trigPrimBypassHTH"); - if (trigPrimBypass_) { - edm::LogWarning("Digitization") << "Beware a simplified trigger primitive " - "computation is used for the ECAL selective readout"; - if (trigPrimBypassMode_ != 0 && trigPrimBypassMode_ != 1) { - throw cms::Exception("InvalidParameter") - << "Invalid value for EcalSelectiveReadoutProducer parameter 'trigPrimBypassMode_'." - " Valid values are 0 and 1.\n"; - } - ttThresOnCompressedEt_ = (trigPrimBypassMode_ == 1); - } } void EcalSelectiveReadoutSuppressor::setTriggerMap(const EcalTrigTowerConstituentsMap* map) { @@ -443,10 +444,9 @@ void EcalSelectiveReadoutSuppressor::setTtFlags(const edm::EventSetup& es, const CaloSubdetectorGeometry* eeGeometry = nullptr; const CaloSubdetectorGeometry* ebGeometry = nullptr; // if(eeGeometry==0 || ebGeometry==0){ - edm::ESHandle geoHandle; - es.get().get(geoHandle); - eeGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalEndcap); - ebGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + auto const& geo = es.getData(geoToken_); + eeGeometry = geo.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); + ebGeometry = geo.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); // } //init trigPrim array: diff --git a/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSelectiveReadoutProducer.h b/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSelectiveReadoutProducer.h index 91ebcf205ca6e..47ac4b997fac9 100644 --- a/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSelectiveReadoutProducer.h +++ b/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSelectiveReadoutProducer.h @@ -85,7 +85,7 @@ class EcalSelectiveReadoutProducer : public edm::one::EDProducer<> { void printTTFlags(const EcalTrigPrimDigiCollection& tp, std::ostream& os) const; private: - std::unique_ptr suppressor_; + EcalSelectiveReadoutSuppressor suppressor_; std::string digiProducer_; // name of module/plugin/producer making digis std::string ebdigiCollection_; // secondary name given to collection of input digis std::string eedigiCollection_; // secondary name given to collection of input digis @@ -100,7 +100,8 @@ class EcalSelectiveReadoutProducer : public edm::one::EDProducer<> { const CaloGeometry* theGeometry; const EcalTrigTowerConstituentsMap* theTriggerTowerMap; const EcalElectronicsMapping* theElecMap; - edm::ParameterSet params_; + + bool suppressorSettingsSet_ = false; bool trigPrimBypass_; diff --git a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSelectiveReadoutProducer.cc b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSelectiveReadoutProducer.cc index b47f0f45fbd04..2b11ad4d1e8dc 100644 --- a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSelectiveReadoutProducer.cc +++ b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSelectiveReadoutProducer.cc @@ -17,7 +17,7 @@ using namespace std; EcalSelectiveReadoutProducer::EcalSelectiveReadoutProducer(const edm::ParameterSet& params) - : params_(params), firstCallEB_(true), firstCallEE_(true), iEvent_(1) { + : suppressor_(params, consumesCollector()), firstCallEB_(true), firstCallEE_(true), iEvent_(1) { //settings: // settings which are only in python config files: digiProducer_ = params.getParameter("digiProducer"); @@ -122,12 +122,12 @@ void EcalSelectiveReadoutProducer::produce(edm::Event& event, const edm::EventSe eeSrFlags = std::make_unique(); } - if (suppressor_.get() == nullptr) { + if (not suppressorSettingsSet_) { //Check the validity of EcalSRSettings checkValidity(*settings_); - //instantiates the selective readout algorithm: - suppressor_ = std::make_unique(params_, settings_); + suppressor_.setSettings(settings_); + suppressorSettingsSet_ = true; // check that everything is up-to-date checkGeometry(eventSetup); @@ -135,25 +135,25 @@ void EcalSelectiveReadoutProducer::produce(edm::Event& event, const edm::EventSe checkElecMap(eventSetup); } - suppressor_->run(eventSetup, - *trigPrims, - *ebDigis, - *eeDigis, - selectedEBDigis.get(), - selectedEEDigis.get(), - ebSrFlags.get(), - eeSrFlags.get()); + suppressor_.run(eventSetup, + *trigPrims, + *ebDigis, + *eeDigis, + selectedEBDigis.get(), + selectedEEDigis.get(), + ebSrFlags.get(), + eeSrFlags.get()); if (dumpFlags_ >= iEvent_) { ofstream ttfFile("TTF.txt", (iEvent_ == 1 ? ios::trunc : ios::app)); - suppressor_->printTTFlags(ttfFile, iEvent_, iEvent_ == 1 ? true : false); + suppressor_.printTTFlags(ttfFile, iEvent_, iEvent_ == 1 ? true : false); ofstream srfFile("SRF.txt", (iEvent_ == 1 ? ios::trunc : ios::app)); if (iEvent_ == 1) { - suppressor_->getEcalSelectiveReadout()->printHeader(srfFile); + suppressor_.getEcalSelectiveReadout()->printHeader(srfFile); } srfFile << "# Event " << iEvent_ << "\n"; - suppressor_->getEcalSelectiveReadout()->print(srfFile); + suppressor_.getEcalSelectiveReadout()->print(srfFile); srfFile << "\n"; ofstream afFile("AF.txt", (iEvent_ == 1 ? ios::trunc : ios::app)); @@ -215,7 +215,7 @@ void EcalSelectiveReadoutProducer::checkGeometry(const edm::EventSetup& eventSet // see if we need to update if (pGeometry != theGeometry) { theGeometry = pGeometry; - suppressor_->setGeometry(theGeometry); + suppressor_.setGeometry(theGeometry); } } @@ -227,7 +227,7 @@ void EcalSelectiveReadoutProducer::checkTriggerMap(const edm::EventSetup& eventS // see if we need to update if (pMap != theTriggerTowerMap) { theTriggerTowerMap = pMap; - suppressor_->setTriggerMap(theTriggerTowerMap); + suppressor_.setTriggerMap(theTriggerTowerMap); } } @@ -239,7 +239,7 @@ void EcalSelectiveReadoutProducer::checkElecMap(const edm::EventSetup& eventSetu // see if we need to update if (pMap != theElecMap) { theElecMap = pMap; - suppressor_->setElecMap(theElecMap); + suppressor_.setElecMap(theElecMap); } } diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc b/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc index 4c168d120dd21..4bbb887ec4cad 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc +++ b/SimCalorimetry/EcalZeroSuppressionProducers/src/ESZeroSuppressionProducer.cc @@ -2,21 +2,21 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "SimCalorimetry/EcalZeroSuppressionProducers/interface/ESZeroSuppressionProducer.h" -ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet &ps) : - digiProducer_(ps.getParameter("digiProducer")), - ESdigiCollection_(ps.getParameter("ESdigiCollection")), - ESZSdigiCollection_(ps.getParameter("ESZSdigiCollection")), - ES_token(consumes(edm::InputTag(digiProducer_))), - esthresholdsToken_(esConsumes()), - espedsToken_(esConsumes()) { +ESZeroSuppressionProducer::ESZeroSuppressionProducer(const edm::ParameterSet &ps) + : digiProducer_(ps.getParameter("digiProducer")), + ESdigiCollection_(ps.getParameter("ESdigiCollection")), + ESZSdigiCollection_(ps.getParameter("ESZSdigiCollection")), + ES_token(consumes(edm::InputTag(digiProducer_))), + esthresholdsToken_(esConsumes()), + espedsToken_(esConsumes()) { produces(ESZSdigiCollection_); } ESZeroSuppressionProducer::~ESZeroSuppressionProducer() {} void ESZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { - const ESThresholds& thresholds = eventSetup.getData(esthresholdsToken_); - const ESPedestals& pedestals = eventSetup.getData(espedsToken_); + const ESThresholds &thresholds = eventSetup.getData(esthresholdsToken_); + const ESPedestals &pedestals = eventSetup.getData(espedsToken_); float ts2Threshold = thresholds.getTS2Threshold(); From 2c72a0fd995d4b993a68014b61bc3b9bed0e6daf Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 16:24:03 +0200 Subject: [PATCH 099/923] Migrate classes deriving from IsoDepositExtractor to esConsumes() --- .../EgammaHcalExtractor.cc | 8 +++---- .../EgammaRecHitExtractor.cc | 14 +++++------ .../MuonIsolation/plugins/CaloExtractor.cc | 1 - .../plugins/CaloExtractorByAssociator.cc | 24 +++++++++---------- .../plugins/CaloExtractorByAssociator.h | 8 +++++++ .../MuonIsolation/plugins/JetExtractor.cc | 1 - .../plugins/PixelTrackExtractor.cc | 2 -- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaHcalExtractor.cc b/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaHcalExtractor.cc index dc3b4f2732593..57d0e0923c719 100644 --- a/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaHcalExtractor.cc +++ b/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaHcalExtractor.cc @@ -63,6 +63,7 @@ namespace egammaisolation { double etLow_; edm::EDGetTokenT hcalRecHitProducerToken_; + edm::ESGetToken geometryToken_; }; } // namespace egammaisolation @@ -79,7 +80,8 @@ EgammaHcalExtractor::EgammaHcalExtractor(const edm::ParameterSet& par, edm::Cons : extRadius_(par.getParameter("extRadius")), intRadius_(par.getParameter("intRadius")), etLow_(par.getParameter("etMin")), - hcalRecHitProducerToken_(iC.consumes(par.getParameter("hcalRecHits"))) {} + hcalRecHitProducerToken_(iC.consumes(par.getParameter("hcalRecHits"))), + geometryToken_(iC.esConsumes()) {} EgammaHcalExtractor::~EgammaHcalExtractor() {} @@ -90,9 +92,7 @@ reco::IsoDeposit EgammaHcalExtractor::deposit(const edm::Event& iEvent, auto const& hcalRecHits = iEvent.get(hcalRecHitProducerToken_); //Get Calo Geometry - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* caloGeom = pG.product(); + const CaloGeometry* caloGeom = &iSetup.getData(geometryToken_); CaloDualConeSelector coneSel(intRadius_, extRadius_, caloGeom, DetId::Hcal); //Take the SC position diff --git a/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaRecHitExtractor.cc b/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaRecHitExtractor.cc index 364e6c2d74984..91f1e6057623c 100644 --- a/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaRecHitExtractor.cc +++ b/RecoEgamma/EgammaIsolationAlgos/plugins/iso_deposit_extractors/EgammaRecHitExtractor.cc @@ -20,7 +20,6 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "FWCore/Framework/interface/ConsumesCollector.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" @@ -77,6 +76,8 @@ namespace egammaisolation { edm::InputTag endcapEcalHitsTag_; edm::EDGetTokenT barrelEcalHitsToken_; edm::EDGetTokenT endcapEcalHitsToken_; + edm::ESGetToken geometryToken_; + edm::ESGetToken sevlvToken_; bool fakeNegativeDeposit_; bool tryBoth_; bool useEt_; @@ -113,6 +114,8 @@ EgammaRecHitExtractor::EgammaRecHitExtractor(const edm::ParameterSet& par, edm:: endcapEcalHitsTag_(par.getParameter("endcapEcalHits")), barrelEcalHitsToken_(iC.consumes(barrelEcalHitsTag_)), endcapEcalHitsToken_(iC.consumes(endcapEcalHitsTag_)), + geometryToken_(iC.esConsumes()), + sevlvToken_(iC.esConsumes()), fakeNegativeDeposit_(par.getParameter("subtractSuperClusterEnergy")), tryBoth_(par.getParameter("tryBoth")), vetoClustered_(par.getParameter("vetoClustered")), @@ -170,18 +173,13 @@ EgammaRecHitExtractor::~EgammaRecHitExtractor() {} reco::IsoDeposit EgammaRecHitExtractor::deposit(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Candidate& emObject) const { - edm::ESHandle pG; - iSetup.get().get(pG); - //Get the channel status from the db //edm::ESHandle chStatus; //iSetup.get().get(chStatus); - edm::ESHandle sevlv; - iSetup.get().get(sevlv); - const EcalSeverityLevelAlgo* sevLevel = sevlv.product(); + const EcalSeverityLevelAlgo* sevLevel = &iSetup.getData(sevlvToken_); - const CaloGeometry* caloGeom = pG.product(); + const CaloGeometry* caloGeom = &iSetup.getData(geometryToken_); const CaloSubdetectorGeometry* barrelgeom = caloGeom->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); const CaloSubdetectorGeometry* endcapgeom = caloGeom->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); diff --git a/RecoMuon/MuonIsolation/plugins/CaloExtractor.cc b/RecoMuon/MuonIsolation/plugins/CaloExtractor.cc index cdcee543e6da3..e31ae87a7f2ab 100644 --- a/RecoMuon/MuonIsolation/plugins/CaloExtractor.cc +++ b/RecoMuon/MuonIsolation/plugins/CaloExtractor.cc @@ -1,7 +1,6 @@ #include "CaloExtractor.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc index 0ae95b8fa251d..8fbf37a61b254 100644 --- a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc +++ b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc @@ -1,18 +1,13 @@ #include "CaloExtractorByAssociator.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" @@ -55,6 +50,7 @@ CaloExtractorByAssociator::CaloExtractorByAssociator(const ParameterSet& par, ed theNoiseTow_EE(par.getParameter("NoiseTow_EE")), theService(nullptr), theAssociator(nullptr), + bFieldToken_(iC.esConsumes()), thePrintTimeReport(par.getUntrackedParameter("PrintTimeReport")) { ParameterSet serviceParameters = par.getParameter("ServiceParameters"); theService = new MuonServiceProxy(serviceParameters, edm::ConsumesCollector(iC)); @@ -63,6 +59,10 @@ CaloExtractorByAssociator::CaloExtractorByAssociator(const ParameterSet& par, ed theAssociatorParameters = new TrackAssociatorParameters(); theAssociatorParameters->loadParameters(par.getParameter("TrackAssociatorParameters"), iC); theAssociator = new TrackDetectorAssociator(); + + if (theUseRecHitsFlag) { + caloGeomToken_ = iC.esConsumes(); + } } CaloExtractorByAssociator::~CaloExtractorByAssociator() { @@ -124,10 +124,9 @@ std::vector CaloExtractorByAssociator::deposits(const Event& event, IsoDeposit depHcal(muonDir); IsoDeposit depHOcal(muonDir); - edm::ESHandle bField; - eventSetup.get().get(bField); + auto const& bField = eventSetup.getData(bFieldToken_); - reco::TransientTrack tMuon(muon, &*bField); + reco::TransientTrack tMuon(muon, &bField); FreeTrajectoryState iFTS = tMuon.initialFreeState(); TrackDetMatchInfo mInfo = theAssociator->associate(event, eventSetup, iFTS, *theAssociatorParameters); @@ -159,14 +158,13 @@ std::vector CaloExtractorByAssociator::deposits(const Event& event, if (theUseRecHitsFlag) { //! do things based on rec-hits here //! too much copy-pasting now (refactor later?) - edm::ESHandle caloGeom; - eventSetup.get().get(caloGeom); + auto const& caloGeom = eventSetup.getData(caloGeomToken_); //Ecal std::vector::const_iterator eHitCI = mInfo.ecalRecHits.begin(); for (; eHitCI != mInfo.ecalRecHits.end(); ++eHitCI) { const EcalRecHit* eHitCPtr = *eHitCI; - GlobalPoint eHitPos = caloGeom->getPosition(eHitCPtr->detid()); + GlobalPoint eHitPos = caloGeom.getPosition(eHitCPtr->detid()); double deltar0 = reco::deltaR(muon, eHitPos); double cosTheta = 1. / cosh(eHitPos.eta()); double energy = eHitCPtr->energy(); @@ -207,7 +205,7 @@ std::vector CaloExtractorByAssociator::deposits(const Event& event, std::vector::const_iterator hHitCI = mInfo.hcalRecHits.begin(); for (; hHitCI != mInfo.hcalRecHits.end(); ++hHitCI) { const HBHERecHit* hHitCPtr = *hHitCI; - GlobalPoint hHitPos = caloGeom->getPosition(hHitCPtr->detid()); + GlobalPoint hHitPos = caloGeom.getPosition(hHitCPtr->detid()); double deltar0 = reco::deltaR(muon, hHitPos); double cosTheta = 1. / cosh(hHitPos.eta()); double energy = hHitCPtr->energy(); @@ -248,7 +246,7 @@ std::vector CaloExtractorByAssociator::deposits(const Event& event, std::vector::const_iterator hoHitCI = mInfo.hoRecHits.begin(); for (; hoHitCI != mInfo.hoRecHits.end(); ++hoHitCI) { const HORecHit* hoHitCPtr = *hoHitCI; - GlobalPoint hoHitPos = caloGeom->getPosition(hoHitCPtr->detid()); + GlobalPoint hoHitPos = caloGeom.getPosition(hoHitCPtr->detid()); double deltar0 = reco::deltaR(muon, hoHitPos); double cosTheta = 1. / cosh(hoHitPos.eta()); double energy = hoHitCPtr->energy(); diff --git a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.h b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.h index c8ef48fbe2a41..bffbddd717d7e 100644 --- a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.h +++ b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.h @@ -25,6 +25,11 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + class TrackAssociatorParameters; class TrackDetectorAssociator; class MuonServiceProxy; @@ -100,6 +105,9 @@ namespace muonisolation { TrackAssociatorParameters* theAssociatorParameters; TrackDetectorAssociator* theAssociator; + edm::ESGetToken bFieldToken_; + edm::ESGetToken caloGeomToken_; + //! flag to turn on/off printing of a time report bool thePrintTimeReport; diff --git a/RecoMuon/MuonIsolation/plugins/JetExtractor.cc b/RecoMuon/MuonIsolation/plugins/JetExtractor.cc index 432e8a5880e6b..2c77fd49b0d1b 100644 --- a/RecoMuon/MuonIsolation/plugins/JetExtractor.cc +++ b/RecoMuon/MuonIsolation/plugins/JetExtractor.cc @@ -1,7 +1,6 @@ #include "JetExtractor.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoMuon/MuonIsolation/plugins/PixelTrackExtractor.cc b/RecoMuon/MuonIsolation/plugins/PixelTrackExtractor.cc index 9a194dd08b522..15799955ba2f4 100644 --- a/RecoMuon/MuonIsolation/plugins/PixelTrackExtractor.cc +++ b/RecoMuon/MuonIsolation/plugins/PixelTrackExtractor.cc @@ -8,8 +8,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "FWCore/Framework/interface/ESHandle.h" - using namespace edm; using namespace std; using namespace reco; From f495ca3a1a44ffb1120725aecfe5dd557efde6f9 Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 1 Aug 2021 20:33:12 +0200 Subject: [PATCH 100/923] migrate jets,met --- PhysicsTools/NanoAOD/python/jets_cff.py | 41 +++++++++++++++---------- PhysicsTools/NanoAOD/python/met_cff.py | 11 +++---- PhysicsTools/NanoAOD/python/nano_cff.py | 29 ++++++++--------- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index 5ba6d67e54bf4..a07a08a54125a 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -719,14 +719,19 @@ pileupJetId106XUL18=pileupJetId.clone(jets="updatedJets",algos = cms.VPSet(_chsalgos_106X_UL18),inputIsCorrected=True,applyJec=False,vertexes="offlineSlimmedPrimaryVertices") #before cross linking -jetSequence = cms.Sequence(jetCorrFactorsNano+updatedJets+tightJetId+tightJetIdLepVeto+bJetVars+qgtagger+jercVars+pileupJetId94X+pileupJetId102X+pileupJetId106XUL16+pileupJetId106XUL16APV+pileupJetId106XUL17+pileupJetId106XUL18+updatedJetsWithUserData+jetCorrFactorsAK8+updatedJetsAK8+tightJetIdAK8+tightJetIdLepVetoAK8+updatedJetsAK8WithUserData+chsForSATkJets+softActivityJets+softActivityJets2+softActivityJets5+softActivityJets10+finalJets+finalJetsAK8) +jetUserDataTask = cms.Task(bJetVars, qgtagger, jercVars, tightJetId, tightJetIdLepVeto, pileupJetId94X, pileupJetId102X, pileupJetId106XUL16,pileupJetId106XUL16APV,pileupJetId106XUL17,pileupJetId106XUL18) +jetAK8UserDataTask = cms.Task(tightJetIdAK8,tightJetIdLepVetoAK8) +_jetUserDataTask2016 = jetUserDataTask.copy() +_jetUserDataTask2016.add(looseJetId) +_jetAK8UserDataTask2016 = jetAK8UserDataTask.copy() +_jetAK8UserDataTask2016.add(looseJetIdAK8) -_jetSequence_2016 = jetSequence.copy() -_jetSequence_2016.insert(_jetSequence_2016.index(tightJetId), looseJetId) -_jetSequence_2016.insert(_jetSequence_2016.index(tightJetIdAK8), looseJetIdAK8) for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: - modifier.toReplaceWith(jetSequence, _jetSequence_2016) + modifier.toReplaceWith(jetUserDataTask,_jetUserDataTask2016) + modifier.toReplaceWith(jetAK8UserDataTask,_jetAK8UserDataTask2016) + +softActivityTask = cms.Task(chsForSATkJets,softActivityJets,softActivityJets2,softActivityJets5,softActivityJets10) #HF shower shape recomputation #Only run if needed (i.e. if default MINIAOD info is missing or outdated because of new JECs...) @@ -745,22 +750,26 @@ modifier.toModify( jetTable.variables, hfsigmaPhiPhi = Var("userFloat('hfsigmaPhiPhi')",float,doc="sigmaPhiPhi for HF jets (noise discriminating variable)",precision=10)) modifier.toModify( jetTable.variables, hfcentralEtaStripSize = Var("userInt('hfcentralEtaStripSize')", int, doc="eta size of the central tower strip in HF (noise discriminating variable) ")) modifier.toModify( jetTable.variables, hfadjacentEtaStripsSize = Var("userInt('hfadjacentEtaStripsSize')", int, doc="eta size of the strips next to the central tower strip in HF (noise discriminating variable) ")) - _jetSequence_rerunHFshowershape = jetSequence.copy() - _jetSequence_rerunHFshowershape.insert(_jetSequence_rerunHFshowershape.index(updatedJetsWithUserData), hfJetShowerShapeforNanoAOD) - modifier.toReplaceWith(jetSequence, _jetSequence_rerunHFshowershape) + modifier.toModify(jetUserDataTask, jetUserDataTask.add(hfJetShowerShapeforNanoAOD)) +#before cross linking +jetTask = cms.Task(jetCorrFactorsNano,updatedJets,jetUserDataTask,updatedJetsWithUserData,jetCorrFactorsAK8,updatedJetsAK8,jetAK8UserDataTask,updatedJetsAK8WithUserData,softActivityTask,finalJets,finalJetsAK8) #after lepton collections have been run -jetLepSequence = cms.Sequence(lepInJetVars) +jetLepTask = cms.Task(lepInJetVars) #after cross linkining -jetTables = cms.Sequence(bjetNN+cjetNN+jetTable+fatJetTable+subJetTable+saJetTable+saTable) +jetTablesTask = cms.Task(bjetNN,cjetNN,jetTable,fatJetTable,subJetTable,saJetTable,saTable) #MC only producers and tables -jetMC = cms.Sequence(jetMCTable+genJetTable+patJetPartonsNano+genJetFlavourTable+genJetAK8Table+genJetAK8FlavourAssociation+genJetAK8FlavourTable+fatJetMCTable+genSubJetAK8Table+subjetMCTable) -_jetMC_pre94X = jetMC.copy() -_jetMC_pre94X.insert(_jetMC_pre94X.index(genJetFlavourTable),genJetFlavourAssociation) -_jetMC_pre94X.remove(genSubJetAK8Table) -run2_miniAOD_80XLegacy.toReplaceWith(jetMC, _jetMC_pre94X) - +jetMCTaskak4 = cms.Task(jetMCTable,genJetTable,patJetPartonsNano,genJetFlavourTable) +jetMCTaskak8 = cms.Task(genJetAK8Table,genJetAK8FlavourAssociation,genJetAK8FlavourTable,fatJetMCTable,genSubJetAK8Table,subjetMCTable) +jetMCTask = jetMCTaskak4.copy() +jetMCTask.add(jetMCTaskak8) + +_jetMC_pre94XTask = jetMCTaskak4.copy() +_jetMC_pre94XTask.add(genJetFlavourAssociation) +_jetMC_pre94XTask.add(jetMCTaskak8) +_jetMC_pre94XTask.copyAndExclude([genSubJetAK8Table]) +run2_miniAOD_80XLegacy.toReplaceWith(jetMCTask, _jetMC_pre94XTask) diff --git a/PhysicsTools/NanoAOD/python/met_cff.py b/PhysicsTools/NanoAOD/python/met_cff.py index 67d4ee111c4ce..dff815240bec1 100644 --- a/PhysicsTools/NanoAOD/python/met_cff.py +++ b/PhysicsTools/NanoAOD/python/met_cff.py @@ -158,11 +158,10 @@ ) - -metTables = cms.Sequence( metTable + rawMetTable + caloMetTable + puppiMetTable + rawPuppiMetTable+ tkMetTable + chsMetTable) -deepMetTables = cms.Sequence( deepMetResolutionTuneTable + deepMetResponseTuneTable ) -_withFixEE2017_sequence = cms.Sequence(metTables.copy() + metFixEE2017Table) +metTablesTask = cms.Task( metTable, rawMetTable, caloMetTable, puppiMetTable, rawPuppiMetTable, tkMetTable, chsMetTable) +deepMetTablesTask = cms.Task( deepMetResolutionTuneTable, deepMetResponseTuneTable ) +_withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table) for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: - modifier.toReplaceWith(metTables,_withFixEE2017_sequence) # only in old miniAOD, the new ones will come from the UL rereco -metMC = cms.Sequence( metMCTable ) + modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco +metMCTask = cms.Task( metMCTable ) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index d3db0eb156bc0..d472abce4fc58 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -62,11 +62,11 @@ ) nanoSequenceCommon = cms.Sequence( - nanoMetadata + jetSequence + cms.Sequence(extraFlagsProducersTask, muonTask, tauTask, boostedTauTask, electronTask, lowPtElectronTask, photonTask, - vertexTablesTask,isoTrackTask) + jetLepSequence + # must be after all the leptons - linkedObjects + - jetTables + cms.Sequence(muonTablesTask, tauTablesTask, boostedTauTablesTask, electronTablesTask, lowPtElectronTablesTask, photonTablesTask, globalTablesTask) + metTables + simpleCleanerTable + cms.Sequence(extraFlagsTableTask,isoTrackTablesTask) - ) + nanoMetadata + cms.Sequence(jetTask,extraFlagsProducersTask, muonTask, tauTask, boostedTauTask, electronTask, lowPtElectronTask, photonTask, + vertexTablesTask,isoTrackTask,jetLepTask) + # must be after all the leptons + linkedObjects + + cms.Sequence(jetTablesTask, muonTablesTask, tauTablesTask, boostedTauTablesTask, electronTablesTask, lowPtElectronTablesTask, photonTablesTask, globalTablesTask, metTablesTask, cms.Task(simpleCleanerTable), extraFlagsTableTask,isoTrackTablesTask) +) nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask) nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable) @@ -74,9 +74,9 @@ nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim) nanoSequenceFS = cms.Sequence( - cms.Sequence(genParticleTask,particleLevelTask) + nanoSequenceCommon + jetMC + cms.Sequence(muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask, - tauMCTask,boostedTauMCTask) + metMC + - cms.Sequence(ttbarCatMCProducersTask,globalTablesMCTask,cms.Task(btagWeightTable),genWeightsTableTask,genVertexTablesTask,genParticleTablesTask,particleLevelTablesTask,ttbarCategoryTableTask) ) + cms.Sequence(genParticleTask,particleLevelTask) + nanoSequenceCommon + cms.Sequence(jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask, + tauMCTask,boostedTauMCTask, metMCTask, + ttbarCatMCProducersTask,globalTablesMCTask,cms.Task(btagWeightTable),genWeightsTableTask,genVertexTablesTask,genParticleTablesTask,particleLevelTablesTask,ttbarCategoryTableTask) ) # GenVertex only stored in newer MiniAOD nanoSequenceMC = nanoSequenceFS.copy() @@ -144,7 +144,7 @@ def nanoAOD_addDeepMET(process, addDeepMETProducer, ResponseTune_Graph): process.deepMETsResponseTune = process.deepMETProducer.clone() #process.deepMETsResponseTune.graph_path = 'RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb' process.deepMETsResponseTune.graph_path = ResponseTune_Graph.value() - process.metTables += process.deepMetTables + process.metTablesTask.add(process.deepMetTablesTask) return process from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD @@ -171,20 +171,21 @@ def nanoAOD_recalibrateMETs(process,isData): extractDeepMETs = nanoAOD_DeepMET_switch.nanoAOD_addDeepMET_switch and not nanoAOD_DeepMET_switch.nanoAOD_produceDeepMET_switch runMetCorAndUncFromMiniAOD(process,isData=isData, extractDeepMETs=extractDeepMETs) - process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.fullPatMetSequence)) + process.nanoSequenceCommon.insert(2,cms.Sequence(process.fullPatMetSequence)) process.basicJetsForMetForT1METNano = process.basicJetsForMet.clone( src = process.updatedJetsWithUserData.src, skipEM = False, type1JetPtThreshold = 0.0, calcMuonSubtrRawPtAsValueMap = cms.bool(True), ) - process.jetSequence.insert(process.jetSequence.index(process.updatedJetsWithUserData),cms.Sequence(process.basicJetsForMetForT1METNano)) + + process.jetTask.add(process.basicJetsForMetForT1METNano) process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt") process.corrT1METJetTable.src = process.finalJets.src process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9" for table in process.jetTable, process.corrT1METJetTable: table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6) - process.metTables += process.corrT1METJetTable + process.metTablesTask.add(process.corrT1METJetTable) # @@ -219,7 +220,7 @@ def nanoAOD_recalibrateMETs(process,isData): process.patJetsPuppi.addGenJetMatch = cms.bool(False) runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) - process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) + process.nanoSequenceCommon.insert(2,cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) return process from PhysicsTools.SelectorUtils.tools.vid_id_tools import * @@ -300,7 +301,7 @@ def nanoAOD_runMETfixEE2017(process,isData): fixEE2017 = True, fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139}, postfix = "FixEE2017") - process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),process.fullPatMetSequenceFixEE2017) + process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017) def nanoAOD_customizeCommon(process): makePuppiesFromMiniAOD(process,True) From 0c52a61392a7f0256f38b817be9d44c8c84a0cab Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 1 Aug 2021 21:25:36 +0200 Subject: [PATCH 101/923] TEMPORARY: comment met otherwise 1325.7 and 11634.0 doens't run --- PhysicsTools/NanoAOD/python/met_cff.py | 6 +++--- PhysicsTools/NanoAOD/python/nano_cff.py | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/met_cff.py b/PhysicsTools/NanoAOD/python/met_cff.py index dff815240bec1..bbd6b357fcf99 100644 --- a/PhysicsTools/NanoAOD/python/met_cff.py +++ b/PhysicsTools/NanoAOD/python/met_cff.py @@ -160,8 +160,8 @@ metTablesTask = cms.Task( metTable, rawMetTable, caloMetTable, puppiMetTable, rawPuppiMetTable, tkMetTable, chsMetTable) deepMetTablesTask = cms.Task( deepMetResolutionTuneTable, deepMetResponseTuneTable ) -_withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table) -for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: - modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco +#_withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table) +#for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: +# modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco metMCTask = cms.Task( metMCTable ) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index d472abce4fc58..9e6939c394649 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -148,7 +148,7 @@ def nanoAOD_addDeepMET(process, addDeepMETProducer, ResponseTune_Graph): return process from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD -from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD +#from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD def nanoAOD_recalibrateMETs(process,isData): # add DeepMETs @@ -221,6 +221,7 @@ def nanoAOD_recalibrateMETs(process,isData): runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) process.nanoSequenceCommon.insert(2,cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) + return process from PhysicsTools.SelectorUtils.tools.vid_id_tools import * @@ -304,11 +305,11 @@ def nanoAOD_runMETfixEE2017(process,isData): process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017) def nanoAOD_customizeCommon(process): - makePuppiesFromMiniAOD(process,True) - process.puppiNoLep.useExistingWeights = True - process.puppi.useExistingWeights = True - run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False) - run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False) +# makePuppiesFromMiniAOD(process,True) +# process.puppiNoLep.useExistingWeights = True +# process.puppi.useExistingWeights = True +# run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False) +# run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False) process = nanoAOD_activateVID(process) nanoAOD_addDeepInfo_switch = cms.PSet( nanoAOD_addDeepBTag_switch = cms.untracked.bool(False), @@ -369,16 +370,16 @@ def nanoAOD_customizeCommon(process): def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) - process = nanoAOD_recalibrateMETs(process,isData=True) - for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: - modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) +# process = nanoAOD_recalibrateMETs(process,isData=True) +# for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: +# modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) return process def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) - process = nanoAOD_recalibrateMETs(process,isData=False) - for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: - modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) +# process = nanoAOD_recalibrateMETs(process,isData=False) +# for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: +# modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) return process ###increasing the precision of selected GenParticles. From 5a5b209ca64eae22981d72caf1f70ce4340277c1 Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 1 Aug 2021 21:26:05 +0200 Subject: [PATCH 102/923] add run3Modifier --- Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py | 3 +++ Configuration/StandardSequences/python/Eras.py | 2 +- PhysicsTools/NanoAOD/python/nano_eras_cff.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py diff --git a/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py b/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py new file mode 100644 index 0000000000000..29aa657695945 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run3_nanoAOD_devel = cms.Modifier() diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 72bc7b46fed06..03168ff128dc7 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -72,7 +72,7 @@ def __init__(self): 'trackingLowPU', 'trackingPhase1', 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018', 'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', 'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016', - 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', + 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', 'run3_nanoAOD_devel', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', 'bParking'] diff --git a/PhysicsTools/NanoAOD/python/nano_eras_cff.py b/PhysicsTools/NanoAOD/python/nano_eras_cff.py index 62b2723a2fe31..522d55ff1db1b 100644 --- a/PhysicsTools/NanoAOD/python/nano_eras_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_eras_cff.py @@ -20,3 +20,4 @@ from Configuration.Eras.Modifier_run2_nanoAOD_106Xv2_cff import run2_nanoAOD_106Xv2 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 +from Configuration.Eras.Modifier_run3_nanoAOD_devel_cff import run3_nanoAOD_devel From 3b96f81c3920497d5c76ed2bdabdd328d9024eac Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 1 Aug 2021 21:26:34 +0200 Subject: [PATCH 103/923] ele/ph no ID yet for Run3 --- PhysicsTools/NanoAOD/python/electrons_cff.py | 32 ++++++++++++++++++++ PhysicsTools/NanoAOD/python/photons_cff.py | 21 +++++++++++++ 2 files changed, 53 insertions(+) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 5c82b9c6cdeb3..9f628778f1cb9 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -526,6 +526,38 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): electronTablesTask = cms.Task(electronMVATTH, electronTable) electronMCTask = cms.Task(tautaggerForMatching, matchingElecPhoton, electronsMCMatchForTable, electronsMCMatchForTableAlt, electronMCTable) +## TEMPORARY as no ID for Run3 yet +(run3_nanoAOD_devel).toReplaceWith(electronTask, electronTask.copyAndExclude([bitmapVIDForEle,bitmapVIDForEleHEEP])) +(run3_nanoAOD_devel).toModify(slimmedElectronsWithUserData, userIntFromBools = cms.PSet()) +(run3_nanoAOD_devel).toModify(slimmedElectronsWithUserData.userInts, + VIDNestedWPBitmap = None, + VIDNestedWPBitmapHEEP = None) +(run3_nanoAOD_devel).toModify(slimmedElectronsWithUserData.userFloats, + mvaFall17V1Iso = None, + mvaFall17V1noIso = None, + mvaFall17V2Iso = None, + mvaFall17V2noIso = None, + ) +(run3_nanoAOD_devel).toModify(electronTable.variables, + mvaFall17V2Iso = None, + mvaFall17V2Iso_WP80 = None, + mvaFall17V2Iso_WP90 = None, + mvaFall17V2Iso_WPL = None, + mvaFall17V2noIso = None, + mvaFall17V2noIso_WP80 = None, + mvaFall17V2noIso_WP90 = None, + mvaFall17V2noIso_WPL = None, + vidNestedWPBitmapHEEP = None, + vidNestedWPBitmap = None, + cutBased = None, + cutBased_HEEP = None, +) + +(run3_nanoAOD_devel).toReplaceWith(electronTablesTask, electronTablesTask.copyAndExclude([electronMVATTH])) +(run3_nanoAOD_devel).toModify(electronTable, externalVariables = None) +##### end TEMPORARY Run3 + + #for NANO from reminAOD, no need to run slimmedElectronsUpdated, other modules of electron sequence will run on slimmedElectrons for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: modifier.toModify(bitmapVIDForEle, src = "slimmedElectronsUpdated") diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 94ad0920ba616..1a9ef58adc7dd 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -319,6 +319,27 @@ def make_bitmapVID_docstring(id_modules_working_points_pset): photonTablesTask = cms.Task(photonTable) photonMCTask = cms.Task(photonsMCMatchForTable, photonMCTable) + +## TEMPORARY as no ID for Run3 yet +(run3_nanoAOD_devel).toReplaceWith(photonTask, photonTask.copyAndExclude([bitmapVIDForPho])) +(run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData, userIntFromBools = cms.PSet()) +(run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData.userInts, + VIDNestedWPBitmap = None,) +(run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData.userFloats, + mvaID = None, + mvaID_Fall17V1p1 = None, + mvaID_Spring16nonTrigV1 = None) +(run3_nanoAOD_devel).toModify(photonTable.variables, + cutBased = None, + cutBased_Fall17V1Bitmap = None, + vidNestedWPBitmap = None, + mvaID = None, + mvaID_Fall17V1p1 = None, + mvaID_WP90 = None, + mvaID_WP80 = None, +) +#### end TEMPORARY Run3 + from RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff import egmPhotonIsolation from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import photonIDValueMapProducer From 3cbc4334dfb8168bc58b1897447d2b8abe5a65c8 Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 1 Aug 2021 22:12:15 +0200 Subject: [PATCH 104/923] complete the migration of main sequences --- PhysicsTools/NanoAOD/python/nano_cff.py | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 9e6939c394649..353b8f20de0d2 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -61,22 +61,30 @@ precision = cms.int32(10), ) -nanoSequenceCommon = cms.Sequence( - nanoMetadata + cms.Sequence(jetTask,extraFlagsProducersTask, muonTask, tauTask, boostedTauTask, electronTask, lowPtElectronTask, photonTask, - vertexTablesTask,isoTrackTask,jetLepTask) + # must be after all the leptons - linkedObjects + - cms.Sequence(jetTablesTask, muonTablesTask, tauTablesTask, boostedTauTablesTask, electronTablesTask, lowPtElectronTablesTask, photonTablesTask, globalTablesTask, metTablesTask, cms.Task(simpleCleanerTable), extraFlagsTableTask,isoTrackTablesTask) -) +nanoTableTaskCommon = cms.Task( + cms.Task(nanoMetadata), jetTask, extraFlagsProducersTask, muonTask, tauTask, boostedTauTask, + electronTask , lowPtElectronTask, photonTask, + vertexTask, isoTrackTask, jetLepTask, # must be after all the leptons + cms.Task(linkedObjects), + jetTablesTask, muonTablesTask, tauTablesTask, boostedTauTablesTask, + electronTablesTask, lowPtElectronTablesTask, photonTablesTask, + globalTablesTask, vertexTablesTask, metTablesTask, simpleCleanerTable, extraFlagsTableTask, + isoTrackTablesTask + ) + +nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon) nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask) nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable) nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim) -nanoSequenceFS = cms.Sequence( - cms.Sequence(genParticleTask,particleLevelTask) + nanoSequenceCommon + cms.Sequence(jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask, - tauMCTask,boostedTauMCTask, metMCTask, - ttbarCatMCProducersTask,globalTablesMCTask,cms.Task(btagWeightTable),genWeightsTableTask,genVertexTablesTask,genParticleTablesTask,particleLevelTablesTask,ttbarCategoryTableTask) ) +nanoTableTaskFS = cms.Task(genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask, + tauMCTask, boostedTauMCTask, + metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, cms.Task(btagWeightTable), ttbarCategoryTableTask, + genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, particleLevelTablesTask) + +nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS)) # GenVertex only stored in newer MiniAOD nanoSequenceMC = nanoSequenceFS.copy() From 9d5268de88e6d05bc276d1f65ffb817d29ee5aca Mon Sep 17 00:00:00 2001 From: maria Date: Mon, 2 Aug 2021 16:21:08 +0200 Subject: [PATCH 105/923] fix 8x and 94x --- PhysicsTools/NanoAOD/python/met_cff.py | 9 ++++++--- PhysicsTools/NanoAOD/python/nano_cff.py | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/met_cff.py b/PhysicsTools/NanoAOD/python/met_cff.py index bbd6b357fcf99..77b5dd107c5fb 100644 --- a/PhysicsTools/NanoAOD/python/met_cff.py +++ b/PhysicsTools/NanoAOD/python/met_cff.py @@ -160,8 +160,11 @@ metTablesTask = cms.Task( metTable, rawMetTable, caloMetTable, puppiMetTable, rawPuppiMetTable, tkMetTable, chsMetTable) deepMetTablesTask = cms.Task( deepMetResolutionTuneTable, deepMetResponseTuneTable ) -#_withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table) -#for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: -# modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco +_withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table) +for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: + modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco metMCTask = cms.Task( metMCTable ) + +#TEMPORARY since neede to disable the met-reconstruction +(run2_miniAOD_80XLegacy).toReplaceWith(metTablesTask, metTablesTask.copyAndExclude([tkMetTable,chsMetTable])) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 353b8f20de0d2..fdec0652211a8 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -379,15 +379,15 @@ def nanoAOD_customizeCommon(process): def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) # process = nanoAOD_recalibrateMETs(process,isData=True) -# for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: -# modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) + for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: + modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) return process def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) # process = nanoAOD_recalibrateMETs(process,isData=False) -# for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: -# modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) + for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: + modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) return process ###increasing the precision of selected GenParticles. From 30b783a03c4bc8d180ea2cb9d4714f9e703b7a82 Mon Sep 17 00:00:00 2001 From: maria Date: Fri, 6 Aug 2021 21:42:19 +0200 Subject: [PATCH 106/923] repack puppiMET --- PhysicsTools/NanoAOD/python/met_cff.py | 4 ---- PhysicsTools/NanoAOD/python/nano_cff.py | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/met_cff.py b/PhysicsTools/NanoAOD/python/met_cff.py index 77b5dd107c5fb..8b6fec3693251 100644 --- a/PhysicsTools/NanoAOD/python/met_cff.py +++ b/PhysicsTools/NanoAOD/python/met_cff.py @@ -164,7 +164,3 @@ for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco metMCTask = cms.Task( metMCTable ) - - -#TEMPORARY since neede to disable the met-reconstruction -(run2_miniAOD_80XLegacy).toReplaceWith(metTablesTask, metTablesTask.copyAndExclude([tkMetTable,chsMetTable])) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index fdec0652211a8..eb7c31d1116b4 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -156,7 +156,6 @@ def nanoAOD_addDeepMET(process, addDeepMETProducer, ResponseTune_Graph): return process from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD -#from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD def nanoAOD_recalibrateMETs(process,isData): # add DeepMETs @@ -196,7 +195,14 @@ def nanoAOD_recalibrateMETs(process,isData): process.metTablesTask.add(process.corrT1METJetTable) -# + from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD + makePuppiesFromMiniAOD(process,True) + process.puppiNoLep.useExistingWeights = True + process.puppi.useExistingWeights = True + run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False) + run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False) + print("will make Puppies on top of MINIAOD") + # makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID nanoAOD_PuppiV15_switch = cms.PSet( recoMetFromPFCs = cms.untracked.bool(False), @@ -224,8 +230,7 @@ def nanoAOD_recalibrateMETs(process,isData): getJetMCFlavour= False ) - process.patJetsPuppi.addGenPartonMatch = cms.bool(False) - process.patJetsPuppi.addGenJetMatch = cms.bool(False) + print("nanoAOD_PuppiV15_switch.reclusterJets is true") runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) process.nanoSequenceCommon.insert(2,cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) @@ -313,11 +318,6 @@ def nanoAOD_runMETfixEE2017(process,isData): process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017) def nanoAOD_customizeCommon(process): -# makePuppiesFromMiniAOD(process,True) -# process.puppiNoLep.useExistingWeights = True -# process.puppi.useExistingWeights = True -# run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False) -# run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False) process = nanoAOD_activateVID(process) nanoAOD_addDeepInfo_switch = cms.PSet( nanoAOD_addDeepBTag_switch = cms.untracked.bool(False), @@ -378,14 +378,17 @@ def nanoAOD_customizeCommon(process): def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) -# process = nanoAOD_recalibrateMETs(process,isData=True) + + for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: + modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(process,isData=True)) for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) return process def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) -# process = nanoAOD_recalibrateMETs(process,isData=False) + for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: + modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(process,isData=False)) for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) return process From b3459f3b2d1a0eabb8462996562c8df9f4838cf4 Mon Sep 17 00:00:00 2001 From: maria Date: Mon, 9 Aug 2021 09:25:05 +0200 Subject: [PATCH 107/923] add two workflow --- .../python/relval_standard.py | 2 ++ .../PyReleaseValidation/python/relval_steps.py | 17 +++++++++++++++++ PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 3 +++ 3 files changed, 22 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 7e339233900b6..cfafb0124246e 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -191,6 +191,8 @@ workflows[136.735] = ['',['RunNoBPTX2016B','HLTDR2_2016','RECODR2reHLTAlCaTkCosmics_HIPM','HARVESTDR2']] # reminiAOD wf on 2016B input, mainly here for PPS testing workflows[136.72411] = ['',['RunJetHT2016B_reminiaodUL','REMINIAOD_data2016UL_HIPM','HARVESTDR2_REMINIAOD_data2016UL_HIPM']] +workflows[136.72412] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM','HARVESTDR2_REMININANO_data2016UL_HIPM']] +workflows[136.72413] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM_met','HARVESTDR2_REMININANO_data2016UL_HIPM_met']] ### run 2016C ### workflows[136.736] = ['',['RunHLTPhy2016C','HLTDR2_2016','RECODR2_2016reHLT_HIPM','HARVESTDR2']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index a6d51b37517b8..a1be438f42b31 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2821,9 +2821,13 @@ def gen2021HiMix(fragment,howMuch): steps['HARVESTDCEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3'},steps['HARVESTDC']]) steps['HARVESTDR2_REMINIAOD_data2016']=merge([{'--data':'', '-s':'HARVESTING:@miniAODDQM','--era':'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTDR2']]) +steps['HARVESTDR2_REMININANO_data2016']=merge([{'--data':'', '-s':'HARVESTING:@miniAODDQM+@nanoAODDQM','--era':'Run2_2016'},steps['HARVESTDR2']]) steps['HARVESTDR2_REMINIAOD_data2016_HIPM']=merge([{'--era':'Run2_2016_HIPM,run2_miniAOD_80XLegacy'},steps['HARVESTDR2_REMINIAOD_data2016']]) steps['HARVESTDR2_REMINIAOD_data2016UL']=merge([{'--era':'Run2_2016', '--procModifiers':'run2_miniAOD_UL_preSummer20'},steps['HARVESTDR2_REMINIAOD_data2016']]) +steps['HARVESTDR2_REMININANO_data2016UL']=merge([{'--era':'Run2_2016', '--procModifiers':'run2_miniAOD_UL_preSummer20'},steps['HARVESTDR2_REMININANO_data2016']]) steps['HARVESTDR2_REMINIAOD_data2016UL_HIPM']=merge([{'--era':'Run2_2016_HIPM'},steps['HARVESTDR2_REMINIAOD_data2016UL']]) +steps['HARVESTDR2_REMININANO_data2016UL_HIPM']=merge([{'--era':'Run2_2016_HIPM,run2_nanoAOD_106Xv2,run3_nanoAOD_devel'},steps['HARVESTDR2_REMININANO_data2016UL']]) +steps['HARVESTDR2_REMININANO_data2016UL_HIPM_met']=merge([{'--era':'Run2_2016_HIPM,run2_nanoAOD_106Xv1,run3_nanoAOD_devel'},steps['HARVESTDR2_REMININANO_data2016UL']]) steps['HARVEST2017_REMINIAOD_data2017']=merge([{'--era':'Run2_2017,run2_miniAOD_94XFall17'},steps['HARVESTDR2_REMINIAOD_data2016']]) steps['HARVEST2017_REMINIAOD_data2017UL']=merge([{'--era':'Run2_2017'},steps['HARVESTDR2_REMINIAOD_data2016UL']]) @@ -3105,9 +3109,22 @@ def gen2021HiMix(fragment,howMuch): '--datatier' : 'MINIAOD,DQMIO' },stepMiniAODDefaults]) +steps['REMININANO_data2016'] = merge([{'-s' : 'PAT,NANO,DQM:@miniAODDQM+@nanoAODDQM', + '--process' : 'PATnano', + '--era' : 'Run2_2016', + '--conditions' : 'auto:run2_data_relval', + '--data' : '', + '--scenario' : 'pp', + '--eventcontent' : 'MINIAOD,NANOEDMAOD,DQM', + '--datatier' : 'MINIAOD,NANOAOD,DQMIO' + }]) + steps['REMINIAOD_data2016_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM,run2_miniAOD_80XLegacy'},steps['REMINIAOD_data2016']]) steps['REMINIAOD_data2016UL'] = merge([{'--era' : 'Run2_2016', '--procModifiers' : 'run2_miniAOD_UL_preSummer20'},steps['REMINIAOD_data2016']]) +steps['REMININANO_data2016UL'] = merge([{'--era' : 'Run2_2016', '--procModifiers' : 'run2_miniAOD_UL_preSummer20'},steps['REMININANO_data2016']]) steps['REMINIAOD_data2016UL_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM'},steps['REMINIAOD_data2016UL']]) +steps['REMININANO_data2016UL_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM,run2_nanoAOD_106Xv2,run3_nanoAOD_devel'},steps['REMININANO_data2016UL']]) +steps['REMININANO_data2016UL_HIPM_met'] = merge([{'--era' : 'Run2_2016_HIPM,run2_nanoAOD_106Xv1,run3_nanoAOD_devel'},steps['REMININANO_data2016UL']]) stepReMiniAODData17 = merge([{'--era' : 'Run2_2017,run2_miniAOD_94XFall17'},steps['REMINIAOD_data2016']]) steps['REMINIAOD_data2017'] = stepReMiniAODData17 diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 7d1c275c7511a..c0dda1f2e08c8 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -119,4 +119,7 @@ verboseQT = cms.untracked.bool(True) ) +(run3_nanoAOD_devel).toModify(nanoDQM.vplots, Electron = None) +(run3_nanoAOD_devel).toModify(nanoDQMMC.vplots, Electron = None) + nanoHarvest = cms.Sequence( nanoDQMQTester ) From 68c3ecb148a9692c4d792933692926e6cccf72ad Mon Sep 17 00:00:00 2001 From: maria Date: Thu, 12 Aug 2021 10:38:02 +0200 Subject: [PATCH 108/923] isolate jets for T1met --- PhysicsTools/NanoAOD/python/nano_cff.py | 43 +++++++++++++++++-------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index eb7c31d1116b4..47ec8fce6804e 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -179,20 +179,6 @@ def nanoAOD_recalibrateMETs(process,isData): runMetCorAndUncFromMiniAOD(process,isData=isData, extractDeepMETs=extractDeepMETs) process.nanoSequenceCommon.insert(2,cms.Sequence(process.fullPatMetSequence)) - process.basicJetsForMetForT1METNano = process.basicJetsForMet.clone( - src = process.updatedJetsWithUserData.src, - skipEM = False, - type1JetPtThreshold = 0.0, - calcMuonSubtrRawPtAsValueMap = cms.bool(True), - ) - - process.jetTask.add(process.basicJetsForMetForT1METNano) - process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt") - process.corrT1METJetTable.src = process.finalJets.src - process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9" - for table in process.jetTable, process.corrT1METJetTable: - table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6) - process.metTablesTask.add(process.corrT1METJetTable) from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD @@ -317,7 +303,36 @@ def nanoAOD_runMETfixEE2017(process,isData): postfix = "FixEE2017") process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017) + +def nanoAOD_jetForT1met(process): + process.basicJetsForMetForT1METNano = cms.EDProducer("PATJetCleanerForType1MET", + src = process.updatedJetsWithUserData.src, + jetCorrEtaMax = cms.double(9.9), + jetCorrLabel = cms.InputTag("L3Absolute"), + jetCorrLabelRes = cms.InputTag("L2L3Residual"), + offsetCorrLabel = cms.InputTag("L1FastJet"), + skipEM = cms.bool(False), + skipEMfractionThreshold = cms.double(0.9), + skipMuonSelection = cms.string('isGlobalMuon | isStandAloneMuon'), + skipMuons = cms.bool(True), + type1JetPtThreshold = cms.double(0.0), + calcMuonSubtrRawPtAsValueMap = cms.bool(True) + ) + + process.jetTask.add(process.basicJetsForMetForT1METNano) + process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt") + process.corrT1METJetTable.src = process.finalJets.src + process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9" + process.metTablesTask.add(process.corrT1METJetTable) + + for table in process.jetTable, process.corrT1METJetTable: + table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6) + + return process + def nanoAOD_customizeCommon(process): + + process = nanoAOD_jetForT1met(process) process = nanoAOD_activateVID(process) nanoAOD_addDeepInfo_switch = cms.PSet( nanoAOD_addDeepBTag_switch = cms.untracked.bool(False), From 276b7e084b17b0e02cda392ab9c05b35f0a2a817 Mon Sep 17 00:00:00 2001 From: maria Date: Tue, 24 Aug 2021 17:44:38 +0200 Subject: [PATCH 109/923] prevent call in data --- PhysicsTools/NanoAOD/python/nano_cff.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 47ec8fce6804e..d4f762e0ed287 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -216,6 +216,9 @@ def nanoAOD_recalibrateMETs(process,isData): getJetMCFlavour= False ) + process.patJetsPuppi.addGenPartonMatch = cms.bool(False) + process.patJetsPuppi.addGenJetMatch = cms.bool(False) + print("nanoAOD_PuppiV15_switch.reclusterJets is true") runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) @@ -395,7 +398,7 @@ def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: - modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(process,isData=True)) + modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=True)) for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True)) return process @@ -403,7 +406,7 @@ def nanoAOD_customizeData(process): def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: - modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(process,isData=False)) + modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=False)) for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False)) return process From b451a53e4889cd66128951a195df07bae28132cc Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 17:49:47 +0200 Subject: [PATCH 110/923] Remove unnecessary members from CkfTrackCandidateMakerBase --- .../CkfPattern/interface/CkfTrackCandidateMakerBase.h | 4 ---- RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc | 7 ------- 2 files changed, 11 deletions(-) diff --git a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h index 18b1f215d1e86..933ccc1f21540 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h +++ b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h @@ -59,10 +59,6 @@ namespace cms { std::unique_ptr theInitialState; - const std::string theMagFieldName; - edm::ESHandle theMagField; - edm::ESHandle theGeomSearchTracker; - std::string theNavigationSchoolName; const NavigationSchool* theNavigationSchool; diff --git a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc index 75217eca7add1..0d6db4554606a 100644 --- a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc +++ b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc @@ -72,8 +72,6 @@ namespace cms { theTrajectoryCleaner(nullptr), theInitialState(std::make_unique( conf.getParameter("TransientInitialStateEstimatorParameters"))), - theMagFieldName(conf.exists("SimpleMagneticField") ? conf.getParameter("SimpleMagneticField") - : ""), theNavigationSchoolName(conf.getParameter("NavigationSchool")), theNavigationSchool(nullptr), maxSeedsBeforeCleaning_(0), @@ -126,11 +124,6 @@ namespace cms { void CkfTrackCandidateMakerBase::setEventSetup(const edm::EventSetup& es) { //services - es.get().get(theGeomSearchTracker); - es.get().get(theMagFieldName, theMagField); - // edm::ESInputTag mfESInputTag(mfName); - // es.get().get(mfESInputTag,theMagField ); - edm::ESHandle trajectoryCleanerH; es.get().get(theTrajectoryCleanerName, trajectoryCleanerH); theTrajectoryCleaner = trajectoryCleanerH.product(); From aff723540940a6c96235104fba0a0c0c6a7f826a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 18:05:32 +0200 Subject: [PATCH 111/923] Migrate CkfTrackCandidateMakerBase to esConsumes() --- .../interface/CkfTrackCandidateMakerBase.h | 10 ++++-- .../src/CkfTrackCandidateMakerBase.cc | 36 ++++++++++--------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h index 933ccc1f21540..1117a159ff93b 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h +++ b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h @@ -2,7 +2,6 @@ #define CkfTrackCandidateMakerBase_h #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -29,6 +28,8 @@ #include class TransientInitialStateEstimator; +class NavigationSchoolRecord; +class TrackerDigiGeometryRecord; namespace cms { class CkfTrackCandidateMakerBase { @@ -54,14 +55,17 @@ namespace cms { std::unique_ptr theTrajectoryBuilder; - std::string theTrajectoryCleanerName; + edm::ESGetToken theTrajectoryCleanerToken; const TrajectoryCleaner* theTrajectoryCleaner; std::unique_ptr theInitialState; - std::string theNavigationSchoolName; + edm::ESGetToken theNavigationSchoolToken; const NavigationSchool* theNavigationSchool; + edm::ESGetToken thePropagatorToken; + edm::ESGetToken theTrackerToken; + std::unique_ptr theSeedCleaner; unsigned int maxSeedsBeforeCleaning_; diff --git a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc index 0d6db4554606a..d5674c24e46fb 100644 --- a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc +++ b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc @@ -1,5 +1,4 @@ #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/isFinite.h" @@ -68,12 +67,15 @@ namespace cms { theMaxNSeeds(conf.getParameter("maxNSeeds")), theTrajectoryBuilder( createBaseCkfTrajectoryBuilder(conf.getParameter("TrajectoryBuilderPSet"), iC)), - theTrajectoryCleanerName(conf.getParameter("TrajectoryCleaner")), + theTrajectoryCleanerToken( + iC.esConsumes(edm::ESInputTag("", conf.getParameter("TrajectoryCleaner")))), theTrajectoryCleaner(nullptr), theInitialState(std::make_unique( conf.getParameter("TransientInitialStateEstimatorParameters"))), - theNavigationSchoolName(conf.getParameter("NavigationSchool")), + theNavigationSchoolToken( + iC.esConsumes(edm::ESInputTag("", conf.getParameter("NavigationSchool")))), theNavigationSchool(nullptr), + thePropagatorToken(iC.esConsumes(edm::ESInputTag("", "AnyDirectionAnalyticalPropagator"))), maxSeedsBeforeCleaning_(0), theMTELabel(iC.consumes(conf.getParameter("MeasurementTrackerEvent"))), skipClusters_(false), @@ -109,6 +111,12 @@ namespace cms { } #endif +#ifdef EDM_ML_DEBUG + if (theTrackCandidateOutput) { + theTrackerToken = iC.esConsumes(); + } +#endif + #ifdef VI_REPRODUCIBLE std::cout << "CkfTrackCandidateMaker in reproducible setting" << std::endl; assert(nullptr == theSeedCleaner); @@ -124,13 +132,9 @@ namespace cms { void CkfTrackCandidateMakerBase::setEventSetup(const edm::EventSetup& es) { //services - edm::ESHandle trajectoryCleanerH; - es.get().get(theTrajectoryCleanerName, trajectoryCleanerH); - theTrajectoryCleaner = trajectoryCleanerH.product(); + theTrajectoryCleaner = &es.getData(theTrajectoryCleanerToken); - edm::ESHandle navigationSchoolH; - es.get().get(theNavigationSchoolName, navigationSchoolH); - theNavigationSchool = navigationSchoolH.product(); + theNavigationSchool = &es.getData(theNavigationSchoolToken); theTrajectoryBuilder->setNavigationSchool(theNavigationSchool); } @@ -143,8 +147,7 @@ namespace cms { // NavigationSetter setter( *theNavigationSchool); // propagator - edm::ESHandle thePropagator; - es.get().get("AnyDirectionAnalyticalPropagator", thePropagator); + auto const& propagator = es.getData(thePropagatorToken); // method for Debugging printHitsDebugger(e); @@ -498,7 +501,7 @@ namespace cms { if (useSplitting && (initState.second != recHits.front().det()) && recHits.front().det()) { LogDebug("CkfPattern") << "propagating to hit front in case of splitting."; TrajectoryStateOnSurface&& propagated = - thePropagator->propagate(initState.first, recHits.front().det()->surface()); + propagator.propagate(initState.first, recHits.front().det()->surface()); if (!propagated.isValid()) continue; state = trajectoryStateTransform::persistentState(propagated, recHits.front().rawId()); @@ -510,11 +513,10 @@ namespace cms { } } //output trackcandidates - edm::ESHandle tracker; - es.get().get(tracker); - LogTrace("CkfPattern|TrackingRegressionTest") << "========== CkfTrackCandidateMaker Info ==========" - << "number of Seed: " << collseed->size() << '\n' - << PrintoutHelper::regressionTest(*tracker, unsmoothedResult); + LogTrace("CkfPattern|TrackingRegressionTest") + << "========== CkfTrackCandidateMaker Info ==========" + << "number of Seed: " << collseed->size() << '\n' + << PrintoutHelper::regressionTest(es.getData(theTrackerToken), unsmoothedResult); assert(viTotHits >= 0); // just to use it... // std::cout << "VICkfPattern result " << output->size() << " " << viTotHits << std::endl; From e21f703f78ce772c397e11d94bbb17ef9717f6fd Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 24 Aug 2021 11:11:51 -0500 Subject: [PATCH 112/923] Use ESGetToken with EGRegressionModifierV3 --- RecoEgamma/EgammaTools/plugins/EGRegressionModifierV3.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/RecoEgamma/EgammaTools/plugins/EGRegressionModifierV3.cc b/RecoEgamma/EgammaTools/plugins/EGRegressionModifierV3.cc index 0c24f9f4298d2..6075df61c4d8e 100644 --- a/RecoEgamma/EgammaTools/plugins/EGRegressionModifierV3.cc +++ b/RecoEgamma/EgammaTools/plugins/EGRegressionModifierV3.cc @@ -63,6 +63,7 @@ class EGRegressionModifierV3 : public ModifyObjectValueBase { bool useClosestToCentreSeedCrysDef_; float maxRawEnergyForLowPtEBSigma_; float maxRawEnergyForLowPtEESigma_; + edm::ESGetToken caloGeomToken_; edm::ESHandle caloGeomHandle_; }; @@ -81,6 +82,9 @@ EGRegressionModifierV3::EGRegressionModifierV3(const edm::ParameterSet& conf, ed if (conf.exists("phoRegs")) { phoRegs_ = std::make_unique(conf.getParameterSet("phoRegs"), cc); } + if (useClosestToCentreSeedCrysDef_) { + caloGeomToken_ = cc.esConsumes(); + } } EGRegressionModifierV3::~EGRegressionModifierV3() {} @@ -92,8 +96,9 @@ void EGRegressionModifierV3::setEventContent(const edm::EventSetup& iSetup) { eleRegs_->setEventContent(iSetup); if (phoRegs_) phoRegs_->setEventContent(iSetup); - if (useClosestToCentreSeedCrysDef_) - iSetup.get().get(caloGeomHandle_); + if (useClosestToCentreSeedCrysDef_) { + caloGeomHandle_ = iSetup.getHandle(caloGeomToken_); + } } void EGRegressionModifierV3::modifyObject(reco::GsfElectron& ele) const { From d4863ee8e124e5f2b3091b157bfcc2873d54b543 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 24 Aug 2021 11:13:55 -0500 Subject: [PATCH 113/923] Use esConsumes for PhysicsTools/PatAlgos modules --- .../PatAlgos/interface/KinResolutionsLoader.h | 13 ++++++++----- .../interface/KinematicResolutionProvider.h | 6 ------ .../PatAlgos/interface/VertexingHelper.h | 2 ++ .../plugins/PATCompositeCandidateProducer.cc | 3 ++- .../PatAlgos/plugins/PATElectronProducer.cc | 3 ++- .../plugins/PATGenericParticleProducer.cc | 3 ++- .../plugins/PATIsolatedTrackProducer.cc | 19 ++++++++++--------- .../PatAlgos/plugins/PATJetProducer.cc | 3 ++- .../PatAlgos/plugins/PATJetSlimmer.cc | 9 +++------ .../PatAlgos/plugins/PATMETProducer.cc | 3 ++- .../PatAlgos/plugins/PATMuonProducer.cc | 3 ++- .../PatAlgos/plugins/PATMuonSlimmer.cc | 9 +++------ .../PatAlgos/plugins/PATPFParticleProducer.cc | 3 ++- .../PatAlgos/plugins/PATPhotonProducer.cc | 3 ++- .../PatAlgos/plugins/PATTauProducer.cc | 3 ++- .../PatAlgos/plugins/PATTauSlimmer.cc | 9 +++------ .../plugins/TauJetCorrFactorsProducer.cc | 16 ++++++++++++---- .../PatAlgos/src/KinResolutionsLoader.cc | 15 +++++++-------- PhysicsTools/PatAlgos/src/VertexingHelper.cc | 5 ++++- 19 files changed, 70 insertions(+), 60 deletions(-) diff --git a/PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h b/PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h index 0a91984e24726..c1ec774d26392 100644 --- a/PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h +++ b/PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h @@ -5,13 +5,16 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + #include "PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h" +#include "PhysicsTools/PatAlgos/interface/KinematicResolutionRcd.h" namespace pat { namespace helper { @@ -21,7 +24,7 @@ namespace pat { KinResolutionsLoader() {} /// Constructor from a PSet - KinResolutionsLoader(const edm::ParameterSet &iConfig); + KinResolutionsLoader(const edm::ParameterSet &iConfig, edm::ConsumesCollector); /// 'true' if this there is at least one efficiency configured bool enabled() const { return !patlabels_.empty(); } @@ -40,15 +43,15 @@ namespace pat { /// Labels of the resolutions in PAT std::vector patlabels_; /// Labels of the KinematicResolutionProvider in the EventSetup - std::vector eslabels_; + std::vector> estokens_; /// Handles to the EventSetup - std::vector > handles_; + std::vector resolutions_; }; // class template void KinResolutionsLoader::setResolutions(pat::PATObject &obj) const { for (size_t i = 0, n = patlabels_.size(); i < n; ++i) { - obj.setKinResolution(handles_[i]->getResolution(obj), patlabels_[i]); + obj.setKinResolution(resolutions_[i]->getResolution(obj), patlabels_[i]); } } diff --git a/PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h b/PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h index 1bf59ce4c1c83..edbec4e2c5b49 100644 --- a/PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h +++ b/PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h @@ -21,16 +21,10 @@ namespace reco { namespace pat { class CandKinResolution; } -namespace edm { - class ParameterSet; - class EventSetup; -} // namespace edm class KinematicResolutionProvider { public: virtual ~KinematicResolutionProvider() = default; - /// everything that needs to be done before the event loop - virtual void setup(const edm::EventSetup &iSetup) const {} /// get a CandKinResolution object from the service; this /// function needs to be implemented by any derived class virtual pat::CandKinResolution getResolution(const reco::Candidate &c) const = 0; diff --git a/PhysicsTools/PatAlgos/interface/VertexingHelper.h b/PhysicsTools/PatAlgos/interface/VertexingHelper.h index bb64b5a3bc698..d99129091ac8e 100644 --- a/PhysicsTools/PatAlgos/interface/VertexingHelper.h +++ b/PhysicsTools/PatAlgos/interface/VertexingHelper.h @@ -22,6 +22,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "PhysicsTools/UtilAlgos/interface/ParameterAdapter.h" namespace reco { @@ -82,6 +83,7 @@ namespace pat { edm::Handle vertexHandle_; /// use tracks inside candidates bool useTracks_; + edm::ESGetToken ttToken_; edm::ESHandle ttBuilder_; //--------- Tools for reading vertex associations (playback mode) ----- diff --git a/PhysicsTools/PatAlgos/plugins/PATCompositeCandidateProducer.cc b/PhysicsTools/PatAlgos/plugins/PATCompositeCandidateProducer.cc index ddf2788fec258..279cb6e2dc16f 100644 --- a/PhysicsTools/PatAlgos/plugins/PATCompositeCandidateProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATCompositeCandidateProducer.cc @@ -72,7 +72,8 @@ PATCompositeCandidateProducer::PATCompositeCandidateProducer(const ParameterSet& // Resolution configurables if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // produces vector of particles diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index ad05429fab5a6..7601f81769617 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -339,7 +339,8 @@ PATElectronProducer::PATElectronProducer(const edm::ParameterSet& iConfig) } // resolution configurables if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } if (addPuppiIsolation_) { //puppi diff --git a/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc b/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc index e6a4d1da31112..9ce9e8766b308 100644 --- a/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc @@ -149,7 +149,8 @@ PATGenericParticleProducer::PATGenericParticleProducer(const edm::ParameterSet& // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } if (iConfig.exists("vertexing")) { diff --git a/PhysicsTools/PatAlgos/plugins/PATIsolatedTrackProducer.cc b/PhysicsTools/PatAlgos/plugins/PATIsolatedTrackProducer.cc index f4d5dbb0d709a..efa03479e82f9 100644 --- a/PhysicsTools/PatAlgos/plugins/PATIsolatedTrackProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATIsolatedTrackProducer.cc @@ -85,6 +85,9 @@ namespace pat { const edm::EDGetTokenT> gt2dedxStrip_; const edm::EDGetTokenT> gt2dedxPixel_; const edm::EDGetTokenT gt2dedxHitInfo_; + const edm::ESGetToken hcalQToken_; + const edm::ESGetToken ecalSToken_; + const edm::ESGetToken bFieldToken_; const bool addPrescaledDeDxTracks_; const edm::EDGetTokenT> gt2dedxHitInfoPrescale_; const bool usePrecomputedDeDxStrip_; @@ -128,6 +131,9 @@ pat::PATIsolatedTrackProducer::PATIsolatedTrackProducer(const edm::ParameterSet& gt2dedxStrip_(consumes>(iConfig.getParameter("dEdxDataStrip"))), gt2dedxPixel_(consumes>(iConfig.getParameter("dEdxDataPixel"))), gt2dedxHitInfo_(consumes(iConfig.getParameter("dEdxHitInfo"))), + hcalQToken_(esConsumes(edm::ESInputTag("", "withTopo"))), + ecalSToken_(esConsumes()), + bFieldToken_(esConsumes()), addPrescaledDeDxTracks_(iConfig.getParameter("addPrescaledDeDxTracks")), gt2dedxHitInfoPrescale_(addPrescaledDeDxTracks_ ? consumes>( iConfig.getParameter("dEdxHitInfoPrescale")) @@ -223,13 +229,9 @@ void pat::PATIsolatedTrackProducer::produce(edm::Event& iEvent, const edm::Event iEvent.getByToken(gt2dedxHitInfoPrescale_, gt2dedxHitInfoPrescale); } - edm::ESHandle hcalQ_h; - iSetup.get().get("withTopo", hcalQ_h); - const HcalChannelQuality* hcalQ = hcalQ_h.product(); + const HcalChannelQuality* hcalQ = &iSetup.getData(hcalQToken_); - edm::ESHandle ecalS_h; - iSetup.get().get(ecalS_h); - const EcalChannelStatus* ecalS = ecalS_h.product(); + const EcalChannelStatus* ecalS = &iSetup.getData(ecalSToken_); auto outDeDxC = std::make_unique(); std::vector dEdXass; @@ -749,9 +751,8 @@ float pat::PATIsolatedTrackProducer::getDeDx(const reco::DeDxHitInfo* hitInfo, b TrackDetMatchInfo pat::PATIsolatedTrackProducer::getTrackDetMatchInfo(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) { - edm::ESHandle bField; - iSetup.get().get(bField); - FreeTrajectoryState initialState = trajectoryStateTransform::initialFreeState(track, &*bField); + auto const& bField = iSetup.getData(bFieldToken_); + FreeTrajectoryState initialState = trajectoryStateTransform::initialFreeState(track, &bField); // can't use the associate() using reco::Track directly, since // track->extra() is non-null but segfaults when trying to use it diff --git a/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc b/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc index b8feb6fec61f9..f3a05782fe530 100644 --- a/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc @@ -184,7 +184,8 @@ PATJetProducer::PATJetProducer(const edm::ParameterSet &iConfig) // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } if (discriminatorTags_.empty()) { addDiscriminators_ = false; diff --git a/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc index ac374eef2b0b9..590ca5172e281 100644 --- a/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc @@ -29,7 +29,6 @@ namespace pat { ~PATJetSlimmer() override {} void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; - void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) final; private: edm::EDGetTokenT> pf2pc_; @@ -71,15 +70,13 @@ pat::PATJetSlimmer::PATJetSlimmer(const edm::ParameterSet& iConfig) produces>(); } -void pat::PATJetSlimmer::beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup& iSetup) { - if (modifyJet_) - jetModifier_->setEventContent(iSetup); -} - void pat::PATJetSlimmer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; using namespace std; + if (modifyJet_) + jetModifier_->setEventContent(iSetup); + Handle> src; iEvent.getByToken(jets_, src); Handle> pf2pc; diff --git a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc index e65a0f3b395f5..3bb4ee4f7280f 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc @@ -98,7 +98,8 @@ PATMETProducer::PATMETProducer(const edm::ParameterSet& iConfig) : useUserData_( // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // Check to see if the user wants to add user data diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc index 7acd5d4d6a330..301a5fa773fbc 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc @@ -403,7 +403,8 @@ PATMuonProducer::PATMuonProducer(const edm::ParameterSet& iConfig, PATMuonHeavyO // resolutions addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // puppi addPuppiIsolation_ = iConfig.getParameter("addPuppiIsolation"); diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc index ce7cce3748e94..d53ac16a68c7f 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc @@ -28,7 +28,6 @@ namespace pat { ~PATMuonSlimmer() override {} void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; - void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final; private: const edm::EDGetTokenT src_; @@ -85,15 +84,13 @@ pat::PATMuonSlimmer::PATMuonSlimmer(const edm::ParameterSet &iConfig) } } -void pat::PATMuonSlimmer::beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &iSetup) { - if (modifyMuon_) - muonModifier_->setEventContent(iSetup); -} - void pat::PATMuonSlimmer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { using namespace edm; using namespace std; + if (modifyMuon_) + muonModifier_->setEventContent(iSetup); + Handle src; iEvent.getByToken(src_, src); diff --git a/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc index ed528d8b502af..51d42ca6f2d89 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc @@ -96,7 +96,8 @@ PATPFParticleProducer::PATPFParticleProducer(const edm::ParameterSet& iConfig) // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // Check to see if the user wants to add user data diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index 0de95e311a2f2..e44054c58a6a0 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -289,7 +289,8 @@ PATPhotonProducer::PATPhotonProducer(const edm::ParameterSet& iConfig) // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // Check to see if the user wants to add user data if (useUserData_) { diff --git a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc index 119fab2569f45..6067a789f96f5 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc @@ -273,7 +273,8 @@ PATTauProducer::PATTauProducer(const edm::ParameterSet& iConfig) // Resolution configurables addResolutions_ = iConfig.getParameter("addResolutions"); if (addResolutions_) { - resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions")); + resolutionLoader_ = + pat::helper::KinResolutionsLoader(iConfig.getParameter("resolutions"), consumesCollector()); } // Check to see if the user wants to add user data if (useUserData_) { diff --git a/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc index 9b6cc186945b1..dd18782dee81e 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc @@ -22,7 +22,6 @@ namespace pat { ~PATTauSlimmer() override {} void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; - void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final; private: const edm::EDGetTokenT> src_; @@ -54,15 +53,13 @@ pat::PATTauSlimmer::PATTauSlimmer(const edm::ParameterSet &iConfig) produces>(); } -void pat::PATTauSlimmer::beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &iSetup) { - if (modifyTau_) - tauModifier_->setEventContent(iSetup); -} - void pat::PATTauSlimmer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { using namespace edm; using namespace std; + if (modifyTau_) + tauModifier_->setEventContent(iSetup); + Handle> src; iEvent.getByToken(src_, src); diff --git a/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc b/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc index 4977ce23b694e..4af93660bab4c 100644 --- a/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc @@ -30,6 +30,7 @@ #include #include #include +#include namespace pat { @@ -84,6 +85,9 @@ namespace pat { /// jec levels typedef std::vector vstring; vstring levels_; + + using CorrectionToken = edm::ESGetToken; + std::unordered_map payloadToTokens_; }; } // namespace pat @@ -113,8 +117,13 @@ TauJetCorrFactorsProducer::TauJetCorrFactorsProducer(const edm::ParameterSet& cf } } - if (!payloadMapping.decayModes_.empty()) + if (!payloadMapping.decayModes_.empty()) { payloadMappings_.push_back(payloadMapping); + payloadToTokens_.emplace(payloadMapping.payload_, CorrectionToken()); + } + } + for (auto& payloadToken : payloadToTokens_) { + payloadToken.second = esConsumes(edm::ESInputTag("", payloadToken.first)); } produces(); @@ -180,10 +189,9 @@ void TauJetCorrFactorsProducer::produce(edm::Event& evt, const edm::EventSetup& // retrieve JEC parameters from the DB and build a new corrector, // in case it does not exist already for current payload if (correctorMapping.find(payload) == correctorMapping.end()) { - edm::ESHandle jecParameters; - es.get().get(payload, jecParameters); + auto const& jecParameters = es.getData(payloadToTokens_[payload]); - correctorMapping[payload] = std::make_shared(params(*jecParameters, levels_)); + correctorMapping[payload] = std::make_shared(params(jecParameters, levels_)); } FactorizedJetCorrectorPtr& corrector = correctorMapping[payload]; diff --git a/PhysicsTools/PatAlgos/src/KinResolutionsLoader.cc b/PhysicsTools/PatAlgos/src/KinResolutionsLoader.cc index a278f4c010dbd..4cf4fbd5bb015 100644 --- a/PhysicsTools/PatAlgos/src/KinResolutionsLoader.cc +++ b/PhysicsTools/PatAlgos/src/KinResolutionsLoader.cc @@ -5,17 +5,17 @@ using pat::helper::KinResolutionsLoader; -KinResolutionsLoader::KinResolutionsLoader(const edm::ParameterSet &iConfig) { +KinResolutionsLoader::KinResolutionsLoader(const edm::ParameterSet &iConfig, edm::ConsumesCollector iCollector) { // Get the names (sorted) patlabels_ = iConfig.getParameterNamesForType(); // get the InputTags - for (std::vector::const_iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) { - eslabels_.push_back(iConfig.getParameter(*it)); + estokens_.reserve(patlabels_.size()); + for (auto const &label : patlabels_) { + estokens_.emplace_back(iCollector.esConsumes(edm::ESInputTag("", iConfig.getParameter(label)))); } - - // prepare the Handles - handles_.resize(patlabels_.size()); + // prepare the resolutions + resolutions_.resize(patlabels_.size()); // 'default' maps to empty string for (std::vector::iterator it = patlabels_.begin(), ed = patlabels_.end(); it != ed; ++it) { @@ -26,8 +26,7 @@ KinResolutionsLoader::KinResolutionsLoader(const edm::ParameterSet &iConfig) { void KinResolutionsLoader::newEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) { for (size_t i = 0, n = patlabels_.size(); i < n; ++i) { - iSetup.get().get(eslabels_[i], handles_[i]); - handles_[i]->setup(iSetup); + resolutions_[i] = &iSetup.getData(estokens_[i]); } } diff --git a/PhysicsTools/PatAlgos/src/VertexingHelper.cc b/PhysicsTools/PatAlgos/src/VertexingHelper.cc index 17fd943f6b91f..60752df6db20c 100644 --- a/PhysicsTools/PatAlgos/src/VertexingHelper.cc +++ b/PhysicsTools/PatAlgos/src/VertexingHelper.cc @@ -33,6 +33,9 @@ pat::helper::VertexingHelper::VertexingHelper(const edm::ParameterSet &iConfig, } else { enabled_ = false; } + if (!playback_) { + ttToken_ = iC.esConsumes(edm::ESInputTag("", "TransientTrackBuilder")); + } } void pat::helper::VertexingHelper::newEvent(const edm::Event &iEvent) { @@ -46,7 +49,7 @@ void pat::helper::VertexingHelper::newEvent(const edm::Event &iEvent) { void pat::helper::VertexingHelper::newEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) { newEvent(iEvent); if (!playback_) - iSetup.get().get("TransientTrackBuilder", ttBuilder_); + ttBuilder_ = iSetup.getHandle(ttToken_); } pat::VertexAssociation pat::helper::VertexingHelper::associate(const reco::Candidate &c) const { From 9e6cadfdb245a6e276e9d5258601370ff4cca789 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 24 Aug 2021 19:48:45 +0200 Subject: [PATCH 114/923] Rearrange the .h files in SimCalorimetry/HcalZeroSuppressionProducers --- .../BuildFile.xml | 4 +- .../{src => interface}/HcalZSAlgoRealistic.h | 6 +-- .../HcalZeroSuppressionAlgo.h | 4 +- .../plugins/BuildFile.xml | 9 +++++ .../{src => plugins}/HcalRealisticZS.cc | 35 ++++++++++++++++- .../src/HcalRealisticZS.h | 38 ------------------- .../src/HcalZSAlgoRealistic.cc | 2 +- .../src/HcalZeroSuppressionAlgo.cc | 2 +- .../src/SealModule.cc | 5 --- 9 files changed, 53 insertions(+), 52 deletions(-) rename SimCalorimetry/HcalZeroSuppressionProducers/{src => interface}/HcalZSAlgoRealistic.h (88%) rename SimCalorimetry/HcalZeroSuppressionProducers/{src => interface}/HcalZeroSuppressionAlgo.h (89%) create mode 100644 SimCalorimetry/HcalZeroSuppressionProducers/plugins/BuildFile.xml rename SimCalorimetry/HcalZeroSuppressionProducers/{src => plugins}/HcalRealisticZS.cc (84%) delete mode 100644 SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h delete mode 100644 SimCalorimetry/HcalZeroSuppressionProducers/src/SealModule.cc diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml b/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml index b5e2472fed074..e395591715b27 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml +++ b/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml @@ -1,7 +1,9 @@ - + + + diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.h b/SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZSAlgoRealistic.h similarity index 88% rename from SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.h rename to SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZSAlgoRealistic.h index aadbd91453314..524e4f1dad456 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.h +++ b/SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZSAlgoRealistic.h @@ -1,7 +1,7 @@ -#ifndef SIMCALORIMETRY_HCALZEROSUPPRESSIONALGOS_HCALZSALGOREALISTIC_H -#define SIMCALORIMETRY_HCALZEROSUPPRESSIONALGOS_HCALZSALGOREALISTIC_H 1 +#ifndef SIMCALORIMETRY_HCALZEROSUPPRESSIONPRODUCERS_HCALZSALGOREALISTIC_H +#define SIMCALORIMETRY_HCALZEROSUPPRESSIONPRODUCERS_HCALZSALGOREALISTIC_H 1 -#include "HcalZeroSuppressionAlgo.h" +#include "SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZeroSuppressionAlgo.h" /** \class HcalZSAlgoRealistic * diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.h b/SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZeroSuppressionAlgo.h similarity index 89% rename from SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.h rename to SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZeroSuppressionAlgo.h index a0fe27d6ab45d..a39e453be41ce 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.h +++ b/SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZeroSuppressionAlgo.h @@ -1,5 +1,5 @@ -#ifndef SimCalorimetry_HcalZeroSuppressionAlgos_HCALZEROSUPPESSIONALGO_H -#define SimCalorimetry_HcalZeroSuppressionAlgos_HCALZEROSUPPESSIONALGO_H 1 +#ifndef SimCalorimetry_HcalZeroSuppressionProducers_HCALZEROSUPPESSIONALGO_H +#define SimCalorimetry_HcalZeroSuppressionProducers_HCALZEROSUPPESSIONALGO_H 1 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/plugins/BuildFile.xml b/SimCalorimetry/HcalZeroSuppressionProducers/plugins/BuildFile.xml new file mode 100644 index 0000000000000..629c5420e8d9a --- /dev/null +++ b/SimCalorimetry/HcalZeroSuppressionProducers/plugins/BuildFile.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc b/SimCalorimetry/HcalZeroSuppressionProducers/plugins/HcalRealisticZS.cc similarity index 84% rename from SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc rename to SimCalorimetry/HcalZeroSuppressionProducers/plugins/HcalRealisticZS.cc index 98d873566e32c..b66cde85d792d 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc +++ b/SimCalorimetry/HcalZeroSuppressionProducers/plugins/HcalRealisticZS.cc @@ -1,14 +1,42 @@ +/** \class HcalSimpleRealisticZS + +\author J. Mans - Minnesota +*/ + #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" -#include "HcalRealisticZS.h" +#include "SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZSAlgoRealistic.h" #include #include +#include + +class HcalRealisticZS : public edm::stream::EDProducer<> { +public: + explicit HcalRealisticZS(const edm::ParameterSet &ps); + ~HcalRealisticZS() override; + void produce(edm::Event &e, const edm::EventSetup &c) override; + +private: + std::unique_ptr algo_; + std::string inputLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_hfQIE10_; + edm::EDGetTokenT tok_hbheQIE11_; + edm::ESGetToken tok_dbService_; +}; HcalRealisticZS::HcalRealisticZS(edm::ParameterSet const &conf) : inputLabel_(conf.getParameter("digiLabel")) { @@ -146,3 +174,8 @@ void HcalRealisticZS::produce(edm::Event &e, const edm::EventSetup &eventSetup) e.put(std::move(zs_hfQIE10), "HFQIE10DigiCollection"); e.put(std::move(zs_hbheQIE11), "HBHEQIE11DigiCollection"); } + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_FWK_MODULE(HcalRealisticZS); diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h deleted file mode 100644 index 32affab43ec30..0000000000000 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef HCALSIMPLEREALISTICZS_H -#define HCALSIMPLEREALISTICZS_H 1 - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "HcalZSAlgoRealistic.h" - -#include - -/** \class HcalSimpleRealisticZS - -\author J. Mans - Minnesota -*/ -class HcalRealisticZS : public edm::stream::EDProducer<> { -public: - explicit HcalRealisticZS(const edm::ParameterSet &ps); - ~HcalRealisticZS() override; - void produce(edm::Event &e, const edm::EventSetup &c) override; - -private: - std::unique_ptr algo_; - std::string inputLabel_; - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - edm::EDGetTokenT tok_hfQIE10_; - edm::EDGetTokenT tok_hbheQIE11_; - edm::ESGetToken tok_dbService_; -}; - -#endif diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.cc b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.cc index 47060762c8db4..709cff7ce64be 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.cc +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZSAlgoRealistic.cc @@ -1,4 +1,4 @@ -#include "HcalZSAlgoRealistic.h" +#include "SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZSAlgoRealistic.h" #include HcalZSAlgoRealistic::HcalZSAlgoRealistic(bool mp, diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.cc b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.cc index a4a41afc986be..9269d661ef059 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.cc +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalZeroSuppressionAlgo.cc @@ -1,4 +1,4 @@ -#include "HcalZeroSuppressionAlgo.h" +#include "SimCalorimetry/HcalZeroSuppressionProducers/interface/HcalZeroSuppressionAlgo.h" HcalZeroSuppressionAlgo::HcalZeroSuppressionAlgo(bool mp) : m_markAndPass(mp) { m_dbService = nullptr; } diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/SealModule.cc b/SimCalorimetry/HcalZeroSuppressionProducers/src/SealModule.cc deleted file mode 100644 index d4efe739f6169..0000000000000 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/SealModule.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "HcalRealisticZS.h" - -DEFINE_FWK_MODULE(HcalRealisticZS); From bce47440e22a53fb6394e1321f2e2e68bdc89463 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 24 Aug 2021 13:09:17 -0500 Subject: [PATCH 115/923] Use sufficient digits when converting a double This fixes the unit test failure using runNotAutoGeneratedCfi_cfg.py. --- FWCore/ParameterSet/src/types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/ParameterSet/src/types.cc b/FWCore/ParameterSet/src/types.cc index abcfd9316a167..bb62c1c6f41e8 100644 --- a/FWCore/ParameterSet/src/types.cc +++ b/FWCore/ParameterSet/src/types.cc @@ -471,7 +471,7 @@ bool edm::decode(double& to, std::string const& from) { bool edm::encode(std::string& to, double from) { std::ostringstream ost; - ost.precision(std::numeric_limits::digits10 + 1); + ost.precision(std::numeric_limits::max_digits10); ost << from; if (!ost) return false; From af7c905b2d2db15c745f8014b97eed93a6611924 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 20:16:12 +0200 Subject: [PATCH 116/923] Migrate BaseCkfTrajectoryBuilder to esConsumes() --- .../interface/BaseCkfTrajectoryBuilder.h | 14 +++++--- .../interface/CkfTrajectoryBuilder.h | 6 ++-- .../plugins/GroupedCkfTrajectoryBuilder.cc | 1 + .../src/BaseCkfTrajectoryBuilder.cc | 35 +++++++------------ .../CkfPattern/src/CkfTrajectoryBuilder.cc | 9 +++-- .../plugins/CkfDebugTrajectoryBuilder.h | 4 +-- 6 files changed, 34 insertions(+), 35 deletions(-) diff --git a/RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h b/RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h index f8249ffdd3185..11b8c738f65e7 100644 --- a/RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h +++ b/RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h @@ -3,8 +3,10 @@ #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h" #include "TrackingTools/PatternTools/interface/TrajectoryBuilder.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" #include @@ -26,6 +28,7 @@ class TrajectoryMeasurement; class TrajectoryContainer; class TrajectoryStateOnSurface; class TrajectoryFitter; +class TransientRecHitRecord; class TransientTrackingRecHitBuilder; class Trajectory; class TempTrajectory; @@ -65,6 +68,7 @@ class BaseCkfTrajectoryBuilder : public TrajectoryBuilder { // Claims ownership of TrajectoryFilter pointers BaseCkfTrajectoryBuilder(const edm::ParameterSet& conf, + edm::ConsumesCollector iC, std::unique_ptr filter, std::unique_ptr inOutFilter = nullptr); BaseCkfTrajectoryBuilder(const BaseCkfTrajectoryBuilder&) = delete; @@ -182,11 +186,11 @@ class BaseCkfTrajectoryBuilder : public TrajectoryBuilder { std::unique_ptr theInOutFilter; /** Filter used at end of in-out tracking */ // for EventSetup - const std::string theUpdatorName; - const std::string thePropagatorAlongName; - const std::string thePropagatorOppositeName; - const std::string theEstimatorName; - const std::string theRecHitBuilderName; + const edm::ESGetToken theUpdatorToken; + const edm::ESGetToken thePropagatorAlongToken; + const edm::ESGetToken thePropagatorOppositeToken; + const edm::ESGetToken theEstimatorToken; + const edm::ESGetToken theRecHitBuilderToken; }; #endif diff --git a/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h b/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h index 16a3afe18c2f3..81abb6b8d80ed 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h +++ b/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h @@ -35,8 +35,10 @@ class CkfTrajectoryBuilder : public BaseCkfTrajectoryBuilder { typedef std::vector TrajectoryContainer; typedef std::vector TempTrajectoryContainer; - CkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector& iC); - CkfTrajectoryBuilder(const edm::ParameterSet& conf, std::unique_ptr filter); + CkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector iC); + CkfTrajectoryBuilder(const edm::ParameterSet& conf, + edm::ConsumesCollector iC, + std::unique_ptr filter); ~CkfTrajectoryBuilder() override {} diff --git a/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.cc b/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.cc index 693c6f4cdedd7..bad4d1ec39059 100644 --- a/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.cc +++ b/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.cc @@ -111,6 +111,7 @@ namespace { GroupedCkfTrajectoryBuilder::GroupedCkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector& iC) : BaseCkfTrajectoryBuilder(conf, + iC, BaseCkfTrajectoryBuilder::createTrajectoryFilter( conf.getParameter("trajectoryFilter"), iC), conf.getParameter("useSameTrajFilter") diff --git a/RecoTracker/CkfPattern/src/BaseCkfTrajectoryBuilder.cc b/RecoTracker/CkfPattern/src/BaseCkfTrajectoryBuilder.cc index 25f38e6568f28..84aebfa9a1f90 100644 --- a/RecoTracker/CkfPattern/src/BaseCkfTrajectoryBuilder.cc +++ b/RecoTracker/CkfPattern/src/BaseCkfTrajectoryBuilder.cc @@ -20,21 +20,22 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" BaseCkfTrajectoryBuilder::BaseCkfTrajectoryBuilder(const edm::ParameterSet& conf, + edm::ConsumesCollector iC, std::unique_ptr filter, std::unique_ptr inOutFilter) : theSeedAs5DHit(conf.getParameter("seedAs5DHit")), theFilter(std::move(filter)), theInOutFilter(std::move(inOutFilter)), - theUpdatorName(conf.getParameter("updator")), - thePropagatorAlongName(conf.getParameter("propagatorAlong")), - thePropagatorOppositeName(conf.getParameter("propagatorOpposite")), - theEstimatorName(conf.getParameter("estimator")), - theRecHitBuilderName(conf.getParameter("TTRHBuilder")) { + theUpdatorToken(iC.esConsumes(edm::ESInputTag("", conf.getParameter("updator")))), + thePropagatorAlongToken(iC.esConsumes(edm::ESInputTag("", conf.getParameter("propagatorAlong")))), + thePropagatorOppositeToken( + iC.esConsumes(edm::ESInputTag("", conf.getParameter("propagatorOpposite")))), + theEstimatorToken(iC.esConsumes(edm::ESInputTag("", conf.getParameter("estimator")))), + theRecHitBuilderToken(iC.esConsumes(edm::ESInputTag("", conf.getParameter("TTRHBuilder")))) { if (conf.exists("clustersToSkip")) edm::LogError("BaseCkfTrajectoryBuilder") << "ERROR: " << typeid(*this).name() << " has a clustersToSkip parameter set"; @@ -227,23 +228,11 @@ void BaseCkfTrajectoryBuilder::unset() const { void BaseCkfTrajectoryBuilder::setEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup, const MeasurementTrackerEvent* data) { - edm::ESHandle updatorHandle; - edm::ESHandle propagatorAlongHandle; - edm::ESHandle propagatorOppositeHandle; - edm::ESHandle estimatorHandle; - edm::ESHandle recHitBuilderHandle; - - iSetup.get().get(theUpdatorName, updatorHandle); - iSetup.get().get(thePropagatorAlongName, propagatorAlongHandle); - iSetup.get().get(thePropagatorOppositeName, propagatorOppositeHandle); - iSetup.get().get(theEstimatorName, estimatorHandle); - iSetup.get().get(theRecHitBuilderName, recHitBuilderHandle); - - theUpdator = updatorHandle.product(); - thePropagatorAlong = propagatorAlongHandle.product(); - thePropagatorOpposite = propagatorOppositeHandle.product(); - theEstimator = estimatorHandle.product(); - theTTRHBuilder = recHitBuilderHandle.product(); + theUpdator = &iSetup.getData(theUpdatorToken); + thePropagatorAlong = &iSetup.getData(thePropagatorAlongToken); + thePropagatorOpposite = &iSetup.getData(thePropagatorOppositeToken); + theEstimator = &iSetup.getData(theEstimatorToken); + theTTRHBuilder = &iSetup.getData(theRecHitBuilderToken); setData(data); if (theFilter) diff --git a/RecoTracker/CkfPattern/src/CkfTrajectoryBuilder.cc b/RecoTracker/CkfPattern/src/CkfTrajectoryBuilder.cc index 36984bfd67fef..79d888103a1c5 100644 --- a/RecoTracker/CkfPattern/src/CkfTrajectoryBuilder.cc +++ b/RecoTracker/CkfPattern/src/CkfTrajectoryBuilder.cc @@ -26,13 +26,16 @@ using namespace std; -CkfTrajectoryBuilder::CkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector& iC) +CkfTrajectoryBuilder::CkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector iC) : CkfTrajectoryBuilder(conf, + iC, BaseCkfTrajectoryBuilder::createTrajectoryFilter( conf.getParameter("trajectoryFilter"), iC)) {} -CkfTrajectoryBuilder::CkfTrajectoryBuilder(const edm::ParameterSet& conf, std::unique_ptr filter) - : BaseCkfTrajectoryBuilder(conf, std::move(filter)) { +CkfTrajectoryBuilder::CkfTrajectoryBuilder(const edm::ParameterSet& conf, + edm::ConsumesCollector iC, + std::unique_ptr filter) + : BaseCkfTrajectoryBuilder(conf, iC, std::move(filter)) { theMaxCand = conf.getParameter("maxCand"); theLostHitPenalty = conf.getParameter("lostHitPenalty"); theIntermediateCleaning = conf.getParameter("intermediateCleaning"); diff --git a/RecoTracker/DebugTools/plugins/CkfDebugTrajectoryBuilder.h b/RecoTracker/DebugTools/plugins/CkfDebugTrajectoryBuilder.h index 6de87200f88c3..34307a68a5840 100644 --- a/RecoTracker/DebugTools/plugins/CkfDebugTrajectoryBuilder.h +++ b/RecoTracker/DebugTools/plugins/CkfDebugTrajectoryBuilder.h @@ -8,8 +8,8 @@ class CkfDebugTrajectoryBuilder : public CkfTrajectoryBuilder { public: - CkfDebugTrajectoryBuilder(const edm::ParameterSet& conf) - : CkfTrajectoryBuilder(conf, std::unique_ptr{}) { + CkfDebugTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector iC) + : CkfTrajectoryBuilder(conf, iC, std::unique_ptr{}) { //edm::LogVerbatim("CkfDebugger") <<"CkfDebugTrajectoryBuilder::CkfDebugTrajectoryBuilder"; } From 7483bce784b9795733f2d43fcbb3383113001494 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 20:38:44 +0200 Subject: [PATCH 117/923] Migrate TransientInitialStateEstimator to esConsumes() --- .../interface/ConversionTrackFinder.h | 4 +++- .../interface/InOutConversionTrackFinder.h | 4 +++- .../interface/OutInConversionTrackFinder.h | 4 +++- .../src/ConversionTrackFinder.cc | 5 +++-- .../src/InOutConversionTrackFinder.cc | 5 +++-- .../src/OutInConversionTrackFinder.cc | 5 +++-- .../src/ConversionTrackCandidateProducer.cc | 4 ++-- .../TransientInitialStateEstimator.h | 7 ++++--- .../src/CkfTrackCandidateMakerBase.cc | 2 +- .../src/TransientInitialStateEstimator.cc | 19 +++++++------------ 10 files changed, 32 insertions(+), 27 deletions(-) diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h b/RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h index 93a1a16e00792..da13c22e242a6 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h @@ -30,7 +30,9 @@ class TrackerGeometry; class ConversionTrackFinder { public: - ConversionTrackFinder(const edm::ParameterSet& config, const BaseCkfTrajectoryBuilder* trajectoryBuilder); + ConversionTrackFinder(const edm::ParameterSet& config, + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC); virtual ~ConversionTrackFinder(); diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionTrackFinder.h b/RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionTrackFinder.h index 1a7b0a66f26fe..64bc70e6d5bb8 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionTrackFinder.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionTrackFinder.h @@ -27,7 +27,9 @@ class TrajectoryCleanerBySharedHits; class InOutConversionTrackFinder : public ConversionTrackFinder { public: - InOutConversionTrackFinder(const edm::ParameterSet& config, const BaseCkfTrajectoryBuilder* trajectoryBuilder); + InOutConversionTrackFinder(const edm::ParameterSet& config, + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC); ~InOutConversionTrackFinder() override; std::vector tracks(const TrajectorySeedCollection& seeds, diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionTrackFinder.h b/RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionTrackFinder.h index ee3706c2ae6e5..196af47f13760 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionTrackFinder.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionTrackFinder.h @@ -29,7 +29,9 @@ class TrajectoryCleanerBySharedHits; class OutInConversionTrackFinder : public ConversionTrackFinder { public: - OutInConversionTrackFinder(const edm::ParameterSet& config, const BaseCkfTrajectoryBuilder* trajectoryBuilder); + OutInConversionTrackFinder(const edm::ParameterSet& config, + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC); ~OutInConversionTrackFinder() override; diff --git a/RecoEgamma/EgammaPhotonAlgos/src/ConversionTrackFinder.cc b/RecoEgamma/EgammaPhotonAlgos/src/ConversionTrackFinder.cc index 694f033b045b6..f393083043b5e 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/ConversionTrackFinder.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/ConversionTrackFinder.cc @@ -14,10 +14,11 @@ #include ConversionTrackFinder::ConversionTrackFinder(const edm::ParameterSet& conf, - const BaseCkfTrajectoryBuilder* trajectoryBuilder) + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC) : theCkfTrajectoryBuilder_(trajectoryBuilder), theInitialState_(new TransientInitialStateEstimator( - conf.getParameter("TransientInitialStateEstimatorParameters"))), + conf.getParameter("TransientInitialStateEstimatorParameters"), iC)), theTrackerGeom_(nullptr), theUpdator_(nullptr), thePropagator_(nullptr) { diff --git a/RecoEgamma/EgammaPhotonAlgos/src/InOutConversionTrackFinder.cc b/RecoEgamma/EgammaPhotonAlgos/src/InOutConversionTrackFinder.cc index 4a6780f4dbdf4..2a0c7685219c1 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/InOutConversionTrackFinder.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/InOutConversionTrackFinder.cc @@ -18,8 +18,9 @@ #include InOutConversionTrackFinder::InOutConversionTrackFinder(const edm::ParameterSet& conf, - const BaseCkfTrajectoryBuilder* trajectoryBuilder) - : ConversionTrackFinder(conf, trajectoryBuilder) { + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC) + : ConversionTrackFinder(conf, trajectoryBuilder, iC) { theTrajectoryCleaner_ = new TrajectoryCleanerBySharedHits(conf); // get the seed cleaner diff --git a/RecoEgamma/EgammaPhotonAlgos/src/OutInConversionTrackFinder.cc b/RecoEgamma/EgammaPhotonAlgos/src/OutInConversionTrackFinder.cc index 7d7f0ff6fb333..6836a889c0b2f 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/OutInConversionTrackFinder.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/OutInConversionTrackFinder.cc @@ -18,8 +18,9 @@ #include "Utilities/General/interface/precomputed_value_sort.h" OutInConversionTrackFinder::OutInConversionTrackFinder(const edm::ParameterSet& conf, - const BaseCkfTrajectoryBuilder* trajectoryBuilder) - : ConversionTrackFinder(conf, trajectoryBuilder) { + const BaseCkfTrajectoryBuilder* trajectoryBuilder, + edm::ConsumesCollector iC) + : ConversionTrackFinder(conf, trajectoryBuilder, iC) { theTrajectoryCleaner_ = new TrajectoryCleanerBySharedHits(conf); // get the seed cleaner diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc index f95619b2f8817..be107b0b161d8 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc @@ -145,9 +145,9 @@ ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::Pa theTrajectoryBuilder_(createBaseCkfTrajectoryBuilder( config.getParameter("TrajectoryBuilderPSet"), consumesCollector())), outInSeedFinder_{config, consumesCollector()}, - outInTrackFinder_{config, theTrajectoryBuilder_.get()}, + outInTrackFinder_{config, theTrajectoryBuilder_.get(), consumesCollector()}, inOutSeedFinder_{config, consumesCollector()}, - inOutTrackFinder_{config, theTrajectoryBuilder_.get()} { + inOutTrackFinder_{config, theTrajectoryBuilder_.get(), consumesCollector()} { OutInTrackCandidateCollection_ = config.getParameter("outInTrackCandidateCollection"); InOutTrackCandidateCollection_ = config.getParameter("inOutTrackCandidateCollection"); diff --git a/RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h b/RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h index a53f5404db4f4..773165bdee02b 100644 --- a/RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h +++ b/RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h @@ -1,6 +1,7 @@ #ifndef TransientInitialStateEstimator_H #define TransientInitialStateEstimator_H +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" @@ -24,14 +25,14 @@ class TransientInitialStateEstimator { public: typedef TrajectoryStateOnSurface TSOS; - TransientInitialStateEstimator(const edm::ParameterSet& conf); + TransientInitialStateEstimator(const edm::ParameterSet& conf, edm::ConsumesCollector iC); void setEventSetup(const edm::EventSetup& es, const TkClonerImpl& hc); std::pair innerState(const Trajectory& traj, bool doBackFit = true) const; private: - const std::string thePropagatorAlongName; - const std::string thePropagatorOppositeName; + const edm::ESGetToken thePropagatorAlongToken; + const edm::ESGetToken thePropagatorOppositeToken; const Propagator* thePropagatorAlong; const Propagator* thePropagatorOpposite; // not used? can we remove it? TkClonerImpl theHitCloner; diff --git a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc index d5674c24e46fb..7de1aec82550d 100644 --- a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc +++ b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc @@ -71,7 +71,7 @@ namespace cms { iC.esConsumes(edm::ESInputTag("", conf.getParameter("TrajectoryCleaner")))), theTrajectoryCleaner(nullptr), theInitialState(std::make_unique( - conf.getParameter("TransientInitialStateEstimatorParameters"))), + conf.getParameter("TransientInitialStateEstimatorParameters"), iC)), theNavigationSchoolToken( iC.esConsumes(edm::ESInputTag("", conf.getParameter("NavigationSchool")))), theNavigationSchool(nullptr), diff --git a/RecoTracker/CkfPattern/src/TransientInitialStateEstimator.cc b/RecoTracker/CkfPattern/src/TransientInitialStateEstimator.cc index 39492fbf4dc94..0cff75b14cc80 100644 --- a/RecoTracker/CkfPattern/src/TransientInitialStateEstimator.cc +++ b/RecoTracker/CkfPattern/src/TransientInitialStateEstimator.cc @@ -1,7 +1,6 @@ #include "RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -18,23 +17,19 @@ using namespace std; -TransientInitialStateEstimator::TransientInitialStateEstimator(const edm::ParameterSet& conf) - : thePropagatorAlongName(conf.getParameter("propagatorAlongTISE")), - thePropagatorOppositeName(conf.getParameter("propagatorOppositeTISE")), +TransientInitialStateEstimator::TransientInitialStateEstimator(const edm::ParameterSet& conf, edm::ConsumesCollector iC) + : thePropagatorAlongToken( + iC.esConsumes(edm::ESInputTag("", conf.getParameter("propagatorAlongTISE")))), + thePropagatorOppositeToken( + iC.esConsumes(edm::ESInputTag("", conf.getParameter("propagatorOppositeTISE")))), thePropagatorAlong(nullptr), thePropagatorOpposite(nullptr), theNumberMeasurementsForFit(conf.getParameter("numberMeasurementsForFit")) {} void TransientInitialStateEstimator::setEventSetup(const edm::EventSetup& es, const TkClonerImpl& hc) { theHitCloner = hc; - - edm::ESHandle halong; - edm::ESHandle hopposite; - - es.get().get(thePropagatorAlongName, halong); - es.get().get(thePropagatorOppositeName, hopposite); - thePropagatorAlong = halong.product(); - thePropagatorOpposite = hopposite.product(); + thePropagatorAlong = &es.getData(thePropagatorAlongToken); + thePropagatorOpposite = &es.getData(thePropagatorOppositeToken); } std::pair TransientInitialStateEstimator::innerState(const Trajectory& traj, From 9fbcb7507740d1ad4f526c992d2aabeba313ec74 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 21:14:37 +0200 Subject: [PATCH 118/923] Remove unnecessary ESHandle.h includes --- RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h | 1 - RecoTracker/CkfPattern/plugins/CkfTrackCandidateMaker.h | 1 - RecoTracker/CkfPattern/plugins/CkfTrajectoryMaker.h | 1 - RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.h | 1 - 4 files changed, 4 deletions(-) diff --git a/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h b/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h index 81abb6b8d80ed..b1bf2caf60150 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h +++ b/RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h @@ -10,7 +10,6 @@ class TrajectorySeed; class TrajectoryStateOnSurface; class TrajectoryFilter; -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" diff --git a/RecoTracker/CkfPattern/plugins/CkfTrackCandidateMaker.h b/RecoTracker/CkfPattern/plugins/CkfTrackCandidateMaker.h index ea6568482d926..df04d6c825322 100644 --- a/RecoTracker/CkfPattern/plugins/CkfTrackCandidateMaker.h +++ b/RecoTracker/CkfPattern/plugins/CkfTrackCandidateMaker.h @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoTracker/CkfPattern/plugins/CkfTrajectoryMaker.h b/RecoTracker/CkfPattern/plugins/CkfTrajectoryMaker.h index f4c51a85e645e..56f069af97330 100644 --- a/RecoTracker/CkfPattern/plugins/CkfTrajectoryMaker.h +++ b/RecoTracker/CkfPattern/plugins/CkfTrajectoryMaker.h @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.h b/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.h index 06f0a2f3ce16e..aa98aec3a37d9 100644 --- a/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.h +++ b/RecoTracker/CkfPattern/plugins/GroupedCkfTrajectoryBuilder.h @@ -1,7 +1,6 @@ #ifndef GroupedCkfTrajectoryBuilder_H #define GroupedCkfTrajectoryBuilder_H -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" From 7eae84fd47ca9cc60d27237d553038c693f7c1c1 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 24 Aug 2021 22:16:32 +0200 Subject: [PATCH 119/923] Utilities/StaticAnalyzers: Update function dumper to not add virtual at the end of function call printout. Change category of some checks to deprecated. --- .../src/ClangCmsCheckerPluginRegister.cpp | 6 +++--- Utilities/StaticAnalyzers/src/ESRecordGetChecker.cpp | 2 +- Utilities/StaticAnalyzers/src/FunctionDumper.cpp | 12 +++--------- Utilities/StaticAnalyzers/src/edmChecker.cpp | 2 +- Utilities/StaticAnalyzers/src/getByChecker.cpp | 4 ++-- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Utilities/StaticAnalyzers/src/ClangCmsCheckerPluginRegister.cpp b/Utilities/StaticAnalyzers/src/ClangCmsCheckerPluginRegister.cpp index a6a938ce9560f..1807327aeefd0 100644 --- a/Utilities/StaticAnalyzers/src/ClangCmsCheckerPluginRegister.cpp +++ b/Utilities/StaticAnalyzers/src/ClangCmsCheckerPluginRegister.cpp @@ -69,7 +69,7 @@ extern "C" void clang_registerCheckers(clang::ento::CheckerRegistry ®istry) { registry.addChecker( "cms.CodeRules.CatchAll", "Checks for 'catch(...)' in source files", "no docs"); registry.addChecker( - "cms.edmChecker", + "deprecated.edmChecker", "Flags classes inheriting from edm::EDProducer,edm::EDFilter,edm::Analyzer or edm::OutputModule", "no docs"); registry.addChecker( @@ -85,9 +85,9 @@ extern "C" void clang_registerCheckers(clang::ento::CheckerRegistry ®istry) { registry.addChecker( "optional.EDMPluginDumper", "Dumps macro DEFINE_EDM_PLUGIN types", "no docs"); registry.addChecker( - "cms.ThrUnsafeFCallChecker", "Reports calls of known thread unsafe functions", "no docs"); + "threadsafety.ThrUnsafeFCallChecker", "Reports calls of known thread unsafe functions", "no docs"); registry.addChecker( - "threadsafety.ESRecordGetChecker", "Checks for calls to EventSetupRecord::get", "no docs"); + "deprecated.ESRecordGetChecker", "Checks for calls to EventSetupRecord::get", "no docs"); } extern "C" const char clang_analyzerAPIVersionString[] = CLANG_ANALYZER_API_VERSION_STRING; diff --git a/Utilities/StaticAnalyzers/src/ESRecordGetChecker.cpp b/Utilities/StaticAnalyzers/src/ESRecordGetChecker.cpp index cdb3f73303864..1e8f3a85f8139 100644 --- a/Utilities/StaticAnalyzers/src/ESRecordGetChecker.cpp +++ b/Utilities/StaticAnalyzers/src/ESRecordGetChecker.cpp @@ -61,7 +61,7 @@ namespace clangcms { "the token see " "https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideHowToGetDataFromES#Getting_data_from_EventSetup_wit"; PathDiagnosticLocation CELoc = PathDiagnosticLocation::createBegin(CE, BR.getSourceManager(), AC); - BugType *BT = new BugType(Checker, "EventSetupRecord::get function called", "ThreadSafety"); + BugType *BT = new BugType(Checker, "EventSetupRecord::get function called", "Deprecated API"); std::unique_ptr R = std::make_unique(*BT, llvm::StringRef(os.str()), CELoc); R->addRange(CE->getSourceRange()); BR.emitReport(std::move(R)); diff --git a/Utilities/StaticAnalyzers/src/FunctionDumper.cpp b/Utilities/StaticAnalyzers/src/FunctionDumper.cpp index cb78f074b8761..634ee5dd23fba 100644 --- a/Utilities/StaticAnalyzers/src/FunctionDumper.cpp +++ b/Utilities/StaticAnalyzers/src/FunctionDumper.cpp @@ -137,10 +137,7 @@ namespace clangcms { fixAnonNS(mname); std::string tname = "function-dumper.txt.unsorted"; std::string ostring; - if (MD->isVirtual()) - ostring = "function '" + mdname + "' " + "calls function '" + mname + " virtual'\n"; - else - ostring = "function '" + mdname + "' " + "calls function '" + mname + "'\n"; + ostring = "function '" + mdname + "' " + "calls function '" + mname + "'\n"; support::writeLog(ostring, tname); VisitChildren(CXE); @@ -166,10 +163,7 @@ namespace clangcms { mname = support::getQualifiedName(*FD); std::string tname = "function-dumper.txt.unsorted"; std::string ostring; - if (FD->isVirtualAsWritten() || FD->isPure()) - ostring = "function '" + mdname + "' " + "calls function '" + mname + " virtual'\n"; - else - ostring = "function '" + mdname + "' " + "calls function '" + mname + "'\n"; + ostring = "function '" + mdname + "' " + "calls function '" + mname + "'\n"; support::writeLog(ostring, tname); VisitChildren(CE); @@ -194,7 +188,7 @@ namespace clangcms { for (auto I = MD->begin_overridden_methods(), E = MD->end_overridden_methods(); I != E; ++I) { std::string oname = support::getQualifiedName(*(*I)); walker.fixAnonNS(oname); - std::string ostring = "function '" + mname + "' " + "overrides function '" + oname + " virtual'\n"; + std::string ostring = "function '" + mname + "' " + "overrides function '" + oname + "'\n"; support::writeLog(ostring, tname); } return; diff --git a/Utilities/StaticAnalyzers/src/edmChecker.cpp b/Utilities/StaticAnalyzers/src/edmChecker.cpp index 93584c76d059f..8502ae575dd76 100644 --- a/Utilities/StaticAnalyzers/src/edmChecker.cpp +++ b/Utilities/StaticAnalyzers/src/edmChecker.cpp @@ -27,7 +27,7 @@ namespace clangcms { BR.EmitBasicReport(RD, this, "inherits from edm::EDProducer,edm::EDFilter,edm::EDAnalyzer, or edm::OutputModule", - "ThreadSafety", + "Deprecated API", os.str(), ELoc); } diff --git a/Utilities/StaticAnalyzers/src/getByChecker.cpp b/Utilities/StaticAnalyzers/src/getByChecker.cpp index b02664366af6b..c785e66572f25 100644 --- a/Utilities/StaticAnalyzers/src/getByChecker.cpp +++ b/Utilities/StaticAnalyzers/src/getByChecker.cpp @@ -101,7 +101,7 @@ namespace clangcms { // llvm::errs()< R = std::make_unique(*BT, llvm::StringRef(os.str()), CELoc); R->addRange(CE->getSourceRange()); BR.emitReport(std::move(R)); @@ -124,7 +124,7 @@ namespace clangcms { // (*I)->printPretty(llvm::errs(),0,Policy); // llvm::errs()<<" "< R = std::make_unique(*BT, llvm::StringRef(os.str()), CELoc); R->addRange(CE->getSourceRange()); BR.emitReport(std::move(R)); From 04d9e3e58c56576747695afdf53905fcd03acf8a Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 24 Aug 2021 22:37:26 +0200 Subject: [PATCH 120/923] Add -enable-checker deprecated --- Utilities/StaticAnalyzers/scripts/run_class_checker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/StaticAnalyzers/scripts/run_class_checker.sh b/Utilities/StaticAnalyzers/scripts/run_class_checker.sh index a18efb4d9b07b..5b2c6c2ca4b6f 100755 --- a/Utilities/StaticAnalyzers/scripts/run_class_checker.sh +++ b/Utilities/StaticAnalyzers/scripts/run_class_checker.sh @@ -10,7 +10,7 @@ cd ${LOCALRT}/src/Utilities/StaticAnalyzers scram b -j $J cd ${LOCALRT}/ export USER_CXXFLAGS="-DEDM_ML_DEBUG -w" -export USER_LLVM_CHECKERS="-enable-checker threadsafety -enable-checker optional.ClassChecker -enable-checker cms -disable-checker cms.FunctionDumper" +export USER_LLVM_CHECKERS="-enable-checker threadsafety -enable-checker optional.ClassChecker -enable-checker cms -enable-checker deprecated -disable-checker cms.FunctionDumper" scram b -k -j $J checker SCRAM_IGNORE_PACKAGES=Fireworks/% SCRAM_IGNORE_SUBDIRS=test > ${LOCALRT}/tmp/class+function-checker.log 2>&1 cd ${LOCALRT}/tmp/ touch check-end From b7f02967cddf484cdddfe855324af674398a84eb Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 24 Aug 2021 15:42:39 -0500 Subject: [PATCH 121/923] Avoid calling JetResolution*::get Instead, just get data directly from the EventSetup using the proper esConsumes. --- .../PatAlgos/plugins/PATMETProducer.cc | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc index 3bb4ee4f7280f..f53a93c34cad7 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc @@ -25,6 +25,8 @@ #include "PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h" #include "PhysicsTools/PatAlgos/interface/PATUserDataHelper.h" #include "RecoMET/METAlgorithms/interface/METSignificance.h" +#include "CondFormats/DataRecord/interface/JetResolutionRcd.h" +#include "CondFormats/DataRecord/interface/JetResolutionScaleFactorRcd.h" #include @@ -65,10 +67,10 @@ namespace pat { edm::EDGetTokenT> pfCandToken_; std::vector>> lepTokens_; edm::EDGetTokenT rhoToken_; - std::string jetResPtType_; - std::string jetResPhiType_; - std::string jetSFType_; edm::EDGetTokenT> weightsToken_; + edm::ESGetToken jetResPtToken_; + edm::ESGetToken jetResPhiToken_; + edm::ESGetToken jetSFToken_; const reco::METCovMatrix getMETCovMatrix(const edm::Event& event, const edm::EventSetup& iSetup, @@ -115,15 +117,18 @@ PATMETProducer::PATMETProducer(const edm::ParameterSet& iConfig) : useUserData_( weightsToken_ = consumes>(srcWeights); metSigAlgo_ = new metsig::METSignificance(iConfig); rhoToken_ = consumes(iConfig.getParameter("srcRho")); - jetSFType_ = iConfig.getParameter("srcJetSF"); - jetResPtType_ = iConfig.getParameter("srcJetResPt"); - jetResPhiType_ = iConfig.getParameter("srcJetResPhi"); jetToken_ = consumes>(iConfig.getParameter("srcJets")); pfCandToken_ = consumes>(iConfig.getParameter("srcPFCands")); std::vector srcLeptonsTags = iConfig.getParameter>("srcLeptons"); for (std::vector::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) { lepTokens_.push_back(consumes>(*it)); } + auto jetSFType = iConfig.getParameter("srcJetSF"); + auto jetResPtType = iConfig.getParameter("srcJetResPt"); + auto jetResPhiType = iConfig.getParameter("srcJetResPhi"); + jetResPtToken_ = esConsumes(edm::ESInputTag("", jetResPtType)); + jetResPhiToken_ = esConsumes(edm::ESInputTag("", jetResPhiType)); + jetSFToken_ = esConsumes(edm::ESInputTag("", jetSFType)); } // produces vector of mets @@ -255,9 +260,9 @@ const reco::METCovMatrix PATMETProducer::getMETCovMatrix(const edm::Event& event if (!weightsToken_.isUninitialized()) event.getByToken(weightsToken_, weights); - JME::JetResolution resPtObj = JME::JetResolution::get(iSetup, jetResPtType_); - JME::JetResolution resPhiObj = JME::JetResolution::get(iSetup, jetResPhiType_); - JME::JetResolutionScaleFactor resSFObj = JME::JetResolutionScaleFactor::get(iSetup, jetSFType_); + JME::JetResolution resPtObj = iSetup.getData(jetResPtToken_); + JME::JetResolution resPhiObj = iSetup.getData(jetResPhiToken_); + JME::JetResolutionScaleFactor resSFObj = iSetup.getData(jetSFToken_); //Compute the covariance matrix and fill it const edm::ValueMap* weightsPtr = nullptr; From 61a4ce9177be701677a629a5dfa4d6407c02831a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 24 Aug 2021 21:50:48 +0200 Subject: [PATCH 122/923] Migrate ClusterShapeTrajectoryFilter to esConsumes() --- .../interface/ClusterShapeTrajectoryFilter.h | 1 + .../src/ClusterShapeTrajectoryFilter.cc | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeTrajectoryFilter.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeTrajectoryFilter.h index d4a7415b68ca6..154d8ddd314d0 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeTrajectoryFilter.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeTrajectoryFilter.h @@ -36,6 +36,7 @@ class ClusterShapeTrajectoryFilter : public TrajectoryFilter { private: edm::EDGetTokenT theCacheToken; + edm::ESGetToken theFilterToken; const SiPixelClusterShapeCache* theCache; const ClusterShapeHitFilter* theFilter; }; diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/ClusterShapeTrajectoryFilter.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/ClusterShapeTrajectoryFilter.cc index 2b434747047a9..6ff70589ce341 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/ClusterShapeTrajectoryFilter.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/ClusterShapeTrajectoryFilter.cc @@ -6,14 +6,12 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" #include "TrackingTools/PatternTools/interface/TempTrajectory.h" -#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" @@ -37,18 +35,14 @@ using namespace std; /*****************************************************************************/ ClusterShapeTrajectoryFilter::ClusterShapeTrajectoryFilter(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) : theCacheToken(iC.consumes(iConfig.getParameter("cacheSrc"))), + theFilterToken(iC.esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter"))), theFilter(nullptr) {} ClusterShapeTrajectoryFilter::~ClusterShapeTrajectoryFilter() {} void ClusterShapeTrajectoryFilter::setEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle shape; - iSetup.get().get("ClusterShapeHitFilter", shape); - theFilter = shape.product(); - - edm::Handle cache; - iEvent.getByToken(theCacheToken, cache); - theCache = cache.product(); + theFilter = &iSetup.getData(theFilterToken); + theCache = &iEvent.get(theCacheToken); } /*****************************************************************************/ From d69d83d9fed3037ccb65d637cd97120ca79abb54 Mon Sep 17 00:00:00 2001 From: maria Date: Wed, 25 Aug 2021 11:32:20 +0200 Subject: [PATCH 123/923] fix 80X mc --- PhysicsTools/NanoAOD/python/jets_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index a07a08a54125a..589a8e6684682 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -767,9 +767,9 @@ jetMCTask = jetMCTaskak4.copy() jetMCTask.add(jetMCTaskak8) +_jetMCTaskak8 = jetMCTaskak8.copyAndExclude([genSubJetAK8Table]) + _jetMC_pre94XTask = jetMCTaskak4.copy() _jetMC_pre94XTask.add(genJetFlavourAssociation) -_jetMC_pre94XTask.add(jetMCTaskak8) -_jetMC_pre94XTask.copyAndExclude([genSubJetAK8Table]) +_jetMC_pre94XTask.add(_jetMCTaskak8) run2_miniAOD_80XLegacy.toReplaceWith(jetMCTask, _jetMC_pre94XTask) - From 0e55061d2dcab1987dc12fa152392cb8be2dca52 Mon Sep 17 00:00:00 2001 From: lathomasexport Date: Wed, 25 Aug 2021 11:39:02 +0200 Subject: [PATCH 124/923] Defining a common module for pfcands used in trk met --- PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py | 7 +++---- PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py | 6 ++++++ .../python/tools/runMETCorrectionsAndUncertainties.py | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 80614e2c9d1e2..773999927c4b3 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -6,6 +6,8 @@ from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +from PhysicsTools.PatUtils.tools.pfforTrkMET_cff import * + def miniAOD_customizeCommon(process): process.patMuons.isoDeposits = cms.PSet() process.patElectrons.isoDeposits = cms.PSet() @@ -216,10 +218,7 @@ def _add_slimmedMETsNoHF(process): # ================== CHSMET # ================== TrkMET - process.TrkCands = cms.EDFilter("CandPtrSelector", - src=cms.InputTag("packedPFCandidates"), - cut=cms.string("charge()!=0 && pvAssociationQuality()>=4 && vertexRef().key()==0") - ) + process.TrkCands = chargedPackedCandsForTkMet.clone() task.add(process.TrkCands) process.pfMetTrk = pfMet.clone(src = 'TrkCands') diff --git a/PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py b/PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py new file mode 100644 index 0000000000000..d5bfa986f8f79 --- /dev/null +++ b/PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +chargedPackedCandsForTkMet = cms.EDFilter("CandPtrSelector", + src=cms.InputTag("packedPFCandidates"), + cut=cms.string("charge()!=0 && pvAssociationQuality()>=4 && vertexRef().key()==0") + ) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index e4af61c9f3a95..804dbff34d274 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -6,6 +6,7 @@ from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection import CommonTools.CandAlgos.candPtrProjector_cfi as _mod +from PhysicsTools.PatUtils.tools.pfforTrkMET_cff import * def isValidInputTag(input): @@ -1727,8 +1728,8 @@ def miniAODConfigurationPre(self, process, patMetModuleSequence, pfCandCollectio patMetModuleSequence += getattr(process, "pfCHS") patMetModuleSequence += getattr(process, "pfMetCHS") patMetModuleSequence += getattr(process, "patCHSMet") - - pfTrk = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("pvAssociationQuality()>=4 && charge()!=0 && vertexRef().key()==0")) + + pfTrk = chargedPackedCandsForTkMet.clone() addToProcessAndTask("pfTrk", pfTrk, process, task) pfMetTrk = pfMet.clone(src = 'pfTrk') addToProcessAndTask("pfMetTrk", pfMetTrk, process, task) From 59dc13b44a29d6ef88c6e9a59205bd21c493f446 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 09:39:32 -0500 Subject: [PATCH 125/923] Use esConsumes in RecoBTag modules --- .../plugins/PixelClusterTagInfoProducer.cc | 13 +++++++------ RecoBTag/SoftLepton/plugins/SoftLepton.cc | 5 ++--- RecoBTag/SoftLepton/plugins/SoftLepton.h | 10 ++++++---- .../plugins/SoftPFElectronTagInfoProducer.cc | 7 +++---- .../plugins/SoftPFElectronTagInfoProducer.h | 2 ++ .../SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc | 7 +++---- .../SoftLepton/plugins/SoftPFMuonTagInfoProducer.h | 2 ++ 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/RecoBTag/PixelCluster/plugins/PixelClusterTagInfoProducer.cc b/RecoBTag/PixelCluster/plugins/PixelClusterTagInfoProducer.cc index 1f0c291c9a699..b05d51ecb0dde 100644 --- a/RecoBTag/PixelCluster/plugins/PixelClusterTagInfoProducer.cc +++ b/RecoBTag/PixelCluster/plugins/PixelClusterTagInfoProducer.cc @@ -37,6 +37,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/ESGetToken.h" // TagInfo #include "DataFormats/BTauReco/interface/PixelClusterTagInfo.h" @@ -79,6 +80,8 @@ class PixelClusterTagInfoProducer : public edm::global::EDProducer<> { const edm::EDGetTokenT > m_jets; const edm::EDGetTokenT m_vertices; const edm::EDGetTokenT > m_pixelhit; + const edm::ESGetToken m_geomToken; + const edm::ESGetToken m_topoToken; const bool m_isPhase1; const bool m_addFPIX; const int m_minADC; @@ -92,6 +95,8 @@ PixelClusterTagInfoProducer::PixelClusterTagInfoProducer(const edm::ParameterSet : m_jets(consumes >(iConfig.getParameter("jets"))), m_vertices(consumes(iConfig.getParameter("vertices"))), m_pixelhit(consumes >(iConfig.getParameter("pixelhit"))), + m_geomToken(esConsumes()), + m_topoToken(esConsumes()), m_isPhase1(iConfig.getParameter("isPhase1")), m_addFPIX(iConfig.getParameter("addForward")), m_minADC(iConfig.getParameter("minAdcCount")), @@ -140,14 +145,10 @@ void PixelClusterTagInfoProducer::produce(edm::StreamID iID, edm::Event& iEvent, const edmNew::DetSetVector& collectionClusters(*collectionHandle); // Open Geometry - edm::ESHandle geom; - iSetup.get().get(geom); - const TrackerGeometry& theTracker(*geom); + const TrackerGeometry& theTracker = iSetup.getData(m_geomToken); // Retrieve tracker topology from geometry - edm::ESHandle tTopoH; - iSetup.get().get(tTopoH); - const TrackerTopology* tTopo = tTopoH.product(); + const TrackerTopology* tTopo = &iSetup.getData(m_topoToken); std::vector clusters; diff --git a/RecoBTag/SoftLepton/plugins/SoftLepton.cc b/RecoBTag/SoftLepton/plugins/SoftLepton.cc index 67a7c3a216a48..2ea9b230d89f6 100644 --- a/RecoBTag/SoftLepton/plugins/SoftLepton.cc +++ b/RecoBTag/SoftLepton/plugins/SoftLepton.cc @@ -85,6 +85,7 @@ SoftLepton::SoftLepton(const edm::ParameterSet &iConfig) m_leptonId(iConfig.exists("leptonId") ? iConfig.getParameter("leptonId") : edm::InputTag()), token_leptonId(mayConsume >( iConfig.exists("leptonId") ? iConfig.getParameter("leptonId") : edm::InputTag())), + token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), m_transientTrackBuilder(nullptr), m_refineJetAxis(iConfig.getParameter("refineJetAxis")), m_deltaRCut(iConfig.getParameter("leptonDeltaRCut")), @@ -99,9 +100,7 @@ SoftLepton::~SoftLepton(void) {} // ------------ method called once per event during the event loop ----------------------- void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { // grab a TransientTrack helper from the Event Setup - edm::ESHandle builder; - setup.get().get("TransientTrackBuilder", builder); - m_transientTrackBuilder = builder.product(); + m_transientTrackBuilder = &setup.getData(token_builder); // input objects diff --git a/RecoBTag/SoftLepton/plugins/SoftLepton.h b/RecoBTag/SoftLepton/plugins/SoftLepton.h index 245bdfb2e84b0..b9e605f5b6396 100644 --- a/RecoBTag/SoftLepton/plugins/SoftLepton.h +++ b/RecoBTag/SoftLepton/plugins/SoftLepton.h @@ -44,6 +44,7 @@ #include "DataFormats/MuonReco/interface/Muon.h" #include "DataFormats/MuonReco/interface/MuonSelectors.h" #include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" class TransientTrackBuilder; @@ -99,15 +100,16 @@ class SoftLepton : public edm::stream::EDProducer<> { const edm::EDGetTokenT > token_leptonId; // service used to make transient tracks from tracks + const edm::ESGetToken token_builder; const TransientTrackBuilder* m_transientTrackBuilder; // algorithm configuration - unsigned int m_refineJetAxis; - double m_deltaRCut; - double m_chi2Cut; + const unsigned int m_refineJetAxis; + const double m_deltaRCut; + const double m_chi2Cut; // specific for reco::Muons - muon::SelectionType m_muonSelection; + const muon::SelectionType m_muonSelection; // nominal beam spot position static const reco::Vertex s_nominalBeamSpot; diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc index 940bf0f31eb01..cfc6cb2e7db7f 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc @@ -25,7 +25,8 @@ #include "CommonTools/Egamma/interface/ConversionTools.h" #include "DataFormats/PatCandidates/interface/Electron.h" -SoftPFElectronTagInfoProducer::SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf) { +SoftPFElectronTagInfoProducer::SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf) + : token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { token_jets = consumes >(conf.getParameter("jets")); token_elec = consumes >(conf.getParameter("electrons")); token_primaryVertex = consumes(conf.getParameter("primaryVertex")); @@ -40,9 +41,7 @@ SoftPFElectronTagInfoProducer::~SoftPFElectronTagInfoProducer() {} void SoftPFElectronTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { auto theElecTagInfo = std::make_unique(); - edm::ESHandle builder; - iSetup.get().get("TransientTrackBuilder", builder); - transientTrackBuilder = builder.product(); + transientTrackBuilder = &iSetup.getData(token_builder); edm::Handle PVCollection; iEvent.getByToken(token_primaryVertex, PVCollection); diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h index f837f28057683..84475a0fd740c 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h +++ b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h @@ -14,6 +14,7 @@ #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" // Vertex #include "DataFormats/VertexReco/interface/Vertex.h" @@ -41,6 +42,7 @@ class SoftPFElectronTagInfoProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT > token_elec; edm::EDGetTokenT token_BeamSpot; edm::EDGetTokenT token_allConversions; + const edm::ESGetToken token_builder; float DeltaRElectronJet, MaxSip3Dsig; bool goodvertex; diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc index 64bacc10a386a..bbcd0fc09a1d2 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc @@ -32,7 +32,8 @@ #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include -SoftPFMuonTagInfoProducer::SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf) { +SoftPFMuonTagInfoProducer::SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf) + : builderToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { jetToken = consumes >(conf.getParameter("jets")); muonToken = consumes >(conf.getParameter("muons")); vertexToken = consumes(conf.getParameter("primaryVertex")); @@ -67,9 +68,7 @@ void SoftPFMuonTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetu const reco::Vertex* vertex = &theVertexCollection->front(); // Biult TransientTrackBuilder - edm::ESHandle theTrackBuilder; - iSetup.get().get("TransientTrackBuilder", theTrackBuilder); - const TransientTrackBuilder* transientTrackBuilder = theTrackBuilder.product(); + const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(builderToken); // Loop on jets for (unsigned int ij = 0, nj = theJetCollection->size(); ij < nj; ij++) { diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h index d0f5017623ec2..791e5f530b517 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h +++ b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h @@ -19,6 +19,7 @@ #include "DataFormats/MuonReco/interface/MuonSelectors.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" @@ -37,6 +38,7 @@ class SoftPFMuonTagInfoProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT > jetToken; edm::EDGetTokenT > muonToken; edm::EDGetTokenT vertexToken; + const edm::ESGetToken builderToken; float pTcut, SIPsigcut, IPsigcut, ratio1cut, ratio2cut; bool useFilter; }; From 6214d48bf2e08c1b4a4ee97cca6be405495e20f8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 09:55:34 -0500 Subject: [PATCH 126/923] Move contents of .h files into .cc files for plugins --- RecoBTag/SoftLepton/plugins/SoftLepton.cc | 98 ++++++++++++++- RecoBTag/SoftLepton/plugins/SoftLepton.h | 118 ------------------ .../plugins/SoftPFElectronTagInfoProducer.cc | 56 ++++++++- .../plugins/SoftPFElectronTagInfoProducer.h | 52 -------- .../plugins/SoftPFMuonTagInfoProducer.cc | 43 ++++++- .../plugins/SoftPFMuonTagInfoProducer.h | 46 ------- RecoBTag/SoftLepton/plugins/module.cc | 8 -- 7 files changed, 193 insertions(+), 228 deletions(-) delete mode 100644 RecoBTag/SoftLepton/plugins/SoftLepton.h delete mode 100644 RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h delete mode 100644 RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h diff --git a/RecoBTag/SoftLepton/plugins/SoftLepton.cc b/RecoBTag/SoftLepton/plugins/SoftLepton.cc index 2ea9b230d89f6..cd1b9cd461962 100644 --- a/RecoBTag/SoftLepton/plugins/SoftLepton.cc +++ b/RecoBTag/SoftLepton/plugins/SoftLepton.cc @@ -8,6 +8,7 @@ Description: CMSSW EDProducer for soft lepton b tagging. Implementation: + The actual tagging is performed by SoftLeptonAlgorithm. */ // Original Author: fwyzard @@ -17,10 +18,37 @@ #include #include #include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "DataFormats/Common/interface/RefToBase.h" +#include "DataFormats/Math/interface/Vector3D.h" +#include "DataFormats/GeometryVector/interface/GlobalVector.h" +#include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/JetReco/interface/JetTracksAssociation.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/Electron.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/MakerMacros.h" + // ROOT::Math vectors (aka math::XYZVector) #include "DataFormats/Math/interface/LorentzVector.h" #include "Math/GenVector/PxPyPzM4D.h" @@ -33,7 +61,73 @@ #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/IPTools/interface/IPTools.h" -#include "SoftLepton.h" + +class SoftLepton : public edm::stream::EDProducer<> { +public: + explicit SoftLepton(const edm::ParameterSet &iConfig); + ~SoftLepton() override; + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + + struct TrackCompare { + inline bool operator()(const edm::RefToBase &t1, const edm::RefToBase &t2) const { + return t1.key() < t2.key(); + } + }; + + typedef std::map LeptonIds; + typedef std::map, LeptonIds, TrackCompare> Leptons; + + // generic interface, using a TrackRefVector for lepton tracks + reco::SoftLeptonTagInfo tag(const edm::RefToBase &jet, + const reco::TrackRefVector &tracks, + const Leptons &leptons, + const reco::Vertex &primaryVertex) const; + +protected: + // generic interface, using a TrackRefVector for lepton tracks + + GlobalVector refineJetAxis(const edm::RefToBase &jet, + const reco::TrackRefVector &tracks, + const edm::RefToBase &exclude = edm::RefToBase()) const; + + static double relativeEta(const math::XYZVector &vector, const math::XYZVector &axis); + + static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis); + +private: + void produce(edm::Event &event, const edm::EventSetup &setup) override; + + // configuration + const edm::InputTag m_jets; + const edm::EDGetTokenT token_jtas; + const edm::EDGetTokenT > token_jets; + const edm::EDGetTokenT token_primaryVertex; + const edm::InputTag m_leptons; + const edm::EDGetTokenT > token_gsfElectrons; + const edm::EDGetTokenT > token_electrons; + const edm::EDGetTokenT token_pfElectrons; + const edm::EDGetTokenT > token_muons; + const edm::EDGetTokenT > token_tracks; + const edm::InputTag m_leptonCands; + const edm::EDGetTokenT > token_leptonCands; + const edm::InputTag m_leptonId; + const edm::EDGetTokenT > token_leptonId; + + // service used to make transient tracks from tracks + const edm::ESGetToken token_builder; + const TransientTrackBuilder *m_transientTrackBuilder; + + // algorithm configuration + const unsigned int m_refineJetAxis; + const double m_deltaRCut; + const double m_chi2Cut; + + // specific for reco::Muons + const muon::SelectionType m_muonSelection; + + // nominal beam spot position + static const reco::Vertex s_nominalBeamSpot; +}; enum AxisType { AXIS_CALORIMETRIC = 0, // use the calorimietric jet axis @@ -441,3 +535,5 @@ void SoftLepton::fillDescriptions(edm::ConfigurationDescriptions &descriptions) desc.add("leptonChi2Cut", 9999.0); descriptions.addDefault(desc); } + +DEFINE_FWK_MODULE(SoftLepton); diff --git a/RecoBTag/SoftLepton/plugins/SoftLepton.h b/RecoBTag/SoftLepton/plugins/SoftLepton.h deleted file mode 100644 index b9e605f5b6396..0000000000000 --- a/RecoBTag/SoftLepton/plugins/SoftLepton.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef RecoBTag_SoftLepton_SoftLepton_h -#define RecoBTag_SoftLepton_SoftLepton_h - -// -*- C++ -*- -// -// Package: SoftLepton -// Class: SoftLepton -// -/**\class SoftLepton SoftLepton.h RecoBTag/SoftLepton/plugin/SoftLepton.h - - Description: CMSSW EDProducer wrapper for sot lepton b tagging. - - Implementation: - The actual tagging is performed by SoftLeptonAlgorithm. -*/ -// -// Original Author: fwyzard -// Created: Wed Oct 18 18:02:07 CEST 2006 -// - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/Common/interface/RefToBase.h" -#include "DataFormats/Math/interface/Vector3D.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/JetReco/interface/Jet.h" -#include "DataFormats/JetReco/interface/JetTracksAssociation.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" -#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" - -class TransientTrackBuilder; - -class SoftLepton : public edm::stream::EDProducer<> { -public: - explicit SoftLepton(const edm::ParameterSet& iConfig); - ~SoftLepton() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - struct TrackCompare { - inline bool operator()(const edm::RefToBase& t1, const edm::RefToBase& t2) const { - return t1.key() < t2.key(); - } - }; - - typedef std::map LeptonIds; - typedef std::map, LeptonIds, TrackCompare> Leptons; - - // generic interface, using a TrackRefVector for lepton tracks - reco::SoftLeptonTagInfo tag(const edm::RefToBase& jet, - const reco::TrackRefVector& tracks, - const Leptons& leptons, - const reco::Vertex& primaryVertex) const; - -protected: - // generic interface, using a TrackRefVector for lepton tracks - - GlobalVector refineJetAxis(const edm::RefToBase& jet, - const reco::TrackRefVector& tracks, - const edm::RefToBase& exclude = edm::RefToBase()) const; - - static double relativeEta(const math::XYZVector& vector, const math::XYZVector& axis); - - static double boostedPPar(const math::XYZVector& vector, const math::XYZVector& axis); - -private: - void produce(edm::Event& event, const edm::EventSetup& setup) override; - - // configuration - const edm::InputTag m_jets; - const edm::EDGetTokenT token_jtas; - const edm::EDGetTokenT > token_jets; - const edm::EDGetTokenT token_primaryVertex; - const edm::InputTag m_leptons; - const edm::EDGetTokenT > token_gsfElectrons; - const edm::EDGetTokenT > token_electrons; - const edm::EDGetTokenT token_pfElectrons; - const edm::EDGetTokenT > token_muons; - const edm::EDGetTokenT > token_tracks; - const edm::InputTag m_leptonCands; - const edm::EDGetTokenT > token_leptonCands; - const edm::InputTag m_leptonId; - const edm::EDGetTokenT > token_leptonId; - - // service used to make transient tracks from tracks - const edm::ESGetToken token_builder; - const TransientTrackBuilder* m_transientTrackBuilder; - - // algorithm configuration - const unsigned int m_refineJetAxis; - const double m_deltaRCut; - const double m_chi2Cut; - - // specific for reco::Muons - const muon::SelectionType m_muonSelection; - - // nominal beam spot position - static const reco::Vertex s_nominalBeamSpot; -}; - -#endif // RecoBTag_SoftLepton_SoftLepton_h diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc index cfc6cb2e7db7f..900ea6b214404 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc @@ -1,4 +1,5 @@ -#include "RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" @@ -15,16 +16,65 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" + +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" + +// Vertex +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" +#include "DataFormats/PatCandidates/interface/Electron.h" + // Transient Track and IP #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/IPTools/interface/IPTools.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include #include "CommonTools/Egamma/interface/ConversionTools.h" #include "DataFormats/PatCandidates/interface/Electron.h" +#include +#include + +// SoftPFElectronTagInfoProducer: the SoftPFElectronTagInfoProducer takes +// a PFCandidateCollection as input and produces a RefVector +// to the likely soft electrons in this collection. + +class SoftPFElectronTagInfoProducer : public edm::stream::EDProducer<> { +public: + SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf); + ~SoftPFElectronTagInfoProducer() override; + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + bool isElecClean(edm::Event&, const reco::GsfElectron*); + float boostedPPar(const math::XYZVector&, const math::XYZVector&); + + // service used to make transient tracks from tracks + const TransientTrackBuilder* transientTrackBuilder; + edm::EDGetTokenT token_primaryVertex; + edm::EDGetTokenT > token_jets; + edm::EDGetTokenT > token_elec; + edm::EDGetTokenT token_BeamSpot; + edm::EDGetTokenT token_allConversions; + const edm::ESGetToken token_builder; + float DeltaRElectronJet, MaxSip3Dsig; + bool goodvertex; + + const reco::Vertex* vertex; +}; + SoftPFElectronTagInfoProducer::SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf) : token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { token_jets = consumes >(conf.getParameter("jets")); @@ -148,3 +198,5 @@ float SoftPFElectronTagInfoProducer::boostedPPar(const math::XYZVector& vector, ROOT::Math::BoostX boost(-jet.Beta()); return boost(lepton).x(); } + +DEFINE_FWK_MODULE(SoftPFElectronTagInfoProducer); diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h deleted file mode 100644 index 84475a0fd740c..0000000000000 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef RecoBTag_SoftLepton_SoftPFElectronTagInfoProducer_h -#define RecoBTag_SoftLepton_SoftPFElectronTagInfoProducer_h - -#include - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" - -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" - -// Vertex -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" -#include "DataFormats/PatCandidates/interface/Electron.h" -// SoftPFElectronTagInfoProducer: the SoftPFElectronTagInfoProducer takes -// a PFCandidateCollection as input and produces a RefVector -// to the likely soft electrons in this collection. - -class SoftPFElectronTagInfoProducer : public edm::stream::EDProducer<> { -public: - SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf); - ~SoftPFElectronTagInfoProducer() override; - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - bool isElecClean(edm::Event&, const reco::GsfElectron*); - float boostedPPar(const math::XYZVector&, const math::XYZVector&); - - // service used to make transient tracks from tracks - const TransientTrackBuilder* transientTrackBuilder; - edm::EDGetTokenT token_primaryVertex; - edm::EDGetTokenT > token_jets; - edm::EDGetTokenT > token_elec; - edm::EDGetTokenT token_BeamSpot; - edm::EDGetTokenT token_allConversions; - const edm::ESGetToken token_builder; - float DeltaRElectronJet, MaxSip3Dsig; - bool goodvertex; - - const reco::Vertex* vertex; -}; - -#endif diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc index bbcd0fc09a1d2..ecc4395090670 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc @@ -2,7 +2,28 @@ // * Mail: a.zucchetta@cern.ch // * January 16, 2015 -#include "RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" + +#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" +#include "DataFormats/BTauReco/interface/CandSoftLeptonTagInfo.h" + #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" #include "DataFormats/Math/interface/deltaR.h" @@ -31,6 +52,24 @@ #include "TrackingTools/IPTools/interface/IPTools.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include +#include + +class SoftPFMuonTagInfoProducer : public edm::stream::EDProducer<> { +public: + SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf); + ~SoftPFMuonTagInfoProducer() override; + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + virtual float boostedPPar(const math::XYZVector&, const math::XYZVector&); + + edm::EDGetTokenT > jetToken; + edm::EDGetTokenT > muonToken; + edm::EDGetTokenT vertexToken; + const edm::ESGetToken builderToken; + float pTcut, SIPsigcut, IPsigcut, ratio1cut, ratio2cut; + bool useFilter; +}; SoftPFMuonTagInfoProducer::SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf) : builderToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { @@ -171,3 +210,5 @@ float SoftPFMuonTagInfoProducer::boostedPPar(const math::XYZVector& vector, cons ROOT::Math::BoostX boost(-jet.Beta()); return boost(lepton).x(); } + +DEFINE_FWK_MODULE(SoftPFMuonTagInfoProducer); diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h deleted file mode 100644 index 791e5f530b517..0000000000000 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h +++ /dev/null @@ -1,46 +0,0 @@ -// * Author: Alberto Zucchetta -// * Mail: a.zucchetta@cern.ch -// * January 16, 2015 - -#ifndef RecoBTag_SoftLepton_SoftPFMuonTagInfoProducer_h -#define RecoBTag_SoftLepton_SoftPFMuonTagInfoProducer_h - -#include - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" - -#include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" -#include "DataFormats/BTauReco/interface/CandSoftLeptonTagInfo.h" - -class SoftPFMuonTagInfoProducer : public edm::stream::EDProducer<> { -public: - SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf); - ~SoftPFMuonTagInfoProducer() override; - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - virtual float boostedPPar(const math::XYZVector&, const math::XYZVector&); - - edm::EDGetTokenT > jetToken; - edm::EDGetTokenT > muonToken; - edm::EDGetTokenT vertexToken; - const edm::ESGetToken builderToken; - float pTcut, SIPsigcut, IPsigcut, ratio1cut, ratio2cut; - bool useFilter; -}; - -#endif diff --git a/RecoBTag/SoftLepton/plugins/module.cc b/RecoBTag/SoftLepton/plugins/module.cc index 710db04f699e3..3d2a231f7ecc8 100644 --- a/RecoBTag/SoftLepton/plugins/module.cc +++ b/RecoBTag/SoftLepton/plugins/module.cc @@ -1,10 +1,6 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "RecoBTag/SoftLepton/plugins/SoftLepton.h" -#include "RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h" -#include "RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h" - #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "RecoBTag/SoftLepton/interface/GenericSelectorByValueMap.h" @@ -16,10 +12,6 @@ #include "RecoBTag/SoftLepton/interface/MuonTagger.h" #include "RecoBTag/SoftLepton/interface/MuonTaggerNoIP.h" -DEFINE_FWK_MODULE(SoftLepton); -DEFINE_FWK_MODULE(SoftPFElectronTagInfoProducer); -DEFINE_FWK_MODULE(SoftPFMuonTagInfoProducer); - // "float" is the type stored in the ValueMap typedef edm::GenericSelectorByValueMap BtagGsfElectronSelector; DEFINE_FWK_MODULE(BtagGsfElectronSelector); From f5c009df5e286386c3ab8761638d06940b8d5d83 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 25 Aug 2021 17:03:45 +0200 Subject: [PATCH 127/923] Update he tools to investigate geometry setups --- .../PrintGeomInfo/test/SimFileCompare.cpp | 29 +++- .../test/python/g4OverlapCheckBigXML_cfg.py | 45 +++++ .../python/g4OverlapCheckBigXMLdd4hep_cfg.py | 47 +++++ Validation/Geometry/macros/MatBudgetVolume.C | 164 +++++++++--------- 4 files changed, 200 insertions(+), 85 deletions(-) create mode 100644 SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXML_cfg.py create mode 100644 SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXMLdd4hep_cfg.py diff --git a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp index ac8a2af3b0dd8..f0e6932c13936 100644 --- a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp +++ b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp @@ -275,6 +275,8 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi std::cout << "\nEntries in " << fileFile1 << " and " << fileFile2 << " do not match in the content\n"; const double denmin = 0.0001; int kount1(0), kount2(0); + double difmax1(0), difmax2(0); + std::string nameMax(""); if (type == 0) { const double tol1 = 0.00001; for (auto it1 : matFile1) { @@ -285,6 +287,11 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi 0.5 * (it1.second.radl - it2->second.radl) / std::max(denmin, (it1.second.radl + it2->second.radl)); double idif = 0.5 * (it1.second.intl - it2->second.intl) / std::max(denmin, (it1.second.intl + it2->second.intl)); + if (std::abs(rdif) > difmax1) { + difmax1 = std::abs(rdif); + difmax2 = std::abs(idif); + nameMax = it1.first; + } if ((std::abs(rdif) > tol1) || (std::abs(idif) > tol1)) { ++kount2; std::cout << it1.first << " X0 " << it1.second.radl << ":" << it2->second.radl << ":" << rdif << " #L " @@ -293,7 +300,7 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi } } std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol1 - << " or more\n"; + << " or more; the maximum happens for " << nameMax << " with " << difmax1 << ":" << difmax2 << "\n"; } else if (type == 1) { const double tol2 = 0.0001; for (auto it1 : solidFile1) { @@ -302,6 +309,10 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi ++kount1; double vdif = 0.5 * (it1.second.volume - it2->second.volume) / std::max(denmin, (it1.second.volume + it2->second.volume)); + if (std::abs(vdif) > difmax1) { + difmax1 = std::abs(vdif); + nameMax = it1.first; + } if (std::abs(vdif) > tol2) { ++kount2; std::cout << it1.first << " Volume " << it1.second.volume << ":" << it2->second.volume << ":" << vdif @@ -310,7 +321,7 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi } } std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol2 - << " or more\n"; + << " or more; the maximum happens for " << nameMax << " with " << difmax1 << "\n"; } else if (type == 2) { const double tol3 = 0.0001; for (auto it1 : lvFile1) { @@ -319,6 +330,10 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi ++kount1; double vdif = 0.5 * (it1.second.mass - it2->second.mass) / std::max(denmin, (it1.second.mass + it2->second.mass)); + if (std::abs(vdif) > difmax1) { + difmax1 = std::abs(vdif); + nameMax = it1.first; + } if (std::abs(vdif) > tol3) { ++kount2; std::cout << it1.first << " Mass " << it1.second.mass << ":" << it2->second.mass << ":" << vdif << std::endl; @@ -326,7 +341,7 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi } } std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol3 - << " or more\n"; + << " or more; the maximum happens for " << nameMax << " with " << difmax1 << "\n"; } else { const double tol4 = 0.0001; for (auto it1 : pvFile1) { @@ -336,6 +351,12 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi double xdif = (it1.second.xx - it2->second.xx); double ydif = (it1.second.yy - it2->second.yy); double zdif = (it1.second.zz - it2->second.zz); + double vdif = std::max(std::abs(xdif), std::abs(ydif)); + vdif = std::max(vdif, std::abs(zdif)); + if (vdif > difmax1) { + difmax1 = vdif; + nameMax = it1.first; + } if ((std::abs(xdif) > tol4) || (std::abs(ydif) > tol4) || (std::abs(zdif) > tol4)) { ++kount2; std::cout << it1.first << " x " << it1.second.xx << ":" << it2->second.xx << ":" << xdif << " y " @@ -345,7 +366,7 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi } } std::cout << "\n " << kount2 << " out of " << kount1 << " entries having discrpancies at the level of " << tol4 - << " or more\n"; + << " or more; the maximum happens for " << nameMax << " with " << difmax1 << "\n"; } } diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXML_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXML_cfg.py new file mode 100644 index 0000000000000..53233b548fd16 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXML_cfg.py @@ -0,0 +1,45 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('SIM',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') + +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.HCalGeom=dict() + +from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * +process = checkOverlap(process) + +# enable Geant4 overlap check +process.g4SimHits.CheckGeometry = True + +# Geant4 geometry check +process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("cms2021") +process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True) +process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.1) +process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000) +process.g4SimHits.G4CheckOverlap.Depth = cms.int32(-1) +# tells if NodeName is G4Region or G4PhysicalVolume +process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False) +# list of names +process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('OCMS') +# enable dump gdml file +process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.bool(False) +# if defined a G4PhysicsVolume info is printed +process.g4SimHits.G4CheckOverlap.PVname = '' +# if defined a list of daughter volumes is printed +process.g4SimHits.G4CheckOverlap.LVname = '' + +# extra output files, created if a name is not empty +process.g4SimHits.FileNameField = '' +process.g4SimHits.FileNameGDML = '' +process.g4SimHits.FileNameRegions = '' +# diff --git a/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXMLdd4hep_cfg.py b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXMLdd4hep_cfg.py new file mode 100644 index 0000000000000..2161b487dae3c --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXMLdd4hep_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') + +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.HCalGeom=dict() + +from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * +process = checkOverlap(process) + +# enable Geant4 overlap check +process.g4SimHits.CheckGeometry = True + +process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4Core/PrintGeomInfo/data/dd4hep/cmsExtendedGeometry2021.xml") + +# Geant4 geometry check +process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("cms2021") +process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True) +process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.1) +process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000) +process.g4SimHits.G4CheckOverlap.Depth = cms.int32(-1) +# tells if NodeName is G4Region or G4PhysicalVolume +process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False) +# list of names +process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('cms:OCMS_1') +# enable dump gdml file +process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.bool(False) +# if defined a G4PhysicsVolume info is printed +process.g4SimHits.G4CheckOverlap.PVname = '' +# if defined a list of daughter volumes is printed +process.g4SimHits.G4CheckOverlap.LVname = '' + +# extra output files, created if a name is not empty +process.g4SimHits.FileNameField = '' +process.g4SimHits.FileNameGDML = '' +process.g4SimHits.FileNameRegions = '' +# diff --git a/Validation/Geometry/macros/MatBudgetVolume.C b/Validation/Geometry/macros/MatBudgetVolume.C index 6e64e0c08c6d5..a793007f20012 100644 --- a/Validation/Geometry/macros/MatBudgetVolume.C +++ b/Validation/Geometry/macros/MatBudgetVolume.C @@ -18,14 +18,14 @@ // Compares material budget plots from 2 different files // // etaPhiPlotComp4(filePreFix, tag, plot, ifEta, debug) -// Compares material budget plots from 4 different files: +// 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}") +// ("{DDD}{DD4Hep}") // /////////////////////////////////////////////////////////////////////////////// @@ -66,13 +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}", + 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 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; @@ -242,8 +242,7 @@ 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, std::string txt, 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); @@ -261,12 +260,12 @@ void etaPhiPlotComp( std::string ztit = "Eta"; char ytit[40]; if (plot == "radl") { - sprintf(ytit, "#frac%s for MB (X_{0})", txt.c_str()); + sprintf (ytit, "#frac%s for MB (X_{0})", txt.c_str()); } else if (plot == "step") { - sprintf(ytit, "#frac%s for MB (Step Length)", txt.c_str()); + sprintf (ytit, "#frac%s for MB (Step Length)", txt.c_str()); } else { plot = "intl"; - sprintf(ytit, "#frac%s for MB (#lambda)", txt.c_str()); + sprintf (ytit, "#frac%s for MB (#lambda)", txt.c_str()); } if (!ifEta) { xtit = "#phi"; @@ -299,7 +298,7 @@ void etaPhiPlotComp( } std::vector xx, yy, dx, dy; int ii = nflayer[i]; - double sumNum(0), sumDen(0); + double sumNum(0), sumDen(0), maxtmp(0), maxDev(0), dmaxDev(0); for (unsigned int k = 0; k < xx0.size(); ++k) { if ((yy1[k] > 0) && (yy2[k] > 0)) { double rat = yy1[k] / yy2[k]; @@ -314,13 +313,19 @@ void etaPhiPlotComp( } double temp1 = (rat > 1.0) ? 1.0 / rat : rat; double temp2 = (rat > 1.0) ? drt / (rat * rat) : drt; - sumNum += (fabs(1.0 - temp1) / (temp2 * temp2)); + 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 << "Mean deviation for " << title[ii] << " " << sumNum << " +- " << sumDen << std::endl; + std::cout << "Mean deviation for " << title[ii] << " " << 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(colorLay[ii]); @@ -416,74 +421,71 @@ void etaPhiPlotComp4(std::string filePreFix, std::string tag, std::string plot, 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; - } + 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)); - } + 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); + 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); + } } } } @@ -509,13 +511,13 @@ void etaPhiPlotComp4(std::string filePreFix, std::string tag, std::string plot, 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; + 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; } } } From 8f01892b904ee56f45fbcffec46bf09f3a535f1c Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 25 Aug 2021 17:18:46 +0200 Subject: [PATCH 128/923] Code check --- .../PrintGeomInfo/test/SimFileCompare.cpp | 38 ++-- Validation/Geometry/macros/MatBudgetVolume.C | 165 +++++++++--------- 2 files changed, 104 insertions(+), 99 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp index f0e6932c13936..bea0d0746eec2 100644 --- a/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp +++ b/SimG4Core/PrintGeomInfo/test/SimFileCompare.cpp @@ -287,11 +287,11 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi 0.5 * (it1.second.radl - it2->second.radl) / std::max(denmin, (it1.second.radl + it2->second.radl)); double idif = 0.5 * (it1.second.intl - it2->second.intl) / std::max(denmin, (it1.second.intl + it2->second.intl)); - if (std::abs(rdif) > difmax1) { - difmax1 = std::abs(rdif); - difmax2 = std::abs(idif); - nameMax = it1.first; - } + if (std::abs(rdif) > difmax1) { + difmax1 = std::abs(rdif); + difmax2 = std::abs(idif); + nameMax = it1.first; + } if ((std::abs(rdif) > tol1) || (std::abs(idif) > tol1)) { ++kount2; std::cout << it1.first << " X0 " << it1.second.radl << ":" << it2->second.radl << ":" << rdif << " #L " @@ -309,10 +309,10 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi ++kount1; double vdif = 0.5 * (it1.second.volume - it2->second.volume) / std::max(denmin, (it1.second.volume + it2->second.volume)); - if (std::abs(vdif) > difmax1) { - difmax1 = std::abs(vdif); - nameMax = it1.first; - } + if (std::abs(vdif) > difmax1) { + difmax1 = std::abs(vdif); + nameMax = it1.first; + } if (std::abs(vdif) > tol2) { ++kount2; std::cout << it1.first << " Volume " << it1.second.volume << ":" << it2->second.volume << ":" << vdif @@ -330,10 +330,10 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi ++kount1; double vdif = 0.5 * (it1.second.mass - it2->second.mass) / std::max(denmin, (it1.second.mass + it2->second.mass)); - if (std::abs(vdif) > difmax1) { - difmax1 = std::abs(vdif); - nameMax = it1.first; - } + if (std::abs(vdif) > difmax1) { + difmax1 = std::abs(vdif); + nameMax = it1.first; + } if (std::abs(vdif) > tol3) { ++kount2; std::cout << it1.first << " Mass " << it1.second.mass << ":" << it2->second.mass << ":" << vdif << std::endl; @@ -351,12 +351,12 @@ void CompareFiles(const char* fileFile1, const char* fileFile2, int type, int fi double xdif = (it1.second.xx - it2->second.xx); double ydif = (it1.second.yy - it2->second.yy); double zdif = (it1.second.zz - it2->second.zz); - double vdif = std::max(std::abs(xdif), std::abs(ydif)); - vdif = std::max(vdif, std::abs(zdif)); - if (vdif > difmax1) { - difmax1 = vdif; - nameMax = it1.first; - } + double vdif = std::max(std::abs(xdif), std::abs(ydif)); + vdif = std::max(vdif, std::abs(zdif)); + if (vdif > difmax1) { + difmax1 = vdif; + nameMax = it1.first; + } if ((std::abs(xdif) > tol4) || (std::abs(ydif) > tol4) || (std::abs(zdif) > tol4)) { ++kount2; std::cout << it1.first << " x " << it1.second.xx << ":" << it2->second.xx << ":" << xdif << " y " diff --git a/Validation/Geometry/macros/MatBudgetVolume.C b/Validation/Geometry/macros/MatBudgetVolume.C index a793007f20012..aa51f0ae0f8aa 100644 --- a/Validation/Geometry/macros/MatBudgetVolume.C +++ b/Validation/Geometry/macros/MatBudgetVolume.C @@ -18,7 +18,7 @@ // Compares material budget plots from 2 different files // // etaPhiPlotComp4(filePreFix, tag, plot, ifEta, debug) -// Compares material budget plots from 4 different files: +// 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 @@ -66,13 +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}", + 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 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; @@ -242,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, std::string txt, 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); @@ -260,12 +261,12 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool std::string ztit = "Eta"; char ytit[40]; if (plot == "radl") { - sprintf (ytit, "#frac%s for MB (X_{0})", txt.c_str()); + sprintf(ytit, "#frac%s for MB (X_{0})", txt.c_str()); } else if (plot == "step") { - sprintf (ytit, "#frac%s for MB (Step Length)", txt.c_str()); + sprintf(ytit, "#frac%s for MB (Step Length)", txt.c_str()); } else { plot = "intl"; - sprintf (ytit, "#frac%s for MB (#lambda)", txt.c_str()); + sprintf(ytit, "#frac%s for MB (#lambda)", txt.c_str()); } if (!ifEta) { xtit = "#phi"; @@ -313,19 +314,20 @@ void etaPhiPlotComp(TString fileName1, TString fileName2, std::string plot, bool } 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)); + 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; - } + 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 << "Mean deviation for " << title[ii] << " " << sumNum << " +- " << sumDen << " Max " << maxDev << " +- " << dmaxDev << std::endl; + std::cout << "Mean deviation for " << title[ii] << " " << 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(colorLay[ii]); @@ -421,71 +423,74 @@ void etaPhiPlotComp4(std::string filePreFix, std::string tag, std::string plot, 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; - } + 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)); - } + 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; + 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); } - 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); - } } } } @@ -511,13 +516,13 @@ void etaPhiPlotComp4(std::string filePreFix, std::string tag, std::string plot, 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; + 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; } } } From 5b1ca8e2a8d6dade620f7cb10c0eba776b9599d3 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 13:08:58 -0500 Subject: [PATCH 129/923] Modernized modules - made modules global - use new Event get syntax - added fillDescriptions --- RecoBTag/SoftLepton/plugins/SoftLepton.cc | 103 +++++++-------- .../plugins/SoftPFElectronTagInfoProducer.cc | 124 +++++++++--------- .../plugins/SoftPFMuonTagInfoProducer.cc | 84 ++++++------ 3 files changed, 153 insertions(+), 158 deletions(-) diff --git a/RecoBTag/SoftLepton/plugins/SoftLepton.cc b/RecoBTag/SoftLepton/plugins/SoftLepton.cc index cd1b9cd461962..09705ed584dc0 100644 --- a/RecoBTag/SoftLepton/plugins/SoftLepton.cc +++ b/RecoBTag/SoftLepton/plugins/SoftLepton.cc @@ -22,7 +22,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/Common/interface/RefToBase.h" @@ -62,10 +62,10 @@ #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/IPTools/interface/IPTools.h" -class SoftLepton : public edm::stream::EDProducer<> { +class SoftLepton : public edm::global::EDProducer<> { public: explicit SoftLepton(const edm::ParameterSet &iConfig); - ~SoftLepton() override; + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); struct TrackCompare { @@ -74,14 +74,15 @@ class SoftLepton : public edm::stream::EDProducer<> { } }; - typedef std::map LeptonIds; - typedef std::map, LeptonIds, TrackCompare> Leptons; + using LeptonIds = std::map; + using Leptons = std::map, LeptonIds, TrackCompare>; // generic interface, using a TrackRefVector for lepton tracks reco::SoftLeptonTagInfo tag(const edm::RefToBase &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, - const reco::Vertex &primaryVertex) const; + const reco::Vertex &primaryVertex, + const TransientTrackBuilder &builder) const; protected: // generic interface, using a TrackRefVector for lepton tracks @@ -95,7 +96,7 @@ class SoftLepton : public edm::stream::EDProducer<> { static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis); private: - void produce(edm::Event &event, const edm::EventSetup &setup) override; + void produce(edm::StreamID, edm::Event &event, const edm::EventSetup &setup) const final; // configuration const edm::InputTag m_jets; @@ -115,8 +116,8 @@ class SoftLepton : public edm::stream::EDProducer<> { // service used to make transient tracks from tracks const edm::ESGetToken token_builder; - const TransientTrackBuilder *m_transientTrackBuilder; + const edm::EDPutTokenT token_put; // algorithm configuration const unsigned int m_refineJetAxis; const double m_deltaRCut; @@ -163,38 +164,30 @@ const reco::Vertex SoftLepton::s_nominalBeamSpot( // ------------ c'tor -------------------------------------------------------------------- SoftLepton::SoftLepton(const edm::ParameterSet &iConfig) : m_jets(iConfig.getParameter("jets")), - token_jtas(mayConsume(iConfig.getParameter("jets"))), - token_jets(mayConsume >(iConfig.getParameter("jets"))), + token_jtas(mayConsume(m_jets)), + token_jets(mayConsume >(m_jets)), token_primaryVertex(consumes(iConfig.getParameter("primaryVertex"))), m_leptons(iConfig.getParameter("leptons")), - token_gsfElectrons(mayConsume(iConfig.getParameter("leptons"))), - token_electrons(mayConsume(iConfig.getParameter("leptons"))), - token_pfElectrons(mayConsume(iConfig.getParameter("leptons"))), - token_muons(mayConsume(iConfig.getParameter("leptons"))), - token_tracks(mayConsume >(iConfig.getParameter("leptons"))), - m_leptonCands(iConfig.exists("leptonCands") ? iConfig.getParameter("leptonCands") - : edm::InputTag()), - token_leptonCands(mayConsume >( - iConfig.exists("leptonCands") ? iConfig.getParameter("leptonCands") : edm::InputTag())), - m_leptonId(iConfig.exists("leptonId") ? iConfig.getParameter("leptonId") : edm::InputTag()), - token_leptonId(mayConsume >( - iConfig.exists("leptonId") ? iConfig.getParameter("leptonId") : edm::InputTag())), + token_gsfElectrons(mayConsume(m_leptons)), + token_electrons(mayConsume(m_leptons)), + token_pfElectrons(mayConsume(m_leptons)), + token_muons(mayConsume(m_leptons)), + token_tracks(mayConsume >(m_leptons)), + m_leptonCands(iConfig.getParameter("leptonCands")), + token_leptonCands(mayConsume >(m_leptonCands)), + m_leptonId(iConfig.getParameter("leptonId")), + token_leptonId(mayConsume >(m_leptonId)), token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), - m_transientTrackBuilder(nullptr), + token_put(produces()), m_refineJetAxis(iConfig.getParameter("refineJetAxis")), m_deltaRCut(iConfig.getParameter("leptonDeltaRCut")), m_chi2Cut(iConfig.getParameter("leptonChi2Cut")), - m_muonSelection((muon::SelectionType)iConfig.getParameter("muonSelection")) { - produces(); -} - -// ------------ d'tor -------------------------------------------------------------------- -SoftLepton::~SoftLepton(void) {} + m_muonSelection((muon::SelectionType)iConfig.getParameter("muonSelection")) {} // ------------ method called once per event during the event loop ----------------------- -void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { +void SoftLepton::produce(edm::StreamID, edm::Event &event, const edm::EventSetup &setup) const { // grab a TransientTrack helper from the Event Setup - m_transientTrackBuilder = &setup.getData(token_builder); + auto const &transientTrackBuilder = setup.getData(token_builder); // input objects @@ -205,8 +198,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { do { { // look for a JetTracksAssociationCollection - edm::Handle h_jtas; - event.getByToken(token_jtas, h_jtas); + edm::Handle h_jtas = event.getHandle(token_jtas); if (h_jtas.isValid()) { unsigned int size = h_jtas->size(); jets.resize(size); @@ -220,8 +212,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { } { // else... // look for a View - edm::Handle > h_jets; - event.getByToken(token_jets, h_jets); + edm::Handle > h_jets = event.getHandle(token_jets); if (h_jets.isValid()) { unsigned int size = h_jets->size(); jets.resize(size); @@ -240,8 +231,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { // input primary vetex reco::Vertex vertex; - Handle h_primaryVertex; - event.getByToken(token_primaryVertex, h_primaryVertex); + Handle h_primaryVertex = event.getHandle(token_primaryVertex); if (h_primaryVertex.isValid() and not h_primaryVertex->empty()) vertex = h_primaryVertex->front(); else @@ -254,7 +244,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { Handle > h_leptonCands; bool haveLeptonCands = !(m_leptonCands == edm::InputTag()); if (haveLeptonCands) - event.getByToken(token_leptonCands, h_leptonCands); + h_leptonCands = event.getHandle(token_leptonCands); // try to access the input collection as a collection of GsfElectrons, Muons or Tracks @@ -262,8 +252,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { do { { // look for View - Handle h_electrons; - event.getByToken(token_gsfElectrons, h_electrons); + Handle h_electrons = event.getHandle(token_gsfElectrons); if (h_electrons.isValid()) { leptonId = SoftLeptonProperties::Quality::egammaElectronId; @@ -281,8 +270,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { { // else // look for View // FIXME: is this obsolete? - Handle h_electrons; - event.getByToken(token_electrons, h_electrons); + Handle h_electrons = event.getHandle(token_electrons); if (h_electrons.isValid()) { leptonId = SoftLeptonProperties::Quality::egammaElectronId; for (ElectronView::const_iterator electron = h_electrons->begin(); electron != h_electrons->end(); ++electron) { @@ -297,8 +285,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { { // else // look for PFElectrons // FIXME: is this obsolete? - Handle h_electrons; - event.getByToken(token_pfElectrons, h_electrons); + Handle h_electrons = event.getHandle(token_pfElectrons); if (h_electrons.isValid()) { leptonId = SoftLeptonProperties::Quality::egammaElectronId; for (reco::PFCandidateCollection::const_iterator electron = h_electrons->begin(); @@ -321,8 +308,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { } { // else // look for View - Handle h_muons; - event.getByToken(token_muons, h_muons); + Handle h_muons = event.getHandle(token_muons); if (h_muons.isValid()) { for (MuonView::const_iterator muon = h_muons->begin(); muon != h_muons->end(); ++muon) { // FIXME -> turn this selection into a muonCands input? @@ -347,8 +333,7 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { } { // else // look for edm::View - Handle > h_tracks; - event.getByToken(token_tracks, h_tracks); + Handle > h_tracks = event.getHandle(token_tracks); if (h_tracks.isValid()) { for (unsigned int i = 0; i < h_tracks->size(); i++) { LeptonIds &id = leptons[h_tracks->refAt(i)]; @@ -366,27 +351,27 @@ void SoftLepton::produce(edm::Event &event, const edm::EventSetup &setup) { } while (false); if (!(m_leptonId == edm::InputTag())) { - Handle > h_leptonId; - event.getByToken(token_leptonId, h_leptonId); + edm::ValueMap const &h_leptonId = event.get(token_leptonId); for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) - lepton->second[leptonId] = (*h_leptonId)[lepton->first]; + lepton->second[leptonId] = h_leptonId[lepton->first]; } // output collections - auto outputCollection = std::make_unique(); + reco::SoftLeptonTagInfoCollection outputCollection; for (unsigned int i = 0; i < jets.size(); ++i) { - reco::SoftLeptonTagInfo result = tag(jets[i], tracks[i], leptons, vertex); - outputCollection->push_back(result); + reco::SoftLeptonTagInfo result = tag(jets[i], tracks[i], leptons, vertex, transientTrackBuilder); + outputCollection.push_back(result); } - event.put(std::move(outputCollection)); + event.emplace(token_put, std::move(outputCollection)); } // --------------------------------------------------------------------------------------- reco::SoftLeptonTagInfo SoftLepton::tag(const edm::RefToBase &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, - const reco::Vertex &primaryVertex) const { + const reco::Vertex &primaryVertex, + const TransientTrackBuilder &transientTrackBuilder) const { reco::SoftLeptonTagInfo info; info.setJetRef(jet); @@ -403,7 +388,7 @@ reco::SoftLeptonTagInfo SoftLepton::tag(const edm::RefToBase &jet, reco::SoftLeptonProperties properties; - reco::TransientTrack transientTrack = m_transientTrackBuilder->build(*lepton->first); + reco::TransientTrack transientTrack = transientTrackBuilder.build(*lepton->first); Measurement1D ip2d = IPTools::signedTransverseImpactParameter(transientTrack, jetAxis, primaryVertex).second; Measurement1D ip3d = IPTools::signedImpactParameter3D(transientTrack, jetAxis, primaryVertex).second; properties.sip2dsig = ip2d.significance(); @@ -527,8 +512,8 @@ void SoftLepton::fillDescriptions(edm::ConfigurationDescriptions &descriptions) desc.add("muonSelection", 1); desc.add("leptons", edm::InputTag("muons")); desc.add("primaryVertex", edm::InputTag("offlinePrimaryVertices")); - desc.add("leptonCands", edm::InputTag("")); - desc.add("leptonId", edm::InputTag("")); + desc.add("leptonCands", edm::InputTag()); + desc.add("leptonId", edm::InputTag()); desc.add("refineJetAxis", 0); desc.add("jets", edm::InputTag("ak4PFJetsCHS")); desc.add("leptonDeltaRCut", 0.4); diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc index 900ea6b214404..7ddd77b57eed5 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc @@ -16,7 +16,7 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/BTauReco/interface/SoftLeptonTagInfo.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -51,85 +51,84 @@ // a PFCandidateCollection as input and produces a RefVector // to the likely soft electrons in this collection. -class SoftPFElectronTagInfoProducer : public edm::stream::EDProducer<> { +class SoftPFElectronTagInfoProducer : public edm::global::EDProducer<> { public: SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf); - ~SoftPFElectronTagInfoProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void produce(edm::Event&, const edm::EventSetup&) override; - bool isElecClean(edm::Event&, const reco::GsfElectron*); - float boostedPPar(const math::XYZVector&, const math::XYZVector&); + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const final; + static bool isElecClean(edm::Event&, const reco::GsfElectron*); + static float boostedPPar(const math::XYZVector&, const math::XYZVector&); // service used to make transient tracks from tracks - const TransientTrackBuilder* transientTrackBuilder; - edm::EDGetTokenT token_primaryVertex; - edm::EDGetTokenT > token_jets; - edm::EDGetTokenT > token_elec; - edm::EDGetTokenT token_BeamSpot; - edm::EDGetTokenT token_allConversions; + const edm::EDGetTokenT token_primaryVertex; + const edm::EDGetTokenT > token_jets; + const edm::EDGetTokenT > token_elec; + const edm::EDGetTokenT token_BeamSpot; + const edm::EDGetTokenT token_allConversions; const edm::ESGetToken token_builder; - float DeltaRElectronJet, MaxSip3Dsig; - bool goodvertex; - - const reco::Vertex* vertex; + const edm::EDPutTokenT token_put; + const float DeltaRElectronJet, MaxSip3Dsig; }; SoftPFElectronTagInfoProducer::SoftPFElectronTagInfoProducer(const edm::ParameterSet& conf) - : token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { - token_jets = consumes >(conf.getParameter("jets")); - token_elec = consumes >(conf.getParameter("electrons")); - token_primaryVertex = consumes(conf.getParameter("primaryVertex")); - token_BeamSpot = consumes(edm::InputTag("offlineBeamSpot")); - token_allConversions = consumes(edm::InputTag("allConversions")); - DeltaRElectronJet = conf.getParameter("DeltaRElectronJet"); - MaxSip3Dsig = conf.getParameter("MaxSip3Dsig"); - produces(); + : token_primaryVertex(consumes(conf.getParameter("primaryVertex"))), + token_jets(consumes(conf.getParameter("jets"))), + token_elec(consumes(conf.getParameter("electrons"))), + token_BeamSpot(consumes(edm::InputTag("offlineBeamSpot"))), + token_allConversions(consumes(edm::InputTag("allConversions"))), + token_builder(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + token_put(produces()), + DeltaRElectronJet(conf.getParameter("DeltaRElectronJet")), + MaxSip3Dsig(conf.getParameter("MaxSip3Dsig")) {} + +void SoftPFElectronTagInfoProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("primaryVertex"); + desc.add("jets"); + desc.add("electrons"); + desc.add("DeltaRElectronJet"); + desc.add("MaxSip3Dsig"); + descriptions.addDefault(desc); } -SoftPFElectronTagInfoProducer::~SoftPFElectronTagInfoProducer() {} - -void SoftPFElectronTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - auto theElecTagInfo = std::make_unique(); - transientTrackBuilder = &iSetup.getData(token_builder); +void SoftPFElectronTagInfoProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + reco::CandSoftLeptonTagInfoCollection theElecTagInfo; + const auto& transientTrackBuilder = iSetup.getData(token_builder); - edm::Handle PVCollection; - iEvent.getByToken(token_primaryVertex, PVCollection); + edm::Handle PVCollection = iEvent.getHandle(token_primaryVertex); if (!PVCollection.isValid()) return; - if (!PVCollection->empty()) { - goodvertex = true; - vertex = &PVCollection->front(); - } else - goodvertex = false; - edm::Handle hConversions; - iEvent.getByToken(token_allConversions, hConversions); - - edm::Handle > theJetCollection; - iEvent.getByToken(token_jets, theJetCollection); - - edm::Handle > theGEDGsfElectronCollection; - iEvent.getByToken(token_elec, theGEDGsfElectronCollection); - - edm::Handle bsHandle; - iEvent.getByToken(token_BeamSpot, bsHandle); - const reco::BeamSpot& beamspot = *bsHandle.product(); - - for (unsigned int i = 0; i < theJetCollection->size(); i++) { - edm::RefToBase jetRef = theJetCollection->refAt(i); + + reco::ConversionCollection const& hConversions = iEvent.get(token_allConversions); + + edm::View const& theJetCollection = iEvent.get(token_jets); + + edm::View const& theGEDGsfElectronCollection = iEvent.get(token_elec); + + if (PVCollection->empty() and not theJetCollection.empty() and not theGEDGsfElectronCollection.empty()) { + //we would need to access a vertex from the collection but there isn't one. + return; + } + + const reco::BeamSpot& beamspot = iEvent.get(token_BeamSpot); + + for (unsigned int i = 0; i < theJetCollection.size(); i++) { + edm::RefToBase jetRef = theJetCollection.refAt(i); reco::CandSoftLeptonTagInfo tagInfo; tagInfo.setJetRef(jetRef); - std::vector Elec; - for (unsigned int ie = 0, ne = theGEDGsfElectronCollection->size(); ie < ne; ++ie) { + for (unsigned int ie = 0, ne = theGEDGsfElectronCollection.size(); ie < ne; ++ie) { //Get the edm::Ptr and the GsfElectron - edm::Ptr lepPtr = theGEDGsfElectronCollection->ptrAt(ie); - const reco::GsfElectron* recoelectron = theGEDGsfElectronCollection->refAt(ie).get(); + edm::Ptr lepPtr = theGEDGsfElectronCollection.ptrAt(ie); + const reco::GsfElectron* recoelectron = theGEDGsfElectronCollection.refAt(ie).get(); const pat::Electron* patelec = dynamic_cast(recoelectron); if (patelec) { if (!patelec->passConversionVeto()) continue; } else { - if (ConversionTools::hasMatchedConversion(*(recoelectron), *hConversions, beamspot.position())) + if (ConversionTools::hasMatchedConversion(*(recoelectron), hConversions, beamspot.position())) continue; } //Make sure that the electron is inside the jet @@ -145,12 +144,13 @@ void SoftPFElectronTagInfoProducer::produce(edm::Event& iEvent, const edm::Event //Compute the TagInfos members math::XYZVector pel = recoelectron->p4().Vect(); math::XYZVector pjet = jetRef->p4().Vect(); - reco::TransientTrack transientTrack = transientTrackBuilder->build(recoelectron->gsfTrack()); + reco::TransientTrack transientTrack = transientTrackBuilder.build(recoelectron->gsfTrack()); + auto const& vertex = PVCollection->front(); Measurement1D ip2d = IPTools::signedTransverseImpactParameter( - transientTrack, GlobalVector(jetRef->px(), jetRef->py(), jetRef->pz()), *vertex) + transientTrack, GlobalVector(jetRef->px(), jetRef->py(), jetRef->pz()), vertex) .second; Measurement1D ip3d = IPTools::signedImpactParameter3D( - transientTrack, GlobalVector(jetRef->px(), jetRef->py(), jetRef->pz()), *vertex) + transientTrack, GlobalVector(jetRef->px(), jetRef->py(), jetRef->pz()), vertex) .second; properties.sip2dsig = ip2d.significance(); properties.sip3dsig = ip3d.significance(); @@ -171,9 +171,9 @@ void SoftPFElectronTagInfoProducer::produce(edm::Event& iEvent, const edm::Event // Fill the TagInfos tagInfo.insert(lepPtr, properties); } - theElecTagInfo->push_back(tagInfo); + theElecTagInfo.push_back(tagInfo); } - iEvent.put(std::move(theElecTagInfo)); + iEvent.emplace(token_put, std::move(theElecTagInfo)); } bool SoftPFElectronTagInfoProducer::isElecClean(edm::Event& iEvent, const reco::GsfElectron* candidate) { diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc index ecc4395090670..1e1d7bf554c08 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc @@ -5,7 +5,7 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -54,60 +54,70 @@ #include #include -class SoftPFMuonTagInfoProducer : public edm::stream::EDProducer<> { +class SoftPFMuonTagInfoProducer : public edm::global::EDProducer<> { public: SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf); - ~SoftPFMuonTagInfoProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void produce(edm::Event&, const edm::EventSetup&) override; - virtual float boostedPPar(const math::XYZVector&, const math::XYZVector&); + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const final; + float boostedPPar(const math::XYZVector&, const math::XYZVector&) const; - edm::EDGetTokenT > jetToken; - edm::EDGetTokenT > muonToken; - edm::EDGetTokenT vertexToken; + const edm::EDGetTokenT > jetToken; + const edm::EDGetTokenT > muonToken; + const edm::EDGetTokenT vertexToken; const edm::ESGetToken builderToken; - float pTcut, SIPsigcut, IPsigcut, ratio1cut, ratio2cut; - bool useFilter; + const edm::EDPutTokenT putToken; + const float pTcut, SIPsigcut, IPsigcut, ratio1cut, ratio2cut; + const bool useFilter; }; SoftPFMuonTagInfoProducer::SoftPFMuonTagInfoProducer(const edm::ParameterSet& conf) - : builderToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) { - jetToken = consumes >(conf.getParameter("jets")); - muonToken = consumes >(conf.getParameter("muons")); - vertexToken = consumes(conf.getParameter("primaryVertex")); - pTcut = conf.getParameter("muonPt"); - SIPsigcut = conf.getParameter("muonSIPsig"); - IPsigcut = conf.getParameter("filterIpsig"); - ratio1cut = conf.getParameter("filterRatio1"); - ratio2cut = conf.getParameter("filterRatio2"); - useFilter = conf.getParameter("filterPromptMuons"); - produces(); + : jetToken(consumes(conf.getParameter("jets"))), + muonToken(consumes(conf.getParameter("muons"))), + vertexToken(consumes(conf.getParameter("primaryVertex"))), + builderToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + putToken(produces()), + pTcut(conf.getParameter("muonPt")), + SIPsigcut(conf.getParameter("muonSIPsig")), + IPsigcut(conf.getParameter("filterIpsig")), + ratio1cut(conf.getParameter("filterRatio1")), + ratio2cut(conf.getParameter("filterRatio2")), + useFilter(conf.getParameter("filterPromptMuons")) {} + +void SoftPFMuonTagInfoProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("jets"); + desc.add("muons"); + desc.add("primaryVertex"); + desc.add("muonPt"); + desc.add("muonSIPsig"); + desc.add("filterIpsig"); + desc.add("filterRatio1"); + desc.add("filterRatio2"); + desc.add("filterPromptMuons"); + descriptions.addDefault(desc); } -SoftPFMuonTagInfoProducer::~SoftPFMuonTagInfoProducer() {} - -void SoftPFMuonTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void SoftPFMuonTagInfoProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { // Declare produced collection - auto theMuonTagInfo = std::make_unique(); + reco::CandSoftLeptonTagInfoCollection theMuonTagInfo; // Declare and open Jet collection - edm::Handle > theJetCollection; - iEvent.getByToken(jetToken, theJetCollection); + edm::Handle > theJetCollection = iEvent.getHandle(jetToken); // Declare Muon collection - edm::Handle > theMuonCollection; - iEvent.getByToken(muonToken, theMuonCollection); + edm::Handle > theMuonCollection = iEvent.getHandle(muonToken); // Declare and open Vertex collection - edm::Handle theVertexCollection; - iEvent.getByToken(vertexToken, theVertexCollection); + edm::Handle theVertexCollection = iEvent.getHandle(vertexToken); if (!theVertexCollection.isValid() || theVertexCollection->empty()) return; const reco::Vertex* vertex = &theVertexCollection->front(); - // Biult TransientTrackBuilder - const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(builderToken); + // Build TransientTrackBuilder + const TransientTrackBuilder& transientTrackBuilder = iSetup.getData(builderToken); // Loop on jets for (unsigned int ij = 0, nj = theJetCollection->size(); ij < nj; ij++) { @@ -154,7 +164,7 @@ void SoftPFMuonTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetu reco::TrackRef trkRef(muon->innerTrack()); reco::TrackBaseRef trkBaseRef(trkRef); // Build Transient Track - reco::TransientTrack transientTrack = transientTrackBuilder->build(trkRef); + reco::TransientTrack transientTrack = transientTrackBuilder.build(trkRef); // Define jet and muon vectors reco::Candidate::Vector jetvect(jetRef->p4().Vect()), muonvect(muon->p4().Vect()); // Calculate variables @@ -193,15 +203,15 @@ void SoftPFMuonTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetu } // --- End loop on daughters // Fill the TagInfo collection - theMuonTagInfo->push_back(tagInfo); + theMuonTagInfo.push_back(tagInfo); } // --- End loop on jets // Put the TagInfo collection in the event - iEvent.put(std::move(theMuonTagInfo)); + iEvent.emplace(putToken, std::move(theMuonTagInfo)); } // compute the lepton momentum along the jet axis, in the jet rest frame -float SoftPFMuonTagInfoProducer::boostedPPar(const math::XYZVector& vector, const math::XYZVector& axis) { +float SoftPFMuonTagInfoProducer::boostedPPar(const math::XYZVector& vector, const math::XYZVector& axis) const { static const double lepton_mass = 0.00; // assume a massless (ultrarelativistic) lepton static const double jet_mass = 5.279; // use B±/B0 mass as the jet rest mass [PDG 2007 updates] ROOT::Math::LorentzVector > lepton( From 588acb895808093f1b9fa8450cf08456e3f6c8d7 Mon Sep 17 00:00:00 2001 From: tkello Date: Wed, 25 Aug 2021 21:50:08 +0200 Subject: [PATCH 130/923] Fix on compilation issues with DMR, GC and MTS validation scripts. --- .../macros/PlotAlignmentValidation.C | 2179 ++++++------ .../OfflineValidation/macros/trackSplitPlot.h | 377 ++- .../scripts/GeometryComparisonPlotter.cc | 2906 +++++++++-------- 3 files changed, 2988 insertions(+), 2474 deletions(-) diff --git a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C index ac26ba7ea0a88..db8e05dae9419 100644 --- a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C +++ b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C @@ -42,26 +42,23 @@ #include #include - /*! \class PlotAlignmentValidation * \brief Class PlotAlignmentValidation * Class used as the last step for Offline Track Validation tool. * The main goal of this class is creating the plots regarding DMRs and Surface Deformations for modules and substructures. */ - //------------------------------------------------------------------------------ /*! \fn PlotAlignmentValidation * \brief Constructor for the class */ -PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtext) -{ +PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtext) { setOutputDir("."); setTreeBaseDir(); sourcelist = NULL; - - moreThanOneSource=false; + + moreThanOneSource = false; useFit_ = false; // Force ROOT to use scientific notation even with smaller datasets @@ -81,8 +78,9 @@ PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtex /*! \fn PlotAlignmentValidation * \brief Constructor for the class. This function also retrieves the list of root files used to produce DMRs and Surface Deformations */ -PlotAlignmentValidation::PlotAlignmentValidation(const char *inputFile,std::string legendName, int lineColor, int lineStyle, bool bigtext) : PlotAlignmentValidation(bigtext) -{ +PlotAlignmentValidation::PlotAlignmentValidation( + const char* inputFile, std::string legendName, int lineColor, int lineStyle, bool bigtext) + : PlotAlignmentValidation(bigtext) { loadFileList(inputFile, legendName, lineColor, lineStyle); } @@ -90,16 +88,12 @@ PlotAlignmentValidation::PlotAlignmentValidation(const char *inputFile,std::stri /*! \fn ~PlotAlignmentValidation * \brief Default destructor */ -PlotAlignmentValidation::~PlotAlignmentValidation() -{ - - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it){ +PlotAlignmentValidation::~PlotAlignmentValidation() { + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { delete (*it); } delete sourcelist; - } //------------------------------------------------------------------------------ @@ -108,23 +102,21 @@ PlotAlignmentValidation::~PlotAlignmentValidation() * \brief Create/open the root and txt summary files, where the DMR histograms and the associtated mean/sigma are stored respectively */ - -void PlotAlignmentValidation::openSummaryFile() -{ +void PlotAlignmentValidation::openSummaryFile() { if (!openedsummaryfile) { openedsummaryfile = true; - summaryfile.open(outputDir+"/"+summaryfilename+".txt"); + summaryfile.open(TString(outputDir + "/") + summaryfilename + ".txt"); //Rootfile introduced to store the DMR histograms - rootsummaryfile= new TFile(outputDir+"/"+summaryfilename+".root","RECREATE"); + rootsummaryfile = new TFile(TString(outputDir + "/") + summaryfilename + ".root", "RECREATE"); for (auto vars : sourceList) { summaryfile << "\t" << vars->getName(); } summaryfile << "\tformat={}\n"; - }else{ + } else { //Check for the rootfile to be open, and open it in case it is not already. - if (!rootsummaryfile->IsOpen()) rootsummaryfile->Open(outputDir+"/"+summaryfilename+".root","UPDATE"); - + if (!rootsummaryfile->IsOpen()) + rootsummaryfile->Open(TString(outputDir + "/") + summaryfilename + ".root", "UPDATE"); } } @@ -132,27 +124,19 @@ void PlotAlignmentValidation::openSummaryFile() /*! \fn loadFileList * \brief Add to the list of sources the rootfile associated to a particular geometry */ -void PlotAlignmentValidation::loadFileList(const char *inputFile, std::string legendName, int lineColor, int lineStyle) -{ - +void PlotAlignmentValidation::loadFileList(const char* inputFile, std::string legendName, int lineColor, int lineStyle) { if (openedsummaryfile) { std::cout << "Can't load a root file after opening the summary file!" << std::endl; assert(0); } - sourceList.push_back( new TkOfflineVariables( inputFile, treeBaseDir, legendName, lineColor, lineStyle ) ); - + sourceList.push_back(new TkOfflineVariables(inputFile, treeBaseDir, legendName, lineColor, lineStyle)); } //------------------------------------------------------------------------------ /*! \fn useFitForDMRplots * \brief Store the selected boolean in one of the private members of the class */ -void PlotAlignmentValidation::useFitForDMRplots(bool usefit) -{ - - useFit_ = usefit; - -} +void PlotAlignmentValidation::useFitForDMRplots(bool usefit) { useFit_ = usefit; } //------------------------------------------------------------------------------ /*! \fn numberOfLayers @@ -161,27 +145,42 @@ void PlotAlignmentValidation::useFitForDMRplots(bool usefit) //TODO Possible improvement: reduce the number of switches in the code by implementing a map int PlotAlignmentValidation::numberOfLayers(int phase, int subdetector) { switch (phase) { - case 0: - switch (subdetector) { - case 1: return 3; - case 2: return 2; - case 3: return 4; - case 4: return 3; - case 5: return 6; - case 6: return 9; - default: assert(false); - } - case 1: - switch (subdetector) { - case 1: return 4; - case 2: return 3; - case 3: return 4; - case 4: return 3; - case 5: return 6; - case 6: return 9; - default: assert(false); - } - default: assert(false); + case 0: + switch (subdetector) { + case 1: + return 3; + case 2: + return 2; + case 3: + return 4; + case 4: + return 3; + case 5: + return 6; + case 6: + return 9; + default: + assert(false); + } + case 1: + switch (subdetector) { + case 1: + return 4; + case 2: + return 3; + case 3: + return 4; + case 4: + return 3; + case 5: + return 6; + case 6: + return 9; + default: + assert(false); + } + default: + assert(false); } return 0; } @@ -202,16 +201,14 @@ int PlotAlignmentValidation::maxNumberOfLayers(int subdetector) { /*! \fn legendOptions * \brief Assign legend options to members of the class */ -void PlotAlignmentValidation::legendOptions(TString options) -{ - +void PlotAlignmentValidation::legendOptions(TString options) { showMean_ = false; showRMS_ = false; showMeanError_ = false; showRMSError_ = false; showModules_ = false; showUnderOverFlow_ = false; - options.ReplaceAll(" ","").ToLower(); + options.ReplaceAll(" ", "").ToLower(); if (options.Contains("mean") || options.Contains("all")) showMean_ = true; if (options.Contains("meanerror") || options.Contains("all")) @@ -232,8 +229,7 @@ void PlotAlignmentValidation::legendOptions(TString options) /*! \fn setOutputDir * \brief Set the output direcotry */ -void PlotAlignmentValidation::setOutputDir( std::string dir ) -{ +void PlotAlignmentValidation::setOutputDir(std::string dir) { if (openedsummaryfile) { std::cout << "Can't set the output dir after opening the summary file!" << std::endl; assert(0); @@ -246,64 +242,81 @@ void PlotAlignmentValidation::setOutputDir( std::string dir ) /*! \fn plotSubDetResiduals * \brief Function used to plot residuals for a subdetector */ -void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned int subDetId) -{ +void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto, unsigned int subDetId) { gStyle->SetOptStat(11111); gStyle->SetOptFit(0000); - TCanvas *c = new TCanvas("c", "c"); + TCanvas* c = new TCanvas("c", "c"); c->SetTopMargin(0.15); - TString histoName= ""; - if (plotNormHisto) {histoName= "h_NormXprime";} - else histoName= "h_Xprime_"; - switch (subDetId){ - case 1 : histoName+="TPBBarrel_0";break; - case 2 : histoName+="TPEendcap_1";break; - case 3 : histoName+="TPEendcap_2";break; - case 4 : histoName+="TIBBarrel_0";break; - case 5 : histoName+="TIDEndcap_1";break; - case 6 : histoName+="TIDEndcap_2";break; - case 7 : histoName+="TOBBarrel_3";break; - case 8 : histoName+="TECEndcap_4";break; - case 9 : histoName+="TECEndcap_5";break; + TString histoName = ""; + if (plotNormHisto) { + histoName = "h_NormXprime"; + } else + histoName = "h_Xprime_"; + switch (subDetId) { + case 1: + histoName += "TPBBarrel_0"; + break; + case 2: + histoName += "TPEendcap_1"; + break; + case 3: + histoName += "TPEendcap_2"; + break; + case 4: + histoName += "TIBBarrel_0"; + break; + case 5: + histoName += "TIDEndcap_1"; + break; + case 6: + histoName += "TIDEndcap_2"; + break; + case 7: + histoName += "TOBBarrel_3"; + break; + case 8: + histoName += "TECEndcap_4"; + break; + case 9: + histoName += "TECEndcap_5"; + break; } int tmpcounter = 0; - TH1 *sumHisto = 0; - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it) { - if (tmpcounter == 0 ) { - TFile *f= (*it)->getFile(); - sumHisto =(TH1*) f->FindKeyAny(histoName)->ReadObj();//FindObjectAny(histoName.Data()); - sumHisto->SetLineColor(tmpcounter+1); - sumHisto->SetLineStyle(tmpcounter+1); + TH1* sumHisto = 0; + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { + if (tmpcounter == 0) { + TFile* f = (*it)->getFile(); + sumHisto = (TH1*)f->FindKeyAny(histoName)->ReadObj(); //FindObjectAny(histoName.Data()); + sumHisto->SetLineColor(tmpcounter + 1); + sumHisto->SetLineStyle(tmpcounter + 1); sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw); sumHisto->Draw(); - + //get statistic box coordinate to plot all boxes one below the other //gStyle->SetStatY(0.91); //gStyle->SetStatW(0.15); //gStyle->SetStatBorderSize(1); //gStyle->SetStatH(0.10); - - + tmpcounter++; } else { - sumHisto = (TH1*) (*it)->getFile()->FindObjectAny(histoName); - sumHisto->SetLineColor(tmpcounter+1); - sumHisto->SetLineStyle(tmpcounter+1); + sumHisto = (TH1*)(*it)->getFile()->FindObjectAny(histoName); + sumHisto->SetLineColor(tmpcounter + 1); + sumHisto->SetLineStyle(tmpcounter + 1); sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw); //hstack->Add(sumHisto); - + c->Update(); - tmpcounter++; + tmpcounter++; } - TObject *statObj = sumHisto->GetListOfFunctions()->FindObject("stats"); + TObject* statObj = sumHisto->GetListOfFunctions()->FindObject("stats"); if (statObj && statObj->InheritsFrom(TPaveStats::Class())) { - TPaveStats *stats = static_cast(statObj); - stats->SetLineColor(tmpcounter+1); - stats->SetTextColor(tmpcounter+1); + TPaveStats* stats = static_cast(statObj); + stats->SetLineColor(tmpcounter + 1); + stats->SetTextColor(tmpcounter + 1); stats->SetFillColor(10); - stats->SetX1NDC(0.91-tmpcounter*0.1); + stats->SetX1NDC(0.91 - tmpcounter * 0.1); stats->SetX2NDC(0.15); stats->SetY1NDC(1); stats->SetY2NDC(0.10); @@ -312,200 +325,191 @@ void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned in } //hstack->Draw("nostack"); char PlotName[1000]; - sprintf( PlotName, "%s/%s.png", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.png", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.pdf", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.pdf", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.root", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.root", outputDir.c_str(), histoName.Data()); c->Print(PlotName); //delete c; //c=0; - } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotHitMaps() -{ - +void PlotAlignmentValidation::plotHitMaps() { //gStyle->SetOptStat(0); - - TCanvas *c = new TCanvas("c", "c", 1200,400); - c->Divide(3,1); + + TCanvas* c = new TCanvas("c", "c", 1200, 400); + c->Divide(3, 1); //ps->NewPage(); //------------------------------------------------- //plot Hit map //------------------------------------------------- - std::string histName_="Entriesprofile"; + std::string histName_ = "Entriesprofile"; c->cd(1); - TTree *tree= (*sourceList.begin())->getTree(); - tree->Draw("entries:posR:posZ","","COLZ2Prof"); + TTree* tree = (*sourceList.begin())->getTree(); + tree->Draw("entries:posR:posZ", "", "COLZ2Prof"); c->cd(2); - tree->Draw("entries:posY:posX","","COLZ2Prof"); + tree->Draw("entries:posY:posX", "", "COLZ2Prof"); c->cd(3); - tree->Draw("entries:posR:posPhi","","COLZ2Prof"); - + tree->Draw("entries:posR:posPhi", "", "COLZ2Prof"); + char PlotName[1000]; - sprintf( PlotName, "%s/%s.png", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.png", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.eps", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.pdf", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.pdf", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.root", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.root", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); // //c->Update(); - c->Close(); + c->Close(); //---------------------------------------------------- - } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotOutlierModules(const char *outputFileName, std::string plotVariable, - float plotVariable_cut ,int unsigned minHits) -{ - - Int_t counter=0; - +void PlotAlignmentValidation::plotOutlierModules(const char* outputFileName, + std::string plotVariable, + float plotVariable_cut, + int unsigned minHits) { + Int_t counter = 0; + gStyle->SetOptStat(111111); gStyle->SetStatY(0.9); //TList* treelist=getTreeList(); - - TCanvas *c1 = new TCanvas("canv", "canv", 800, 500); - outputFile = outputDir +'/'+ outputFileName; - c1->Print( (outputFile+'[').Data() ); - - - c1->Divide(2,1); - - TTree *tree= (*sourceList.begin())->getTree(); - TkOffTreeVariables *treeMem = 0; // ROOT will initilise + + TCanvas* c1 = new TCanvas("canv", "canv", 800, 500); + outputFile = outputDir + '/' + outputFileName; + c1->Print((outputFile + '[').Data()); + + c1->Divide(2, 1); + + TTree* tree = (*sourceList.begin())->getTree(); + TkOffTreeVariables* treeMem = 0; // ROOT will initilise tree->SetBranchAddress("TkOffTreeVariables", &treeMem); - - - Long64_t nentries = tree->GetEntriesFast(); - - for (Long64_t i = 0; i < nentries; i++){ - + + Long64_t nentries = tree->GetEntriesFast(); + + for (Long64_t i = 0; i < nentries; i++) { tree->GetEntry(i); float var = 0; - if (plotVariable == "chi2PerDofX") var =treeMem->chi2PerDofX; - else if(plotVariable == "chi2PerDofY") var =treeMem->chi2PerDofY; - else if(plotVariable == "fitMeanX") var =treeMem->fitMeanX; - else if(plotVariable == "fitMeanY") var =treeMem->fitMeanY; - else if(plotVariable == "fitSigmaX") var =treeMem->fitSigmaX; - else if(plotVariable == "fitSigmaY") var =treeMem->fitSigmaY; + if (plotVariable == "chi2PerDofX") + var = treeMem->chi2PerDofX; + else if (plotVariable == "chi2PerDofY") + var = treeMem->chi2PerDofY; + else if (plotVariable == "fitMeanX") + var = treeMem->fitMeanX; + else if (plotVariable == "fitMeanY") + var = treeMem->fitMeanY; + else if (plotVariable == "fitSigmaX") + var = treeMem->fitSigmaX; + else if (plotVariable == "fitSigmaY") + var = treeMem->fitSigmaY; else { - cout<<"There is no variable "<entries "<entries< plotVariable_cut && treeMem->entries > minHits) - { - - TFile *f=(*sourceList.begin())->getFile();//(TFile*)sourcelist->First(); - - if(f->FindKeyAny(treeMem->histNameX.c_str())!=0){ - TH1 *h = (TH1*) f->FindKeyAny(treeMem->histNameX.c_str())->ReadObj();//f->FindObjectAny(treeMem->histNameX.c_str()); - gStyle->SetOptFit(0111); - cout<<"hist name "<GetName()<GetPath(), "TrackerOfflineValidation" ); - //cout<<"hist path "<GetEntries()<cd(0); - TPaveText * text=new TPaveText(0,0.95,0.99,0.99); - text->AddText(path); - text->SetFillColor(0); - text->SetShadowColor(0); - text->SetBorderSize( 0 ); - text->Draw(); - - //residual histogram - c1->cd(1); - TPad *subpad = (TPad*)c1->GetPad(1); - subpad->SetPad(0,0,0.5,0.94); - h->Draw(); - - //norm. residual histogram - h = (TH1*) f->FindObjectAny(treeMem->histNameNormX.c_str()); - if(h) cout<GetEntries()<cd(2); - TPad *subpad2 = (TPad*)c1->GetPad(2); - subpad2->SetPad(0.5,0,0.99,0.94); - h->Draw(); - - c1->Print(outputFile); - counter++; - } - else{ - cout<<"There are no residual histograms on module level stored!"<entries "<entries< plotVariable_cut && treeMem->entries > minHits) { + TFile* f = (*sourceList.begin())->getFile(); //(TFile*)sourcelist->First(); + + if (f->FindKeyAny(treeMem->histNameX.c_str()) != 0) { + TH1* h = + (TH1*)f->FindKeyAny(treeMem->histNameX.c_str())->ReadObj(); //f->FindObjectAny(treeMem->histNameX.c_str()); + gStyle->SetOptFit(0111); + cout << "hist name " << h->GetName() << endl; + + TString path = (char*)strstr(gDirectory->GetPath(), "TrackerOfflineValidation"); + //cout<<"hist path "<GetEntries() << endl; + + //modules' location as title + c1->cd(0); + TPaveText* text = new TPaveText(0, 0.95, 0.99, 0.99); + text->AddText(path); + text->SetFillColor(0); + text->SetShadowColor(0); + text->SetBorderSize(0); + text->Draw(); + + //residual histogram + c1->cd(1); + TPad* subpad = (TPad*)c1->GetPad(1); + subpad->SetPad(0, 0, 0.5, 0.94); + h->Draw(); + + //norm. residual histogram + h = (TH1*)f->FindObjectAny(treeMem->histNameNormX.c_str()); + if (h) + cout << h->GetEntries() << endl; + c1->cd(2); + TPad* subpad2 = (TPad*)c1->GetPad(2); + subpad2->SetPad(0.5, 0, 0.99, 0.94); + h->Draw(); + + c1->Print(outputFile); + counter++; + } else { + cout << "There are no residual histograms on module level stored!" << endl; + cout << "Please make sure that moduleLevelHistsTransient = cms.bool(False) in the validation job!" << endl; + break; } - + } } - c1->Print( (outputFile+"]").Data() ); - if (counter == 0) cout<<"no bad modules found"<Print((outputFile + "]").Data()); + if (counter == 0) + cout << "no bad modules found" << endl; + //read the number of entries in the t3 //TTree* tree=0; //tree=(TTree*)treeList->At(0); - - + //c1->Close(); - } //------------------------------------------------------------------------------ /*! \fn getTreeList * \brief Extract from the rootfiles stored in the sourcelist the corresponding trees. */ -TList* PlotAlignmentValidation::getTreeList() -{ - TList *treeList = new TList(); - TFile *first_source = (TFile*)sourcelist->First(); - std::cout<GetName()<Get( treeBaseDir.c_str() ); - treeList->Add( (TTree*)(*d).Get("TkOffVal") ); - - if( moreThanOneSource ==true ){ - TFile *nextsource = (TFile*)sourcelist->After( first_source ); - while ( nextsource ) { - std::cout<GetName()<Get("TrackerOfflineValidation"); - +TList* PlotAlignmentValidation::getTreeList() { + TList* treeList = new TList(); + TFile* first_source = (TFile*)sourcelist->First(); + std::cout << first_source->GetName() << std::endl; + TDirectoryFile* d = (TDirectoryFile*)first_source->Get(treeBaseDir.c_str()); + treeList->Add((TTree*)(*d).Get("TkOffVal")); + + if (moreThanOneSource == true) { + TFile* nextsource = (TFile*)sourcelist->After(first_source); + while (nextsource) { + std::cout << nextsource->GetName() << std::endl; + d = (TDirectoryFile*)nextsource->Get("TrackerOfflineValidation"); + treeList->Add((TTree*)(*d).Get("TkOffVal")); - - nextsource = (TFile*)sourcelist->After( nextsource ); + + nextsource = (TFile*)sourcelist->After(nextsource); } } return treeList; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::setTreeBaseDir( std::string dir ) -{ - treeBaseDir = dir; -} +void PlotAlignmentValidation::setTreeBaseDir(std::string dir) { treeBaseDir = dir; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotSurfaceShapes( const std::string& options, const std::string& residType ) -{ +void PlotAlignmentValidation::plotSurfaceShapes(const std::string& options, const std::string& residType) { cout << "-------- plotSurfaceShapes called with " << options << endl; if (options == "none") return; - else if (options == "coarse"){ + else if (options == "coarse") { plotSS("subdet=1"); plotSS("subdet=2"); plotSS("subdet=3"); @@ -514,23 +518,22 @@ void PlotAlignmentValidation::plotSurfaceShapes( const std::string& options, con plotSS("subdet=6"); } // else if (options == "fine") ... - else - plotSS( options, residType ); + else + plotSS(options, residType); return; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotSS( const std::string& options, const std::string& residType ) -{ +void PlotAlignmentValidation::plotSS(const std::string& options, const std::string& residType) { if (residType == "") { - plotSS( options, "ResXvsXProfile"); - plotSS( options, "ResXvsYProfile"); + plotSS(options, "ResXvsXProfile"); + plotSS(options, "ResXvsYProfile"); return; } int bkperrorx = gStyle->GetErrorX(); - gStyle->SetErrorX(1); //regardless of style settings, we want x error bars here + gStyle->SetErrorX(1); //regardless of style settings, we want x error bars here int plotLayerN = 0; // int plotRingN = 0; @@ -538,41 +541,44 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str bool plotLayers = false; // overrides plotLayerN // bool plotRings = false; // Todo: implement this? bool plotSplits = false; - int plotSubDetN = 0; // if zero, plot all + int plotSubDetN = 0; // if zero, plot all TRegexp layer_re("layer=[0-9]+"); Ssiz_t index, len; - if (options.find("split") != std::string::npos) { plotSplits = true; } - if (options.find("layers") != std::string::npos) { plotLayers = true; } + if (options.find("split") != std::string::npos) { + plotSplits = true; + } + if (options.find("layers") != std::string::npos) { + plotLayers = true; + } if ((index = layer_re.Index(options, &len)) != -1) { if (plotLayers) { std::cerr << "Warning: option 'layers' overrides 'layer=N'" << std::endl; } else { - std::string substr = options.substr(index+6, len-6); + std::string substr = options.substr(index + 6, len - 6); plotLayerN = atoi(substr.c_str()); } } TRegexp subdet_re("subdet=[1-6]+"); if ((index = subdet_re.Index(options, &len)) != -1) { - std::string substr = options.substr(index+7, len-7); + std::string substr = options.substr(index + 7, len - 7); plotSubDetN = atoi(substr.c_str()); } gStyle->SetOptStat(0); - + TCanvas c("canv", "canv"); // todo: title, min/max, nbins? // Loop over detectors - for (int iSubDet=1; iSubDet<=6; ++iSubDet) { - + for (int iSubDet = 1; iSubDet <= 6; ++iSubDet) { // TEC requires special care since rings 1-4 and 5-7 are plotted separately - bool isTEC = (iSubDet==6); + bool isTEC = (iSubDet == 6); // if subdet is specified, skip other subdets - if (plotSubDetN!=0 && iSubDet!=plotSubDetN) + if (plotSubDetN != 0 && iSubDet != plotSubDetN) continue; // Skips plotting too high layers @@ -586,120 +592,131 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str int maxlayer = plotLayers ? maxNumberOfLayers(iSubDet) : plotLayerN; // see later where this is used int maxlayerphase0 = plotLayers ? numberOfLayers(0, iSubDet) : plotLayerN; - + for (int layer = minlayer; layer <= maxlayer; layer++) { + // two plots for TEC, skip first + for (int iTEC = 0; iTEC < 2; iTEC++) { + if (!isTEC && iTEC == 0) + continue; + + char selection[1000]; + if (!isTEC) { + if (layer == 0) + sprintf(selection, "subDetId==%d", iSubDet); + else + sprintf(selection, "subDetId==%d && layer == %d", iSubDet, layer); + } else { // TEC + if (iTEC == 0) // rings + sprintf(selection, "subDetId==%d && ring <= 4", iSubDet); + else + sprintf(selection, "subDetId==%d && ring > 4", iSubDet); + } - // two plots for TEC, skip first - for (int iTEC = 0; iTEC<2; iTEC++) { - if (!isTEC && iTEC==0) continue; - - char selection[1000]; - if (!isTEC){ - if (layer==0) - sprintf(selection,"subDetId==%d",iSubDet); - else - sprintf(selection,"subDetId==%d && layer == %d",iSubDet,layer); - } - else{ // TEC - if (iTEC==0) // rings - sprintf(selection,"subDetId==%d && ring <= 4",iSubDet); - else - sprintf(selection,"subDetId==%d && ring > 4",iSubDet); - } - - - // Title for plot and name for the file - - TString subDetName; - switch (iSubDet) { - case 1: subDetName = "BPIX"; break; - case 2: subDetName = "FPIX"; break; - case 3: subDetName = "TIB"; break; - case 4: subDetName = "TID"; break; - case 5: subDetName = "TOB"; break; - case 6: subDetName = "TEC"; break; - } + // Title for plot and name for the file + + TString subDetName; + switch (iSubDet) { + case 1: + subDetName = "BPIX"; + break; + case 2: + subDetName = "FPIX"; + break; + case 3: + subDetName = "TIB"; + break; + case 4: + subDetName = "TID"; + break; + case 5: + subDetName = "TOB"; + break; + case 6: + subDetName = "TEC"; + break; + } TString secondline = ""; - if (layer!=0) { - // TEC and TID have discs, the rest have layers - if (iSubDet==4 || iSubDet==6) - secondline = "disc "; - else { - secondline = "layer "; - } - secondline += Form("%d",layer); - secondline += " "; - } - if (isTEC && iTEC==0) - secondline += TString("R1-4"); - if (isTEC && iTEC>0) - secondline += TString("R5-7"); - - // Generate histograms with selection - TLegend* legend = 0; + if (layer != 0) { + // TEC and TID have discs, the rest have layers + if (iSubDet == 4 || iSubDet == 6) + secondline = "disc "; + else { + secondline = "layer "; + } + secondline += Form("%d", layer); + secondline += " "; + } + if (isTEC && iTEC == 0) + secondline += TString("R1-4"); + if (isTEC && iTEC > 0) + secondline += TString("R5-7"); + + // Generate histograms with selection + TLegend* legend = 0; // Any file from phase 0 will be skipped if the last argument is false - THStack *hs = addHists(selection, residType, &legend, false, /*validforphase0 = */layer <= maxlayerphase0); - if (!hs || hs->GetHists()==0 || hs->GetHists()->GetSize()==0) { - std::cout << "No histogram for " << subDetName << - ", perhaps not enough data? Creating default histogram." << std::endl; - if(hs == 0) - hs = new THStack("hstack", ""); - - TProfile* defhist = new TProfile("defhist", "Empty default histogram", 100, -1, 1, -1, 1); - hs->Add(defhist); - hs->Draw(); - } - else { - hs->Draw("nostack PE"); - modifySSHistAndLegend(hs, legend); - legend->Draw(); - setTitleStyle(*hs, "", "", iSubDet, true, secondline); - - // Adjust Labels - TH1* firstHisto = (TH1*) hs->GetHists()->First(); - TString xName = firstHisto->GetXaxis()->GetTitle(); - TString yName = firstHisto->GetYaxis()->GetTitle(); - hs->GetHistogram()->GetXaxis()->SetTitleColor( kBlack ); - hs->GetHistogram()->GetXaxis()->SetTitle( xName ); - hs->GetHistogram()->GetYaxis()->SetTitleColor( kBlack ); - // micrometers: - yName.ReplaceAll("cm", "#mum"); - hs->GetHistogram()->GetYaxis()->SetTitle( yName ); - } - - // Save plot to file - std::ostringstream plotName; - plotName << outputDir << "/SurfaceShape_" << subDetName << "_"; - plotName << residType; - if (layer!=0) { - plotName << "_"; - // TEC and TID have discs, the rest have layers - if (iSubDet==4 || iSubDet==6) - plotName << "disc"; - else { - plotName << "layer"; - } - plotName << layer; - } - if (isTEC && iTEC==0) - plotName << "_" << "R1-4"; - if (isTEC && iTEC>0) - plotName << "_" << "R5-7"; - - // PNG,EPS,PDF files - c.Update(); - c.Print((plotName.str() + ".png").c_str()); - c.Print((plotName.str() + ".eps").c_str()); - c.Print((plotName.str() + ".pdf").c_str()); - - // ROOT file - TFile f((plotName.str() + ".root").c_str(), "recreate"); - c.Write(); - f.Close(); - - delete legend; - delete hs; + THStack* hs = addHists(selection, residType, &legend, false, /*validforphase0 = */ layer <= maxlayerphase0); + if (!hs || hs->GetHists() == 0 || hs->GetHists()->GetSize() == 0) { + std::cout << "No histogram for " << subDetName << ", perhaps not enough data? Creating default histogram." + << std::endl; + if (hs == 0) + hs = new THStack("hstack", ""); + + TProfile* defhist = new TProfile("defhist", "Empty default histogram", 100, -1, 1, -1, 1); + hs->Add(defhist); + hs->Draw(); + } else { + hs->Draw("nostack PE"); + modifySSHistAndLegend(hs, legend); + legend->Draw(); + setTitleStyle(*hs, "", "", iSubDet, true, secondline); + + // Adjust Labels + TH1* firstHisto = (TH1*)hs->GetHists()->First(); + TString xName = firstHisto->GetXaxis()->GetTitle(); + TString yName = firstHisto->GetYaxis()->GetTitle(); + hs->GetHistogram()->GetXaxis()->SetTitleColor(kBlack); + hs->GetHistogram()->GetXaxis()->SetTitle(xName); + hs->GetHistogram()->GetYaxis()->SetTitleColor(kBlack); + // micrometers: + yName.ReplaceAll("cm", "#mum"); + hs->GetHistogram()->GetYaxis()->SetTitle(yName); + } + + // Save plot to file + std::ostringstream plotName; + plotName << outputDir << "/SurfaceShape_" << subDetName << "_"; + plotName << residType; + if (layer != 0) { + plotName << "_"; + // TEC and TID have discs, the rest have layers + if (iSubDet == 4 || iSubDet == 6) + plotName << "disc"; + else { + plotName << "layer"; + } + plotName << layer; + } + if (isTEC && iTEC == 0) + plotName << "_" + << "R1-4"; + if (isTEC && iTEC > 0) + plotName << "_" + << "R5-7"; + + // PNG,EPS,PDF files + c.Update(); + c.Print((plotName.str() + ".png").c_str()); + c.Print((plotName.str() + ".eps").c_str()); + c.Print((plotName.str() + ".pdf").c_str()); + + // ROOT file + TFile f((plotName.str() + ".root").c_str(), "recreate"); + c.Write(); + f.Close(); + + delete legend; + delete hs; } } } @@ -708,36 +725,34 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str return; } - //------------------------------------------------------------------------------ /*! \fn plotDMR * \brief Main function used to plot DMRs for a single IOV printing the canvases in the output directory and saving histograms and fit funtions in a root file. */ -void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits, const std::string& options) -{ +void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits, const std::string& options) { // If several, comma-separated values are given in 'variable', // call plotDMR with each value separately. // If a comma is found, the string is divided to two. // (no space allowed) std::size_t findres = variable.find(","); - if ( findres != std::string::npos) { - std::string substring1 = variable.substr(0, findres); - std::string substring2 = variable.substr(findres+1, std::string::npos); + if (findres != std::string::npos) { + std::string substring1 = variable.substr(0, findres); + std::string substring2 = variable.substr(findres + 1, std::string::npos); plotDMR(substring1, minHits, options); plotDMR(substring2, minHits, options); return; - } + } // Variable name should end with X or Y. If it doesn't, recursively calls plotDMR twice with // X and Y added, respectively - if (variable == "mean" || variable == "median" || variable == "meanNorm" || - variable == "rms" || variable == "rmsNorm") { - plotDMR(variable+"X", minHits, options); - plotDMR(variable+"Y", minHits, options); + if (variable == "mean" || variable == "median" || variable == "meanNorm" || variable == "rms" || + variable == "rmsNorm") { + plotDMR(variable + "X", minHits, options); + plotDMR(variable + "Y", minHits, options); return; } - // options: + // options: // -plain (default, the whole distribution) // -split (distribution splitted to two) // -layers (plain db for each layer/disc superimposed in one plot) @@ -749,30 +764,38 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits bool plotPlain = false, plotSplits = false, plotLayers = false; int plotLayerN = 0; Ssiz_t index, len; - if (options.find("plain") != std::string::npos) { plotPlain = true; } - if (options.find("split") != std::string::npos) { plotSplits = true; } - if (options.find("layers") != std::string::npos) { plotLayers = true; } + if (options.find("plain") != std::string::npos) { + plotPlain = true; + } + if (options.find("split") != std::string::npos) { + plotSplits = true; + } + if (options.find("layers") != std::string::npos) { + plotLayers = true; + } if ((index = layer_re.Index(options, &len)) != -1) { if (plotLayers) { std::cerr << "Warning: option 'layers' overrides 'layer=N'" << std::endl; } else { - std::string substr = options.substr(index+6, len-6); + std::string substr = options.substr(index + 6, len - 6); plotLayerN = atoi(substr.c_str()); } } // Defaults to plotting only plain plot if empty (or invalid) // option string is given - if (!plotPlain && !plotSplits) { plotPlain = true; } + if (!plotPlain && !plotSplits) { + plotPlain = true; + } // This boolean array tells for which detector modules to plot split DMR plots // They are plotted for BPIX, FPIX, TIB and TOB - static bool plotSplitsFor[6] = { true, true, true, false, true, false }; + static bool plotSplitsFor[6] = {true, true, true, false, true, false}; DMRPlotInfo plotinfo; gStyle->SetOptStat(0); - + TCanvas c("canv", "canv"); plotinfo.variable = variable; @@ -783,38 +806,77 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits // width in cm // for DMRS, use 100 bins in range +-10 um, bin width 0.2um // if modified, check also TrackerOfflineValidationSummary_cfi.py and TrackerOfflineValidation_Standalone_cff.py - if (variable == "meanX") { plotinfo.nbins = 50; plotinfo.min = -0.001; plotinfo.max = 0.001; } - else if (variable == "meanY") { plotinfo.nbins = 50; plotinfo.min = -0.005; plotinfo.max = 0.005; } - else if (variable == "medianX") - if (plotSplits) { plotinfo.nbins = 50; plotinfo.min = -0.0005; plotinfo.max = 0.0005;} - else { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; } + if (variable == "meanX") { + plotinfo.nbins = 50; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } else if (variable == "meanY") { + plotinfo.nbins = 50; + plotinfo.min = -0.005; + plotinfo.max = 0.005; + } else if (variable == "medianX") + if (plotSplits) { + plotinfo.nbins = 50; + plotinfo.min = -0.0005; + plotinfo.max = 0.0005; + } else { + plotinfo.nbins = 100; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } else if (variable == "medianY") - if (plotSplits) { plotinfo.nbins = 50; plotinfo.min = -0.0005; plotinfo.max = 0.0005;} - else { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; } - else if (variable == "meanNormX") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; } - else if (variable == "meanNormY") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; } - else if (variable == "rmsX") { plotinfo.nbins = 100; plotinfo.min = 0.0; plotinfo.max = 0.1; } - else if (variable == "rmsY") { plotinfo.nbins = 100; plotinfo.min = 0.0; plotinfo.max = 0.1; } - else if (variable == "rmsNormX") { plotinfo.nbins = 100; plotinfo.min = 0.3; plotinfo.max = 1.8; } - else if (variable == "rmsNormY") { plotinfo.nbins = 100; plotinfo.min = 0.3; plotinfo.max = 1.8; } - else { + if (plotSplits) { + plotinfo.nbins = 50; + plotinfo.min = -0.0005; + plotinfo.max = 0.0005; + } else { + plotinfo.nbins = 100; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } + else if (variable == "meanNormX") { + plotinfo.nbins = 100; + plotinfo.min = -2.0; + plotinfo.max = 2.0; + } else if (variable == "meanNormY") { + plotinfo.nbins = 100; + plotinfo.min = -2.0; + plotinfo.max = 2.0; + } else if (variable == "rmsX") { + plotinfo.nbins = 100; + plotinfo.min = 0.0; + plotinfo.max = 0.1; + } else if (variable == "rmsY") { + plotinfo.nbins = 100; + plotinfo.min = 0.0; + plotinfo.max = 0.1; + } else if (variable == "rmsNormX") { + plotinfo.nbins = 100; + plotinfo.min = 0.3; + plotinfo.max = 1.8; + } else if (variable == "rmsNormY") { + plotinfo.nbins = 100; + plotinfo.min = 0.3; + plotinfo.max = 1.8; + } else { std::cerr << "Unknown variable " << variable << std::endl; - plotinfo.nbins = 100; plotinfo.min = -0.1; plotinfo.max = 0.1; + plotinfo.nbins = 100; + plotinfo.min = -0.1; + plotinfo.max = 0.1; } //Begin loop on structures - for (int i=1; i<=6; ++i) { - + for (int i = 1; i <= 6; ++i) { // Skip strip detectors if plotting any "Y" variable - if (i != 1 && i != 2 && variable.length() > 0 && variable[variable.length()-1] == 'Y') { + if (i != 1 && i != 2 && variable.length() > 0 && variable[variable.length() - 1] == 'Y') { continue; } - + // Skips plotting too high layers if (plotLayerN > maxNumberOfLayers(i)) { continue; } - plotinfo.plotSplits = plotSplits && plotSplitsFor[i-1]; + plotinfo.plotSplits = plotSplits && plotSplitsFor[i - 1]; if (!plotinfo.plotPlain && !plotinfo.plotSplits) { continue; } @@ -824,17 +886,27 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits bool hasheader = (TkAlStyle::legendheader != ""); int nPlots = 1; - if (plotinfo.plotSplits) { nPlots = 3; } + if (plotinfo.plotSplits) { + nPlots = 3; + } // This will make the legend a bit bigger than necessary if there is a mixture of phase 0 and phase 1. // Not worth it to implement more complicated logic. - if (plotinfo.plotLayers) { nPlots *= maxNumberOfLayers(i); } + if (plotinfo.plotLayers) { + nPlots *= maxNumberOfLayers(i); + } nPlots *= sourceList.size(); - if (twolines_) { nPlots *= 2; } + if (twolines_) { + nPlots *= 2; + } nPlots += hasheader; double legendY = 0.80; - if (nPlots > 3) { legendY -= 0.01 * (nPlots - 3); } - if (bigtext_) { legendY -= 0.05; } + if (nPlots > 3) { + legendY -= 0.01 * (nPlots - 3); + } + if (bigtext_) { + legendY -= 0.05; + } if (legendY < 0.6) { std::cerr << "Warning: Huge legend!" << std::endl; legendY = 0.6; @@ -845,53 +917,72 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits plotinfo.subDetId = i; plotinfo.legend = new TLegend(0.17, legendY, 0.85, 0.88); plotinfo.legend->SetNColumns(2); - if (hasheader) plotinfo.legend->SetHeader(TkAlStyle::legendheader); - if (bigtext_) plotinfo.legend->SetTextSize(TkAlStyle::textSize); + if (hasheader) + plotinfo.legend->SetHeader(TkAlStyle::legendheader); + if (bigtext_) + plotinfo.legend->SetTextSize(TkAlStyle::textSize); plotinfo.legend->SetFillStyle(0); plotinfo.hstack = &hstack; plotinfo.h = plotinfo.h1 = plotinfo.h2 = 0; plotinfo.firsthisto = true; openSummaryFile(); - vmean.clear(); vrms.clear(); vdeltamean.clear(); vmeanerror.clear(); vPValueEqualSplitMeans.clear(), vAlignmentUncertainty.clear(); vPValueMeanEqualIdeal.clear(); vPValueRMSEqualIdeal.clear(); + vmean.clear(); + vrms.clear(); + vdeltamean.clear(); + vmeanerror.clear(); + vPValueEqualSplitMeans.clear(), vAlignmentUncertainty.clear(); + vPValueMeanEqualIdeal.clear(); + vPValueRMSEqualIdeal.clear(); std::string stringsubdet; switch (i) { - case 1: stringsubdet = "BPIX"; break; - case 2: stringsubdet = "FPIX"; break; - case 3: stringsubdet = "TIB"; break; - case 4: stringsubdet = "TID"; break; - case 5: stringsubdet = "TOB"; break; - case 6: stringsubdet = "TEC"; break; + case 1: + stringsubdet = "BPIX"; + break; + case 2: + stringsubdet = "FPIX"; + break; + case 3: + stringsubdet = "TIB"; + break; + case 4: + stringsubdet = "TID"; + break; + case 5: + stringsubdet = "TOB"; + break; + case 6: + stringsubdet = "TEC"; + break; } - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it) { - + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { plotinfo.vars = *it; plotinfo.h1 = plotinfo.h2 = plotinfo.h = 0; int minlayer = plotLayers ? 1 : plotLayerN; //Layer 0 is associated to the entire structure, this check ensures that even when both the plotLayers and the plotPlain options are active, also the histogram for the entire structure is made. - if(plotinfo.plotPlain) minlayer=0; + if (plotinfo.plotPlain) + minlayer = 0; int maxlayer = plotLayers ? numberOfLayers(plotinfo.vars->getPhase(), plotinfo.subDetId) : plotLayerN; for (int layer = minlayer; layer <= maxlayer; layer++) { + if (plotinfo.plotPlain) { + plotDMRHistogram(plotinfo, 0, layer, stringsubdet); + } - if (plotinfo.plotPlain) { - plotDMRHistogram(plotinfo, 0, layer, stringsubdet); - } - - if (plotinfo.plotSplits) { - plotDMRHistogram(plotinfo, -1, layer, stringsubdet); - plotDMRHistogram(plotinfo, 1, layer, stringsubdet); - } + if (plotinfo.plotSplits) { + plotDMRHistogram(plotinfo, -1, layer, stringsubdet); + plotDMRHistogram(plotinfo, 1, layer, stringsubdet); + } - if (plotinfo.plotPlain) { - if (plotinfo.h) { + if (plotinfo.plotPlain) { + if (plotinfo.h) { setDMRHistStyleAndLegend(plotinfo.h, plotinfo, 0, layer); } else { - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && + /*!plotinfo.plotLayers && */ layer == 0) { vmean.push_back(nan("")); vrms.push_back(nan("")); vmeanerror.push_back(nan("")); @@ -904,57 +995,58 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits } } } - } - - if (plotinfo.plotSplits) { - // Add delta mu to the histogram - if (plotinfo.h1 != 0 && plotinfo.h2 != 0 && !plotinfo.plotPlain) { - std::ostringstream legend; - std::string unit = " #mum"; - legend.precision(3); - legend << fixed; // to always show 3 decimals - float factor = 10000.0f; - if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { - factor = 1.0f; - unit = ""; - } - float deltamu = factor*(plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); - legend << plotinfo.vars->getName(); - if (layer > 0) { - // TEC and TID have discs, the rest have layers - if (i==4 || i==6) - legend << ", disc "; - else - legend << ", layer "; - legend << layer; - } - plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); - legend.str(""); - legend << "#Delta#mu = " << deltamu << unit; - plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); - - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && !plotLayers && layer==0) { - vdeltamean.push_back(deltamu); + } + + if (plotinfo.plotSplits) { + // Add delta mu to the histogram + if (plotinfo.h1 != 0 && plotinfo.h2 != 0 && !plotinfo.plotPlain) { + std::ostringstream legend; + std::string unit = " #mum"; + legend.precision(3); + legend << fixed; // to always show 3 decimals + float factor = 10000.0f; + if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || + plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + factor = 1.0f; + unit = ""; + } + float deltamu = factor * (plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); + legend << plotinfo.vars->getName(); + if (layer > 0) { + // TEC and TID have discs, the rest have layers + if (i == 4 || i == 6) + legend << ", disc "; + else + legend << ", layer "; + legend << layer; } - } - if (plotinfo.h1) { setDMRHistStyleAndLegend(plotinfo.h1, plotinfo, -1, layer); } - if (plotinfo.h2) { setDMRHistStyleAndLegend(plotinfo.h2, plotinfo, 1, layer); } - } + plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); + legend.str(""); + legend << "#Delta#mu = " << deltamu << unit; + plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && !plotLayers && layer == 0) { + vdeltamean.push_back(deltamu); + } + } + if (plotinfo.h1) { + setDMRHistStyleAndLegend(plotinfo.h1, plotinfo, -1, layer); + } + if (plotinfo.h2) { + setDMRHistStyleAndLegend(plotinfo.h2, plotinfo, 1, layer); + } + } } - } - if (hstack.GetHists()!=0 && hstack.GetHists()->GetSize()!=0) { + if (hstack.GetHists() != 0 && hstack.GetHists()->GetSize() != 0) { hstack.Draw("nostack"); - hstack.SetMaximum(plotinfo.maxY*1.3); + hstack.SetMaximum(plotinfo.maxY * 1.3); setTitleStyle(hstack, variable.c_str(), "#modules", plotinfo.subDetId); setHistStyle(*hstack.GetHistogram(), variable.c_str(), "#modules", 1); - plotinfo.legend->Draw(); - } - else { + plotinfo.legend->Draw(); + } else { // Draw an empty default histogram plotinfo.h = new TH1F("defhist", "Empty default histogram", plotinfo.nbins, plotinfo.min, plotinfo.max); plotinfo.h->SetMaximum(10); @@ -968,42 +1060,66 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits std::ostringstream plotName; plotName << outputDir << "/D"; - if (variable=="medianX") plotName << "medianR_"; - else if (variable=="medianY") plotName << "medianYR_"; - else if (variable=="meanX") plotName << "meanR_"; - else if (variable=="meanY") plotName << "meanYR_"; - else if (variable=="meanNormX") plotName << "meanNR_"; - else if (variable=="meanNormY") plotName << "meanNYR_"; - else if (variable=="rmsX") plotName << "rmsR_"; - else if (variable=="rmsY") plotName << "rmsYR_"; - else if (variable=="rmsNormX") plotName << "rmsNR_"; - else if (variable=="rmsNormY") plotName << "rmsNYR_"; - + if (variable == "medianX") + plotName << "medianR_"; + else if (variable == "medianY") + plotName << "medianYR_"; + else if (variable == "meanX") + plotName << "meanR_"; + else if (variable == "meanY") + plotName << "meanYR_"; + else if (variable == "meanNormX") + plotName << "meanNR_"; + else if (variable == "meanNormY") + plotName << "meanNYR_"; + else if (variable == "rmsX") + plotName << "rmsR_"; + else if (variable == "rmsY") + plotName << "rmsYR_"; + else if (variable == "rmsNormX") + plotName << "rmsNR_"; + else if (variable == "rmsNormY") + plotName << "rmsNYR_"; TString subdet; switch (i) { - case 1: subdet = "BPIX"; break; - case 2: subdet = "FPIX"; break; - case 3: subdet = "TIB"; break; - case 4: subdet = "TID"; break; - case 5: subdet = "TOB"; break; - case 6: subdet = "TEC"; break; + case 1: + subdet = "BPIX"; + break; + case 2: + subdet = "FPIX"; + break; + case 3: + subdet = "TIB"; + break; + case 4: + subdet = "TID"; + break; + case 5: + subdet = "TOB"; + break; + case 6: + subdet = "TEC"; + break; } plotName << subdet; - if (plotPlain && !plotSplits) { plotName << "_plain"; } - else if (!plotPlain && plotSplits) { plotName << "_split"; } + if (plotPlain && !plotSplits) { + plotName << "_plain"; + } else if (!plotPlain && plotSplits) { + plotName << "_split"; + } if (plotLayers) { // TEC and TID have discs, the rest have layers - if (i==4 || i==6) + if (i == 4 || i == 6) plotName << "_discs"; else plotName << "_layers"; } if (plotLayerN > 0) { // TEC and TID have discs, the rest have layers - if (i==4 || i==6) + if (i == 4 || i == 6) plotName << "_disc"; else plotName << "_layer"; @@ -1011,7 +1127,7 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits } // PNG,EPS,PDF files - c.Update(); + c.Update(); c.Print((plotName.str() + ".png").c_str()); c.Print((plotName.str() + ".eps").c_str()); c.Print((plotName.str() + ".pdf").c_str()); @@ -1020,7 +1136,7 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits TFile f((plotName.str() + ".root").c_str(), "recreate"); c.Write(); f.Close(); - + // Free allocated memory. delete plotinfo.h; delete plotinfo.h1; @@ -1028,120 +1144,143 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits if (vmean.size()) { summaryfile << " mu_" << subdet; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto mu : vmean) summaryfile << "\t" << mu; + for (auto mu : vmean) + summaryfile << "\t" << mu; summaryfile << "\n"; } if (vrms.size()) { summaryfile << "sigma_" << subdet; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto sigma : vrms) summaryfile << "\t" << sigma; + for (auto sigma : vrms) + summaryfile << "\t" << sigma; summaryfile << "\n"; } if (vdeltamean.size()) { - summaryfile << " dmu_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " dmu_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\Delta\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vdeltamean) summaryfile << "\t" << dmu; + for (auto dmu : vdeltamean) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vmeanerror.size()) { - summaryfile << " sigma_mu_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " sigma_mu_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vmeanerror) summaryfile << "\t" << dmu; + for (auto dmu : vmeanerror) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueEqualSplitMeans.size()) { - summaryfile << " p_delta_mu_equal_zero_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_delta_mu_equal_zero_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\delta\\mu_\\text{" << subdet << "}=0)"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueEqualSplitMeans) summaryfile << "\t" << dmu; + for (auto dmu : vPValueEqualSplitMeans) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vAlignmentUncertainty.size()) { - summaryfile << " alignment_uncertainty_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " alignment_uncertainty_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma_\\text{align}_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vAlignmentUncertainty) summaryfile << "\t" << dmu; + for (auto dmu : vAlignmentUncertainty) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueMeanEqualIdeal.size()) { - summaryfile << " p_mean_equals_ideal_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_mean_equals_ideal_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\mu_\\text{" << subdet << "}=\\mu_\\text{ideal})"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueMeanEqualIdeal) summaryfile << "\t" << dmu; + for (auto dmu : vPValueMeanEqualIdeal) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueRMSEqualIdeal.size()) { - summaryfile << " p_RMS_equals_ideal_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_RMS_equals_ideal_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\sigma_\\text{" << subdet << "}=\\sigma_\\text{ideal})"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueRMSEqualIdeal) summaryfile << "\t" << dmu; + for (auto dmu : vPValueRMSEqualIdeal) + summaryfile << "\t" << dmu; summaryfile << "\n"; } } } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotChi2(const char *inputFile) -{ +void PlotAlignmentValidation::plotChi2(const char* inputFile) { // Opens the file (it should be OfflineValidation(Parallel)_result.root) // and reads and plots the norm_chi^2 and h_chi2Prob -distributions. Bool_t errorflag = kTRUE; - TFile* fi1 = TFile::Open(inputFile,"read"); + TFile* fi1 = TFile::Open(inputFile, "read"); TDirectoryFile* mta1 = NULL; TDirectoryFile* mtb1 = NULL; TCanvas* normchi = NULL; TCanvas* chiprob = NULL; if (fi1 != NULL) { - mta1 = (TDirectoryFile*) fi1->Get("TrackerOfflineValidationStandalone"); - if(mta1 != NULL) { - mtb1 = (TDirectoryFile*) mta1->Get("GlobalTrackVariables"); - if(mtb1 != NULL) { + mta1 = (TDirectoryFile*)fi1->Get("TrackerOfflineValidationStandalone"); + if (mta1 != NULL) { + mtb1 = (TDirectoryFile*)mta1->Get("GlobalTrackVariables"); + if (mtb1 != NULL) { normchi = dynamic_cast(mtb1->Get("h_normchi2")); chiprob = dynamic_cast(mtb1->Get("h_chi2Prob")); if (normchi != NULL && chiprob != NULL) { @@ -1150,17 +1289,17 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) } } } - if(errorflag) - { + if (errorflag) { std::cout << "PlotAlignmentValidation::plotChi2: Can't find data from given file," << " no chi^2-plots produced" << std::endl; return; } - TLegend *legend = 0; + TLegend* legend = 0; for (auto primitive : *normchi->GetListOfPrimitives()) { legend = dynamic_cast(primitive); - if (legend) break; + if (legend) + break; } if (legend) { openSummaryFile(); @@ -1172,10 +1311,11 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) int style = alignment->getLineStyle(); bool foundit = false; for (auto entry : *legend->GetListOfPrimitives()) { - TLegendEntry *legendentry = dynamic_cast(entry); + TLegendEntry* legendentry = dynamic_cast(entry); assert(legendentry); - TH1 *h = dynamic_cast(legendentry->GetObject()); - if (!h) continue; + TH1* h = dynamic_cast(legendentry->GetObject()); + if (!h) + continue; if (legendentry->GetLabel() == title && h->GetLineColor() == color && h->GetLineStyle() == style) { foundit = true; summaryfile << h->GetEntries(); @@ -1210,56 +1350,72 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) fi3.Close(); delete fi1; - } //------------------------------------------------------------------------------ -THStack* PlotAlignmentValidation::addHists(const TString& selection, const TString &residType, - TLegend **myLegend, bool printModuleIds, bool validforphase0) -{ +THStack* PlotAlignmentValidation::addHists( + const TString& selection, const TString& residType, TLegend** myLegend, bool printModuleIds, bool validforphase0) { enum ResidType { - xPrimeRes, yPrimeRes, xPrimeNormRes, yPrimeNormRes, xRes, yRes, xNormRes, /*yResNorm*/ - ResXvsXProfile, ResXvsYProfile, ResYvsXProfile, ResYvsYProfile + xPrimeRes, + yPrimeRes, + xPrimeNormRes, + yPrimeNormRes, + xRes, + yRes, + xNormRes, /*yResNorm*/ + ResXvsXProfile, + ResXvsYProfile, + ResYvsXProfile, + ResYvsYProfile }; ResidType rType = xPrimeRes; - if (residType == "xPrime") rType = xPrimeRes; - else if (residType == "yPrime") rType = yPrimeRes; - else if (residType == "xPrimeNorm") rType = xPrimeNormRes; - else if (residType == "yPrimeNorm") rType = yPrimeNormRes; - else if (residType == "x") rType = xRes; - else if (residType == "y") rType = yRes; - else if (residType == "xNorm") rType = xNormRes; + if (residType == "xPrime") + rType = xPrimeRes; + else if (residType == "yPrime") + rType = yPrimeRes; + else if (residType == "xPrimeNorm") + rType = xPrimeNormRes; + else if (residType == "yPrimeNorm") + rType = yPrimeNormRes; + else if (residType == "x") + rType = xRes; + else if (residType == "y") + rType = yRes; + else if (residType == "xNorm") + rType = xNormRes; // else if (residType == "yNorm") rType = yResNorm; - else if (residType == "ResXvsXProfile") rType = ResXvsXProfile; - else if (residType == "ResYvsXProfile") rType = ResYvsXProfile; - else if (residType == "ResXvsYProfile") rType = ResXvsYProfile; - else if (residType == "ResYvsYProfile") rType = ResYvsYProfile; + else if (residType == "ResXvsXProfile") + rType = ResXvsXProfile; + else if (residType == "ResYvsXProfile") + rType = ResYvsXProfile; + else if (residType == "ResXvsYProfile") + rType = ResXvsYProfile; + else if (residType == "ResYvsYProfile") + rType = ResYvsYProfile; else { - std::cout << "PlotAlignmentValidation::addHists: Unknown residual type " - << residType << std::endl; + std::cout << "PlotAlignmentValidation::addHists: Unknown residual type " << residType << std::endl; return 0; } cout << "PlotAlignmentValidation::addHists: using selection " << selection << endl; - THStack * retHistoStack = new THStack("hstack", ""); + THStack* retHistoStack = new THStack("hstack", ""); if (myLegend != 0) if (*myLegend == 0) { *myLegend = new TLegend(0.17, 0.80, 0.85, 0.88); } - for(std::vector::iterator itSourceFile = sourceList.begin(); - itSourceFile != sourceList.end(); ++itSourceFile) { - + for (std::vector::iterator itSourceFile = sourceList.begin(); itSourceFile != sourceList.end(); + ++itSourceFile) { std::vector histnames; - TFile *f = (*itSourceFile)->getFile(); - TTree *tree= (*itSourceFile)->getTree(); + TFile* f = (*itSourceFile)->getFile(); + TTree* tree = (*itSourceFile)->getTree(); int myLineColor = (*itSourceFile)->getLineColor(); int myLineStyle = (*itSourceFile)->getLineStyle(); TString myLegendName = (*itSourceFile)->getName(); - TH1 *h = 0; // becomes result - UInt_t nEmpty = 0;// selected, but empty hists - Long64_t nentries = tree->GetEntriesFast(); + TH1* h = 0; // becomes result + UInt_t nEmpty = 0; // selected, but empty hists + Long64_t nentries = tree->GetEntriesFast(); if (!f || !tree) { std::cout << "PlotAlignmentValidation::addHists: no tree or no file" << std::endl; return 0; @@ -1267,19 +1423,19 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri bool histnamesfilled = false; int phase = (bool)(f->Get("TrackerOfflineValidationStandalone/Pixel/P1PXBBarrel_1")); - if (residType.Contains("Res") && residType.Contains("Profile")) - { - TString basename = TString(residType).ReplaceAll("Res","p_res") - .ReplaceAll("vs","") - .ReplaceAll("Profile","_"); //gives e.g.: p_resXX_ + if (residType.Contains("Res") && residType.Contains("Profile")) { + TString basename = TString(residType) + .ReplaceAll("Res", "p_res") + .ReplaceAll("vs", "") + .ReplaceAll("Profile", "_"); //gives e.g.: p_resXX_ if (selection == "subDetId==1") { - if (phase==1) + if (phase == 1) histnames.push_back(TString(basename) += "P1PXBBarrel_1"); else histnames.push_back(TString(basename) += "TPBBarrel_1"); histnamesfilled = true; } else if (selection == "subDetId==2") { - if (phase==1) { + if (phase == 1) { histnames.push_back(TString(basename) += "P1PXECEndcap_2"); histnames.push_back(TString(basename) += "P1PXECEndcap_3"); } else { @@ -1297,7 +1453,7 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri } else if (selection == "subDetId==5") { histnames.push_back(TString(basename) += "TOBBarrel_4"); histnamesfilled = true; - } else if (selection == "subDetId==6") { //whole TEC - doesn't happen by default but easy enough to account for + } else if (selection == "subDetId==6") { //whole TEC - doesn't happen by default but easy enough to account for histnames.push_back(TString(basename) += "TECEndcap_5"); histnames.push_back(TString(basename) += "TECEndcap_6"); histnamesfilled = true; @@ -1307,16 +1463,13 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri for (int iDisk = 1; iDisk <= 9; iDisk++) for (int iSide = 1; iSide <= 2; iSide++) for (int iPetal = 1; iPetal <= 8; iPetal++) - for (int iRing = 1; iRing <= 4 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing++) + for (int iRing = 1; iRing <= 4 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); iRing++) //in the higher disks, the inner rings go away. But the numbering in the file structure removes the higher numbers // so the numbers there do not correspond to the actual ring numbers { stringstream s; - s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap - << "/TECDisk_" << iDisk - << "/TECSide_" << iSide - << "/TECPetal_" << iPetal - << "/" << basename << "TECRing_" << iRing; + s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap << "/TECDisk_" << iDisk + << "/TECSide_" << iSide << "/TECPetal_" << iPetal << "/" << basename << "TECRing_" << iRing; histnames.push_back(TString(s.str())); } histnamesfilled = true; @@ -1326,23 +1479,21 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri for (int iDisk = 1; iDisk <= 9; iDisk++) for (int iSide = 1; iSide <= 2; iSide++) for (int iPetal = 1; iPetal <= 8; iPetal++) - for (int iRing = 5 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing <= 7 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing++) + for (int iRing = 5 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); + iRing <= 7 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); + iRing++) //in the higher disks, the inner rings go away. But the numbering in the file structure removes the higher numbers // so the numbers there do not correspond to the actual ring numbers { stringstream s; - s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap - << "/TECDisk_" << iDisk - << "/TECSide_" << iSide - << "/TECPetal_" << iPetal - << "/" << basename << "TECRing_" << iRing; + s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap << "/TECDisk_" << iDisk + << "/TECSide_" << iSide << "/TECPetal_" << iPetal << "/" << basename << "TECRing_" << iRing; histnames.push_back(TString(s.str())); } histnamesfilled = true; } } - Long64_t nSel = 0; if (histnamesfilled && histnames.size() > 0) { nSel = (Long64_t)histnames.size(); @@ -1351,7 +1502,8 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri // first loop on tree to find out which entries (i.e. modules) fulfill the selection // 'Entry$' gives the entry number in the tree nSel = tree->Draw("Entry$", selection, "goff"); - if (nSel == -1) return 0; // error in selection + if (nSel == -1) + return 0; // error in selection if (nSel == 0) { std::cout << "PlotAlignmentValidation::addHists: no selected module." << std::endl; return 0; @@ -1363,56 +1515,79 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri // second loop on tree: // for each selected entry get the hist from the file and merge - TkOffTreeVariables *treeMem = 0; // ROOT will initialise + TkOffTreeVariables* treeMem = 0; // ROOT will initialise tree->SetBranchAddress("TkOffTreeVariables", &treeMem); - for (Long64_t i = 0; i < nentries; i++){ - if (i < *iterEnt - 0.1 // smaller index (with tolerance): skip - || iterEnt == selected.end()) { // at the end: skip - continue; + for (Long64_t i = 0; i < nentries; i++) { + if (i < *iterEnt - 0.1 // smaller index (with tolerance): skip + || iterEnt == selected.end()) { // at the end: skip + continue; } else if (TMath::Abs(i - *iterEnt) < 0.11) { - ++iterEnt; // take this entry! - } else std::cout << "Must not happen: " << i << " " << *iterEnt << std::endl; + ++iterEnt; // take this entry! + } else + std::cout << "Must not happen: " << i << " " << *iterEnt << std::endl; tree->GetEntry(i); if (printModuleIds) { - std::cout << treeMem->moduleId << ": " << treeMem->entries << " entries" << std::endl; + std::cout << treeMem->moduleId << ": " << treeMem->entries << " entries" << std::endl; } if (treeMem->entries <= 0) { // little speed up: skip empty hists - ++nEmpty; - continue; + ++nEmpty; + continue; } TString hName; - switch(rType) { - case xPrimeRes: hName = treeMem->histNameX.c_str(); break; - case yPrimeRes: hName = treeMem->histNameY.c_str(); break; - case xPrimeNormRes: hName = treeMem->histNameNormX.c_str(); break; - case yPrimeNormRes: hName = treeMem->histNameNormY.c_str(); break; - case xRes: hName = treeMem->histNameLocalX.c_str(); break; - case yRes: hName = treeMem->histNameLocalY.c_str(); break; - case xNormRes: hName = treeMem->histNameNormLocalX.c_str(); break; - /*case yResNorm: hName = treeMem->histNameNormLocalY.c_str(); break;*/ - case ResXvsXProfile: hName = treeMem->profileNameResXvsX.c_str(); break; - case ResXvsYProfile: hName = treeMem->profileNameResXvsY.c_str(); break; - case ResYvsXProfile: hName = treeMem->profileNameResYvsX.c_str(); break; - case ResYvsYProfile: hName = treeMem->profileNameResYvsY.c_str(); break; + switch (rType) { + case xPrimeRes: + hName = treeMem->histNameX.c_str(); + break; + case yPrimeRes: + hName = treeMem->histNameY.c_str(); + break; + case xPrimeNormRes: + hName = treeMem->histNameNormX.c_str(); + break; + case yPrimeNormRes: + hName = treeMem->histNameNormY.c_str(); + break; + case xRes: + hName = treeMem->histNameLocalX.c_str(); + break; + case yRes: + hName = treeMem->histNameLocalY.c_str(); + break; + case xNormRes: + hName = treeMem->histNameNormLocalX.c_str(); + break; + /*case yResNorm: hName = treeMem->histNameNormLocalY.c_str(); break;*/ + case ResXvsXProfile: + hName = treeMem->profileNameResXvsX.c_str(); + break; + case ResXvsYProfile: + hName = treeMem->profileNameResXvsY.c_str(); + break; + case ResYvsXProfile: + hName = treeMem->profileNameResYvsX.c_str(); + break; + case ResYvsYProfile: + hName = treeMem->profileNameResYvsY.c_str(); + break; } histnames.push_back(hName); } } - for (std::vector::iterator ithistname = histnames.begin(); - ithistname != histnames.end(); ++ithistname) { - if (phase == 0 && !validforphase0) break; - TH1 *newHist; + for (std::vector::iterator ithistname = histnames.begin(); ithistname != histnames.end(); ++ithistname) { + if (phase == 0 && !validforphase0) + break; + TH1* newHist; if (ithistname->Contains("/")) { newHist = (TH1*)f->Get(*ithistname); } else { - TKey *histKey = f->FindKeyAny(*ithistname); + TKey* histKey = f->FindKeyAny(*ithistname); newHist = (histKey ? static_cast(histKey->ReadObj()) : 0); } if (!newHist) { - std::cout << "Hist " << *ithistname << " not found in file, break loop." << std::endl; - break; + std::cout << "Hist " << *ithistname << " not found in file, break loop." << std::endl; + break; } if (newHist->GetEntries() == 0) { nEmpty++; @@ -1420,24 +1595,26 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri } newHist->SetLineColor(myLineColor); newHist->SetLineStyle(myLineStyle); - if (!h) { // first hist: clone, but rename keeping only first part of name - TString name(newHist->GetName()); - Ssiz_t pos_ = 0; - for (UInt_t i2 = 0; i2 < 3; ++i2) pos_ = name.Index("_", pos_+1); - name = name(0, pos_); // only up to three '_' - h = static_cast(newHist->Clone("summed_"+name)); - // TString myTitle = Form("%s: %lld modules", selection, nSel); - // h->SetTitle( myTitle ); - } else { // otherwise just add - h->Add(newHist); + if (!h) { // first hist: clone, but rename keeping only first part of name + TString name(newHist->GetName()); + Ssiz_t pos_ = 0; + for (UInt_t i2 = 0; i2 < 3; ++i2) + pos_ = name.Index("_", pos_ + 1); + name = name(0, pos_); // only up to three '_' + h = static_cast(newHist->Clone("summed_" + name)); + // TString myTitle = Form("%s: %lld modules", selection, nSel); + // h->SetTitle( myTitle ); + } else { // otherwise just add + h->Add(newHist); } delete newHist; } - std::cout << "PlotAlignmentValidation::addHists" << "Result is merged from " << nSel-nEmpty - << " hists, " << nEmpty << " hists were empty." << std::endl; + std::cout << "PlotAlignmentValidation::addHists" + << "Result is merged from " << nSel - nEmpty << " hists, " << nEmpty << " hists were empty." << std::endl; - if (nSel-nEmpty == 0) continue; + if (nSel - nEmpty == 0) + continue; if (myLegend != 0) (*myLegend)->AddEntry(h, myLegendName, "L"); @@ -1452,56 +1629,52 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri /*! \fn fitGauss * \brief Operate a Gaussian fit to the given histogram */ -TF1 * -PlotAlignmentValidation::fitGauss(TH1 *hist,int color) -{ +TF1* PlotAlignmentValidation::fitGauss(TH1* hist, int color) { //1. fits a Gauss function to the inner range of abs(2 rms) //2. repeates the Gauss fit in a 2 sigma range around mean of first fit //returns mean and sigma from fit in micron - if (!hist || hist->GetEntries() < 20) return 0; + if (!hist || hist->GetEntries() < 20) + return 0; - float mean = hist->GetMean(); + float mean = hist->GetMean(); float sigma = hist->GetRMS(); - string functionname="gaussian_"; - functionname+=hist->GetName(); - TF1 *func = new TF1(functionname.c_str(), "gaus", mean - 2.*sigma, mean + 2.*sigma); - + string functionname = "gaussian_"; + functionname += hist->GetName(); + TF1* func = new TF1(functionname.c_str(), "gaus", mean - 2. * sigma, mean + 2. * sigma); + func->SetLineColor(color); func->SetLineStyle(2); - if (0 == hist->Fit(func,"QNR")) { // N: do not blow up file by storing fit! - mean = func->GetParameter(1); + if (0 == hist->Fit(func, "QNR")) { // N: do not blow up file by storing fit! + mean = func->GetParameter(1); sigma = func->GetParameter(2); // second fit: three sigma of first fit around mean of first fit - func->SetRange(mean - 3.*sigma, mean + 3.*sigma); + func->SetRange(mean - 3. * sigma, mean + 3. * sigma); // I: integral gives more correct results if binning is too wide // L: Likelihood can treat empty bins correctly (if hist not weighted...) if (0 == hist->Fit(func, "Q0ILR")) { - if (hist->GetFunction(func->GetName())) { // Take care that it is later on drawn: - //hist->GetFunction(func->GetName())->ResetBit(TF1::kNotDraw); + if (hist->GetFunction(func->GetName())) { // Take care that it is later on drawn: + //hist->GetFunction(func->GetName())->ResetBit(TF1::kNotDraw); } } } return func; } - //------------------------------------------------------------------------------ /*! \fn storeHistogramInRootfile * \brief Store the histogram and the gaussian function resulting from the fitGauss function into a root file */ -void PlotAlignmentValidation::storeHistogramInRootfile(TH1* hist) -{ +void PlotAlignmentValidation::storeHistogramInRootfile(TH1* hist) { //Store histogram and fit function in the root summary file rootsummaryfile->cd(); hist->Write(); } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::scaleXaxis(TH1* hist, Int_t scale) -{ +void PlotAlignmentValidation::scaleXaxis(TH1* hist, Int_t scale) { Double_t xmin = hist->GetXaxis()->GetXmin(); Double_t xmax = hist->GetXaxis()->GetXmax(); - hist->GetXaxis()->SetLimits(xmin*scale, xmax*scale); + hist->GetXaxis()->SetLimits(xmin * scale, xmax * scale); } //------------------------------------------------------------------------------ @@ -1511,7 +1684,7 @@ TObject* PlotAlignmentValidation::findObjectFromCanvas(TCanvas* canv, const char TObject* obj = 0; Int_t found = 0; while ((obj = next())) { - if(strncmp(obj->ClassName(), className, 10) == 0) { + if (strncmp(obj->ClassName(), className, 10) == 0) { if (++found == n) return obj; } @@ -1521,30 +1694,42 @@ TObject* PlotAlignmentValidation::findObjectFromCanvas(TCanvas* canv, const char } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::setTitleStyle( TNamed &hist,const char* titleX, const char* titleY,int subDetId, bool isSurfaceDeformation, TString secondline) -{ +void PlotAlignmentValidation::setTitleStyle( + TNamed& hist, const char* titleX, const char* titleY, int subDetId, bool isSurfaceDeformation, TString secondline) { std::stringstream title_Xaxis; std::stringstream title_Yaxis; - TString titleXAxis=titleX; - TString titleYAxis=titleY; + TString titleXAxis = titleX; + TString titleYAxis = titleY; if (titleXAxis != "" && titleYAxis != "") - cout<<"plot "<SetFillStyle(0); text2->SetBorderSize(0); text2->SetMargin(0.01); - text2->SetTextAlign(12); // align left - text2->AddText(0.01,0.75,subD); + text2->SetTextAlign(12); // align left + text2->AddText(0.01, 0.75, subD); if (secondline != "") { text2->AddText(0.01, 0.25, secondline); } text2->Draw(); } - //------------------------------------------------------------------------------ /*! \fn * \brief */ -void PlotAlignmentValidation::setHistStyle( TH1& hist,const char* titleX, const char* titleY, int color) -{ +void PlotAlignmentValidation::setHistStyle(TH1& hist, const char* titleX, const char* titleY, int color) { std::stringstream title_Xaxis; std::stringstream title_Yaxis; - TString titleXAxis=titleX; - TString titleYAxis=titleY; - - if ( titleXAxis.Contains("Phi") )title_Xaxis<InheritsFrom( TH1F::Class() ) )hist.SetLineColor(color); - if (hist.IsA()->InheritsFrom( TProfile::Class() ) ) { + TString titleXAxis = titleX; + TString titleYAxis = titleY; + + if (titleXAxis.Contains("Phi")) + title_Xaxis << titleX << "[rad]"; + else if (titleXAxis.Contains("meanX")) + title_Xaxis << "#LTx'_{pred}-x'_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("meanY")) + title_Xaxis << "#LTy'_{pred}-y'_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("rmsX")) + title_Xaxis << "RMS(x'_{pred}-x'_{hit})[#mum]"; + else if (titleXAxis.Contains("rmsY")) + title_Xaxis << "RMS(y'_{pred}-y'_{hit})[#mum]"; + else if (titleXAxis.Contains("meanNormX")) + title_Xaxis << "#LTx'_{pred}-x'_{hit}/#sigma#GT"; + else if (titleXAxis.Contains("meanNormY")) + title_Xaxis << "#LTy'_{pred}-y'_{hit}/#sigma#GT"; + else if (titleXAxis.Contains("rmsNormX")) + title_Xaxis << "RMS(x'_{pred}-x'_{hit}/#sigma)"; + else if (titleXAxis.Contains("rmsNormY")) + title_Xaxis << "RMS(y'_{pred}-y'_{hit}/#sigma)"; + else if (titleXAxis.Contains("meanLocalX")) + title_Xaxis << "#LTx_{pred}-x_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("rmsLocalX")) + title_Xaxis << "RMS(x_{pred}-x_{hit})[#mum]"; + else if (titleXAxis.Contains("meanNormLocalX")) + title_Xaxis << "#LTx_{pred}-x_{hit}/#sigma#GT[#mum]"; + else if (titleXAxis.Contains("rmsNormLocalX")) + title_Xaxis << "RMS(x_{pred}-x_{hit}/#sigma)[#mum]"; + else if (titleXAxis.Contains("medianX")) + title_Xaxis << "median(x'_{pred}-x'_{hit})[#mum]"; + else if (titleXAxis.Contains("medianY")) + title_Xaxis << "median(y'_{pred}-y'_{hit})[#mum]"; + else + title_Xaxis << titleX << "[cm]"; + + if (hist.IsA()->InheritsFrom(TH1F::Class())) + hist.SetLineColor(color); + if (hist.IsA()->InheritsFrom(TProfile::Class())) { hist.SetMarkerStyle(20); hist.SetMarkerSize(0.8); hist.SetMarkerColor(color); } - - hist.GetXaxis()->SetTitle( (title_Xaxis.str()).c_str() ); + + hist.GetXaxis()->SetTitle((title_Xaxis.str()).c_str()); double binning = (hist.GetXaxis()->GetXmax() - hist.GetXaxis()->GetXmin()) / hist.GetNbinsX(); title_Yaxis.precision(2); - if ( ((titleYAxis.Contains("layer") || titleYAxis.Contains("ring")) - && titleYAxis.Contains("subDetId")) - || titleYAxis.Contains("#modules")) { - title_Yaxis<<"number of modules"; + if (((titleYAxis.Contains("layer") || titleYAxis.Contains("ring")) && titleYAxis.Contains("subDetId")) || + titleYAxis.Contains("#modules")) { + title_Yaxis << "number of modules"; if (TString(title_Xaxis.str()).Contains("[#mum]")) title_Yaxis << " / " << binning << " #mum"; else if (TString(title_Xaxis.str()).Contains("[cm]")) title_Yaxis << " / " << binning << " cm"; else title_Yaxis << " / " << binning; - } - else title_Yaxis<SetTitle( (title_Yaxis.str()).c_str() ); + hist.GetYaxis()->SetTitle((title_Yaxis.str()).c_str()); hist.GetXaxis()->SetTitleFont(42); hist.GetYaxis()->SetTitleFont(42); } //------------------------------------------------------------------------------ -std::string PlotAlignmentValidation:: -getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) -{ +std::string PlotAlignmentValidation::getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) { std::ostringstream builder; builder << "entries >= " << minHits; builder << " && subDetId == " << subDetId; if (direction != 0) { - if (subDetId == 2) { // FPIX is split by zDirection + if (subDetId == 2) { // FPIX is split by zDirection builder << " && zDirection == " << direction; } else { builder << " && rDirection == " << direction; @@ -1644,21 +1841,19 @@ getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) return builder.str(); } -std::string PlotAlignmentValidation:: -getVariableForDMRPlot(const std::string& histoname, const std::string& variable, int nbins, double min, - double max) -{ +std::string PlotAlignmentValidation::getVariableForDMRPlot( + const std::string& histoname, const std::string& variable, int nbins, double min, double max) { std::ostringstream builder; - builder << variable << ">>" << histoname << "(" << nbins << "," << min << - "," << max << ")"; + builder << variable << ">>" << histoname << "(" << nbins << "," << min << "," << max << ")"; return builder.str(); } //------------------------------------------------------------------------------ -void PlotAlignmentValidation:: -setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo, int direction, int layer) -{ - TF1 *fitResults = 0; +void PlotAlignmentValidation::setDMRHistStyleAndLegend(TH1F* h, + PlotAlignmentValidation::DMRPlotInfo& plotinfo, + int direction, + int layer) { + TF1* fitResults = 0; h->SetDirectory(0); @@ -1671,47 +1866,60 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // -However if only direction split plots are to be plotted, the additions should be 0 and +1 respectively // -Modulo 4 arithmetic, because the styles run from 1..4 int linestyle = plotinfo.vars->getLineStyle() - 1, linestyleplus = 0; - if (direction == 1) { linestyleplus = 1; } - if (direction == -1) { linestyleplus = 2; } - if (direction != 0 && plotinfo.plotSplits && !plotinfo.plotPlain) { linestyleplus--; } + if (direction == 1) { + linestyleplus = 1; + } + if (direction == -1) { + linestyleplus = 2; + } + if (direction != 0 && plotinfo.plotSplits && !plotinfo.plotPlain) { + linestyleplus--; + } linestyle = (linestyle + linestyleplus) % 4 + 1; int linecolor = plotinfo.vars->getLineColor(); - if (plotinfo.plotLayers && layer > 0) { linecolor += layer - 1; } + if (plotinfo.plotLayers && layer > 0) { + linecolor += layer - 1; + } if (plotinfo.firsthisto) { - setHistStyle(*h, plotinfo.variable.c_str(), "#modules", 1); //set color later + setHistStyle(*h, plotinfo.variable.c_str(), "#modules", 1); //set color later plotinfo.firsthisto = false; } - h->SetLineColor( linecolor ); - h->SetLineStyle( linestyle ); - - if (plotinfo.maxYGetMaximum()){ - plotinfo.maxY=h->GetMaximum(); + h->SetLineColor(linecolor); + h->SetLineStyle(linestyle); + + if (plotinfo.maxY < h->GetMaximum()) { + plotinfo.maxY = h->GetMaximum(); } - + //fit histogram for median and mean - if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || plotinfo.variable == "meanY") { - fitResults = fitGauss(h, linecolor ); + if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || + plotinfo.variable == "meanY") { + fitResults = fitGauss(h, linecolor); } - + plotinfo.hstack->Add(h); std::ostringstream legend; legend.precision(3); - legend << fixed; // to always show 3 decimals + legend << fixed; // to always show 3 decimals // Legend: header part - if (direction == -1 && plotinfo.subDetId != 2) { legend << "rDirection < 0"; } - else if (direction == 1 && plotinfo.subDetId != 2) { legend << "rDirection > 0"; } - else if (direction == -1 && plotinfo.subDetId == 2) { legend << "zDirection < 0"; } - else if (direction == 1 && plotinfo.subDetId == 2) { legend << "zDirection > 0"; } - else { - legend << plotinfo.vars->getName(); + if (direction == -1 && plotinfo.subDetId != 2) { + legend << "rDirection < 0"; + } else if (direction == 1 && plotinfo.subDetId != 2) { + legend << "rDirection > 0"; + } else if (direction == -1 && plotinfo.subDetId == 2) { + legend << "zDirection < 0"; + } else if (direction == 1 && plotinfo.subDetId == 2) { + legend << "zDirection > 0"; + } else { + legend << plotinfo.vars->getName(); if (layer > 0) { // TEC and TID have discs, the rest have layers - if (plotinfo.subDetId==4 || plotinfo.subDetId==6) + if (plotinfo.subDetId == 4 || plotinfo.subDetId == 6) legend << ", disc "; else legend << ", layer "; @@ -1725,27 +1933,27 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // Legend: Statistics double mean, meanerror, rms, rmserror; TString rmsname, units; - bool showdeltamu = (plotinfo.h1 != 0 && plotinfo.h2 != 0 && plotinfo.plotSplits && plotinfo.plotPlain && direction == 0); - if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || - plotinfo.variable == "medianY" || plotinfo.variable == "meanY" || - plotinfo.variable == "rmsX" || plotinfo.variable == "rmsY") { + bool showdeltamu = + (plotinfo.h1 != 0 && plotinfo.h2 != 0 && plotinfo.plotSplits && plotinfo.plotPlain && direction == 0); + if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || + plotinfo.variable == "meanY" || plotinfo.variable == "rmsX" || plotinfo.variable == "rmsY") { if (useFit_ && fitResults) { - mean = fitResults->GetParameter(1)*10000; - meanerror = fitResults->GetParError(1)*10000; - rms = fitResults->GetParameter(2)*10000; - rmserror = fitResults->GetParError(2)*10000; + mean = fitResults->GetParameter(1) * 10000; + meanerror = fitResults->GetParError(1) * 10000; + rms = fitResults->GetParameter(2) * 10000; + rmserror = fitResults->GetParError(2) * 10000; rmsname = "#sigma"; delete fitResults; } else { - mean = h->GetMean(1)*10000; - meanerror = h->GetMeanError(1)*10000; - rms = h->GetRMS(1)*10000; - rmserror = h->GetRMSError(1)*10000; + mean = h->GetMean(1) * 10000; + meanerror = h->GetMeanError(1) * 10000; + rms = h->GetRMS(1) * 10000; + rmserror = h->GetRMSError(1) * 10000; rmsname = "rms"; } units = " #mum"; - } else if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + } else if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") { mean = h->GetMean(1); meanerror = h->GetMeanError(1); rms = h->GetRMS(1); @@ -1753,8 +1961,7 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo rmsname = "rms"; units = ""; } - if (showMean_) - { + if (showMean_) { legend << " #mu = " << mean; if (showMeanError_) legend << " #pm " << meanerror; @@ -1762,8 +1969,7 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo if (showRMS_ || showdeltamu || ((showModules_ || showUnderOverFlow_) && !twolines_)) legend << ", "; } - if (showRMS_) - { + if (showRMS_) { legend << " " << rmsname << " = " << rms; if (showRMSError_) legend << " #pm " << rmserror; @@ -1772,44 +1978,42 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo legend << ", "; } - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0 && direction==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */ layer == 0 && + direction == 0) { vmean.push_back(mean); vrms.push_back(rms); vmeanerror.push_back(meanerror); - TH1F* ideal = (TH1F*)plotinfo.hstack->GetHists()->At(0); - TH1F* h = plotinfo.h; - if(h->GetRMS() >= ideal->GetRMS()) - { - vAlignmentUncertainty.push_back(sqrt(pow(h->GetRMS(),2)-pow(ideal->GetRMS(),2))); - } - else{ - vAlignmentUncertainty.push_back(nan("")); - } - float p = (float)resampleTestOfEqualMeans(ideal, h, 10000); - vPValueMeanEqualIdeal.push_back(p); - p=resampleTestOfEqualRMS(ideal, h, 10000); - vPValueRMSEqualIdeal.push_back(p); - + TH1F* ideal = (TH1F*)plotinfo.hstack->GetHists()->At(0); + TH1F* h = plotinfo.h; + if (h->GetRMS() >= ideal->GetRMS()) { + vAlignmentUncertainty.push_back(sqrt(pow(h->GetRMS(), 2) - pow(ideal->GetRMS(), 2))); + } else { + vAlignmentUncertainty.push_back(nan("")); + } + float p = (float)resampleTestOfEqualMeans(ideal, h, 10000); + vPValueMeanEqualIdeal.push_back(p); + p = resampleTestOfEqualRMS(ideal, h, 10000); + vPValueRMSEqualIdeal.push_back(p); } // Legend: Delta mu for split plots if (showdeltamu) { float factor = 10000.0f; - if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") { factor = 1.0f; } - float deltamu = factor*(plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); + float deltamu = factor * (plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); legend << "#Delta#mu = " << deltamu << units; if ((showModules_ || showUnderOverFlow_) && !twolines_) legend << ", "; - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0 && direction==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */ layer == 0 && + direction == 0) { vdeltamean.push_back(deltamu); - if(plotinfo.h1->GetEntries()&&plotinfo.h2->GetEntries()){ - float p = (float)resampleTestOfEqualMeans(plotinfo.h1,plotinfo.h2, 10000); - vPValueEqualSplitMeans.push_back(p); - + if (plotinfo.h1->GetEntries() && plotinfo.h2->GetEntries()) { + float p = (float)resampleTestOfEqualMeans(plotinfo.h1, plotinfo.h2, 10000); + vPValueEqualSplitMeans.push_back(p); } } } @@ -1821,13 +2025,14 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo } if (!showUnderOverFlow_ && showModules_) { - legend << (int) h->GetEntries() << " modules"; + legend << (int)h->GetEntries() << " modules"; } if (showUnderOverFlow_) { if (showModules_) { - legend << (int) h->GetEntries() << " modules (" << (int) h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX()+1) << " outside range)"; + legend << (int)h->GetEntries() << " modules (" + << (int)h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX() + 1) << " outside range)"; } else { - legend << (int) h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX()+1) << " modules outside range"; + legend << (int)h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX() + 1) << " modules outside range"; } } plotinfo.legend->AddEntry((TObject*)0, legend.str().c_str(), ""); @@ -1835,7 +2040,6 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // Scale the x-axis (cm to um), if needed if (plotinfo.variable.find("Norm") == std::string::npos) scaleXaxis(h, 10000); - } /*! @@ -1843,60 +2047,81 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo * \brief Create the DMR histrogram using data stored in trees and store them in the plotinfo structure. */ -void PlotAlignmentValidation:: -plotDMRHistogram(PlotAlignmentValidation::DMRPlotInfo& plotinfo, int direction, int layer, std::string subdet) -{ +void PlotAlignmentValidation::plotDMRHistogram(PlotAlignmentValidation::DMRPlotInfo& plotinfo, + int direction, + int layer, + std::string subdet) { TH1F* h = 0; //Create a name for the histogram that summarize all relevant information: name of the geometry, variable plotted, structure, layer, and whether the modules considered point inward or outward. - TString histoname=""; - if(plotinfo.variable == "medianX" || plotinfo.variable == "medianY" )histoname="median"; - else if(plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY")histoname="DrmsNR"; - histoname+="_"; histoname+=plotinfo.vars->getName(); - histoname.ReplaceAll(" ","_"); - histoname+="_"; histoname+=subdet.c_str(); - if (plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormY")histoname+="_y"; - if(layer!=0){ - if(subdet=="TID"||subdet=="TEC")histoname+="_disc"; - else histoname+="_layer"; - histoname+=to_string(layer); - } - if (direction == -1) { histoname += "_minus"; } - else if (direction == 1) { histoname += "_plus"; } - else { histoname += ""; } - std::string plotVariable = getVariableForDMRPlot(histoname.Data(), plotinfo.variable, plotinfo.nbins, plotinfo.min, plotinfo.max); + TString histoname = ""; + if (plotinfo.variable == "medianX" || plotinfo.variable == "medianY") + histoname = "median"; + else if (plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") + histoname = "DrmsNR"; + histoname += "_"; + histoname += plotinfo.vars->getName(); + histoname.ReplaceAll(" ", "_"); + histoname += "_"; + histoname += subdet.c_str(); + if (plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormY") + histoname += "_y"; + if (layer != 0) { + if (subdet == "TID" || subdet == "TEC") + histoname += "_disc"; + else + histoname += "_layer"; + histoname += to_string(layer); + } + if (direction == -1) { + histoname += "_minus"; + } else if (direction == 1) { + histoname += "_plus"; + } else { + histoname += ""; + } + std::string plotVariable = + getVariableForDMRPlot(histoname.Data(), plotinfo.variable, plotinfo.nbins, plotinfo.min, plotinfo.max); std::string selection = getSelectionForDMRPlot(plotinfo.minHits, plotinfo.subDetId, direction, layer); plotinfo.vars->getTree()->Draw(plotVariable.c_str(), selection.c_str(), "goff"); - if (gDirectory) gDirectory->GetObject(histoname.Data(), h); + if (gDirectory) + gDirectory->GetObject(histoname.Data(), h); if (h && h->GetEntries() > 0) { - if (direction == -1) { plotinfo.h1 = h; } - else if (direction == 1) { plotinfo.h2 = h; } - else { plotinfo.h = h; } + if (direction == -1) { + plotinfo.h1 = h; + } else if (direction == 1) { + plotinfo.h2 = h; + } else { + plotinfo.h = h; + } } - if(plotinfo.variable == "medianX" || plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") + if (plotinfo.variable == "medianX" || plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") storeHistogramInRootfile(h); - } -void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend) -{ +void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend) { // Add mean-y-values to the legend and scale the histograms. Double_t legendY = 0.80; bool hasheader = (TkAlStyle::legendheader != ""); - if (hasheader) legend->SetHeader(TkAlStyle::legendheader); + if (hasheader) + legend->SetHeader(TkAlStyle::legendheader); legend->SetFillStyle(0); int legendsize = hs->GetHists()->GetSize() + hasheader; if (legendsize > 3) legendY -= 0.01 * (legendsize - 3); - if (bigtext_) { legendY -= 0.05; } + if (bigtext_) { + legendY -= 0.05; + } if (legendY < 0.6) { std::cerr << "Warning: Huge legend!" << std::endl; legendY = 0.6; } legend->SetY1(legendY); - if (bigtext_) legend->SetTextSize(TkAlStyle::textSize); + if (bigtext_) + legend->SetTextSize(TkAlStyle::textSize); // Loop over all profiles TProfile* prof = 0; @@ -1912,8 +2137,8 @@ void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend std::ostringstream legendtext; legendtext.precision(3); - legendtext << fixed; // to always show 3 decimals - legendtext << ": y mean = " << stats[4]/stats[0]*scale << " #mum"; + legendtext << fixed; // to always show 3 decimals + legendtext << ": y mean = " << stats[4] / stats[0] * scale << " #mum"; TLegendEntry* entry = (TLegendEntry*)legend->GetListOfPrimitives()->At(index); if (entry == 0) @@ -1924,58 +2149,55 @@ void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend } // Make some room for the legend - hs->SetMaximum(hs->GetMaximum("nostack PE")*1.3); + hs->SetMaximum(hs->GetMaximum("nostack PE") * 1.3); } - //random variable: \sigma_{X_1}-\sigma_{X_2}-\delta_{RMS} //is centered approx around 0 //null hypothesis: \delta_{RMS}=0 //so \delta_\sigma is a realization of this random variable //how probable is it to get our value of \delta_\sigma? //->p-value -double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int numSamples){ -//vector to store realizations of random variable - vector diff; - diff.clear(); -//"true" (in bootstrap terms) difference of the samples' RMS - double rmsdiff = abs(h1->GetRMS()-h2->GetRMS()); -//means of the samples to calculate RMS - double m1 = h1->GetMean(); - double m2 = h2->GetMean(); -//realization of random variable - double d1 = 0; - double d2 = 0; -//mean of random variable - double test_mean=0; - for(int i=0;iGetEntries();i++){ - d1+=h1->GetRandom()-m1; - } - for(int i=0;iGetEntries();i++){ - d2+=h2->GetRandom()+m2; - } - d1/=h1->GetEntries(); - d2/=h2->GetEntries(); - diff.push_back(abs(d1-d2-rmsdiff)); - test_mean+=abs(d1-d2-rmsdiff); +double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int numSamples) { + //vector to store realizations of random variable + vector diff; + diff.clear(); + //"true" (in bootstrap terms) difference of the samples' RMS + double rmsdiff = abs(h1->GetRMS() - h2->GetRMS()); + //means of the samples to calculate RMS + double m1 = h1->GetMean(); + double m2 = h2->GetMean(); + //realization of random variable + double d1 = 0; + double d2 = 0; + //mean of random variable + double test_mean = 0; + for (int i = 0; i < numSamples; i++) { + d1 = 0; + d2 = 0; + for (int i = 0; i < h1->GetEntries(); i++) { + d1 += h1->GetRandom() - m1; } - test_mean/=numSamples; -//p value - double p=0; - for(double d:diff){ - if(d>rmsdiff){ - p+=1; - } + for (int i = 0; i < h2->GetEntries(); i++) { + d2 += h2->GetRandom() + m2; } - - p/=numSamples; - return p; -} - + d1 /= h1->GetEntries(); + d2 /= h2->GetEntries(); + diff.push_back(abs(d1 - d2 - rmsdiff)); + test_mean += abs(d1 - d2 - rmsdiff); + } + test_mean /= numSamples; + //p value + double p = 0; + for (double d : diff) { + if (d > rmsdiff) { + p += 1; + } + } + p /= numSamples; + return p; +} //random variable: (\overline{X_1}-\mu_1)-(\overline{X_2}-\mu_2) //is centered approx around 0 @@ -1983,150 +2205,137 @@ double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int n //so \delta_\mu is a realization of this random variable //how probable is it to get our value of \delta_\mu? //->p-value -double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int numSamples){ -//vector to store realization of random variable - vector diff; - diff.clear(); -//"true" (in bootstrap terms) difference of the samples' means - double meandiff = abs(h1->GetMean()-h2->GetMean()); -//realization of random variable - double d1 = 0; - double d2=0; -//mean of random variable - double test_mean=0; - for(int i=0;iGetEntries();i++){ - d1+=h1->GetRandom(); - } - for(int i=0;iGetEntries();i++){ - d2+=h2->GetRandom(); - } - d1/=h1->GetEntries(); - d2/=h2->GetEntries(); - diff.push_back(abs(d1-d2-meandiff)); - test_mean+=abs(d1-d2-meandiff); +double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int numSamples) { + //vector to store realization of random variable + vector diff; + diff.clear(); + //"true" (in bootstrap terms) difference of the samples' means + double meandiff = abs(h1->GetMean() - h2->GetMean()); + //realization of random variable + double d1 = 0; + double d2 = 0; + //mean of random variable + double test_mean = 0; + for (int i = 0; i < numSamples; i++) { + d1 = 0; + d2 = 0; + for (int i = 0; i < h1->GetEntries(); i++) { + d1 += h1->GetRandom(); } - test_mean/=numSamples; -//p-value - double p=0; - for(double d:diff){ - if(d>meandiff){ - p+=1; - } + for (int i = 0; i < h2->GetEntries(); i++) { + d2 += h2->GetRandom(); } - - p/=numSamples; - return p; -} - + d1 /= h1->GetEntries(); + d2 /= h2->GetEntries(); + diff.push_back(abs(d1 - d2 - meandiff)); + test_mean += abs(d1 - d2 - meandiff); + } + test_mean /= numSamples; + //p-value + double p = 0; + for (double d : diff) { + if (d > meandiff) { + p += 1; + } + } + p /= numSamples; + return p; +} -float PlotAlignmentValidation::twotailedStudentTTestEqualMean(float t, float v){ -return 2*(1-ROOT::Math::tdistribution_cdf(abs(t),v)); +float PlotAlignmentValidation::twotailedStudentTTestEqualMean(float t, float v) { + return 2 * (1 - ROOT::Math::tdistribution_cdf(abs(t), v)); } const TString PlotAlignmentValidation::summaryfilename = "OfflineValidationSummary"; +vector PlotAlignmentValidation::findmodule(TFile* f, unsigned int moduleid) { + //TFile *f = TFile::Open(filename, "READ"); + TString histnamex; + TString histnamey; + //read necessary branch/folder + auto t = (TTree*)f->Get("TrackerOfflineValidationStandalone/TkOffVal"); + + TkOffTreeVariables* variables = 0; + t->SetBranchAddress("TkOffTreeVariables", &variables); + unsigned int number_of_entries = t->GetEntries(); + for (unsigned int i = 0; i < number_of_entries; i++) { + t->GetEntry(i); + if (variables->moduleId == moduleid) { + histnamex = variables->histNameX; + histnamey = variables->histNameY; + break; + } + } + vector h; -vector PlotAlignmentValidation::findmodule (TFile* f, unsigned int moduleid){ - - - //TFile *f = TFile::Open(filename, "READ"); - TString histnamex; - TString histnamey; - //read necessary branch/folder - auto t = (TTree*)f->Get("TrackerOfflineValidationStandalone/TkOffVal"); - - TkOffTreeVariables *variables=0; - t->SetBranchAddress("TkOffTreeVariables", &variables); - unsigned int number_of_entries=t->GetEntries(); - for (unsigned int i=0;iGetEntry(i); - if (variables->moduleId==moduleid){ - histnamex=variables->histNameX; - histnamey=variables->histNameY; - break; - } - } - - vector h; - - auto h1 = (TH1*)f->FindObjectAny(histnamex); - auto h2 = (TH1*)f->FindObjectAny(histnamey); - - h1->SetDirectory(0); - h2->SetDirectory(0); - - h.push_back(h1); - h.push_back(h2); - - return h; - } - -void PlotAlignmentValidation::residual_by_moduleID( unsigned int moduleid){ - TCanvas *cx = new TCanvas("x_residual"); - TCanvas *cy = new TCanvas("y_residual"); - TLegend *legendx =new TLegend(0.55, 0.7, 1, 0.9); - TLegend *legendy =new TLegend(0.55, 0.7, 1, 0.9); - - legendx->SetTextSize(0.016); - legendx->SetTextAlign(12); - legendy->SetTextSize(0.016); - legendy->SetTextAlign(12); - - - - - for (auto it : sourceList) { - TFile* file = it->getFile(); - int color = it->getLineColor(); - int linestyle = it->getLineStyle(); //this you set by doing h->SetLineStyle(linestyle) - TString legendname = it->getName(); //this goes in the legend - vector hist = findmodule(file, moduleid); - - TString histnamex = legendname+" NEntries: "+to_string(int(hist[0]->GetEntries())); - hist[0]->SetTitle(histnamex); - hist[0]->SetStats(0); - hist[0]->Rebin(50); - hist[0]->SetBit(TH1::kNoTitle); - hist[0]->SetLineColor(color); - hist[0]->SetLineStyle(linestyle); - cx->cd(); - hist[0]->Draw("Same"); - legendx->AddEntry(hist[0], histnamex, "l"); - - - TString histnamey = legendname+" NEntries: "+to_string(int(hist[1]->GetEntries())); - hist[1]->SetTitle(histnamey); - hist[1]->SetStats(0); - hist[1]->Rebin(50); - hist[1]->SetBit(TH1::kNoTitle); - hist[1]->SetLineColor(color); - hist[1]->SetLineStyle(linestyle); - cy->cd(); - hist[1]->Draw("Same"); - legendy->AddEntry(hist[1], histnamey, "l"); - - } - - TString filenamex = "x_residual_"+to_string(moduleid); - TString filenamey = "y_residual_"+to_string(moduleid); - cx->cd(); - legendx->Draw(); - cx->SaveAs(outputDir + "/" +filenamex+".root"); - cx->SaveAs(outputDir + "/" +filenamex+".pdf"); - cx->SaveAs(outputDir + "/" +filenamex+".png"); - cx->SaveAs(outputDir + "/" +filenamex+".eps"); - - cy->cd(); - legendy->Draw(); - cy->SaveAs(outputDir + "/" +filenamey+".root"); - cy->SaveAs(outputDir + "/" +filenamey+".pdf"); - cy->SaveAs(outputDir + "/" +filenamey+".png"); - cy->SaveAs(outputDir + "/" +filenamey+".eps"); - + auto h1 = (TH1*)f->FindObjectAny(histnamex); + auto h2 = (TH1*)f->FindObjectAny(histnamey); + + h1->SetDirectory(0); + h2->SetDirectory(0); + + h.push_back(h1); + h.push_back(h2); + + return h; +} + +void PlotAlignmentValidation::residual_by_moduleID(unsigned int moduleid) { + TCanvas* cx = new TCanvas("x_residual"); + TCanvas* cy = new TCanvas("y_residual"); + TLegend* legendx = new TLegend(0.55, 0.7, 1, 0.9); + TLegend* legendy = new TLegend(0.55, 0.7, 1, 0.9); + + legendx->SetTextSize(0.016); + legendx->SetTextAlign(12); + legendy->SetTextSize(0.016); + legendy->SetTextAlign(12); + + for (auto it : sourceList) { + TFile* file = it->getFile(); + int color = it->getLineColor(); + int linestyle = it->getLineStyle(); //this you set by doing h->SetLineStyle(linestyle) + TString legendname = it->getName(); //this goes in the legend + vector hist = findmodule(file, moduleid); + + TString histnamex = legendname + " NEntries: " + TString(to_string(int(hist[0]->GetEntries()))); + hist[0]->SetTitle(histnamex); + hist[0]->SetStats(0); + hist[0]->Rebin(50); + hist[0]->SetBit(TH1::kNoTitle); + hist[0]->SetLineColor(color); + hist[0]->SetLineStyle(linestyle); + cx->cd(); + hist[0]->Draw("Same"); + legendx->AddEntry(hist[0], histnamex, "l"); + + TString histnamey = legendname + " NEntries: " + TString(to_string(int(hist[1]->GetEntries()))); + hist[1]->SetTitle(histnamey); + hist[1]->SetStats(0); + hist[1]->Rebin(50); + hist[1]->SetBit(TH1::kNoTitle); + hist[1]->SetLineColor(color); + hist[1]->SetLineStyle(linestyle); + cy->cd(); + hist[1]->Draw("Same"); + legendy->AddEntry(hist[1], histnamey, "l"); + } + TString filenamex = "x_residual_" + to_string(moduleid); + TString filenamey = "y_residual_" + to_string(moduleid); + cx->cd(); + legendx->Draw(); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".root"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".pdf"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".png"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".eps"); + + cy->cd(); + legendy->Draw(); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".root"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".pdf"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".png"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".eps"); } diff --git a/Alignment/OfflineValidation/macros/trackSplitPlot.h b/Alignment/OfflineValidation/macros/trackSplitPlot.h index 123208cc73b90..a75958e2f6592 100644 --- a/Alignment/OfflineValidation/macros/trackSplitPlot.h +++ b/Alignment/OfflineValidation/macros/trackSplitPlot.h @@ -9,6 +9,7 @@ #include "TClass.h" #include "TColor.h" #include "TFile.h" +#include "TF1.h" #include "TGaxis.h" #include "TGraph2DErrors.h" #include "TGraphErrors.h" @@ -29,9 +30,8 @@ #include "TText.h" #include "TTree.h" - -enum PlotType {ScatterPlot,Profile,Histogram,OrgHistogram,Resolution}; -enum Statistic {Minimum, Maximum, Average, RMS}; +enum PlotType { ScatterPlot, Profile, Histogram, OrgHistogram, Resolution }; +enum Statistic { Minimum, Maximum, Average, RMS }; const Double_t pi = TMath::Pi(); vector colors; @@ -45,15 +45,15 @@ Int_t legendGrid = 100; Double_t margin = .1; Double_t increaseby = .1; -TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt"}; -TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""}; -Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false}; +TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt"}; +TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""}; +Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false}; TList *stufftodelete = new TList(); TString subdetector = "PIXEL"; -double outliercut = 0.99; //use the middle 99% of tracks to find the mean and RMS - //(a few tracks are fit badly and skew them otherwise) +double outliercut = 0.99; //use the middle 99% of tracks to find the mean and RMS + //(a few tracks are fit badly and skew them otherwise) /*********************************** Table Of Contents @@ -68,136 +68,335 @@ Table Of Contents #include "trackSplitPlot.h" ofstream devnull("/dev/null"); -template T identity(T t) {return t;} +template +T identity(T t) { + return t; +} //=================== //0. Track Split Plot //=================== -TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString xvar,TString yvar, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString var, - Bool_t relative = false,Bool_t pull = false,TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(TString file,TString xvar,TString yvar,Bool_t profile = false, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(TString file,TString var, - Bool_t relative = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -void placeholder(TString saveas = "",Bool_t wide = false); -void saveplot(TCanvas *c1,TString saveas); +TCanvas *trackSplitPlot(Int_t nFiles, + TString *files, + TString *names, + TString xvar, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(Int_t nFiles, + TString *files, + TString *names, + TString var, + Bool_t relative = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(TString file, + TString xvar, + TString yvar, + Bool_t profile = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(TString file, + TString var, + Bool_t relative = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +void placeholder(TString saveas = "", Bool_t wide = false); +void saveplot(TCanvas *c1, TString saveas); void deleteCanvas(TObject *canvas); void setupcolors(); -void runNumberZoomed(Int_t nFiles,TString *files,TString *names,TString yvar, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - Int_t firstRun = -1,Int_t lastRun = -1,TString saveas = ""); +void runNumberZoomed(Int_t nFiles, + TString *files, + TString *names, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + Int_t firstRun = -1, + Int_t lastRun = -1, + TString saveas = ""); //========================== //1. Misalignment Dependence //========================== void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); Bool_t misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, Bool_t drawfits = true, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -Bool_t misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, +Bool_t misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, Bool_t drawfits = true, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -Bool_t hasFit(TString misalignment,TString xvar,TString yvar,Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false); - +Bool_t hasFit(TString misalignment, + TString xvar, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false); //============= //2. Make Plots //============= -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory, Bool_t matrix[xsize][ysize]); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(TString file,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory,TString xvar,TString yvar); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory,TString xvar,TString yvar); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory, - TString xvar,TString yvar); -void makePlots(TString file,TString directory,TString xvar,TString yvar); -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory); -void makePlots(TString file,TString directory); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + Bool_t matrix[xsize][ysize]); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory, Bool_t matrix[xsize][ysize]); +void makePlots(TString file, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + Bool_t matrix[xsize][ysize]); +void makePlots(TString file, TString directory, Bool_t matrix[xsize][ysize]); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + TString xvar, + TString yvar); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory, TString xvar, TString yvar); +void makePlots(TString file, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + TString xvar, + TString yvar); +void makePlots(TString file, TString directory, TString xvar, TString yvar); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory); +void makePlots(TString file, TString misalignment, Double_t *values, Double_t *phases, TString directory); +void makePlots(TString file, TString directory); //============= //3. Axis Label //============= TString fancyname(TString variable); -TString units(TString variable,Char_t axis); -TString plainunits(TString variable,Char_t axis); -TString latexunits(TString variable,Char_t axis); -TString axislabel(TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); -TString latexlabel(TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); -void setAxisLabels(TH1 *p, PlotType type,TString xvar,TString yvar,Bool_t relative,Bool_t pull); -void setAxisLabels(TMultiGraph *p, PlotType type,TString xvar,TString yvar,Bool_t relative,Bool_t pull); -TString nPart(Int_t part,TString string,TString delimit = ";",Bool_t removerest = true); +TString units(TString variable, Char_t axis); +TString plainunits(TString variable, Char_t axis); +TString latexunits(TString variable, Char_t axis); +TString axislabel( + TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); +TString latexlabel( + TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); +void setAxisLabels(TH1 *p, PlotType type, TString xvar, TString yvar, Bool_t relative, Bool_t pull); +void setAxisLabels(TMultiGraph *p, PlotType type, TString xvar, TString yvar, Bool_t relative, Bool_t pull); +TString nPart(Int_t part, TString string, TString delimit = ";", Bool_t removerest = true); //============== //4. Axis Limits //============== -Double_t findStatistic(Statistic what,Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findAverage(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMin(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMax(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findRMS(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findStatistic(Statistic what,TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findAverage(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMin(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMax(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findRMS(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -void axislimits(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative,Bool_t pull,Double_t &min,Double_t &max,Double_t &bins); +Double_t findStatistic(Statistic what, + Int_t nFiles, + TString *files, + TString var, + Char_t axis, + Bool_t relative = false, + Bool_t pull = false); +Double_t findAverage( + Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMin(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMax(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findRMS(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findStatistic( + Statistic what, TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findAverage(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMin(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMax(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findRMS(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +void axislimits(Int_t nFiles, + TString *files, + TString var, + Char_t axis, + Bool_t relative, + Bool_t pull, + Double_t &min, + Double_t &max, + Double_t &bins); //=============== //5. Place Legend //=============== -Double_t placeLegend(TLegend *l, Double_t width, Double_t height, Double_t x1min, Double_t y1min, Double_t x2max, Double_t y2max); -Bool_t fitsHere(TLegend *l,Double_t x1, Double_t y1, Double_t x2, Double_t y2); +Double_t placeLegend( + TLegend *l, Double_t width, Double_t height, Double_t x1min, Double_t y1min, Double_t x2max, Double_t y2max); +Bool_t fitsHere(TLegend *l, Double_t x1, Double_t y1, Double_t x2, Double_t y2); #endif diff --git a/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc b/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc index 9a2c86493da08..4110c34dfafaa 100644 --- a/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc +++ b/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc @@ -8,1543 +8,1649 @@ /* Thanks a million <3 */ /***********************************************************************************/ -// NOTE: look for "TO DO" as a keyword to now what should be upgraded in later versions.... - +// NOTE: look for "TO DO" as a keyword to now what should be upgraded in later versions.... // modes -#define TALKATIVE // get some comments while processing +#define TALKATIVE // get some comments while processing //#define DEBUG // get a lot of comments while processing + canvases -> resource-consuming! // MACROS -#define INSIDE_VECTOR(vector) \ - cout << #vector << "={"; for (unsigned int i = 0 ; i < vector.size()-1 ; i++) cout << vector[i] << ","; cout << vector.back() << "}"; -#define CHECK_MAP_CONTENT(m,type) \ - for (map::iterator it = m.begin() ; it != m.end() ; it++) \ - cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl; +#define INSIDE_VECTOR(vector) \ + cout << #vector << "={"; \ + for (unsigned int i = 0; i < vector.size() - 1; i++) \ + cout << vector[i] << ","; \ + cout << vector.back() << "}"; +#define CHECK_MAP_CONTENT(m, type) \ + for (map::iterator it = m.begin(); it != m.end(); it++) \ + cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl; // CONSTRUCTOR AND DESTRUCTOR -GeometryComparisonPlotter::GeometryComparisonPlotter (TString tree_file_name, - TString output_directory, - TString modulesToPlot, - TString alignmentName, - TString referenceName, - bool printOnlyGlobal, - bool makeProfilePlots - ) : - _output_directory(output_directory + TString(output_directory.EndsWith("/") ? "" : "/")), - _output_filename("comparison.root"), - _print_option("pdf"), - _module_plot_option(modulesToPlot), - _alignment_name(alignmentName), - _reference_name(referenceName), - _print_only_global(printOnlyGlobal), - _make_profile_plots(makeProfilePlots), - _print(true), // print the graphs in a file (e.g. pdf) - _legend(true), // print the graphs in a file (e.g. pdf) - _write(true), // write the graphs in a root file - _batchMode( +GeometryComparisonPlotter::GeometryComparisonPlotter(TString tree_file_name, + TString output_directory, + TString modulesToPlot, + TString alignmentName, + TString referenceName, + bool printOnlyGlobal, + bool makeProfilePlots) + : _output_directory(output_directory + TString(output_directory.EndsWith("/") ? "" : "/")), + _output_filename("comparison.root"), + _print_option("pdf"), + _module_plot_option(modulesToPlot), + _alignment_name(alignmentName), + _reference_name(referenceName), + _print_only_global(printOnlyGlobal), + _make_profile_plots(makeProfilePlots), + _print(true), // print the graphs in a file (e.g. pdf) + _legend(true), // print the graphs in a file (e.g. pdf) + _write(true), // write the graphs in a root file + _batchMode( #ifdef DEBUG - false // false = display canvases (very time- and resource-consuming) + false // false = display canvases (very time- and resource-consuming) #else - true // true = no canvases + true // true = no canvases #endif - ), - _1dModule(true), // cut on 1d modules - _2dModule(true), // cut on 2d modules - _levelCut (DEFAULT_LEVEL), // module level (see branch of same name) - _grid_x(0), // by default no display the grid in the canvases - _grid_y(0), // by default no display the grid in the canvases - _window_width(DEFAULT_WINDOW_WIDTH), - _window_height(DEFAULT_WINDOW_HEIGHT) -{ + ), + _1dModule(true), // cut on 1d modules + _2dModule(true), // cut on 2d modules + _levelCut(DEFAULT_LEVEL), // module level (see branch of same name) + _grid_x(0), // by default no display the grid in the canvases + _grid_y(0), // by default no display the grid in the canvases + _window_width(DEFAULT_WINDOW_WIDTH), + _window_height(DEFAULT_WINDOW_HEIGHT) { #ifdef TALKATIVE - cout << ">>> TALKATIVE MODE ACTIVATED <<<" << endl; + cout << ">>> TALKATIVE MODE ACTIVATED <<<" << endl; #endif #ifdef DEBUG - cout << ">>> DEBUG MODE ACTIVATED <<<" << endl; - cout << __FILE__ << ":"<< __LINE__ << ":Info: inside constructor of GeometryComparisonPlotter utility"<< endl; + cout << ">>> DEBUG MODE ACTIVATED <<<" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: inside constructor of GeometryComparisonPlotter utility" << endl; #endif - //_sublevel_names = {"PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; // C++11 - _sublevel_names[0] = TString("PXB"); - _sublevel_names[1] = TString("PXF"); - _sublevel_names[2] = TString("TIB"); - _sublevel_names[3] = TString("TID"); - _sublevel_names[4] = TString("TOB"); - _sublevel_names[5] = TString("TEC"); - // TO DO: handle other structures - - // read tree - tree_file = new TFile(tree_file_name, "UPDATE"); - data = (TTree*) tree_file->Get("alignTree"); - // int branches - data->SetBranchAddress("id" ,&branch_i["id"]); - data->SetBranchAddress("inModuleList" ,&branch_i["inModuleList"]); - data->SetBranchAddress("badModuleQuality" ,&branch_i["badModuleQuality"]); - data->SetBranchAddress("mid" ,&branch_i["mid"]); - data->SetBranchAddress("level" ,&branch_i["level"]); - data->SetBranchAddress("mlevel" ,&branch_i["mlevel"]); - data->SetBranchAddress("sublevel" ,&branch_i["sublevel"]); - data->SetBranchAddress("useDetId" ,&branch_i["useDetId"]); - data->SetBranchAddress("detDim" ,&branch_i["detDim"]); - // float branches - data->SetBranchAddress("x" ,&branch_f["x"]); - data->SetBranchAddress("y" ,&branch_f["y"]); - data->SetBranchAddress("z" ,&branch_f["z"]); - data->SetBranchAddress("alpha" ,&branch_f["alpha"]); - data->SetBranchAddress("beta" ,&branch_f["beta"]); - data->SetBranchAddress("gamma" ,&branch_f["gamma"]); - data->SetBranchAddress("phi" ,&branch_f["phi"]); - data->SetBranchAddress("eta" ,&branch_f["eta"]); - data->SetBranchAddress("r" ,&branch_f["r"]); - data->SetBranchAddress("dx" ,&branch_f["dx"]); - data->SetBranchAddress("dy" ,&branch_f["dy"]); - data->SetBranchAddress("dz" ,&branch_f["dz"]); - data->SetBranchAddress("dphi" ,&branch_f["dphi"]); - data->SetBranchAddress("dr" ,&branch_f["dr"]); - data->SetBranchAddress("dalpha" ,&branch_f["dalpha"]); - data->SetBranchAddress("dbeta" ,&branch_f["dbeta"]); - data->SetBranchAddress("dgamma" ,&branch_f["dgamma"]); - if (data->GetBranch("rdphi") == 0x0) // in the case of rdphi branch not existing, it is created from r and dphi branches - { + //_sublevel_names = {"PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; // C++11 + _sublevel_names[0] = TString("PXB"); + _sublevel_names[1] = TString("PXF"); + _sublevel_names[2] = TString("TIB"); + _sublevel_names[3] = TString("TID"); + _sublevel_names[4] = TString("TOB"); + _sublevel_names[5] = TString("TEC"); + // TO DO: handle other structures + + // read tree + tree_file = new TFile(tree_file_name, "UPDATE"); + data = (TTree *)tree_file->Get("alignTree"); + // int branches + data->SetBranchAddress("id", &branch_i["id"]); + data->SetBranchAddress("inModuleList", &branch_i["inModuleList"]); + data->SetBranchAddress("badModuleQuality", &branch_i["badModuleQuality"]); + data->SetBranchAddress("mid", &branch_i["mid"]); + data->SetBranchAddress("level", &branch_i["level"]); + data->SetBranchAddress("mlevel", &branch_i["mlevel"]); + data->SetBranchAddress("sublevel", &branch_i["sublevel"]); + data->SetBranchAddress("useDetId", &branch_i["useDetId"]); + data->SetBranchAddress("detDim", &branch_i["detDim"]); + // float branches + data->SetBranchAddress("x", &branch_f["x"]); + data->SetBranchAddress("y", &branch_f["y"]); + data->SetBranchAddress("z", &branch_f["z"]); + data->SetBranchAddress("alpha", &branch_f["alpha"]); + data->SetBranchAddress("beta", &branch_f["beta"]); + data->SetBranchAddress("gamma", &branch_f["gamma"]); + data->SetBranchAddress("phi", &branch_f["phi"]); + data->SetBranchAddress("eta", &branch_f["eta"]); + data->SetBranchAddress("r", &branch_f["r"]); + data->SetBranchAddress("dx", &branch_f["dx"]); + data->SetBranchAddress("dy", &branch_f["dy"]); + data->SetBranchAddress("dz", &branch_f["dz"]); + data->SetBranchAddress("dphi", &branch_f["dphi"]); + data->SetBranchAddress("dr", &branch_f["dr"]); + data->SetBranchAddress("dalpha", &branch_f["dalpha"]); + data->SetBranchAddress("dbeta", &branch_f["dbeta"]); + data->SetBranchAddress("dgamma", &branch_f["dgamma"]); + if (data->GetBranch("rdphi") == + 0x0) // in the case of rdphi branch not existing, it is created from r and dphi branches + { #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl; + cout << __FILE__ << ":" << __LINE__ + << ":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl; #endif - TBranch * br_rdphi = data->Branch("rdphi", &branch_f["rdphi"], "rdphi/F"); - for (unsigned int ientry = 0 ; ientry < data->GetEntries() ; ientry++) - { - data->GetEntry(ientry); - branch_f["rdphi"] = branch_f["r"]*branch_f["dphi"]; - br_rdphi->Fill(); - } + TBranch *br_rdphi = data->Branch("rdphi", &branch_f["rdphi"], "rdphi/F"); + for (unsigned int ientry = 0; ientry < data->GetEntries(); ientry++) { + data->GetEntry(ientry); + branch_f["rdphi"] = branch_f["r"] * branch_f["dphi"]; + br_rdphi->Fill(); } - else - data->SetBranchAddress("rdphi",&branch_f["rdphi"]); + } else + data->SetBranchAddress("rdphi", &branch_f["rdphi"]); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: branch addresses set" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: branch addresses set" << endl; #endif - // style - gROOT->Reset(); - - data->SetMarkerSize(0.5); - data->SetMarkerStyle(6); - - gStyle->SetOptStat("emr"); - gStyle->SetTitleAlign(22); - gStyle->SetTitleX(0.5); - gStyle->SetTitleY(0.97); - gStyle->SetTitleFont(62); - //gStyle->SetOptTitle(0); - - gStyle->SetTextFont(132); - gStyle->SetTextSize(0.08); - gStyle->SetLabelFont(132,"x"); - gStyle->SetLabelFont(132,"y"); - gStyle->SetLabelFont(132,"z"); - gStyle->SetTitleSize(0.08,"x"); - gStyle->SetTitleSize(0.08,"y"); - gStyle->SetTitleSize(0.08,"z"); - gStyle->SetLabelSize(0.08,"x"); - gStyle->SetLabelSize(0.08,"y"); - gStyle->SetLabelSize(0.08,"z"); - - gStyle->SetMarkerStyle(8); - gStyle->SetHistLineWidth(2); - gStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes - - gStyle->SetFrameBorderMode(0); - gStyle->SetCanvasBorderMode(0); - gStyle->SetPadBorderMode(0); - gStyle->SetPadColor(0); - gStyle->SetCanvasColor(0); - gStyle->SetTitleColor(1); - gStyle->SetStatColor(0); - gStyle->SetStatBorderSize(1); - gStyle->SetFrameFillColor(0); - - gStyle->SetPadTickX(1); - gStyle->SetPadTickY(1); - - gStyle->SetPadTopMargin(0.1); - gStyle->SetPadRightMargin(0.05); - gStyle->SetPadBottomMargin(0.16); - gStyle->SetPadLeftMargin(0.18); + // style + gROOT->Reset(); + + data->SetMarkerSize(0.5); + data->SetMarkerStyle(6); + + gStyle->SetOptStat("emr"); + gStyle->SetTitleAlign(22); + gStyle->SetTitleX(0.5); + gStyle->SetTitleY(0.97); + gStyle->SetTitleFont(62); + //gStyle->SetOptTitle(0); + + gStyle->SetTextFont(132); + gStyle->SetTextSize(0.08); + gStyle->SetLabelFont(132, "x"); + gStyle->SetLabelFont(132, "y"); + gStyle->SetLabelFont(132, "z"); + gStyle->SetTitleSize(0.08, "x"); + gStyle->SetTitleSize(0.08, "y"); + gStyle->SetTitleSize(0.08, "z"); + gStyle->SetLabelSize(0.08, "x"); + gStyle->SetLabelSize(0.08, "y"); + gStyle->SetLabelSize(0.08, "z"); + + gStyle->SetMarkerStyle(8); + gStyle->SetHistLineWidth(2); + gStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes + + gStyle->SetFrameBorderMode(0); + gStyle->SetCanvasBorderMode(0); + gStyle->SetPadBorderMode(0); + gStyle->SetPadColor(0); + gStyle->SetCanvasColor(0); + gStyle->SetTitleColor(1); + gStyle->SetStatColor(0); + gStyle->SetStatBorderSize(1); + gStyle->SetFrameFillColor(0); + + gStyle->SetPadTickX(1); + gStyle->SetPadTickY(1); + + gStyle->SetPadTopMargin(0.1); + gStyle->SetPadRightMargin(0.05); + gStyle->SetPadBottomMargin(0.16); + gStyle->SetPadLeftMargin(0.18); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: end of constructor" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: end of constructor" << endl; #endif } -GeometryComparisonPlotter::~GeometryComparisonPlotter () -{ +GeometryComparisonPlotter::~GeometryComparisonPlotter() { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: in destructor of the GeometryComparisonPlotter utility" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: in destructor of the GeometryComparisonPlotter utility" << endl; #endif - tree_file->Close(); + tree_file->Close(); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: ending." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: ending." << endl; #endif } // MAIN METHOD -void GeometryComparisonPlotter::MakePlots (vector x, // axes to combine to plot - vector y, // every combination (except the ones such that x=y) will be perfomed - vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram - vector dyMax) // Minimum of y-variable +void GeometryComparisonPlotter::MakePlots( + vector x, // axes to combine to plot + vector y, // every combination (except the ones such that x=y) will be perfomed + vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram + vector dyMax) // Minimum of y-variable { - /// -1) check that only existing branches are called - // (we use a macro to avoid copy/paste) -#define CHECK_BRANCHES(branchname_vector) \ - for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \ - { \ - if (branch_f.find(branchname_vector[i]) == branch_f.end()) \ - { \ - cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \ - return; \ - } \ - } - CHECK_BRANCHES(x); - CHECK_BRANCHES(y); - - const unsigned int nentries = data->GetEntries(); + /// -1) check that only existing branches are called + // (we use a macro to avoid copy/paste) +#define CHECK_BRANCHES(branchname_vector) \ + for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ + if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ + cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \ + << endl; \ + return; \ + } \ + } + CHECK_BRANCHES(x); + CHECK_BRANCHES(y); + + const unsigned int nentries = data->GetEntries(); #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(x); cout << endl - << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(y); cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(x); + cout << endl << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(y); + cout << endl; #endif - /// 0) min and max values - // the max and min of the graphs are computed from the tree if they have not been manually input yet - // (we use a macro to avoid copy/paste) -#define LIMITS(axes_vector) \ - for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \ - { \ - if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \ - if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \ - if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \ - } - LIMITS(x); - LIMITS(y); + /// 0) min and max values + // the max and min of the graphs are computed from the tree if they have not been manually input yet + // (we use a macro to avoid copy/paste) +#define LIMITS(axes_vector) \ + for (unsigned int i = 0; i < axes_vector.size(); i++) { \ + if (_SF.find(axes_vector[i]) == _SF.end()) \ + _SF[axes_vector[i]] = 1.; \ + if (_min.find(axes_vector[i]) == _min.end()) \ + _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ + if (_max.find(axes_vector[i]) == _max.end()) \ + _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ + } + LIMITS(x); + LIMITS(y); -#ifdef TALKATIVE - CHECK_MAP_CONTENT(_min,float); - CHECK_MAP_CONTENT(_max,float); - CHECK_MAP_CONTENT(_SF ,float); +#ifdef TALKATIVE + CHECK_MAP_CONTENT(_min, float); + CHECK_MAP_CONTENT(_max, float); + CHECK_MAP_CONTENT(_SF, float); #endif - /// 1) declare TGraphs and Histograms for profile plots if these are to be plotted - // the idea is to produce at the end a table of 8 TMultiGraphs and histograms: - // - 0=Tracker, with color code for the different sublevels - // - 1..6=different sublevels, with color code for z < or > 0 - // - 7=only pixel with color code for BPIX and FPIX - - // (convention: the six first (resp. last) correspond to z>0 (resp. z<0)) - // Modules with bad quality and in a list of modules that is given - // by the user (e.g. list of bad/untouched modules, default: empty list) - // are stored in seperate graphs and might be plotted (depends on the module - // plot option, default: all modules plotted) - // This means that 3*2*6 TGraphs will be filled during the loop on the TTree, - // and will be arranged differently with different color codes in the TMultiGraphs - - // For the profile plots - // Either all modules, only good modules or good modules + those in a given list will be plotted - // This means that 2*6 TH2F will be filled during the loop on the TTree, - // and will be arranged differently with different color codes in the Histograms + /// 1) declare TGraphs and Histograms for profile plots if these are to be plotted + // the idea is to produce at the end a table of 8 TMultiGraphs and histograms: + // - 0=Tracker, with color code for the different sublevels + // - 1..6=different sublevels, with color code for z < or > 0 + // - 7=only pixel with color code for BPIX and FPIX + + // (convention: the six first (resp. last) correspond to z>0 (resp. z<0)) + // Modules with bad quality and in a list of modules that is given + // by the user (e.g. list of bad/untouched modules, default: empty list) + // are stored in seperate graphs and might be plotted (depends on the module + // plot option, default: all modules plotted) + // This means that 3*2*6 TGraphs will be filled during the loop on the TTree, + // and will be arranged differently with different color codes in the TMultiGraphs + + // For the profile plots + // Either all modules, only good modules or good modules + those in a given list will be plotted + // This means that 2*6 TH2F will be filled during the loop on the TTree, + // and will be arranged differently with different color codes in the Histograms #ifndef NB_SUBLEVELS #define NB_SUBLEVELS 6 #endif #define NB_Z_SLICES 2 #define NB_MODULE_QUALITY 3 -#define COLOR_CODE(icolor) int(icolor/4)+icolor+1 - - TGraph * graphs[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY]; - long int ipoint[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY]; - - TMultiGraph * mgraphs[x.size()][y.size()][2+NB_SUBLEVELS]; // the 0th is for global plots, the 1..6th for sublevel plots, 7th for pixel only - TCanvas * c[x.size()][y.size()][2+NB_SUBLEVELS], - * c_global[2+NB_SUBLEVELS]; - canvas_index++; // this static index is a safety used in case the MakePlots method is used several times to avoid overloading - - // histograms for profile plots, - // 2D-hists to store the data - // 1D-hists to calculate mean and sigma of y-values for each x-bin of the 2D-hists and for the final profile hist - TH2F * histos2D[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; - TH1F * histos[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; - TH1F * histosYValues[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; // Used to calculate the mean and RMS for each x-bin of the 2D-hist - TH1F * histosTracker[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; // for the tracker plots all histos are copied to avoid using the same hists in different canvas - - TCanvas * c_hist[x.size()][y.size()][2+NB_SUBLEVELS], * c_global_hist[2+NB_SUBLEVELS]; - - unsigned int nXBins; // Sensible number of x-bins differs depending on the variable - - - - - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS+1 ; ic++) - { - c_global[ic] = new TCanvas (TString::Format("global_%s_%d", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ), - canvas_index), - TString::Format("Global overview of the %s variables", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ) ), - _window_width, - _window_height); - c_global[ic]->Divide(x.size(),y.size()); - - if (_make_profile_plots) { - c_global_hist[ic] = new TCanvas (TString::Format("global_profile_plots_%s_%d", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ), - canvas_index), - TString::Format("Global overview profile plots of the %s variables", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ) ), - _window_width, - _window_height); - c_global_hist[ic]->Divide(x.size(),y.size()); - } - - } +#define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1 + + TGraph *graphs[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY]; + long int ipoint[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY]; + + TMultiGraph + *mgraphs[x.size()][y.size()] + [2 + NB_SUBLEVELS]; // the 0th is for global plots, the 1..6th for sublevel plots, 7th for pixel only + TCanvas *c[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global[2 + NB_SUBLEVELS]; + canvas_index++; // this static index is a safety used in case the MakePlots method is used several times to avoid overloading + + // histograms for profile plots, + // 2D-hists to store the data + // 1D-hists to calculate mean and sigma of y-values for each x-bin of the 2D-hists and for the final profile hist + TH2F *histos2D[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES]; + TH1F *histos[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES]; + TH1F *histosYValues[x.size()][y.size()] + [NB_SUBLEVELS * NB_Z_SLICES]; // Used to calculate the mean and RMS for each x-bin of the 2D-hist + TH1F *histosTracker + [x.size()][y.size()] + [NB_SUBLEVELS * + NB_Z_SLICES]; // for the tracker plots all histos are copied to avoid using the same hists in different canvas + + TCanvas *c_hist[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global_hist[2 + NB_SUBLEVELS]; + + unsigned int nXBins; // Sensible number of x-bins differs depending on the variable + + for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) { + c_global[ic] = new TCanvas( + TString::Format( + "global_%s_%d", ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()), canvas_index), + TString::Format("Global overview of the %s variables", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())), + _window_width, + _window_height); + c_global[ic]->Divide(x.size(), y.size()); - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - //if (x[ix] == y[iy]) continue; // do not plot graphs like (r,r) or (phi,phi) - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY ; igraph++) - { - // declaring - ipoint[ix][iy][igraph] = 0; // the purpose of an index for every graph is to avoid thousands of points at the origin of each - graphs[ix][iy][igraph] = new TGraph (); - - graphs[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); - graphs[ix][iy][igraph]->SetMarkerStyle(6); - // pimping - graphs[ix][iy][igraph]->SetName (x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) // graphs for negative/positive z - +TString(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? "bad" : "list") : "good" ));// graphs for good, bad modules and from a list - graphs[ix][iy][igraph]->SetTitle( _sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? " at z<0": " at z>=0") - +TString(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? " bad modules" : " in list") : " good modules" ) - + TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - graphs[ix][iy][igraph]->SetMarkerStyle(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? 4 : 5) : 6); // empty circle for bad modules, X for those in list, dot for good ones - } + if (_make_profile_plots) { + c_global_hist[ic] = + new TCanvas(TString::Format("global_profile_plots_%s_%d", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()), + canvas_index), + TString::Format("Global overview profile plots of the %s variables", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())), + _window_width, + _window_height); + c_global_hist[ic]->Divide(x.size(), y.size()); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int iy = 0; iy < y.size(); iy++) { + //if (x[ix] == y[iy]) continue; // do not plot graphs like (r,r) or (phi,phi) + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY; igraph++) { + // declaring + ipoint[ix][iy][igraph] = + 0; // the purpose of an index for every graph is to avoid thousands of points at the origin of each + graphs[ix][iy][igraph] = new TGraph(); + + graphs[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); + graphs[ix][iy][igraph]->SetMarkerStyle(6); + // pimping + graphs[ix][iy][igraph]->SetName( + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" + : "p") // graphs for negative/positive z + + TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? "bad" : "list") + : "good")); // graphs for good, bad modules and from a list + graphs[ix][iy][igraph]->SetTitle( + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? " at z<0" : " at z>=0") + + TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES + ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? " bad modules" : " in list") + : " good modules") + + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + " /" + + _units[y[iy]]); + graphs[ix][iy][igraph]->SetMarkerStyle( + igraph >= NB_SUBLEVELS * NB_Z_SLICES + ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? 4 : 5) + : 6); // empty circle for bad modules, X for those in list, dot for good ones + } + } + } + + // Use seperate loop for the profile histograms since we do not produce histograms for the different module qualities + if (_make_profile_plots) { + for (unsigned int ix = 0; ix < x.size(); ix++) { + if (x[ix] == "phi") + nXBins = 10; + else + nXBins = 40; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) { + // declaring + histos2D[ix][iy][igraph] = + new TH2F("2Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)), + "", + nXBins, + _min[x[ix]], + _max[x[ix]], + 1000, + _min[y[iy]], + _max[y[iy]] + 1.); } + } } - - // Use seperate loop for the profile histograms since we do not produce histograms for the different module qualities - if (_make_profile_plots) { - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - if ( x[ix] == "phi") nXBins = 10; - else nXBins = 40; - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES ; igraph++) - { - // declaring - histos2D[ix][iy][igraph] = new TH2F ("2Dhist"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index), - "",nXBins,_min[x[ix]],_max[x[ix]], - 1000,_min[y[iy]],_max[y[iy]]+1.); - } - } - } - } - + } + #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TGraph[" << x.size() << "][" << y.size() << "][" << NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY << "] ended." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TGraph[" << x.size() << "][" << y.size() << "][" + << NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY << "] ended." << endl; #endif - /// 2) loop on the TTree data + /// 2) loop on the TTree data #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; #endif #ifdef TALKATIVE - unsigned int progress = 0; - cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; + unsigned int progress = 0; + cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; #endif - for (unsigned int ientry = 0 ; ientry < nentries ; ientry++) - { -#ifdef TALKATIVE - if (10*ientry/nentries != progress) - { - progress = 10*ientry/nentries; - cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10*progress << "%" << endl; - } + for (unsigned int ientry = 0; ientry < nentries; ientry++) { +#ifdef TALKATIVE + if (10 * ientry / nentries != progress) { + progress = 10 * ientry / nentries; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl; + } #endif - // load current tree entry - data->GetEntry(ientry); - - // CUTS on entry - if (branch_i["level"] != _levelCut) continue; - if (!_1dModule && branch_i["detDim"] == 1) continue; - if (!_2dModule && branch_i["detDim"] == 2) continue; - - // loop on the different couples of variables to plot in a graph - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - // CUTS on x[ix] - if (_SF[x[ix]]*branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]]*branch_f[x[ix]] < _min[x[ix]]) - { -//#ifdef DEBUG -// cout << "branch_f[x[ix]]=" << branch_f[x[ix]] << endl; -//#endif - continue; - } + // load current tree entry + data->GetEntry(ientry); + + // CUTS on entry + if (branch_i["level"] != _levelCut) + continue; + if (!_1dModule && branch_i["detDim"] == 1) + continue; + if (!_2dModule && branch_i["detDim"] == 2) + continue; + + // loop on the different couples of variables to plot in a graph + for (unsigned int ix = 0; ix < x.size(); ix++) { + // CUTS on x[ix] + if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) { + //#ifdef DEBUG + // cout << "branch_f[x[ix]]=" << branch_f[x[ix]] << endl; + //#endif + continue; + } + + for (unsigned int iy = 0; iy < y.size(); iy++) { + // CUTS on y[iy] + //if (x[ix] == y[iy]) continue; // TO DO: handle display when such a case occurs + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + + // FILLING histograms take even those outside the plotted range into account + if (_make_profile_plots) { + if (_module_plot_option == "all") { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } else if (_module_plot_option == "list" && + (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } + } - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - // CUTS on y[iy] - //if (x[ix] == y[iy]) continue; // TO DO: handle display when such a case occurs - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - - // FILLING histograms take even those outside the plotted range into account - if (_make_profile_plots) { - if (_module_plot_option == "all"){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0) ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - } - - // restrict scatter plots to chosen range - if (_SF[y[iy]]*branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]]*branch_f[y[iy]] < _min[y[iy]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING GRAPH - if (y.size() >= x.size()){ - if (branch_i["inModuleList"]==0 && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - if (branch_i["inModuleList"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + NB_SUBLEVELS*NB_Z_SLICES; - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - if (branch_i["badModuleQuality"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + 2*NB_SUBLEVELS*NB_Z_SLICES; - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - } - else{ - if (branch_i["inModuleList"]==0 && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - graphs[iy][ix][igraph]->SetPoint(ipoint[iy][ix][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - if (branch_i["inModuleList"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + NB_SUBLEVELS*NB_Z_SLICES; - graphs[iy][ix][igraph]->SetPoint(ipoint[iy][ix][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - if (branch_i["badModuleQuality"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + 2*NB_SUBLEVELS*NB_Z_SLICES; - graphs[iy][ix][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - } - } + // restrict scatter plots to chosen range + if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; } + + // FILLING GRAPH + if (y.size() >= x.size()) { + if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + if (branch_i["inModuleList"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES; + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + if (branch_i["badModuleQuality"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES; + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + } else { + if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + graphs[iy][ix][igraph]->SetPoint( + ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + if (branch_i["inModuleList"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES; + graphs[iy][ix][igraph]->SetPoint( + ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + if (branch_i["badModuleQuality"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES; + graphs[iy][ix][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + } + } } + } #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; #endif - /// 3) merge TGraph objects into TMultiGraph objects, then draw, print and write (according to the options _batchMode, _print and _write respectively) - gROOT->SetBatch(_batchMode); // if true, then equivalent to "root -b", i.e. no canvas - if (_write) - { // opening the file to write the graphs - output = new TFile(_output_directory+TString(_output_filename), "UPDATE"); // possibly existing file will be updated, otherwise created - if (output->IsZombie()) - { - cout << __FILE__ << ":" << __LINE__ << ":Error: Opening of " << _output_directory+TString(_output_filename) << " failed" << endl; - exit(-1); - } + /// 3) merge TGraph objects into TMultiGraph objects, then draw, print and write (according to the options _batchMode, _print and _write respectively) + gROOT->SetBatch(_batchMode); // if true, then equivalent to "root -b", i.e. no canvas + if (_write) { // opening the file to write the graphs + output = new TFile(_output_directory + TString(_output_filename), + "UPDATE"); // possibly existing file will be updated, otherwise created + if (output->IsZombie()) { + cout << __FILE__ << ":" << __LINE__ << ":Error: Opening of " << _output_directory + TString(_output_filename) + << " failed" << endl; + exit(-1); + } #ifdef TALKATIVE - cout << __FILE__ << ":"<< __LINE__ << ":Info: output file is " << _output_directory+TString(_output_filename) << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: output file is " << _output_directory + TString(_output_filename) + << endl; #endif - } - // declaring TMultiGraphs and TCanvas - // Usually more y variables than x variables - // creating TLegend - TLegend * legend = MakeLegend(.1,.92,.9,1.,NB_SUBLEVELS); - if (_write) legend->Write(); - - // check which modules are supposed to be plotted - unsigned int n_module_types = 1; - if (_module_plot_option == "all"){ - n_module_types = 3; //plot all modules (good, list and bad ) - } - else if (_module_plot_option == "list"){ - n_module_types = 2; // plot good modules and those in the list - } - else if (_module_plot_option == "good"){ - n_module_types = 1; // only plot the modules that are neither bad or in the list - } - - -#define INDEX_IN_GLOBAL_CANVAS(i1,i2) 1 + i1 + i2*x.size() - // running on the TGraphs to produce the TMultiGraph and draw/print them - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { + } + // declaring TMultiGraphs and TCanvas + // Usually more y variables than x variables + // creating TLegend + TLegend *legend = MakeLegend(.1, .92, .9, 1., NB_SUBLEVELS); + if (_write) + legend->Write(); + + // check which modules are supposed to be plotted + unsigned int n_module_types = 1; + if (_module_plot_option == "all") { + n_module_types = 3; //plot all modules (good, list and bad ) + } else if (_module_plot_option == "list") { + n_module_types = 2; // plot good modules and those in the list + } else if (_module_plot_option == "good") { + n_module_types = 1; // only plot the modules that are neither bad or in the list + } + +#define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size() + // running on the TGraphs to produce the TMultiGraph and draw/print them + for (unsigned int ix = 0; ix < x.size(); ix++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]="<< x[ix] << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << endl; #endif - // looping on Y axes - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - - + // looping on Y axes + for (unsigned int iy = 0; iy < y.size(); iy++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] - << " and y[" << iy << "]=" << y[iy] - << "\t-> creating TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << " and y[" << iy << "]=" << y[iy] + << "\t-> creating TMultiGraph" << endl; #endif - mgraphs[ix][iy][0] = new TMultiGraph (TString::Format("mgr_%s_vs_%s_tracker_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - mgraphs[ix][iy][7] = new TMultiGraph (TString::Format("mgr_%s_vs_%s_pixel_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - /// TRACKER and PIXEL - // fixing ranges and filling TMultiGraph - // for (unsigned short int jgraph = NB_SUBLEVELS*NB_Z_SLICES-1 ; jgraph >= 0 ; --jgraph) - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES*n_module_types ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES*n_module_types - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + mgraphs[ix][iy][0] = new TMultiGraph( + TString::Format("mgr_%s_vs_%s_tracker_%d", + x[ix].Data(), + y[iy].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + mgraphs[ix][iy][7] = new TMultiGraph( + TString::Format("mgr_%s_vs_%s_pixel_%d", + x[ix].Data(), + y[iy].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + /// TRACKER and PIXEL + // fixing ranges and filling TMultiGraph + // for (unsigned short int jgraph = NB_SUBLEVELS*NB_Z_SLICES-1 ; jgraph >= 0 ; --jgraph) + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES * n_module_types; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES * n_module_types - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: writing TGraph to file" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: writing TGraph to file" << endl; #endif - // write into root file - if (_write) graphs[ix][iy][igraph]->Write(); - if (graphs[ix][iy][igraph]->GetN() == 0) - { + // write into root file + if (_write) + graphs[ix][iy][igraph]->Write(); + if (graphs[ix][iy][igraph]->GetN() == 0) { #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: " << graphs[ix][iy][igraph]->GetName() << " is empty." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << graphs[ix][iy][igraph]->GetName() << " is empty." << endl; #endif - continue; - } + continue; + } #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " - << _sublevel_names[igraph%NB_SUBLEVELS] - << (igraph >= NB_SUBLEVELS ? "(z<0)" : "(z>0)") - << " to global TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " + << _sublevel_names[igraph % NB_SUBLEVELS] << (igraph >= NB_SUBLEVELS ? "(z<0)" : "(z>0)") + << " to global TMultiGraph" << endl; #endif - // clone to prevent any injure on the graph - TGraph * gr = (TGraph *) graphs[ix][iy][igraph]->Clone(); - // color - gr->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - mgraphs[ix][iy][0]->Add(gr, "P");//, (mgraphs[ix][iy][0]->GetListOfGraphs()==0?"AP":"P")); - - if (igraph%NB_SUBLEVELS == 0 || igraph%NB_SUBLEVELS == 1) mgraphs[ix][iy][7]->Add(gr, "P"); // Add BPIX (0) and FPIX (1) to pixel plot - - } - - /// SUBLEVELS (1..6) - for (unsigned int isublevel = 1 ; isublevel <= NB_SUBLEVELS ; isublevel++) - { + // clone to prevent any injure on the graph + TGraph *gr = (TGraph *)graphs[ix][iy][igraph]->Clone(); + // color + gr->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + mgraphs[ix][iy][0]->Add(gr, "P"); //, (mgraphs[ix][iy][0]->GetListOfGraphs()==0?"AP":"P")); + + if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1) + mgraphs[ix][iy][7]->Add(gr, "P"); // Add BPIX (0) and FPIX (1) to pixel plot + } + + /// SUBLEVELS (1..6) + for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " - << _sublevel_names[isublevel-1] << " to sublevel TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " + << _sublevel_names[isublevel - 1] << " to sublevel TMultiGraph" << endl; #endif - mgraphs[ix][iy][isublevel] = new TMultiGraph (TString::Format("%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - _sublevel_names[isublevel-1].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for ") + - _sublevel_names[isublevel-1] // graph title - + TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - graphs[ix][iy][ isublevel-1]->SetMarkerColor(kBlack); - graphs[ix][iy][NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed); - graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kGray+1); - graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed-7); - graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kGray+1); - graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed-7); - if (graphs[ix][iy][ isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][ isublevel-1], "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z>0 + mgraphs[ix][iy][isublevel] = + new TMultiGraph(TString::Format("%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + _sublevel_names[isublevel - 1].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for ") + + _sublevel_names[isublevel - 1] // graph title + + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack); + graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed); + graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1); + graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7); + graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1); + graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7); + if (graphs[ix][iy][isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add( + graphs[ix][iy][isublevel - 1], + "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z>0 #ifdef TALKATIVE - else cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][isublevel-1]=" << graphs[ix][iy][isublevel-1]->GetName() << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; + else + cout << __FILE__ << ":" << __LINE__ + << ":Info: graphs[ix][iy][isublevel-1]=" << graphs[ix][iy][isublevel - 1]->GetName() + << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; #endif - if (graphs[ix][iy][NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][NB_SUBLEVELS+isublevel-1], "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z<0 + if (graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add( + graphs[ix][iy][NB_SUBLEVELS + isublevel - 1], + "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z<0 #ifdef TALKATIVE - else cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" << graphs[ix][iy][NB_Z_SLICES+isublevel-1]->GetName() << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; + else + cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" + << graphs[ix][iy][NB_Z_SLICES + isublevel - 1]->GetName() << " is empty -> not added into " + << mgraphs[ix][iy][isublevel]->GetName() << endl; #endif -#if NB_Z_SLICES!=2 - cout << __FILE__ << ":" << __LINE__ << ":Error: color code incomplete for Z slices..." << endl; +#if NB_Z_SLICES != 2 + cout << __FILE__ << ":" << __LINE__ << ":Error: color code incomplete for Z slices..." << endl; #endif - if (_module_plot_option == "all"){ - if (graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1], "P"); - } - if (_module_plot_option == "list"){ - if (graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1], "P"); - } - } - + if (_module_plot_option == "all") { + if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1], "P"); + } + if (_module_plot_option == "list") { + if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P"); + } + } - // fixing ranges, saving, and drawing of TMultiGraph (tracker AND sublevels AND pixel, i.e. 2+NB_SUBLEVELS objects) - // the individual canvases are saved, but the global are just drawn and will be saved later - for (unsigned short int imgr = 0 ; imgr <= NB_SUBLEVELS+1 ; imgr++) - { + // fixing ranges, saving, and drawing of TMultiGraph (tracker AND sublevels AND pixel, i.e. 2+NB_SUBLEVELS objects) + // the individual canvases are saved, but the global are just drawn and will be saved later + for (unsigned short int imgr = 0; imgr <= NB_SUBLEVELS + 1; imgr++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: treating individual canvases." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: treating individual canvases." << endl; #endif - // drawing into individual canvas and printing it (including a legend for the tracker canvas) - c[ix][iy][imgr] = new TCanvas (TString::Format("c_%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - imgr==0 ? "tracker" : ( imgr==7 ? "pixel" : _sublevel_names[imgr-1].Data() ), - canvas_index), - TString::Format("%s vs. %s at %s level", x[ix].Data(), - y[iy].Data(), - imgr==0 ? "tracker" : ( imgr==7 ? "pixel" : _sublevel_names[imgr-1].Data() ) ), - _window_width, - _window_height); - c[ix][iy][imgr]->SetGrid(_grid_x,_grid_y); // grid - - if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { - if (dyMin[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); - } - if (dyMax[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); - } - mgraphs[ix][iy][imgr]->Draw("A"); - } - if (imgr == 0 && _legend) legend->Draw(); // only for the tracker - if (_print && !_print_only_global) c[ix][iy][imgr]->Print(_output_directory + mgraphs[ix][iy][imgr]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - - // writing into root file - if (_write) mgraphs[ix][iy][imgr]->Write(); - - // drawing into global canvas - c_global[imgr]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { - if (dyMin[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); - } - if (dyMax[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); - } - mgraphs[ix][iy][imgr]->Draw("A"); - } - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + // drawing into individual canvas and printing it (including a legend for the tracker canvas) + c[ix][iy][imgr] = new TCanvas( + TString::Format("c_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data()), + canvas_index), + TString::Format("%s vs. %s at %s level", + x[ix].Data(), + y[iy].Data(), + imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data())), + _window_width, + _window_height); + c[ix][iy][imgr]->SetGrid(_grid_x, _grid_y); // grid + + if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { + if (dyMin[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); + } + if (dyMax[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); + } + mgraphs[ix][iy][imgr]->Draw("A"); + } + if (imgr == 0 && _legend) + legend->Draw(); // only for the tracker + if (_print && !_print_only_global) + c[ix][iy][imgr]->Print( + _output_directory + mgraphs[ix][iy][imgr]->GetName() + ExtensionFromPrintOption(_print_option), + _print_option); + + // writing into root file + if (_write) + mgraphs[ix][iy][imgr]->Write(); + + // drawing into global canvas + c_global[imgr]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { + if (dyMin[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); + } + if (dyMax[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); + } + mgraphs[ix][iy][imgr]->Draw("A"); + } + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + } + } // end of loop on y + } // end of loop on x + + // CUSTOMISATION + gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases + // -> instead, we will write it in the upper part in a TPaveText or in a TLegend + for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) { + c_global[ic]->Draw(); + + // setting legend to tracker canvases + if (!_legend) + break; + TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString("_sub")); + c_temp->Draw(); + c_global[ic] = new TCanvas( + c_temp->GetName() + TString("_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight()); + c_global[ic]->Draw(); + TPad *p_up = new TPad(TString("legend_") + c_temp->GetName(), + "", + 0., + 0.9, + 1., + 1., // relative position + -1, + 0, + 0), // display options + *p_down = new TPad(TString("main_") + c_temp->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0); + // in the lower part, draw the plots + p_down->Draw(); + p_down->cd(); + c_temp->DrawClonePad(); + c_global[ic]->cd(); + // in the upper part, pimp the canvas :p + p_up->Draw(); + p_up->cd(); + if (ic == 0) // tracker + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else if (ic == 7) // pixel + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else // sublevels + { + TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB"); + pt->SetFillColor(0); + pt->AddText(_sublevel_names[ic - 1]); + pt->Draw(); + TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.3); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } + // printing + if (_print) + c_global[ic]->Print(_output_directory + c_global[ic]->GetName() + ExtensionFromPrintOption(_print_option), + _print_option); + if (_write) + c_global[ic]->Write(); + } + + // printing global canvases + if (_write) + output->Close(); + + // Now produce the profile plots if the option is chosen + // Use seperate loops since no seperate plots are produced for different module qualities + if (_make_profile_plots) { + // Fill Content of 2D-hists into 1D-hists for the profile plots + // Loop over all y-bins for a certain x-bin, calculate mean and RMS as entries of the 1D-hists + bool entries = false; + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) { + // Declare hists which will be plotted for the profile plots + histos[ix][iy][igraph] = + new TH1F("1Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)), + "", + histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(), + _min[x[ix]], + _max[x[ix]]); + histos[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); + histos[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph)); + histos[ix][iy][igraph]->StatOverflows(kTRUE); + + // Loop over x bins + for (int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) { + entries = false; + // Declare y-histogram for each x bin + histosYValues[ix][iy][igraph] = + new TH1F("1Dhist_Y-Values" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)) + TString(std::to_string(binx)), + "", + histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(), + _min[y[iy]], + _max[y[iy]] + 1.); + histosYValues[ix][iy][igraph]->StatOverflows(kTRUE); + // Loop over y-bins for each x-bin of the 2D histogram and put it into the 1-d y histograms + // Take overflow bin into account + for (int biny = 0; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins() + 1; biny++) { + if (histos2D[ix][iy][igraph]->GetBinContent(binx, biny) > 1.) { + histosYValues[ix][iy][igraph]->SetBinContent(biny, histos2D[ix][iy][igraph]->GetBinContent(binx, biny)); + entries = true; + } } - } // end of loop on y - } // end of loop on x - - + if (entries) { + histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean()); + histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS()); + } else + histos[ix][iy][igraph]->SetBinContent(binx, -999999.); + } + } - // CUSTOMISATION - gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases - // -> instead, we will write it in the upper part in a TPaveText or in a TLegend - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS+1 ; ic++) - { - c_global[ic]->Draw(); - - // setting legend to tracker canvases - if (!_legend) break; - TCanvas * c_temp = (TCanvas *) c_global[ic]->Clone(c_global[ic]->GetTitle() + TString("_sub")); - c_temp->Draw(); - c_global[ic] = new TCanvas (c_temp->GetName() + TString("_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight()); - c_global[ic]->Draw(); - TPad * p_up = new TPad (TString("legend_") + c_temp->GetName(), "", - 0., 0.9, 1., 1., // relative position - -1, 0, 0), // display options - * p_down = new TPad (TString("main_") + c_temp->GetName(), "", - 0., 0., 1., 0.9, - -1, 0, 0); - // in the lower part, draw the plots - p_down->Draw(); - p_down->cd(); - c_temp->DrawClonePad(); - c_global[ic]->cd(); - // in the upper part, pimp the canvas :p - p_up->Draw(); - p_up->cd(); - if (ic == 0) // tracker - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,NB_SUBLEVELS);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + // Customize and print the histograms + + /// TRACKER + // fixing ranges and draw profile plot histos + + c_hist[ix][iy][0] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index), + TString::Format("Profile plot %s vs. %s at tracker level", x[ix].Data(), y[iy].Data()), + _window_width, + _window_height); + c_hist[ix][iy][0]->SetGrid(_grid_x, _grid_y); // grid + // Draw the frame that will contain the histograms + // One needs to specify the binning and title + c_hist[ix][iy][0]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + if (_legend) + legend->Draw("same"); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + + // clone to prevent any injure on the graph + histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone(); + // color + histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetMarkerStyle(6); + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } + + if (_print && !_print_only_global) + c_hist[ix][iy][0]->Print( + _output_directory + + TString::Format("Profile_plot_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + //Draw into profile hists global tracker canvas + c_global_hist[0]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[0] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } + + /// PIXEL + // fixing ranges and draw profile plot histos + + c_hist[ix][iy][7] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index), + TString::Format("Profile plot %s vs. %s at pixel level", x[ix].Data(), y[iy].Data()), + _window_width, + _window_height); + c_hist[ix][iy][7]->SetGrid(_grid_x, _grid_y); // grid + // Draw the frame that will contain the histograms + // One needs to specify the binning and title + c_hist[ix][iy][7]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + if (_legend) + legend->Draw("same"); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + + if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1) //Only BPIX and FPIX + { + // clone to prevent any injure on the graph + histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone(); + // color + histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetMarkerStyle(6); + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } } - else if (ic == 7) // pixel - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,2);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + + if (_print && !_print_only_global) + c_hist[ix][iy][7]->Print( + _output_directory + + TString::Format("Profile_plot_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + //Draw into profile hists global tracker canvas + c_global_hist[7]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[7] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + histosTracker[ix][iy][igraph]->Draw("same pe0"); } - else // sublevels - { - TPaveText * pt = new TPaveText(.05,.1,.7,.8, "NB"); - pt->SetFillColor(0); - pt->AddText(_sublevel_names[ic-1]); - pt->Draw(); - TPaveText * pt_geom = new TPaveText(.6,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.3); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + /// SUBLEVELS (1..6) + for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) { + // Draw and print profile histograms + c_hist[ix][iy][isublevel] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data(), + canvas_index), + TString::Format("Profile plot %s vs. %s at %s level", + x[ix].Data(), + y[iy].Data(), + isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data()), + _window_width, + _window_height); + c_hist[ix][iy][isublevel]->SetGrid(_grid_x, _grid_y); // grid + c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + + histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack); + histos[ix][iy][isublevel - 1]->SetLineColor(kBlack); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetLineColor(kRed); + + histos[ix][iy][isublevel - 1]->Draw("same pe0"); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0"); + + if (_print && !_print_only_global) + c_hist[ix][iy][isublevel]->Print(_output_directory + + TString::Format("Profile_plot_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + _sublevel_names[isublevel - 1].Data(), + canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + // draw into global canvas + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + c_global_hist[isublevel]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[isublevel] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->SetFillStyle(4000); // make the pad transparent + c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[isublevel] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + histos[ix][iy][isublevel - 1]->Draw("same pe0"); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0"); } - // printing - if (_print) c_global[ic]->Print(_output_directory + c_global[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - if (_write) c_global[ic]->Write(); + + } // end of loop on y + } // end of loop on x + + // CUSTOMISATION + gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases + // -> instead, we will write it in the upper part in a TPaveText or in a TLegend + for (unsigned int ic = 0; ic <= NB_SUBLEVELS; ic++) { + // setting legend to tracker canvases + if (!_legend) + break; + + // setting legend to tracker canvases + if (!_legend) + break; + TCanvas *c_temp_hist = (TCanvas *)c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString("_sub")); + c_temp_hist->Draw(); + c_global_hist[ic] = new TCanvas(c_temp_hist->GetName() + TString("_final"), + c_temp_hist->GetTitle(), + c_temp_hist->GetWindowWidth(), + c_temp_hist->GetWindowHeight()); + c_global_hist[ic]->Draw(); + TPad *p_up = new TPad(TString("legend_") + c_temp_hist->GetName(), + "", + 0., + 0.9, + 1., + 1., // relative position + -1, + 0, + 0), // display options + *p_down = new TPad(TString("main_") + c_temp_hist->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0); + // in the lower part, draw the plots + p_down->Draw(); + p_down->cd(); + c_temp_hist->DrawClonePad(); + c_global_hist[ic]->cd(); + // in the upper part, pimp the canvas :p + p_up->Draw(); + p_up->cd(); + if (ic == 0) // tracker + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else if (ic == 7) // pixel + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else // sublevels + { + TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB"); + pt->SetFillColor(0); + pt->AddText(_sublevel_names[ic - 1]); + pt->Draw(); + TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.3); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } + // printing + if (_print) + c_global_hist[ic]->Print( + _output_directory + c_global_hist[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); } - - // printing global canvases - if (_write) output->Close(); - - - // Now produce the profile plots if the option is chosen - // Use seperate loops since no seperate plots are produced for different module qualities - if (_make_profile_plots) { - - // Fill Content of 2D-hists into 1D-hists for the profile plots - // Loop over all y-bins for a certain x-bin, calculate mean and RMS as entries of the 1D-hists - bool entries = false; - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES ; igraph++) - { - - // Declare hists which will be plotted for the profile plots - histos[ix][iy][igraph] = new TH1F ("1Dhist"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index), - "",histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),_min[x[ix]],_max[x[ix]]); - histos[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); - histos[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph)); - histos[ix][iy][igraph]->StatOverflows(kTRUE); - - - // Loop over x bins - for (int binx = 0 ; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins() ; binx++) - { - entries = false; - // Declare y-histogram for each x bin - histosYValues[ix][iy][igraph] = new TH1F ("1Dhist_Y-Values"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index) - +std::to_string(binx), - "",histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(), - _min[y[iy]], - _max[y[iy]]+1.); - histosYValues[ix][iy][igraph]->StatOverflows(kTRUE); - // Loop over y-bins for each x-bin of the 2D histogram and put it into the 1-d y histograms - // Take overflow bin into account - for (int biny = 0 ; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins()+1 ; biny++) - { - if (histos2D[ix][iy][igraph]->GetBinContent(binx,biny) > 1.) - { - histosYValues[ix][iy][igraph]->SetBinContent(biny,histos2D[ix][iy][igraph]->GetBinContent(binx,biny)); - entries = true; - } - } - if (entries) - { - histos[ix][iy][igraph]->SetBinContent(binx,histosYValues[ix][iy][igraph]->GetMean()); - histos[ix][iy][igraph]->SetBinError(binx,histosYValues[ix][iy][igraph]->GetRMS()); - } - else histos[ix][iy][igraph]->SetBinContent(binx,-999999.); - - } - - } - - // Customize and print the histograms - - /// TRACKER - // fixing ranges and draw profile plot histos - - c_hist[ix][iy][0] = new TCanvas (TString::Format("c_hist_%s_vs_%s_tracker_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at tracker level", x[ix].Data(), - y[iy].Data()), - _window_width, - _window_height); - c_hist[ix][iy][0]->SetGrid(_grid_x,_grid_y); // grid - // Draw the frame that will contain the histograms - // One needs to specify the binning and title - c_hist[ix][iy][0]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - if (_legend) legend->Draw("same"); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - - // clone to prevent any injure on the graph - histosTracker[ix][iy][igraph] = (TH1F *) histos[ix][iy][igraph]->Clone(); - // color - histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetMarkerStyle(6); - histosTracker[ix][iy][igraph]->Draw("same pe0"); - - } - - if (_print && !_print_only_global) c_hist[ix][iy][0]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - //Draw into profile hists global tracker canvas - c_global_hist[0]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - - /// PIXEL - // fixing ranges and draw profile plot histos - - c_hist[ix][iy][7] = new TCanvas (TString::Format("c_hist_%s_vs_%s_pixel_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at pixel level", x[ix].Data(), - y[iy].Data()), - _window_width, - _window_height); - c_hist[ix][iy][7]->SetGrid(_grid_x,_grid_y); // grid - // Draw the frame that will contain the histograms - // One needs to specify the binning and title - c_hist[ix][iy][7]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - if (_legend) legend->Draw("same"); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - - if (igraph%NB_SUBLEVELS == 0 || igraph%NB_SUBLEVELS == 1) //Only BPIX and FPIX - { - // clone to prevent any injure on the graph - histosTracker[ix][iy][igraph] = (TH1F *) histos[ix][iy][igraph]->Clone(); - // color - histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetMarkerStyle(6); - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - - } - - if (_print && !_print_only_global) c_hist[ix][iy][7]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - //Draw into profile hists global tracker canvas - c_global_hist[7]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy - /// SUBLEVELS (1..6) - for (unsigned int isublevel = 1 ; isublevel <= NB_SUBLEVELS ; isublevel++) - { - - // Draw and print profile histograms - c_hist[ix][iy][isublevel] = new TCanvas (TString::Format("c_hist_%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - isublevel==0?"tracker":_sublevel_names[isublevel-1].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at %s level", x[ix].Data(), - y[iy].Data(), - isublevel==0?"tracker":_sublevel_names[isublevel-1].Data()), - _window_width, - _window_height); - c_hist[ix][iy][isublevel]->SetGrid(_grid_x,_grid_y); // grid - c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - histos[ix][iy][ isublevel-1]->SetMarkerColor(kBlack); - histos[ix][iy][ isublevel-1]->SetLineColor(kBlack); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->SetLineColor(kRed); - - - histos[ix][iy][ isublevel-1]->Draw("same pe0"); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->Draw("same pe0"); - - if (_print && !_print_only_global) c_hist[ix][iy][isublevel]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_%s_%d", x[ix].Data(), y[iy].Data(),_sublevel_names[isublevel-1].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - // draw into global canvas - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy - c_global_hist[isublevel]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - - histos[ix][iy][ isublevel-1]->Draw("same pe0"); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->Draw("same pe0"); - } - - } // end of loop on y - } // end of loop on x - - - - // CUSTOMISATION - gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases - // -> instead, we will write it in the upper part in a TPaveText or in a TLegend - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS ; ic++) - { - // setting legend to tracker canvases - if (!_legend) break; - - // setting legend to tracker canvases - if (!_legend) break; - TCanvas * c_temp_hist = (TCanvas *) c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString("_sub")); - c_temp_hist->Draw(); - c_global_hist[ic] = new TCanvas (c_temp_hist->GetName() + TString("_final"), c_temp_hist->GetTitle(), c_temp_hist->GetWindowWidth(), c_temp_hist->GetWindowHeight()); - c_global_hist[ic]->Draw(); - TPad * p_up = new TPad (TString("legend_") + c_temp_hist->GetName(), "", - 0., 0.9, 1., 1., // relative position - -1, 0, 0), // display options - * p_down = new TPad (TString("main_") + c_temp_hist->GetName(), "", - 0., 0., 1., 0.9, - -1, 0, 0); - // in the lower part, draw the plots - p_down->Draw(); - p_down->cd(); - c_temp_hist->DrawClonePad(); - c_global_hist[ic]->cd(); - // in the upper part, pimp the canvas :p - p_up->Draw(); - p_up->cd(); - if (ic == 0) // tracker - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,NB_SUBLEVELS);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - else if (ic == 7) // pixel - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,2);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - else // sublevels - { - TPaveText * pt = new TPaveText(.05,.1,.7,.8, "NB"); - pt->SetFillColor(0); - pt->AddText(_sublevel_names[ic-1]); - pt->Draw(); - TPaveText * pt_geom = new TPaveText(.6,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.3); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - // printing - if (_print) c_global_hist[ic]->Print(_output_directory + c_global_hist[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - } - - } - + } + #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakePlots method" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakePlots method" << endl; #endif - } - // Make additional table for the mean/RMS values of differences -void GeometryComparisonPlotter::MakeTables (vector x, // axes to combine to plot - vector y, // only requires the differences (y values in the plots) and ranges - vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram - vector dyMax) // Maximum of y-variable to enable fixed ranges of the histogram +void GeometryComparisonPlotter::MakeTables( + vector x, // axes to combine to plot + vector y, // only requires the differences (y values in the plots) and ranges + vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram + vector dyMax) // Maximum of y-variable to enable fixed ranges of the histogram { - - /// -1) check that only existing branches are called - // (we use a macro to avoid copy/paste) -#define CHECK_BRANCHES(branchname_vector) \ - for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \ - { \ - if (branch_f.find(branchname_vector[i]) == branch_f.end()) \ - { \ - cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \ - return; \ - } \ - } - CHECK_BRANCHES(x); - CHECK_BRANCHES(y); - - const unsigned int nentries = data->GetEntries(); + /// -1) check that only existing branches are called + // (we use a macro to avoid copy/paste) +#define CHECK_BRANCHES(branchname_vector) \ + for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ + if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ + cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \ + << endl; \ + return; \ + } \ + } + CHECK_BRANCHES(x); + CHECK_BRANCHES(y); + + const unsigned int nentries = data->GetEntries(); #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(x); cout << endl; - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(y); cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(x); + cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(y); + cout << endl; #endif + /// 0) min and max values + // the max and min of the graphs are computed from the tree if they have not been manually input yet + // (we use a macro to avoid copy/paste) +#define LIMITS(axes_vector) \ + for (unsigned int i = 0; i < axes_vector.size(); i++) { \ + if (_SF.find(axes_vector[i]) == _SF.end()) \ + _SF[axes_vector[i]] = 1.; \ + if (_min.find(axes_vector[i]) == _min.end()) \ + _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ + if (_max.find(axes_vector[i]) == _max.end()) \ + _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ + } + LIMITS(x); + LIMITS(y); - /// 0) min and max values - // the max and min of the graphs are computed from the tree if they have not been manually input yet - // (we use a macro to avoid copy/paste) -#define LIMITS(axes_vector) \ - for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \ - { \ - if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \ - if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \ - if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \ - } - LIMITS(x); - LIMITS(y); - -#ifdef TALKATIVE - CHECK_MAP_CONTENT(_min,float); - CHECK_MAP_CONTENT(_max,float); - CHECK_MAP_CONTENT(_SF ,float); +#ifdef TALKATIVE + CHECK_MAP_CONTENT(_min, float); + CHECK_MAP_CONTENT(_max, float); + CHECK_MAP_CONTENT(_SF, float); #endif - /// 1) declare histograms - // the idea is to produce tables of the differences and the absolute positions containing mean and RMS values - // for the different subdetectors - 0..5=different sublevels. - // Values for each endcap detector are to be split in +/-z, for the barrel detectors in +/- x (half barrels) - // Since it is easier to handle in the loops, all subdetectors will be split in - // 4 parts at first: (+/-x)X(+/-z) - // This means that 2*2*6 histograms will be filled during the loop on the TTree - // Pairs of histograms need to be combined afterwards again - // Histograms 0-5 are at +x and +z, 6-11 at +x and -z, 12-17 at -x and +z, and 18-23 at -x and -z - // - // Two version of the table containing the differences are produced. Once using Gaussian fits (more stable - // vs single outliers but perform poorly if the distributions are non-Gaussian) and once using - // the mean and RMS of the histograms (more stable but outliers have a strong impact on the RMS). - // For the absolute positions, only mean+RMS are used since the detector layout is not Gaussian - // (structures due to layers/rings etc) + /// 1) declare histograms + // the idea is to produce tables of the differences and the absolute positions containing mean and RMS values + // for the different subdetectors - 0..5=different sublevels. + // Values for each endcap detector are to be split in +/-z, for the barrel detectors in +/- x (half barrels) + // Since it is easier to handle in the loops, all subdetectors will be split in + // 4 parts at first: (+/-x)X(+/-z) + // This means that 2*2*6 histograms will be filled during the loop on the TTree + // Pairs of histograms need to be combined afterwards again + // Histograms 0-5 are at +x and +z, 6-11 at +x and -z, 12-17 at -x and +z, and 18-23 at -x and -z + // + // Two version of the table containing the differences are produced. Once using Gaussian fits (more stable + // vs single outliers but perform poorly if the distributions are non-Gaussian) and once using + // the mean and RMS of the histograms (more stable but outliers have a strong impact on the RMS). + // For the absolute positions, only mean+RMS are used since the detector layout is not Gaussian + // (structures due to layers/rings etc) #ifndef NB_SUBLEVELS #define NB_SUBLEVELS 6 #endif #define NB_Z_SLICES 2 #define NB_X_SLICES 2 - - TH1F * histosx[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValuex[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMSx[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - - TH1F * histos[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - TF1 * gausFit[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValue[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValueGaussian[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMS[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMSGaussian[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - - // Create and correctly name a histogram for each subdetector*Z_Slice*X_Slice - histos[iy][ihist] = new TH1F ("hist"+y[iy]+_sublevel_names[ihist%NB_SUBLEVELS] - +TString(ihist%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "zn" : "zp" ) - +TString(ihist>=NB_SUBLEVELS*NB_Z_SLICES ? "xn" : "xp" ), - "",1000, - _min[y[iy]], - _max[y[iy]]+1.); - histos[iy][ihist]->StatOverflows(kTRUE); - - } - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - - // Create and correctly name a histogram for each subdetector*Z_Slice*ModuleType - histosx[ix][ihist] = new TH1F ("histx"+x[ix]+_sublevel_names[ihist%NB_SUBLEVELS] - +TString(ihist%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "zn" : "zp" ) - +TString(ihist>=NB_SUBLEVELS*NB_Z_SLICES ? "xn" : "xp" ), - "",1000, - _min[x[ix]], - _max[x[ix]]+1.); - histosx[ix][ihist]->StatOverflows(kTRUE); - - } - } + + TH1F *histosx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValuex[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMSx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + + TH1F *histos[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + TF1 *gausFit[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValue[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValueGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMS[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMSGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // Create and correctly name a histogram for each subdetector*Z_Slice*X_Slice + histos[iy][ihist] = new TH1F("hist" + y[iy] + _sublevel_names[ihist % NB_SUBLEVELS] + + TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") + + TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"), + "", + 1000, + _min[y[iy]], + _max[y[iy]] + 1.); + histos[iy][ihist]->StatOverflows(kTRUE); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // Create and correctly name a histogram for each subdetector*Z_Slice*ModuleType + histosx[ix][ihist] = new TH1F("histx" + x[ix] + _sublevel_names[ihist % NB_SUBLEVELS] + + TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") + + TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"), + "", + 1000, + _min[x[ix]], + _max[x[ix]] + 1.); + histosx[ix][ihist]->StatOverflows(kTRUE); + } + } #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TH1F[" << y.size() << "][" << NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES << "] ended." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TH1F[" << y.size() << "][" + << NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES << "] ended." << endl; #endif - /// 2) loop on the TTree data + /// 2) loop on the TTree data #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; #endif #ifdef TALKATIVE - unsigned int progress = 0; - cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; + unsigned int progress = 0; + cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; #endif - for (unsigned int ientry = 0 ; ientry < nentries ; ientry++) - { -#ifdef TALKATIVE - if (10*ientry/nentries != progress) - { - progress = 10*ientry/nentries; - cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10*progress << "%" << endl; - } + for (unsigned int ientry = 0; ientry < nentries; ientry++) { +#ifdef TALKATIVE + if (10 * ientry / nentries != progress) { + progress = 10 * ientry / nentries; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl; + } #endif - // load current tree entry - data->GetEntry(ientry); - - // CUTS on entry - if (branch_i["level"] != _levelCut) continue; - if (!_1dModule && branch_i["detDim"] == 1) continue; - if (!_2dModule && branch_i["detDim"] == 2) continue; - - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - if (_SF[y[iy]]*branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]]*branch_f[y[iy]] < _min[y[iy]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING HISTOGRAMS - - // histogram for all modules - const short int ihisto = (branch_i["sublevel"]-1) + (branch_f["z"]>=0?0:NB_SUBLEVELS) + (branch_f["x"]>=0?0:NB_SUBLEVELS*NB_Z_SLICES); - - if (_module_plot_option == "all") histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - // Only good modules - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0) histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - // Only good modules and those in the list - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0)) histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - if (_SF[x[ix]]*branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]]*branch_f[x[ix]] < _min[x[ix]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING HISTOGRAMS - - // histogram for all modules - const short int ihistosx = (branch_i["sublevel"]-1) + (branch_f["z"]>=0?0:NB_SUBLEVELS) + (branch_f["x"]>=0?0:NB_SUBLEVELS*NB_Z_SLICES); - - if (_module_plot_option == "all") histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - // Only good modules - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0) histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - // Only good modules and those in the list - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0)) histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - } + // load current tree entry + data->GetEntry(ientry); + + // CUTS on entry + if (branch_i["level"] != _levelCut) + continue; + if (!_1dModule && branch_i["detDim"] == 1) + continue; + if (!_2dModule && branch_i["detDim"] == 2) + continue; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; + } + + // FILLING HISTOGRAMS + + // histogram for all modules + const short int ihisto = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + + (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES); + + if (_module_plot_option == "all") + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + + // Only good modules + else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + + // Only good modules and those in the list + else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; + } + + // FILLING HISTOGRAMS + + // histogram for all modules + const short int ihistosx = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + + (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES); + + if (_module_plot_option == "all") + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); + + // Only good modules + else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); + + // Only good modules and those in the list + else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); } + } #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; #endif - //~ TString rangeLabel = ""; - // Calculate mean and standard deviation for each histogram - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - // combine +/-z histograms for barrel detectors - if (ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 0 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 2 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 4) { - histos[iy][ihist]->Add(histos[iy][ihist+NB_SUBLEVELS]); - } - // combine +/-x histograms for endcap detectors (only used for half shells in barrel) - if (ihist < NB_SUBLEVELS*NB_Z_SLICES && ( ihist%NB_SUBLEVELS == 1 || ihist%NB_SUBLEVELS == 3 || ihist%NB_SUBLEVELS == 5)) { - histos[iy][ihist]->Add(histos[iy][ihist+NB_SUBLEVELS*NB_Z_SLICES]); - } - meanValue[iy][ihist] = histos[iy][ihist]->GetMean(); - RMS[iy][ihist] = histos[iy][ihist]->GetRMS(); - - histos[iy][ihist]->Fit("gaus"); - gausFit[iy][ihist] = histos[iy][ihist]->GetFunction("gaus"); - meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1); - RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2); - - - - } - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - // combine +/-z histograms for barrel detectors - if (ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 0 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 2 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 4) { - histosx[ix][ihist]->Add(histosx[ix][ihist+NB_SUBLEVELS]); - } - // combine +/-x histograms for endcap detectors (only used for half shells in barrel) - if (ihist < NB_SUBLEVELS*NB_Z_SLICES && ( ihist%NB_SUBLEVELS == 1 || ihist%NB_SUBLEVELS == 3 || ihist%NB_SUBLEVELS == 5) ) { - histosx[ix][ihist]->Add(histosx[ix][ihist+NB_SUBLEVELS*NB_Z_SLICES]); - } - meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean(); - RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS(); - - } - } - - TString tableFileName,tableCaption,tableAlign,tableHeadline; - TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine; - - - // table using mean and RMS, round to integers in µm etc. - tableFileName = "table_differences.tex"; - if (_module_plot_option == "all") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, good modules and those in given list used."; - - WriteTable(y,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValue,RMS,"0",tableCaption,tableFileName); - - - //~ // table using Gaussian fit, round to integers in µm etc. - tableFileName = "table_differences_Gaussian.tex"; - if (_module_plot_option == "all") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, good modules and those in given list used."; - - - WriteTable(y,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValueGaussian,RMSGaussian,"0",tableCaption,tableFileName); - - - - // Table for the mean positions on the x-axis, round to 3 digits in cm etc. - tableFileName = "table_meanPos.tex"; - - if (_module_plot_option == "all") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, good modules and those in given list used."; - - WriteTable(x,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValuex,RMSx,"3",tableCaption,tableFileName); - - + //~ TString rangeLabel = ""; + // Calculate mean and standard deviation for each histogram + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // combine +/-z histograms for barrel detectors + if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 || + ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) { + histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS]); + } + // combine +/-x histograms for endcap detectors (only used for half shells in barrel) + if (ihist < NB_SUBLEVELS * NB_Z_SLICES && + (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) { + histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS * NB_Z_SLICES]); + } + meanValue[iy][ihist] = histos[iy][ihist]->GetMean(); + RMS[iy][ihist] = histos[iy][ihist]->GetRMS(); + + histos[iy][ihist]->Fit("gaus"); + gausFit[iy][ihist] = histos[iy][ihist]->GetFunction("gaus"); + meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1); + RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // combine +/-z histograms for barrel detectors + if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 || + ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) { + histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS]); + } + // combine +/-x histograms for endcap detectors (only used for half shells in barrel) + if (ihist < NB_SUBLEVELS * NB_Z_SLICES && + (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) { + histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS * NB_Z_SLICES]); + } + meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean(); + RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS(); + } + } + + TString tableFileName, tableCaption, tableAlign, tableHeadline; + TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine, + TECmLine; + + // table using mean and RMS, round to integers in µm etc. + tableFileName = "table_differences.tex"; + if (_module_plot_option == "all") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, good modules and those in given list used."; + + WriteTable(y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValue, RMS, "0", tableCaption, tableFileName); + + //~ // table using Gaussian fit, round to integers in µm etc. + tableFileName = "table_differences_Gaussian.tex"; + if (_module_plot_option == "all") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, good modules and those in given list used."; + + WriteTable( + y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValueGaussian, RMSGaussian, "0", tableCaption, tableFileName); + + // Table for the mean positions on the x-axis, round to 3 digits in cm etc. + tableFileName = "table_meanPos.tex"; + + if (_module_plot_option == "all") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, good modules and those in given list used."; + + WriteTable(x, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValuex, RMSx, "3", tableCaption, tableFileName); + #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakeLegends method" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakeLegends method" << endl; #endif - } // OPTION METHODS -void GeometryComparisonPlotter::SetPrint (const bool kPrint) { _print = kPrint ; } -void GeometryComparisonPlotter::SetLegend (const bool kLegend) { _legend = kLegend ; } -void GeometryComparisonPlotter::SetWrite (const bool kWrite) { _write = kWrite ; } -void GeometryComparisonPlotter::Set1dModule (const bool k1dModule) { _1dModule = k1dModule ; } -void GeometryComparisonPlotter::Set2dModule (const bool k2dModule) { _2dModule = k2dModule ; } -void GeometryComparisonPlotter::SetLevelCut (const int kLevelCut) { _levelCut = kLevelCut ; } -void GeometryComparisonPlotter::SetBatchMode (const bool kBatchMode) { _batchMode = kBatchMode ; } -void GeometryComparisonPlotter::SetGrid (const int kGridX, - const int kGridY) { _grid_x = kGridX ; - _grid_y = kGridY ; } -void GeometryComparisonPlotter::SetBranchMax (const TString branchname, - const float max) { _max[branchname] = max ; } -void GeometryComparisonPlotter::SetBranchMin (const TString branchname, - const float min) { _min[branchname] = min ; } -void GeometryComparisonPlotter::SetBranchSF (const TString branchname, - const float SF) { _SF[branchname] = SF ; } -void GeometryComparisonPlotter::SetBranchUnits (const TString branchname, - const TString units) { _units[branchname] = units ; } -void GeometryComparisonPlotter::SetPrintOption (const Option_t * print_option) { _print_option = print_option ; } -void GeometryComparisonPlotter::SetCanvasSize (const int window_width, - const int window_height) { _window_width = window_width ; - _window_height = window_height ; } -void GeometryComparisonPlotter::SetOutputFileName (const TString name) { _output_filename = name ; } -void GeometryComparisonPlotter::SetOutputDirectoryName (const TString name) { _output_directory = name - + TString(name.EndsWith("/") ? "" : "/") ; } +void GeometryComparisonPlotter::SetPrint(const bool kPrint) { _print = kPrint; } +void GeometryComparisonPlotter::SetLegend(const bool kLegend) { _legend = kLegend; } +void GeometryComparisonPlotter::SetWrite(const bool kWrite) { _write = kWrite; } +void GeometryComparisonPlotter::Set1dModule(const bool k1dModule) { _1dModule = k1dModule; } +void GeometryComparisonPlotter::Set2dModule(const bool k2dModule) { _2dModule = k2dModule; } +void GeometryComparisonPlotter::SetLevelCut(const int kLevelCut) { _levelCut = kLevelCut; } +void GeometryComparisonPlotter::SetBatchMode(const bool kBatchMode) { _batchMode = kBatchMode; } +void GeometryComparisonPlotter::SetGrid(const int kGridX, const int kGridY) { + _grid_x = kGridX; + _grid_y = kGridY; +} +void GeometryComparisonPlotter::SetBranchMax(const TString branchname, const float max) { _max[branchname] = max; } +void GeometryComparisonPlotter::SetBranchMin(const TString branchname, const float min) { _min[branchname] = min; } +void GeometryComparisonPlotter::SetBranchSF(const TString branchname, const float SF) { _SF[branchname] = SF; } +void GeometryComparisonPlotter::SetBranchUnits(const TString branchname, const TString units) { + _units[branchname] = units; +} +void GeometryComparisonPlotter::SetPrintOption(const Option_t *print_option) { _print_option = print_option; } +void GeometryComparisonPlotter::SetCanvasSize(const int window_width, const int window_height) { + _window_width = window_width; + _window_height = window_height; +} +void GeometryComparisonPlotter::SetOutputFileName(const TString name) { _output_filename = name; } +void GeometryComparisonPlotter::SetOutputDirectoryName(const TString name) { + _output_directory = name + TString(name.EndsWith("/") ? "" : "/"); +} // PRIVATE METHODS -TString GeometryComparisonPlotter::LateXstyle (TString word) -{ - word.ToLower(); - if (word.BeginsWith("d")) word.ReplaceAll("d", "#Delta"); - if (word == TString("rdphi")) word = "r#Delta#phi"; // TO DO: find something less ad hoc... - else if (word.EndsWith("phi")) word.ReplaceAll("phi", "#phi"); - else if (word.EndsWith("alpha")) word.ReplaceAll("alpha", "#alpha"); - else if (word.EndsWith("beta")) word.ReplaceAll("beta" , "#beta"); - else if (word.EndsWith("gamma")) word.ReplaceAll("gamma", "#gamma"); - else if (word.EndsWith("eta")) word.ReplaceAll("eta", "#eta"); - return word; +TString GeometryComparisonPlotter::LateXstyle(TString word) { + word.ToLower(); + if (word.BeginsWith("d")) + word.ReplaceAll("d", "#Delta"); + if (word == TString("rdphi")) + word = "r#Delta#phi"; // TO DO: find something less ad hoc... + else if (word.EndsWith("phi")) + word.ReplaceAll("phi", "#phi"); + else if (word.EndsWith("alpha")) + word.ReplaceAll("alpha", "#alpha"); + else if (word.EndsWith("beta")) + word.ReplaceAll("beta", "#beta"); + else if (word.EndsWith("gamma")) + word.ReplaceAll("gamma", "#gamma"); + else if (word.EndsWith("eta")) + word.ReplaceAll("eta", "#eta"); + return word; } -TString GeometryComparisonPlotter::LateXstyleTable (TString word) -{ - word.ToLower(); - if (word.BeginsWith("d")) word.ReplaceAll("d", "$\\Delta$"); - if (word == TString("rdphi")) word = "r$\\Delta\\phi$"; // TO DO: find something less ad hoc... - else if (word.EndsWith("phi")) word.ReplaceAll("phi", "$\\phi$"); - else if (word.EndsWith("alpha")) word.ReplaceAll("alpha", "$\\alpha$"); - else if (word.EndsWith("beta")) word.ReplaceAll("beta" , "$\\beta$"); - else if (word.EndsWith("gamma")) word.ReplaceAll("gamma", "#$\\gamma$"); - else if (word.EndsWith("eta")) word.ReplaceAll("eta", "$\\eta$"); - return word; +TString GeometryComparisonPlotter::LateXstyleTable(TString word) { + word.ToLower(); + if (word.BeginsWith("d")) + word.ReplaceAll("d", "$\\Delta$"); + if (word == TString("rdphi")) + word = "r$\\Delta\\phi$"; // TO DO: find something less ad hoc... + else if (word.EndsWith("phi")) + word.ReplaceAll("phi", "$\\phi$"); + else if (word.EndsWith("alpha")) + word.ReplaceAll("alpha", "$\\alpha$"); + else if (word.EndsWith("beta")) + word.ReplaceAll("beta", "$\\beta$"); + else if (word.EndsWith("gamma")) + word.ReplaceAll("gamma", "#$\\gamma$"); + else if (word.EndsWith("eta")) + word.ReplaceAll("eta", "$\\eta$"); + return word; } -TString GeometryComparisonPlotter::ExtensionFromPrintOption (TString print_option) -{ - if (print_option.Contains("pdf" )) return TString(".pdf" ); - else if (print_option.Contains("eps" )) return TString(".eps" ); - else if (print_option.Contains("ps" )) return TString(".ps" ); - else if (print_option.Contains("svg" )) return TString(".svg" ); - else if (print_option.Contains("tex" )) return TString(".tex" ); - else if (print_option.Contains("gif" )) return TString(".gif" ); - else if (print_option.Contains("xpm" )) return TString(".xpm" ); - else if (print_option.Contains("png" )) return TString(".png" ); - else if (print_option.Contains("jpg" )) return TString(".jpg" ); - else if (print_option.Contains("tiff")) return TString(".tiff"); - else if (print_option.Contains("cxx" )) return TString(".cxx" ); - else if (print_option.Contains("xml" )) return TString(".xml" ); - else if (print_option.Contains("root")) return TString(".root"); - else - { - cout << __FILE__ << ":" << __LINE__ << ":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl; - return TString(".pdf"); - } +TString GeometryComparisonPlotter::ExtensionFromPrintOption(TString print_option) { + if (print_option.Contains("pdf")) + return TString(".pdf"); + else if (print_option.Contains("eps")) + return TString(".eps"); + else if (print_option.Contains("ps")) + return TString(".ps"); + else if (print_option.Contains("svg")) + return TString(".svg"); + else if (print_option.Contains("tex")) + return TString(".tex"); + else if (print_option.Contains("gif")) + return TString(".gif"); + else if (print_option.Contains("xpm")) + return TString(".xpm"); + else if (print_option.Contains("png")) + return TString(".png"); + else if (print_option.Contains("jpg")) + return TString(".jpg"); + else if (print_option.Contains("tiff")) + return TString(".tiff"); + else if (print_option.Contains("cxx")) + return TString(".cxx"); + else if (print_option.Contains("xml")) + return TString(".xml"); + else if (print_option.Contains("root")) + return TString(".root"); + else { + cout << __FILE__ << ":" << __LINE__ << ":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl; + return TString(".pdf"); + } } -TLegend * GeometryComparisonPlotter::MakeLegend (double x1, - double y1, - double x2, - double y2, - int nPlottedSublevels, - const TString title) -{ - TLegend * legend = new TLegend (x1, y1, x2, y2, title.Data(), "NBNDC"); - legend->SetNColumns(nPlottedSublevels); - legend->SetFillColor(0); - legend->SetLineColor(0); // redundant with option - legend->SetLineWidth(0); // redundant with option - for (int isublevel = 0 ; isublevel < nPlottedSublevels ; isublevel++) // nPlottedSublevels is either NB_SUBLEVELS for the tracker or 2 for the pixel - { - TGraph * g = new TGraph (0); - g->SetMarkerColor(COLOR_CODE(isublevel)); - g->SetFillColor(COLOR_CODE(isublevel)); - g->SetMarkerStyle(kFullSquare); - g->SetMarkerSize(10); - legend->AddEntry(g,_sublevel_names[isublevel], "p"); - } - return legend; +TLegend *GeometryComparisonPlotter::MakeLegend( + double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title) { + TLegend *legend = new TLegend(x1, y1, x2, y2, title.Data(), "NBNDC"); + legend->SetNColumns(nPlottedSublevels); + legend->SetFillColor(0); + legend->SetLineColor(0); // redundant with option + legend->SetLineWidth(0); // redundant with option + for (int isublevel = 0; isublevel < nPlottedSublevels; + isublevel++) // nPlottedSublevels is either NB_SUBLEVELS for the tracker or 2 for the pixel + { + TGraph *g = new TGraph(0); + g->SetMarkerColor(COLOR_CODE(isublevel)); + g->SetFillColor(COLOR_CODE(isublevel)); + g->SetMarkerStyle(kFullSquare); + g->SetMarkerSize(10); + legend->AddEntry(g, _sublevel_names[isublevel], "p"); + } + return legend; } - - -void GeometryComparisonPlotter::WriteTable (vector x, - unsigned int nLevelsTimesSlices, - float meanValue[10][24], - float RMS[10][24], - const TString nDigits, - const TString tableCaption, - const TString tableFileName) -{ - std::ofstream output(_output_directory+tableFileName); - - TString tableAlign,tableHeadline; - TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine; - char meanChar[x.size()][nLevelsTimesSlices][10]; - char RMSChar[x.size()][nLevelsTimesSlices][10]; - - tableAlign = "l"; - tableHeadline = ""; - PXBpLine = "PXB x$+$"; - PXBmLine = "PXB x$-$"; - PXFpLine = "PXF z$+$"; - PXFmLine = "PXF z$-$"; - TIBpLine = "TIB x$+$"; - TIBmLine = "TIB x$-$"; - TIDpLine = "TID z$+$"; - TIDmLine = "TID z$-$"; - TOBpLine = "TOB x$+$"; - TOBmLine = "TOB x$-$"; - TECpLine = "TEC z$+$"; - TECmLine = "TEC z$-$"; - - - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int isubDet = 0 ; isubDet < nLevelsTimesSlices; isubDet++) - { - - sprintf(meanChar[ix][isubDet],"%."+nDigits+"f",meanValue[ix][isubDet]); - sprintf(RMSChar[ix][isubDet],"%."+nDigits+"f",RMS[ix][isubDet]); - } - tableAlign += "|c"; - tableHeadline += " & " + LateXstyleTable(x[ix]) + " / " + _units[x[ix]].ReplaceAll("#mum", "$\\mu$m"); - - PXBpLine += " & $"; PXBpLine += meanChar[ix][0]; PXBpLine += "\\pm"; PXBpLine += RMSChar[ix][0]; PXBpLine += " $"; - PXBmLine += " & $"; PXBmLine += meanChar[ix][12]; PXBmLine += "\\pm"; PXBmLine += RMSChar[ix][12]; PXBmLine += " $"; - PXFpLine += " & $"; PXFpLine += meanChar[ix][1]; PXFpLine += "\\pm"; PXFpLine += RMSChar[ix][1]; PXFpLine += " $"; - PXFmLine += " & $"; PXFmLine += meanChar[ix][7]; PXFmLine += "\\pm"; PXFmLine += RMSChar[ix][7]; PXFmLine += " $"; - TIBpLine += " & $"; TIBpLine += meanChar[ix][2]; TIBpLine += "\\pm"; TIBpLine += RMSChar[ix][2]; TIBpLine += " $"; - TIBmLine += " & $"; TIBmLine += meanChar[ix][14]; TIBmLine += "\\pm"; TIBmLine += RMSChar[ix][14]; TIBmLine += " $"; - TIDpLine += " & $"; TIDpLine += meanChar[ix][3]; TIDpLine += "\\pm"; TIDpLine += RMSChar[ix][3]; TIDpLine += " $"; - TIDmLine += " & $"; TIDmLine += meanChar[ix][9]; TIDmLine += "\\pm"; TIDmLine += RMSChar[ix][9]; TIDmLine += " $"; - TOBpLine += " & $"; TOBpLine += meanChar[ix][4]; TOBpLine += "\\pm"; TOBpLine += RMSChar[ix][4]; TOBpLine += " $"; - TOBmLine += " & $"; TOBmLine += meanChar[ix][16]; TOBmLine += "\\pm"; TOBmLine += RMSChar[ix][16]; TOBmLine += " $"; - TECpLine += " & $"; TECpLine += meanChar[ix][5]; TECpLine += "\\pm"; TECpLine += RMSChar[ix][5]; TECpLine += " $"; - TECmLine += " & $"; TECmLine += meanChar[ix][11]; TECmLine += "\\pm"; TECmLine += RMSChar[ix][11]; TECmLine += " $"; - } - - // Write the table to the tex file - output << "\\begin{table}" << std::endl; - output << "\\caption{" << tableCaption << "}" << std::endl; - output << "\\begin{tabular}{"<< tableAlign <<"}" << std::endl; - output << "\\hline" << std::endl; - output << tableHeadline << " \\\\" << std::endl; - output << "\\hline" << std::endl; - output << PXBpLine << " \\\\"<< std::endl; - output << PXBmLine << " \\\\"<< std::endl; - output << PXFpLine << " \\\\"<< std::endl; - output << PXFmLine << " \\\\"<< std::endl; - output << TIBpLine << " \\\\"<< std::endl; - output << TIBmLine << " \\\\"<< std::endl; - output << TIDpLine << " \\\\"<< std::endl; - output << TIDmLine << " \\\\"<< std::endl; - output << TOBpLine << " \\\\"<< std::endl; - output << TOBmLine << " \\\\"<< std::endl; - output << TECpLine << " \\\\"<< std::endl; - output << TECmLine << " \\\\"<< std::endl; - output << "\\hline" << std::endl; - output << "\\end{tabular}" << std::endl; - output << "\\end{table}" << std::endl; - + +void GeometryComparisonPlotter::WriteTable(vector x, + unsigned int nLevelsTimesSlices, + float meanValue[10][24], + float RMS[10][24], + const TString nDigits, + const TString tableCaption, + const TString tableFileName) { + std::ofstream output(_output_directory + tableFileName); + + TString tableAlign, tableHeadline; + TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine, + TECmLine; + char meanChar[x.size()][nLevelsTimesSlices][10]; + char RMSChar[x.size()][nLevelsTimesSlices][10]; + + tableAlign = "l"; + tableHeadline = ""; + PXBpLine = "PXB x$+$"; + PXBmLine = "PXB x$-$"; + PXFpLine = "PXF z$+$"; + PXFmLine = "PXF z$-$"; + TIBpLine = "TIB x$+$"; + TIBmLine = "TIB x$-$"; + TIDpLine = "TID z$+$"; + TIDmLine = "TID z$-$"; + TOBpLine = "TOB x$+$"; + TOBmLine = "TOB x$-$"; + TECpLine = "TEC z$+$"; + TECmLine = "TEC z$-$"; + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int isubDet = 0; isubDet < nLevelsTimesSlices; isubDet++) { + sprintf(meanChar[ix][isubDet], "%." + nDigits + "f", meanValue[ix][isubDet]); + sprintf(RMSChar[ix][isubDet], "%." + nDigits + "f", RMS[ix][isubDet]); + } + tableAlign += "|c"; + tableHeadline += " & " + LateXstyleTable(x[ix]) + " / " + _units[x[ix]].ReplaceAll("#mum", "$\\mu$m"); + + PXBpLine += " & $"; + PXBpLine += meanChar[ix][0]; + PXBpLine += "\\pm"; + PXBpLine += RMSChar[ix][0]; + PXBpLine += " $"; + PXBmLine += " & $"; + PXBmLine += meanChar[ix][12]; + PXBmLine += "\\pm"; + PXBmLine += RMSChar[ix][12]; + PXBmLine += " $"; + PXFpLine += " & $"; + PXFpLine += meanChar[ix][1]; + PXFpLine += "\\pm"; + PXFpLine += RMSChar[ix][1]; + PXFpLine += " $"; + PXFmLine += " & $"; + PXFmLine += meanChar[ix][7]; + PXFmLine += "\\pm"; + PXFmLine += RMSChar[ix][7]; + PXFmLine += " $"; + TIBpLine += " & $"; + TIBpLine += meanChar[ix][2]; + TIBpLine += "\\pm"; + TIBpLine += RMSChar[ix][2]; + TIBpLine += " $"; + TIBmLine += " & $"; + TIBmLine += meanChar[ix][14]; + TIBmLine += "\\pm"; + TIBmLine += RMSChar[ix][14]; + TIBmLine += " $"; + TIDpLine += " & $"; + TIDpLine += meanChar[ix][3]; + TIDpLine += "\\pm"; + TIDpLine += RMSChar[ix][3]; + TIDpLine += " $"; + TIDmLine += " & $"; + TIDmLine += meanChar[ix][9]; + TIDmLine += "\\pm"; + TIDmLine += RMSChar[ix][9]; + TIDmLine += " $"; + TOBpLine += " & $"; + TOBpLine += meanChar[ix][4]; + TOBpLine += "\\pm"; + TOBpLine += RMSChar[ix][4]; + TOBpLine += " $"; + TOBmLine += " & $"; + TOBmLine += meanChar[ix][16]; + TOBmLine += "\\pm"; + TOBmLine += RMSChar[ix][16]; + TOBmLine += " $"; + TECpLine += " & $"; + TECpLine += meanChar[ix][5]; + TECpLine += "\\pm"; + TECpLine += RMSChar[ix][5]; + TECpLine += " $"; + TECmLine += " & $"; + TECmLine += meanChar[ix][11]; + TECmLine += "\\pm"; + TECmLine += RMSChar[ix][11]; + TECmLine += " $"; + } + + // Write the table to the tex file + output << "\\begin{table}" << std::endl; + output << "\\caption{" << tableCaption << "}" << std::endl; + output << "\\begin{tabular}{" << tableAlign << "}" << std::endl; + output << "\\hline" << std::endl; + output << tableHeadline << " \\\\" << std::endl; + output << "\\hline" << std::endl; + output << PXBpLine << " \\\\" << std::endl; + output << PXBmLine << " \\\\" << std::endl; + output << PXFpLine << " \\\\" << std::endl; + output << PXFmLine << " \\\\" << std::endl; + output << TIBpLine << " \\\\" << std::endl; + output << TIBmLine << " \\\\" << std::endl; + output << TIDpLine << " \\\\" << std::endl; + output << TIDmLine << " \\\\" << std::endl; + output << TOBpLine << " \\\\" << std::endl; + output << TOBmLine << " \\\\" << std::endl; + output << TECpLine << " \\\\" << std::endl; + output << TECmLine << " \\\\" << std::endl; + output << "\\hline" << std::endl; + output << "\\end{tabular}" << std::endl; + output << "\\end{table}" << std::endl; } From 432a7007a57b38b92ff6cff90d2227db5e1ff1b7 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 14:50:52 -0500 Subject: [PATCH 131/923] GsfConstraintAtVertex no longer accesses the EventSetup Users now pass in the required data products to the constructor. --- .../src/GsfElectronAlgo.cc | 2 +- TrackingTools/GsfTracking/BuildFile.xml | 1 - .../interface/GsfConstraintAtVertex.h | 11 ++++--- .../GsfTracking/src/GsfConstraintAtVertex.cc | 31 +++++++++---------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index 694451ad19f3b..1562e13a0a2f5 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -629,7 +629,7 @@ reco::GsfElectronCollection GsfElectronAlgo::completeElectrons(edm::Event const& double magneticFieldInTesla = magneticField.inTesla(GlobalPoint(0., 0., 0.)).z(); MultiTrajectoryStateTransform mtsTransform(&trackerGeometry, &magneticField); - GsfConstraintAtVertex constraintAtVtx(eventSetup); + GsfConstraintAtVertex constraintAtVtx(&trackerGeometry, &magneticField); std::optional ctfTrackTable = std::nullopt; std::optional gsfTrackTable = std::nullopt; diff --git a/TrackingTools/GsfTracking/BuildFile.xml b/TrackingTools/GsfTracking/BuildFile.xml index 10774cfe95275..f38545c852ee3 100644 --- a/TrackingTools/GsfTracking/BuildFile.xml +++ b/TrackingTools/GsfTracking/BuildFile.xml @@ -5,7 +5,6 @@ - diff --git a/TrackingTools/GsfTracking/interface/GsfConstraintAtVertex.h b/TrackingTools/GsfTracking/interface/GsfConstraintAtVertex.h index 1f223afbd0c53..c7c5e0c78a5f5 100644 --- a/TrackingTools/GsfTracking/interface/GsfConstraintAtVertex.h +++ b/TrackingTools/GsfTracking/interface/GsfConstraintAtVertex.h @@ -3,7 +3,6 @@ #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateTransform.h" @@ -12,7 +11,10 @@ #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "RecoTracker/TransientTrackingRecHit/interface/TRecHit2DPosConstraint.h" +#include "TrackingTools/GsfTools/interface/GsfPropagatorAdapter.h" +#include "TrackingTools/PatternTools/interface/TransverseImpactPointExtrapolator.h" +#include class TrackerGeometry; class MagneticField; class GsfPropagatorAdapter; @@ -20,8 +22,7 @@ class TransverseImpactPointExtrapolator; class GsfConstraintAtVertex { public: - explicit GsfConstraintAtVertex(const edm::EventSetup&); - ~GsfConstraintAtVertex(); + explicit GsfConstraintAtVertex(const TrackerGeometry* geometry, const MagneticField* magField); /// (multi)TSOS after including the beamspot TrajectoryStateOnSurface constrainAtBeamSpot(const reco::GsfTrack&, const reco::BeamSpot&) const; @@ -37,6 +38,6 @@ class GsfConstraintAtVertex { GsfMultiStateUpdator gsfUpdator_; const TrackerGeometry* geometry_; const MagneticField* magField_; - GsfPropagatorAdapter* gsfPropagator_; - TransverseImpactPointExtrapolator* tipExtrapolator_; + GsfPropagatorAdapter gsfPropagator_; + TransverseImpactPointExtrapolator tipExtrapolator_; }; diff --git a/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc b/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc index 8c2a5260d2471..71c341c826c7c 100644 --- a/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc +++ b/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc @@ -2,7 +2,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h" @@ -17,25 +16,25 @@ #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h" #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h" -GsfConstraintAtVertex::GsfConstraintAtVertex(const edm::EventSetup& setup) { - edm::ESHandle geometryHandle; - setup.get().get(geometryHandle); - geometry_ = geometryHandle.product(); +GsfConstraintAtVertex::GsfConstraintAtVertex(const TrackerGeometry* geometry, const MagneticField* magField) + : geometry_(geometry), + magField_(magField), + gsfPropagator_(AnalyticalPropagator(magField, anyDirection)), + tipExtrapolator_(gsfPropagator_) { + //edm::ESHandle geometryHandle; + //setup.get().get(geometryHandle); + geometry_ = geometry; - edm::ESHandle magFieldHandle; - setup.get().get(magFieldHandle); - magField_ = magFieldHandle.product(); + //edm::ESHandle magFieldHandle; + //setup.get().get(magFieldHandle); + //magField_ = magFieldHandle.product(); + magField_ = magField; // edm::ESHandle propagatorHandle; // setup.get().get(propagatorName_,propagatorHandle); // propagator_ = propagatorHandle.product(); - gsfPropagator_ = new GsfPropagatorAdapter(AnalyticalPropagator(magField_, anyDirection)); - tipExtrapolator_ = new TransverseImpactPointExtrapolator(*gsfPropagator_); -} - -GsfConstraintAtVertex::~GsfConstraintAtVertex() { - delete tipExtrapolator_; - delete gsfPropagator_; + //gsfPropagator_ = std::make_unique(AnalyticalPropagator(magField, anyDirection)); + //tipExtrapolator_ = std::make_unique(*gsfPropagator_); } TrajectoryStateOnSurface GsfConstraintAtVertex::constrainAtBeamSpot(const reco::GsfTrack& track, @@ -69,7 +68,7 @@ TrajectoryStateOnSurface GsfConstraintAtVertex::constrainAtPoint(const reco::Gsf TrajectoryStateOnSurface innerState = multiStateTransformer_.innerStateOnSurface(track, *geometry_, magField_); if (!innerState.isValid()) return TrajectoryStateOnSurface(); - TrajectoryStateOnSurface tipState = tipExtrapolator_->extrapolate(innerState, globalPosition); + TrajectoryStateOnSurface tipState = tipExtrapolator_.extrapolate(innerState, globalPosition); if (!tipState.isValid()) return TrajectoryStateOnSurface(); // From 93ab48cbfe889497f8ee8b4fbb6047b5592703a7 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 25 Aug 2021 22:25:54 +0200 Subject: [PATCH 132/923] Migrate RPCUnpackingModule to esConsumes() --- EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc | 6 ++---- EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc index 12a6c1d19d109..c82a1d399e111 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc +++ b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc @@ -20,8 +20,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/RPCObjects/interface/RPCEMap.h" -#include "CondFormats/DataRecord/interface/RPCEMapRcd.h" #include "DataFormats/RPCDigi/interface/DataRecord.h" #include "DataFormats/RPCDigi/interface/ReadoutError.h" #include "DataFormats/RPCDigi/interface/RPCRawSynchro.h" @@ -41,6 +39,7 @@ RPCUnpackingModule::RPCUnpackingModule(const edm::ParameterSet& pset) : dataLabel_(pset.getParameter("InputLabel")), doSynchro_(pset.getParameter("doSynchro")), eventCounter_(0), + theReadoutMappingToken(esConsumes()), theCabling(nullptr) { produces(); produces(); @@ -62,8 +61,7 @@ void RPCUnpackingModule::beginRun(const edm::Run& run, const edm::EventSetup& es if (theRecordWatcher.check(es)) { LogTrace("") << "record has CHANGED!!, (re)initialise readout map!"; delete theCabling; - ESTransientHandle readoutMapping; - es.get().get(readoutMapping); + ESTransientHandle readoutMapping = es.getTransientHandle(theReadoutMappingToken); theCabling = readoutMapping->convert(); theReadoutMappingSearch.init(theCabling); LogTrace("") << " READOUT MAP VERSION: " << theCabling->version() << endl; diff --git a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h index ea7a4d7846490..c1237dd93c9f6 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h +++ b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h @@ -9,6 +9,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "CondFormats/DataRecord/interface/RPCEMapRcd.h" +#include "CondFormats/RPCObjects/interface/RPCEMap.h" #include "RPCReadOutMappingWithFastSearch.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" @@ -42,6 +43,7 @@ class RPCUnpackingModule : public edm::stream::EDProducer<> { unsigned long eventCounter_; edm::ESWatcher theRecordWatcher; + edm::ESGetToken theReadoutMappingToken; const RPCReadOutMapping* theCabling; RPCReadOutMappingWithFastSearch theReadoutMappingSearch; edm::EDGetTokenT fedToken_; From 9ceca496a9b22e2d42276b434b44c65928b00a4f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 15:43:52 -0500 Subject: [PATCH 133/923] EcalClusterFunctionBaseClass classes use esConsumes --- .../src/EgammaSCCorrectionMaker.cc | 5 +++-- .../interface/EcalClusterFunctionBaseClass.h | 1 + .../interface/EcalClusterFunctionFactory.h | 3 ++- .../plugins/EcalClusterCrackCorrection.cc | 22 +++++++++---------- .../plugins/EcalClusterEnergyCorrection.cc | 12 +++++----- ...alClusterEnergyCorrectionObjectSpecific.cc | 15 +++++++------ .../plugins/EcalClusterEnergyUncertainty.cc | 12 +++++----- .../test/testEcalClusterFunctions.cc | 3 ++- .../plugins/GsfElectronProducer.cc | 3 ++- .../src/PhotonEnergyCorrector.cc | 8 +++---- 10 files changed, 43 insertions(+), 41 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc b/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc index fed9687ff7589..5a8d036eaab85 100644 --- a/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc +++ b/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc @@ -139,11 +139,12 @@ EgammaSCCorrectionMaker::EgammaSCCorrectionMaker(const edm::ParameterSet& ps) { // energy correction class if (applyEnergyCorrection_) - energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(energyCorrectorName_, ps); + energyCorrectionFunction_ = + EcalClusterFunctionFactory::get()->create(energyCorrectorName_, ps, consumesCollector()); //energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps); if (applyCrackCorrection_) - crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps); + crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create(crackCorrectorName_, ps, consumesCollector()); if (applyLocalContCorrection_) localContCorrectionFunction_ = std::make_unique(consumesCollector()); diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h index fae2e5686f193..7d1b9546ecda9 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h @@ -21,6 +21,7 @@ namespace edm { class Event; class EventSetup; class ParameterSet; + class ConsumesCollector; } // namespace edm class EcalClusterFunctionBaseClass { diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h index 776644a904d89..0d517b905b0b9 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h @@ -12,6 +12,7 @@ #include "FWCore/PluginManager/interface/PluginFactory.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" -typedef edmplugin::PluginFactory EcalClusterFunctionFactory; +typedef edmplugin::PluginFactory + EcalClusterFunctionFactory; #endif diff --git a/RecoEcal/EgammaCoreTools/plugins/EcalClusterCrackCorrection.cc b/RecoEcal/EgammaCoreTools/plugins/EcalClusterCrackCorrection.cc index b119ea72ae7b2..b29889ed6b1a5 100644 --- a/RecoEcal/EgammaCoreTools/plugins/EcalClusterCrackCorrection.cc +++ b/RecoEcal/EgammaCoreTools/plugins/EcalClusterCrackCorrection.cc @@ -16,12 +16,15 @@ #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "TVector2.h" class EcalClusterCrackCorrection : public EcalClusterFunctionBaseClass { public: - EcalClusterCrackCorrection(const edm::ParameterSet &){}; + EcalClusterCrackCorrection(const edm::ParameterSet &, edm::ConsumesCollector iC) + : paramsToken_(iC.esConsumes()), geomToken_(iC.esConsumes()) {} // get/set explicit methods for parameters const EcalClusterCrackCorrParameters *getParameters() const { return params_; } @@ -38,15 +41,15 @@ class EcalClusterCrackCorrection : public EcalClusterFunctionBaseClass { void init(const edm::EventSetup &es) override; private: - edm::ESHandle esParams_; - const EcalClusterCrackCorrParameters *params_; - const edm::EventSetup *es_; //needed to access the ECAL geometry + const edm::ESGetToken paramsToken_; + const edm::ESGetToken geomToken_; + const EcalClusterCrackCorrParameters *params_ = nullptr; + const CaloGeometry *caloGeom_ = nullptr; }; void EcalClusterCrackCorrection::init(const edm::EventSetup &es) { - es.get().get(esParams_); - params_ = esParams_.product(); - es_ = &es; //needed to access the ECAL geometry + params_ = &es.getData(paramsToken_); + caloGeom_ = &es.getData(geomToken_); } void EcalClusterCrackCorrection::checkInit() const { @@ -77,10 +80,7 @@ float EcalClusterCrackCorrection::getValue(const reco::CaloCluster &seedbclus) c if (std::abs(seedbclus.eta()) > 1.4442) return 1.; - edm::ESHandle pG; - es_->get().get(pG); - - const CaloSubdetectorGeometry *geom = pG->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); //EcalBarrel = 1 + const CaloSubdetectorGeometry *geom = caloGeom_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); //EcalBarrel = 1 const math::XYZPoint &position_ = seedbclus.position(); double Theta = -position_.theta() + 0.5 * M_PI; diff --git a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrection.cc b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrection.cc index f515f67b59fd1..e6522c4991b32 100644 --- a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrection.cc +++ b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrection.cc @@ -10,12 +10,13 @@ #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" class EcalClusterEnergyCorrection : public EcalClusterFunctionBaseClass { public: - EcalClusterEnergyCorrection(const edm::ParameterSet &){}; + EcalClusterEnergyCorrection(const edm::ParameterSet &, edm::ConsumesCollector iC) : paramsToken_(iC.esConsumes()) {} // get/set explicit methods for parameters const EcalClusterEnergyCorrectionParameters *getParameters() const { return params_; } @@ -34,8 +35,8 @@ class EcalClusterEnergyCorrection : public EcalClusterFunctionBaseClass { float fBrem(float e, float eta, int algorithm) const; float fEtEta(float et, float eta, int algorithm) const; - edm::ESHandle esParams_; - const EcalClusterEnergyCorrectionParameters *params_; + const edm::ESGetToken paramsToken_; + const EcalClusterEnergyCorrectionParameters *params_ = nullptr; }; // Shower leakage corrections developed by Jungzhie et al. using TB data @@ -240,10 +241,7 @@ float EcalClusterEnergyCorrection::getValue(const reco::SuperCluster &superClust } } -void EcalClusterEnergyCorrection::init(const edm::EventSetup &es) { - es.get().get(esParams_); - params_ = esParams_.product(); -} +void EcalClusterEnergyCorrection::init(const edm::EventSetup &es) { params_ = &es.getData(paramsToken_); } void EcalClusterEnergyCorrection::checkInit() const { if (!params_) { diff --git a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.cc b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.cc index 9ef27199f7057..e0cd6bdfc4105 100644 --- a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.cc +++ b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.cc @@ -10,12 +10,14 @@ #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" #include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" class EcalClusterEnergyCorrectionObjectSpecific : public EcalClusterFunctionBaseClass { public: - EcalClusterEnergyCorrectionObjectSpecific(const edm::ParameterSet &){}; + EcalClusterEnergyCorrectionObjectSpecific(const edm::ParameterSet &, edm::ConsumesCollector iC) + : paramsToken_(iC.esConsumes()) {} // get/set explicit methods for parameters const EcalClusterEnergyCorrectionObjectSpecificParameters *getParameters() const { return params_; } @@ -35,14 +37,13 @@ class EcalClusterEnergyCorrectionObjectSpecific : public EcalClusterFunctionBase float fEt(float et, int algorithm) const; float fEnergy(float e, int algorithm) const; - edm::ESHandle esParams_; - const EcalClusterEnergyCorrectionObjectSpecificParameters *params_; + const edm::ESGetToken + paramsToken_; + const EcalClusterEnergyCorrectionObjectSpecificParameters *params_ = nullptr; }; -void EcalClusterEnergyCorrectionObjectSpecific::init(const edm::EventSetup &es) { - es.get().get(esParams_); - params_ = esParams_.product(); -} +void EcalClusterEnergyCorrectionObjectSpecific::init(const edm::EventSetup &es) { params_ = &es.getData(paramsToken_); } void EcalClusterEnergyCorrectionObjectSpecific::checkInit() const { if (!params_) { diff --git a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.cc b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.cc index 8bbf5c9d4a508..2a84b5d3a4a7d 100644 --- a/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.cc +++ b/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.cc @@ -12,11 +12,12 @@ #include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" #include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" class EcalClusterEnergyUncertainty : public EcalClusterFunctionBaseClass { public: - EcalClusterEnergyUncertainty(const edm::ParameterSet &){}; + EcalClusterEnergyUncertainty(const edm::ParameterSet &, edm::ConsumesCollector iC) : paramsToken_(iC.esConsumes()) {} // get/set explicit methods for parameters const EcalClusterEnergyUncertaintyParameters *getParameters() const { return params_; } @@ -31,14 +32,11 @@ class EcalClusterEnergyUncertainty : public EcalClusterFunctionBaseClass { void init(const edm::EventSetup &es) override; private: - edm::ESHandle esParams_; - const EcalClusterEnergyUncertaintyParameters *params_; + const edm::ESGetToken paramsToken_; + const EcalClusterEnergyUncertaintyParameters *params_ = nullptr; }; -void EcalClusterEnergyUncertainty::init(const edm::EventSetup &es) { - es.get().get(esParams_); - params_ = esParams_.product(); -} +void EcalClusterEnergyUncertainty::init(const edm::EventSetup &es) { params_ = &es.getData(paramsToken_); } void EcalClusterEnergyUncertainty::checkInit() const { if (!params_) { diff --git a/RecoEcal/EgammaCoreTools/test/testEcalClusterFunctions.cc b/RecoEcal/EgammaCoreTools/test/testEcalClusterFunctions.cc index 362fb22970eaa..07c3208abdd50 100644 --- a/RecoEcal/EgammaCoreTools/test/testEcalClusterFunctions.cc +++ b/RecoEcal/EgammaCoreTools/test/testEcalClusterFunctions.cc @@ -29,6 +29,7 @@ Description: #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h" @@ -47,7 +48,7 @@ class testEcalClusterFunctions : public edm::EDAnalyzer { testEcalClusterFunctions::testEcalClusterFunctions(const edm::ParameterSet& ps) { std::string functionName = ps.getParameter("functionName"); - ff_ = EcalClusterFunctionFactory::get()->create(functionName, ps); + ff_ = EcalClusterFunctionFactory::get()->create(functionName, ps, consumesCollector()); std::cout << "got " << functionName << " function at: " << ff_.get() << "\n"; } diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 28b6bcc789997..ca978e41a11fd 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -407,7 +407,8 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf hcalCfgBc_, isoCfg, recHitsCfg, - EcalClusterFunctionFactory::get()->create(cfg.getParameter("crackCorrectionFunction"), cfg), + EcalClusterFunctionFactory::get()->create( + cfg.getParameter("crackCorrectionFunction"), cfg, consumesCollector()), regressionCfg, cfg.getParameter("trkIsol03Cfg"), cfg.getParameter("trkIsol04Cfg"), diff --git a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc index e8d070bac6127..d6547c508c481 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc @@ -25,19 +25,19 @@ PhotonEnergyCorrector::PhotonEnergyCorrector(const edm::ParameterSet& config, ed // function to extract f(eta) correction std::string superClusterFunctionName = config.getParameter("superClusterEnergyCorrFunction"); - scEnergyFunction_ = EcalClusterFunctionFactory::get()->create(superClusterFunctionName, config); + scEnergyFunction_ = EcalClusterFunctionFactory::get()->create(superClusterFunctionName, config, iC); // function to extract corrections to cracks std::string superClusterCrackFunctionName = config.getParameter("superClusterCrackEnergyCorrFunction"); - scCrackEnergyFunction_ = EcalClusterFunctionFactory::get()->create(superClusterCrackFunctionName, config); + scCrackEnergyFunction_ = EcalClusterFunctionFactory::get()->create(superClusterCrackFunctionName, config, iC); // function to extract the error on the sc ecal correction std::string superClusterErrorFunctionName = config.getParameter("superClusterEnergyErrorFunction"); - scEnergyErrorFunction_ = EcalClusterFunctionFactory::get()->create(superClusterErrorFunctionName, config); + scEnergyErrorFunction_ = EcalClusterFunctionFactory::get()->create(superClusterErrorFunctionName, config, iC); // function to extract the error on the photon ecal correction std::string photonEnergyFunctionName = config.getParameter("photonEcalEnergyCorrFunction"); - photonEcalEnergyCorrFunction_ = EcalClusterFunctionFactory::get()->create(photonEnergyFunctionName, config); + photonEcalEnergyCorrFunction_ = EcalClusterFunctionFactory::get()->create(photonEnergyFunctionName, config, iC); //ingredient for photon uncertainty photonUncertaintyCalculator_ = std::make_unique(config); From 37d2c89e671ff03c105ed1e724fb2b66d4e4d7c4 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 16:32:13 -0500 Subject: [PATCH 134/923] Improved LowPtGsfElectronIDProducer - used esConsumes - avoid doing large numbers of string constructions and comparisons. --- .../plugins/LowPtGsfElectronIDProducer.cc | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index a4b24b3fd8f0c..ac334f672dd88 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -35,20 +35,24 @@ class LowPtGsfElectronIDProducer final : public edm::global::EDProducer<> { private: double eval( - const std::string& name, const edm::Ptr&, double rho, float unbiased, float field_z) const; + const GBRForest& model, const edm::Ptr&, double rho, float unbiased, float field_z) const; const bool usePAT_; edm::EDGetTokenT electrons_; edm::EDGetTokenT patElectrons_; const edm::EDGetTokenT rho_; edm::EDGetTokenT > unbiased_; + const edm::ESGetToken fieldToken_; + const std::vector names_; const bool passThrough_; const double minPtThreshold_; const double maxPtThreshold_; std::vector > models_; const std::vector thresholds_; - const std::string version_; + const std::string versionName_; + enum class Version { V0, V1 }; + Version version_; }; //////////////////////////////////////////////////////////////////////////////// @@ -59,12 +63,13 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& patElectrons_(), rho_(consumes(conf.getParameter("rho"))), unbiased_(), + fieldToken_(esConsumes()), names_(conf.getParameter >("ModelNames")), passThrough_(conf.getParameter("PassThrough")), minPtThreshold_(conf.getParameter("MinPtThreshold")), maxPtThreshold_(conf.getParameter("MaxPtThreshold")), thresholds_(conf.getParameter >("ModelThresholds")), - version_(conf.getParameter("Version")) { + versionName_(conf.getParameter("Version")) { if (usePAT_) { patElectrons_ = consumes(conf.getParameter("electrons")); } else { @@ -82,8 +87,12 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& throw cms::Exception("Incorrect configuration") << "'ModelWeights' size (" << models_.size() << ") != 'ModelThresholds' size (" << thresholds_.size() << ").\n"; } - if (version_ != "V0" && version_ != "V1") { - throw cms::Exception("Incorrect configuration") << "Unknown Version: " << version_ << "\n"; + if (versionName_ == "V0") { + version_ = Version::V0; + } else if (versionName_ == "V1") { + version_ = Version::V1; + } else { + throw cms::Exception("Incorrect configuration") << "Unknown Version: " << versionName_ << "\n"; } for (const auto& name : names_) { produces >(name); @@ -94,19 +103,18 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& // void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const { // Get z-component of B field - edm::ESHandle field; - setup.get().get(field); - math::XYZVector zfield(field->inTesla(GlobalPoint(0, 0, 0))); + math::XYZVector zfield(setup.getData(fieldToken_).inTesla(GlobalPoint(0, 0, 0))); // Pileup - edm::Handle rho; - event.getByToken(rho_, rho); - if (!rho.isValid()) { + edm::Handle hRho; + event.getByToken(rho_, hRho); + if (!hRho.isValid()) { std::ostringstream os; os << "Problem accessing rho collection for low-pT electrons" << std::endl; throw cms::Exception("InvalidHandle", os.str()); } + double rho = *hRho; // Retrieve pat::Electrons or reco::GsfElectrons from Event edm::Handle patElectrons; edm::Handle electrons; @@ -124,19 +132,22 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const // Iterate through Electrons, evaluate BDT, and store result std::vector > output; + output.reserve(names_.size()); unsigned int nElectrons = usePAT_ ? patElectrons->size() : electrons->size(); for (unsigned int iname = 0; iname < names_.size(); ++iname) { output.emplace_back(nElectrons, -999.); } if (usePAT_) { + const std::string kUnbiased("unbiased"); for (unsigned int iele = 0; iele < nElectrons; iele++) { edm::Ptr ele(patElectrons, iele); if (!ele->isElectronIDAvailable("unbiased")) { continue; } - for (unsigned int iname = 0; iname < names_.size(); ++iname) { - output[iname][iele] = eval(names_[iname], ele, *rho, ele->electronID("unbiased"), zfield.z()); + float id = ele->electronID(kUnbiased); + for (unsigned int index = 0; index < models_.size(); ++index) { + output[index][iele] = eval(*models_[index], ele, rho, id, zfield.z()); } } } else { @@ -150,8 +161,8 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const continue; } float unbiased = (*unbiasedH)[gsf]; - for (unsigned int iname = 0; iname < names_.size(); ++iname) { - output[iname][iele] = eval(names_[iname], ele, *rho, unbiased, zfield.z()); + for (unsigned int index = 0; index < models_.size(); ++index) { + output[index][iele] = eval(*models_[index], ele, rho, unbiased, zfield.z()); } } } @@ -173,21 +184,14 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const ////////////////////////////////////////////////////////////////////////////////////////// // double LowPtGsfElectronIDProducer::eval( - const std::string& name, const edm::Ptr& ele, double rho, float unbiased, float field_z) const { - auto iter = std::find(names_.begin(), names_.end(), name); - if (iter != names_.end()) { - int index = std::distance(names_.begin(), iter); - std::vector inputs; - if (version_ == "V0") { - inputs = lowptgsfeleid::features_V0(*ele, rho, unbiased); - } else if (version_ == "V1") { - inputs = lowptgsfeleid::features_V1(*ele, rho, unbiased, field_z); - } - return models_.at(index)->GetResponse(inputs.data()); - } else { - throw cms::Exception("Unknown model name") << "'Name given: '" << name << "'. Check against configuration file.\n"; + const GBRForest& model, const edm::Ptr& ele, double rho, float unbiased, float field_z) const { + std::vector inputs; + if (version_ == Version::V0) { + inputs = lowptgsfeleid::features_V0(*ele, rho, unbiased); + } else if (version_ == Version::V1) { + inputs = lowptgsfeleid::features_V1(*ele, rho, unbiased, field_z); } - return 0.; + return model.GetResponse(inputs.data()); } ////////////////////////////////////////////////////////////////////////////////////////// From 50d6202c50f8e24349427531a475025fc8812881 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 16:53:58 -0500 Subject: [PATCH 135/923] Removed unnecessary use of edm::Ptr --- .../plugins/LowPtGsfElectronIDProducer.cc | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index ac334f672dd88..fd02717cf7dce 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -34,8 +34,7 @@ class LowPtGsfElectronIDProducer final : public edm::global::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions&); private: - double eval( - const GBRForest& model, const edm::Ptr&, double rho, float unbiased, float field_z) const; + double eval(const GBRForest& model, const reco::GsfElectron&, double rho, float unbiased, float field_z) const; const bool usePAT_; edm::EDGetTokenT electrons_; @@ -141,22 +140,22 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const if (usePAT_) { const std::string kUnbiased("unbiased"); for (unsigned int iele = 0; iele < nElectrons; iele++) { - edm::Ptr ele(patElectrons, iele); - if (!ele->isElectronIDAvailable("unbiased")) { + pat::Electron const& ele = (*patElectrons)[iele]; + if (!ele.isElectronIDAvailable("unbiased")) { continue; } - float id = ele->electronID(kUnbiased); + float id = ele.electronID(kUnbiased); for (unsigned int index = 0; index < models_.size(); ++index) { output[index][iele] = eval(*models_[index], ele, rho, id, zfield.z()); } } } else { for (unsigned int iele = 0; iele < nElectrons; iele++) { - edm::Ptr ele(electrons, iele); - if (ele->core().isNull()) { + reco::GsfElectron const& ele = (*electrons)[iele]; + if (ele.core().isNull()) { continue; } - const auto& gsf = ele->core()->gsfTrack(); // reco::GsfTrackRef + const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef if (gsf.isNull()) { continue; } @@ -184,12 +183,12 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const ////////////////////////////////////////////////////////////////////////////////////////// // double LowPtGsfElectronIDProducer::eval( - const GBRForest& model, const edm::Ptr& ele, double rho, float unbiased, float field_z) const { + const GBRForest& model, const reco::GsfElectron& ele, double rho, float unbiased, float field_z) const { std::vector inputs; if (version_ == Version::V0) { - inputs = lowptgsfeleid::features_V0(*ele, rho, unbiased); + inputs = lowptgsfeleid::features_V0(ele, rho, unbiased); } else if (version_ == Version::V1) { - inputs = lowptgsfeleid::features_V1(*ele, rho, unbiased, field_z); + inputs = lowptgsfeleid::features_V1(ele, rho, unbiased, field_z); } return model.GetResponse(inputs.data()); } From 62840319fabbe655a2b68591f7379eadf2206f7b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 18:39:44 -0500 Subject: [PATCH 136/923] consolidate common code patterns into a template function --- .../plugins/LowPtGsfElectronIDProducer.cc | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index fd02717cf7dce..19d54319292bd 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -36,6 +36,8 @@ class LowPtGsfElectronIDProducer final : public edm::global::EDProducer<> { private: double eval(const GBRForest& model, const reco::GsfElectron&, double rho, float unbiased, float field_z) const; + template + void doWork(double rho, float bz, EL const& electrons, F&& idFunctor, edm::Event&) const; const bool usePAT_; edm::EDGetTokenT electrons_; edm::EDGetTokenT patElectrons_; @@ -118,63 +120,67 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const edm::Handle patElectrons; edm::Handle electrons; if (usePAT_) { - event.getByToken(patElectrons_, patElectrons); - } else { - event.getByToken(electrons_, electrons); - } + auto const& electrons = event.getHandle(patElectrons_); - // ElectronSeed unbiased BDT - edm::Handle > unbiasedH; - if (!unbiased_.isUninitialized()) { - event.getByToken(unbiased_, unbiasedH); + const std::string kUnbiased("unbiased"); + doWork( + rho, + zfield.z(), + electrons, + [&](auto const& ele) { + if (!ele.isElectronIDAvailable(kUnbiased)) { + return std::numeric_limits::max(); + } + return ele.electronID(kUnbiased); + }, + event); + } else { + auto const& electrons = event.getHandle(electrons_); + // ElectronSeed unbiased BDT + edm::ValueMap const& unbiasedH = event.get(unbiased_); + doWork( + rho, + zfield.z(), + electrons, + [&](auto const& ele) { + if (ele.core().isNull()) { + return std::numeric_limits::max(); + } + const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef + if (gsf.isNull()) { + return std::numeric_limits::max(); + } + return unbiasedH[gsf]; + }, + event); } +} +template +void LowPtGsfElectronIDProducer::doWork( + double rho, float bz, EL const& electrons, F&& idFunctor, edm::Event& event) const { // Iterate through Electrons, evaluate BDT, and store result std::vector > output; output.reserve(names_.size()); - unsigned int nElectrons = usePAT_ ? patElectrons->size() : electrons->size(); + auto nElectrons = electrons->size(); for (unsigned int iname = 0; iname < names_.size(); ++iname) { output.emplace_back(nElectrons, -999.); } - if (usePAT_) { - const std::string kUnbiased("unbiased"); - for (unsigned int iele = 0; iele < nElectrons; iele++) { - pat::Electron const& ele = (*patElectrons)[iele]; - if (!ele.isElectronIDAvailable("unbiased")) { - continue; - } - float id = ele.electronID(kUnbiased); + for (unsigned int iele = 0; iele < nElectrons; iele++) { + auto const& ele = (*electrons)[iele]; + float id = idFunctor(ele); + if (id != std::numeric_limits::max()) { for (unsigned int index = 0; index < models_.size(); ++index) { - output[index][iele] = eval(*models_[index], ele, rho, id, zfield.z()); - } - } - } else { - for (unsigned int iele = 0; iele < nElectrons; iele++) { - reco::GsfElectron const& ele = (*electrons)[iele]; - if (ele.core().isNull()) { - continue; - } - const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef - if (gsf.isNull()) { - continue; - } - float unbiased = (*unbiasedH)[gsf]; - for (unsigned int index = 0; index < models_.size(); ++index) { - output[index][iele] = eval(*models_[index], ele, rho, unbiased, zfield.z()); + output[index][iele] = eval(*models_[index], ele, rho, id, bz); } } } - // Create and put ValueMap in Event for (unsigned int iname = 0; iname < names_.size(); ++iname) { auto ptr = std::make_unique >(edm::ValueMap()); edm::ValueMap::Filler filler(*ptr); - if (usePAT_) { - filler.insert(patElectrons, output[iname].begin(), output[iname].end()); - } else { - filler.insert(electrons, output[iname].begin(), output[iname].end()); - } + filler.insert(electrons, output[iname].begin(), output[iname].end()); filler.fill(); event.put(std::move(ptr), names_[iname]); } From 4a3752c8ceebec17338f409c395f4f0133edea58 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 18:57:42 -0500 Subject: [PATCH 137/923] Changed loop order to model then electrons This avoids having to keep all the model results in memory at one time. --- .../plugins/LowPtGsfElectronIDProducer.cc | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index 19d54319292bd..79b1b1788b913 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -159,30 +159,27 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const template void LowPtGsfElectronIDProducer::doWork( double rho, float bz, EL const& electrons, F&& idFunctor, edm::Event& event) const { - // Iterate through Electrons, evaluate BDT, and store result - std::vector > output; - output.reserve(names_.size()); auto nElectrons = electrons->size(); - for (unsigned int iname = 0; iname < names_.size(); ++iname) { - output.emplace_back(nElectrons, -999.); - } - - for (unsigned int iele = 0; iele < nElectrons; iele++) { - auto const& ele = (*electrons)[iele]; - float id = idFunctor(ele); - if (id != std::numeric_limits::max()) { - for (unsigned int index = 0; index < models_.size(); ++index) { - output[index][iele] = eval(*models_[index], ele, rho, id, bz); + std::vector ids; + ids.reserve(nElectrons); + std::transform(electrons->begin(), electrons->end(), std::back_inserter(ids), idFunctor); + + std::vector output(nElectrons); //resused for each model + for (unsigned int index = 0; index < names_.size(); ++index) { + // Iterate through Electrons, evaluate BDT, and store result + for (unsigned int iele = 0; iele < nElectrons; iele++) { + auto const& ele = (*electrons)[iele]; + if (ids[iele] != std::numeric_limits::max()) { + output[iele] = eval(*models_[index], ele, rho, ids[iele], bz); + } else { + output[iele] = -999.; } } - } - - for (unsigned int iname = 0; iname < names_.size(); ++iname) { auto ptr = std::make_unique >(edm::ValueMap()); edm::ValueMap::Filler filler(*ptr); - filler.insert(electrons, output[iname].begin(), output[iname].end()); + filler.insert(electrons, output.begin(), output.end()); filler.fill(); - event.put(std::move(ptr), names_[iname]); + event.put(std::move(ptr), names_[index]); } } From 7d4a23c41aeb0306c5b083c8870e33a7af3abb9d Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 19:10:47 -0500 Subject: [PATCH 138/923] Use EDPutTokenT to avoid making a temporary container on the heap Some code-formatting also snuck in. --- .../plugins/LowPtGsfElectronIDProducer.cc | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index 79b1b1788b913..96327668a8fd4 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -42,14 +42,15 @@ class LowPtGsfElectronIDProducer final : public edm::global::EDProducer<> { edm::EDGetTokenT electrons_; edm::EDGetTokenT patElectrons_; const edm::EDGetTokenT rho_; - edm::EDGetTokenT > unbiased_; + edm::EDGetTokenT> unbiased_; const edm::ESGetToken fieldToken_; const std::vector names_; + std::vector>> putTokens_; const bool passThrough_; const double minPtThreshold_; const double maxPtThreshold_; - std::vector > models_; + std::vector> models_; const std::vector thresholds_; const std::string versionName_; enum class Version { V0, V1 }; @@ -65,19 +66,19 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& rho_(consumes(conf.getParameter("rho"))), unbiased_(), fieldToken_(esConsumes()), - names_(conf.getParameter >("ModelNames")), + names_(conf.getParameter>("ModelNames")), passThrough_(conf.getParameter("PassThrough")), minPtThreshold_(conf.getParameter("MinPtThreshold")), maxPtThreshold_(conf.getParameter("MaxPtThreshold")), - thresholds_(conf.getParameter >("ModelThresholds")), + thresholds_(conf.getParameter>("ModelThresholds")), versionName_(conf.getParameter("Version")) { if (usePAT_) { patElectrons_ = consumes(conf.getParameter("electrons")); } else { electrons_ = consumes(conf.getParameter("electrons")); - unbiased_ = consumes >(conf.getParameter("unbiased")); + unbiased_ = consumes>(conf.getParameter("unbiased")); } - for (auto& weights : conf.getParameter >("ModelWeights")) { + for (auto& weights : conf.getParameter>("ModelWeights")) { models_.push_back(createGBRForest(edm::FileInPath(weights))); } if (names_.size() != models_.size()) { @@ -95,8 +96,9 @@ LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& } else { throw cms::Exception("Incorrect configuration") << "Unknown Version: " << versionName_ << "\n"; } + putTokens_.reserve(names_.size()); for (const auto& name : names_) { - produces >(name); + putTokens_.emplace_back(produces>(name)); } } @@ -175,11 +177,11 @@ void LowPtGsfElectronIDProducer::doWork( output[iele] = -999.; } } - auto ptr = std::make_unique >(edm::ValueMap()); - edm::ValueMap::Filler filler(*ptr); + edm::ValueMap valueMap; + edm::ValueMap::Filler filler(valueMap); filler.insert(electrons, output.begin(), output.end()); filler.fill(); - event.put(std::move(ptr), names_[index]); + event.emplace(putTokens_[index], std::move(valueMap)); } } @@ -204,10 +206,10 @@ void LowPtGsfElectronIDProducer::fillDescriptions(edm::ConfigurationDescriptions desc.add("electrons", edm::InputTag("lowPtGsfElectrons")); desc.addOptional("unbiased", edm::InputTag("lowPtGsfElectronSeedValueMaps:unbiased")); desc.add("rho", edm::InputTag("fixedGridRhoFastjetAll")); - desc.add >("ModelNames", {""}); - desc.add >( + desc.add>("ModelNames", {""}); + desc.add>( "ModelWeights", {"RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Nov28.root"}); - desc.add >("ModelThresholds", {-99.}); + desc.add>("ModelThresholds", {-99.}); desc.add("PassThrough", false); desc.add("MinPtThreshold", 0.5); desc.add("MaxPtThreshold", 15.); From 18f1955f8ad5f06564be631f785b57b944bf541b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 25 Aug 2021 19:21:47 -0500 Subject: [PATCH 139/923] Added missing esConsumes to LowPtGsfElectronSeedProducer --- .../plugins/LowPtGsfElectronSeedProducer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedProducer.cc index 26d8d7d9d245f..6492ecdd1b94b 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedProducer.cc @@ -152,6 +152,7 @@ class LowPtGsfElectronSeedProducer final const edm::ESGetToken trajectoryFitterToken_; const edm::ESGetToken trajectorySmootherToken_; const edm::ESGetToken builderToken_; + const edm::ESGetToken magToken_; const noZS::EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; const bool passThrough_; @@ -183,6 +184,7 @@ LowPtGsfElectronSeedProducer::LowPtGsfElectronSeedProducer(const edm::ParameterS trajectoryFitterToken_{esConsumes(conf.getParameter("Fitter"))}, trajectorySmootherToken_{esConsumes(conf.getParameter("Smoother"))}, builderToken_{esConsumes(conf.getParameter("TTRHBuilder"))}, + magToken_{esConsumes()}, ecalClusterToolsESGetTokens_{consumesCollector()}, passThrough_(conf.getParameter("PassThrough")), usePfTracks_(conf.getParameter("UsePfTracks")), @@ -203,7 +205,7 @@ LowPtGsfElectronSeedProducer::LowPtGsfElectronSeedProducer(const edm::ParameterS ////////////////////////////////////////////////////////////////////////////////////////// // void LowPtGsfElectronSeedProducer::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const& setup) { - setup.get().get(field_); + field_ = setup.getHandle(magToken_); } ////////////////////////////////////////////////////////////////////////////////////////// From 85e2facace507e386ca0e83981315098e141144e Mon Sep 17 00:00:00 2001 From: swmukher Date: Thu, 26 Aug 2021 09:45:43 +0200 Subject: [PATCH 140/923] new producer for hcal vars --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc new file mode 100644 index 0000000000000..cb8fb1740de82 --- /dev/null +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -0,0 +1,252 @@ +// -*- C++ -*- +// +// Class: EgammaHLTHcalVarProducerFromRecHit +// + +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" + +//This class is similar to the existing class EgammaHLTBcHcalIsolationProducersRegional, +//but the new feature in this code is that the HCAL recHits are used instead of the +//calotowers which is expected to be phased out sometime in Run3. +//The old class can also be used until calotowers stay. After that, one need to switch to this new one. + +//As the old producer code, this one also produces either Hcal isolation or H for H/E depending if doEtSum=true or false. +//H for H/E = either a single HCCAL tower behind SC, or towers in a cone, and hcal isolation has these tower(s) excluded. +//a rho correction can be applied + +class EgammaHLTHcalVarProducerFromRecHit : public edm::global::EDProducer<> { +public: + explicit EgammaHLTHcalVarProducerFromRecHit(const edm::ParameterSet &); + +public: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final; + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + const bool doEtSum_; + EgammaHcalIsolation::arrayHB eThresHB_; + EgammaHcalIsolation::arrayHB etThresHB_; + EgammaHcalIsolation::arrayHE eThresHE_; + EgammaHcalIsolation::arrayHE etThresHE_; + const double innerCone_; + const double outerCone_; + const int depth_; + const int maxSeverityHB_; + const int maxSeverityHE_; + const bool useSingleTower_; + const bool doRhoCorrection_; + const double rhoScale_; + const double rhoMax_; + const std::vector effectiveAreas_; + const std::vector absEtaLowEdges_; + const edm::EDGetTokenT recoEcalCandidateProducer_; + const edm::EDGetTokenT hbheRecHitsTag_; + const edm::EDGetTokenT rhoProducer_; + const edm::ESGetToken caloGeometryToken_; + const edm::ESGetToken hcalTopologyToken_; + const edm::ESGetToken hcalChannelQualityToken_; + const edm::ESGetToken hcalSevLvlComputerToken_; + const edm::ESGetToken caloTowerConstituentsMapToken_; + const edm::EDPutTokenT putToken_; + +}; + +EgammaHLTHcalVarProducerFromRecHit::EgammaHLTHcalVarProducerFromRecHit(const edm::ParameterSet &config) + : doEtSum_(config.getParameter("doEtSum")), + eThresHB_(config.getParameter("eThresHB")), + etThresHB_(config.getParameter("etThresHB")), + eThresHE_(config.getParameter("eThresHE")), + etThresHE_(config.getParameter("etThresHE")), + innerCone_(config.getParameter("innerCone")), + outerCone_(config.getParameter("outerCone")), + depth_(config.getParameter("depth")), + maxSeverityHB_(config.getParameter("maxSeverityHB")), + maxSeverityHE_(config.getParameter("maxSeverityHE")), + useSingleTower_(config.getParameter("useSingleTower")), + doRhoCorrection_(config.getParameter("doRhoCorrection")), + rhoScale_(config.getParameter("rhoScale")), + rhoMax_(config.getParameter("rhoMax")), + effectiveAreas_(config.getParameter >("effectiveAreas")), + absEtaLowEdges_(config.getParameter >("absEtaLowEdges")), + recoEcalCandidateProducer_(consumes(config.getParameter("recoEcalCandidateProducer"))), + hbheRecHitsTag_(consumes(config.getParameter("hbheRecHitsTag"))), + rhoProducer_(doRhoCorrection_ ? consumes(config.getParameter("rhoProducer")) + : edm::EDGetTokenT()), + caloGeometryToken_{esConsumes()}, + hcalTopologyToken_{esConsumes()}, + hcalChannelQualityToken_{esConsumes()}, + hcalSevLvlComputerToken_{esConsumes()}, + caloTowerConstituentsMapToken_{esConsumes()}, + putToken_{produces()} { + if (doRhoCorrection_) { + if (absEtaLowEdges_.size() != effectiveAreas_.size()) { + throw cms::Exception("IncompatibleVects") << "absEtaLowEdges and effectiveAreas should be of the same size. \n"; + } + + if (absEtaLowEdges_.at(0) != 0.0) { + throw cms::Exception("IncompleteCoverage") << "absEtaLowEdges should start from 0. \n"; + } + + for (unsigned int aIt = 0; aIt < absEtaLowEdges_.size() - 1; aIt++) { + if (!(absEtaLowEdges_.at(aIt) < absEtaLowEdges_.at(aIt + 1))) { + throw cms::Exception("ImproperBinning") << "absEtaLowEdges entries should be in increasing order. \n"; + } + } + } +} + +void EgammaHLTHcalVarProducerFromRecHit::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + + desc.add(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate")); + desc.add(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo")); + desc.add(("doRhoCorrection"), false); + desc.add(("rhoMax"), 999999.); + desc.add(("rhoScale"), 1.0); + //eThresHB/HE are from RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py + desc.add >(("eThresHB"), {0.1, 0.2, 0.3, 0.3}); + desc.add >(("etThresHB"), {0, 0, 0, 0}); + desc.add >(("eThresHE"), {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add >(("etThresHE"), {0, 0, 0, 0, 0, 0, 0}); + desc.add(("innerCone"), 0); + desc.add(("outerCone"), 0.14); + desc.add(("depth"), 0); + desc.add(("maxSeverityHB"), 9); + desc.add(("maxSeverityHE"), 9); + desc.add(("doEtSum"), false); + desc.add(("useSingleTower"), false); + desc.add >("effectiveAreas", {0.079, 0.25}); // 2016 post-ichep sinEle default + desc.add >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap + descriptions.add(("hltEgammaHLTHcalVarProducerFromRecHit"), desc); +} + +void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &iSetup) const { + + auto recoEcalCandHandle = iEvent.getHandle(recoEcalCandidateProducer_); + + double rho = 0.0; + + if (doRhoCorrection_) { + rho = iEvent.get(rhoProducer_); + if (rho > rhoMax_) { + rho = rhoMax_; + } + rho = rho * rhoScale_; + } + + reco::RecoEcalCandidateIsolationMap isoMap(recoEcalCandHandle); + + for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); iRecoEcalCand++) { + reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand); + + float isol = 0; + + if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based. + EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + outerCone_, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + innerCone_, + eThresHB_, + etThresHB_, + maxSeverityHB_, + eThresHE_, + etThresHE_, + maxSeverityHE_, + iEvent.get(hbheRecHitsTag_), + iSetup.getData(caloGeometryToken_), + iSetup.getData(hcalTopologyToken_), + iSetup.getData(hcalChannelQualityToken_), + iSetup.getData(hcalSevLvlComputerToken_), + iSetup.getData(caloTowerConstituentsMapToken_)); + + if (doEtSum_) { //hcal iso + isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } + else if (!doEtSum_) { // doEtSum_=False means sum up energy, this is for H/E + isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } + } + + + if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E + EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + outerCone_, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + innerCone_, + eThresHB_, + etThresHB_, + maxSeverityHB_, + eThresHE_, + etThresHE_, + maxSeverityHE_, + iEvent.get(hbheRecHitsTag_), + iSetup.getData(caloGeometryToken_), + iSetup.getData(hcalTopologyToken_), + iSetup.getData(hcalChannelQualityToken_), + iSetup.getData(hcalSevLvlComputerToken_), + iSetup.getData(caloTowerConstituentsMapToken_)); + + isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } + + if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal + EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + outerCone_, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + innerCone_, + eThresHB_, + etThresHB_, + maxSeverityHB_, + eThresHE_, + etThresHE_, + maxSeverityHE_, + iEvent.get(hbheRecHitsTag_), + iSetup.getData(caloGeometryToken_), + iSetup.getData(hcalTopologyToken_), + iSetup.getData(hcalChannelQualityToken_), + iSetup.getData(hcalSevLvlComputerToken_), + iSetup.getData(caloTowerConstituentsMapToken_)); + + isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } + + + if (doRhoCorrection_) { + int iEA = -1; + auto scEta = std::abs(recoEcalCandRef->superCluster()->eta()); + for (int bIt = absEtaLowEdges_.size() - 1; bIt > -1; bIt--) { + if (scEta > absEtaLowEdges_.at(bIt)) { + iEA = bIt; + break; + } + } + isol = isol - rho * effectiveAreas_.at(iEA); + } + + isoMap.insert(recoEcalCandRef, isol); + } + + iEvent.emplace(putToken_, isoMap); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(EgammaHLTHcalVarProducerFromRecHit); From 377344c0408747caa6a982e62f8d2401c8a4bd5d Mon Sep 17 00:00:00 2001 From: iarspider Date: Thu, 26 Aug 2021 10:43:27 +0200 Subject: [PATCH 141/923] [GCC11] CalibPPS/AlignmentRelative: Fix warning: loop variable binds to a temporary --- CalibPPS/AlignmentRelative/src/AlignmentTask.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc index 85dbe488d302e..21850acc71b26 100644 --- a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc +++ b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc @@ -530,7 +530,7 @@ void AlignmentTask::buildEqualMeanUMeanVRotZConstraints(vector Date: Thu, 26 Aug 2021 11:04:09 +0200 Subject: [PATCH 142/923] Update AlignmentTask.cc --- CalibPPS/AlignmentRelative/src/AlignmentTask.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc index 21850acc71b26..963105120b4b4 100644 --- a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc +++ b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc @@ -531,8 +531,8 @@ void AlignmentTask::buildEqualMeanUMeanVRotZConstraints(vector Date: Thu, 26 Aug 2021 12:04:46 +0200 Subject: [PATCH 143/923] Remove unused pointer. --- EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h | 2 -- EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h b/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h index 418949318301a..beb2fa24e8c59 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h @@ -39,8 +39,6 @@ class DCCEESRPBlock : public DCCSRPBlock { bool checkSrpIdAndNumbSRFlags() override; std::unique_ptr* eeSrFlagsDigis_; - - EcalScDetId* pSCDetId_; }; #endif diff --git a/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc b/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc index 97a1c5dc0b286..65288060996ca 100644 --- a/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc +++ b/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc @@ -16,7 +16,7 @@ void DCCEESRPBlock::addSRFlagToCollection() { data_++; const uint16_t *my16Bitp_ = reinterpret_cast(data_); - for (unsigned int n = 0; n < expNumbSrFlags_; n++, pSCDetId_++) { + for (unsigned int n = 0; n < expNumbSrFlags_; ++n) { if (n != 0 && n % 4 == 0) my16Bitp_++; From 2b79cf79fa8dcde874c9e279708c64e1abbb4ad7 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 12:22:48 +0200 Subject: [PATCH 144/923] Remove unused pointers. --- EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h | 2 -- EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h | 1 - 2 files changed, 3 deletions(-) diff --git a/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h b/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h index 3f87bb7361797..fafcd99cd6b42 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h @@ -39,8 +39,6 @@ class DCCEBSRPBlock : public DCCSRPBlock { bool checkSrpIdAndNumbSRFlags() override; std::unique_ptr* ebSrFlagsDigis_; - - EcalTrigTowerDetId* pTTDetId_; }; #endif diff --git a/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h b/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h index 5db19585bf35b..bac78ea4e17ed 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h @@ -59,7 +59,6 @@ class DCCTCCBlock : public DCCDataBlockPrototype { unsigned int expTccId_; unsigned int ps_; - EcalTrigTowerDetId* pTTDetId_; EcalTriggerPrimitiveDigi* pTP_; EcalPseudoStripInputDigi* pPS_; std::unique_ptr* tps_; From af71813b1cc4378624538d2d2c34bf26ee0b2bc2 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Aug 2021 13:43:43 +0200 Subject: [PATCH 145/923] PCL of diamond sampic offset calibration --- ...mondSampicTimingCalibrationPCLHarvester.cc | 277 +++++++++++++++++ ...DiamondSampicTimingCalibrationPCLWorker.cc | 147 +++++++++ .../ALCARECOPPSCalTrackBasedSel_Output_cff.py | 4 +- ...PSDiamondSampicTimingCalibHarvester_cff.py | 5 + ...OPPSDiamondSampicTimingCalib_Output_cff.py | 13 + ...ALCARECOPPSDiamondSampicTimingCalib_cff.py | 34 +++ .../DiamondSampicCalibrationHarvester_cfg.py | 51 ++++ .../DiamondSampicCalibrationWorker_cfg.py | 98 ++++++ .../test/runDiamondSampicCalibration | 7 + Configuration/AlCa/python/autoPCL.py | 3 +- .../EventContent/python/AlCaRecoOutput_cff.py | 1 + .../python/AlCaHarvesting_cff.py | 8 + .../python/AlCaRecoStreams_cff.py | 11 + .../DiamondSampicCalibrationDQMSource.cc | 281 ++++++++++++++++++ 14 files changed, 938 insertions(+), 2 deletions(-) create mode 100644 CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc create mode 100644 CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py create mode 100644 CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py create mode 100644 CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py create mode 100755 CalibPPS/TimingCalibration/test/runDiamondSampicCalibration create mode 100644 DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc new file mode 100644 index 0000000000000..ec107d1bc5b5e --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc @@ -0,0 +1,277 @@ +// -*- C++ -*- +// +// Package: CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLHarvester +// Class: PPSDiamondSampicTimingCalibrationPCLHarvester +// +/**\class PPSDiamondSampicTimingCalibrationPCLHarvester PPSDiamondSampicTimingCalibrationPCLHarvester.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLHarvester/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc + + Description: Harvester of the DiamondSampicCalibration PCL which produces sqlite file with a new calibration + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 26 Jul 2021 16:36:13 GMT +// +// + +#include "DQMServices/Core/interface/DQMEDHarvester.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include +#include + +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" + +#include "CalibPPS/TimingCalibration/interface/TimingCalibrationStruct.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h" + +namespace pt = boost::property_tree; + +struct Histograms_PPSDiamondSampicTimingCalibrationPCLWorker { + std::unordered_map timeHisto; + std::unordered_map db; + std::unordered_map sampic; + std::unordered_map channel; +}; + +class PPSDiamondSampicTimingCalibrationPCLHarvester : public DQMEDHarvester { +public: + PPSDiamondSampicTimingCalibrationPCLHarvester(const edm::ParameterSet&); + void beginRun(const edm::Run&, const edm::EventSetup&) override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + void calibJson(DQMStore::IGetter& iGetter); + void calibDb(DQMStore::IGetter& iGetter); + + edm::ESGetToken geomEsToken_; + edm::ESGetToken timingCalibrationToken_; + edm::ESHandle hTimingCalib_; + std::vector detids_; + const std::string dqmDir_; + const unsigned int min_entries_; + const std::string jsonCalibFile_; +}; + +//------------------------------------------------------------------------------ + +PPSDiamondSampicTimingCalibrationPCLHarvester::PPSDiamondSampicTimingCalibrationPCLHarvester(const edm::ParameterSet& iConfig) + : geomEsToken_(esConsumes()), + dqmDir_(iConfig.getParameter("dqmDir")), + min_entries_(iConfig.getParameter("minEntries")), + jsonCalibFile_(iConfig.getParameter("jsonCalibFile")){ + + if(jsonCalibFile_=="") + timingCalibrationToken_=esConsumes(edm::ESInputTag(iConfig.getParameter("timingCalibrationTag"))); +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + if(jsonCalibFile_=="") + hTimingCalib_ = iSetup.getHandle(timingCalibrationToken_); + const auto& geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + detids_.emplace_back(detid); + } +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::calibJson(DQMStore::IGetter& iGetter) { + + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; + std::string ch_name; + + pt::ptree node; + pt::read_json(jsonCalibFile_, node); + const std::string formula = node.get("formula"); + + for (const auto& detid : detids_) { + detid.channelName(ch_name); + const auto chid = detid.rawId(); + + hists.db[chid]=iGetter.get(dqmDir_+"/"+ch_name+"db"); + hists.sampic[chid]=iGetter.get(dqmDir_+"/"+ch_name+"sampic"); + hists.channel[chid]=iGetter.get(dqmDir_+"/"+ch_name+"channel"); + + int db = hists.db[chid]->getIntValue(); + int sampic = hists.sampic[chid]->getIntValue(); + int channel = hists.channel[chid]->getIntValue(); + + if(!node.get_child_optional("parameters."+ std::to_string(db))){ + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "db "<("time_offset"); + hists.timeHisto[chid] = iGetter.get(dqmDir_+"/"+ch_name); + + if (hists.timeHisto[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve time monitor for detid" << detid; + par.second.put("time_offset",old_time_offset); + continue; + } + + if (min_entries_ > 0 && hists.timeHisto[chid]->getEntries() < min_entries_) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Not enough entries for channel (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " + << min_entries_ << ". Skipping calibration."; + par.second.put("time_offset",old_time_offset); + continue; + } + new_time_offset = old_time_offset - hists.timeHisto[chid]->getMean(); + par.second.put("time_offset",new_time_offset); + break; + } + ct++; + } + } + pt::write_json("adc_offsets_prec.cal.json", node); + +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& iGetter) { + PPSTimingCalibration calib=*hTimingCalib_; + + // book the parameters containers + PPSTimingCalibration::ParametersMap params; + PPSTimingCalibration::TimingMap time_info; + + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; + std::string ch_name; + const std::string formula = calib.formula(); + + for (const auto& detid : detids_) { + detid.channelName(ch_name); + const auto chid = detid.rawId(); + + hists.db[chid]=iGetter.get(dqmDir_+"/"+ch_name+"db"); + if (hists.db[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve db for detid: " << detid; + continue; + } + + hists.sampic[chid]=iGetter.get(dqmDir_+"/"+ch_name+"sampic"); + if (hists.sampic[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve sampic for detid: " << detid; + continue; + } + + hists.channel[chid]=iGetter.get(dqmDir_+"/"+ch_name+"channel"); + if (hists.channel[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve channel hwId for detid: " << detid; + continue; + } + + int db = hists.db[chid]->getIntValue(); + int sampic = hists.sampic[chid]->getIntValue(); + int channel = hists.channel[chid]->getIntValue(); + + PPSTimingCalibration::Key key; + key.db =db; + key.sampic=sampic; + key.channel=channel; + + double timeOffset=calib.timeOffset(db,sampic,channel); + double timePrecision=calib.timePrecision(db,sampic,channel); + if(timeOffset==0&&timePrecision==0){ + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "No calibration found for db: "< 0 && hists.timeHisto[chid]->getEntries() < min_entries_) { + edm::LogInfo("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Not enough entries (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " + << min_entries_ << ". Skipping calibration."; + continue; + } + + double new_time_offset = timeOffset - hists.timeHisto[chid]->getMean(); + time_info[key] = {new_time_offset, timePrecision}; + + } + + auto calibPPS=PPSTimingCalibration(formula, params, time_info); + // write the object + edm::Service poolDbService; + poolDbService->writeOne(&calibPPS, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); + +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + iBooker.cd(); + iBooker.setCurrentFolder(dqmDir_); + if(jsonCalibFile_=="") + calibDb(iGetter); + else + calibJson(iGetter); + +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("timingCalibrationTag", "GlobalTag:DiamondSampicCalibration") + ->setComment("input tag for timing calibration retrieval"); + desc.add("dqmDir", "AlCaReco/PPSDiamondSampicTimingCalibrationPCL") + ->setComment("input path for the various DQM plots"); + desc.add("minEntries", 1)->setComment("minimal number of hits to extract calibration"); + desc.add("jsonCalibFile", "") + ->setComment("input path for json file containing calibration, if none, calibration will be obtained from db instead"); + descriptions.add("PPSDiamondSampicTimingCalibrationPCLHarvester", desc); +} + +DEFINE_FWK_MODULE(PPSDiamondSampicTimingCalibrationPCLHarvester); \ No newline at end of file diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc new file mode 100644 index 0000000000000..a4f9eb0547546 --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc @@ -0,0 +1,147 @@ +// -*- C++ -*- +// +// Package: CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker +// Class: PPSDiamondSampicTimingCalibrationPCLWorker +// +/**\class PPSDiamondSampicTimingCalibrationPCLWorker PPSDiamondSampicTimingCalibrationPCLWorker.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc + + Description: Worker of the DiamondSampicCalibration PCL which produces RecHitsTime histograms and id mapping for the Harvester + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 26 Jul 2021 07:37:13 GMT +// +// + +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" + +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +//------------------------------------------------------------------------------ + +struct Histograms_PPSDiamondSampicTimingCalibrationPCLWorker { + std::unordered_map timeHisto; + std::unordered_map db; + std::unordered_map sampic; + std::unordered_map channel; + +}; + +class PPSDiamondSampicTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer { +public: + explicit PPSDiamondSampicTimingCalibrationPCLWorker(const edm::ParameterSet&); + ~PPSDiamondSampicTimingCalibrationPCLWorker() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void bookHistograms(DQMStore::IBooker&, + edm::Run const&, + edm::EventSetup const&, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker&) const override; + + void dqmAnalyze(edm::Event const&, edm::EventSetup const&, Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const&) const override; + + // ------------ member data ------------ + edm::EDGetTokenT< edm::DetSetVector > totemTimingDigiToken_; + edm::EDGetTokenT> totemTimingRecHitToken_; + edm::ESGetToken geomEsToken_; + std::string folder_; +}; + +//------------------------------------------------------------------------------ + +PPSDiamondSampicTimingCalibrationPCLWorker::PPSDiamondSampicTimingCalibrationPCLWorker(const edm::ParameterSet& iConfig) + : totemTimingDigiToken_(consumes< edm::DetSetVector >(iConfig.getParameter("totemTimingDigiTag"))), + totemTimingRecHitToken_(consumes>(iConfig.getParameter("totemTimingRecHitTag"))), + geomEsToken_(esConsumes()), + folder_(iConfig.getParameter("folder")) {} + +PPSDiamondSampicTimingCalibrationPCLWorker::~PPSDiamondSampicTimingCalibrationPCLWorker() {} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze(edm::Event const& iEvent, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const& histos) const { + edm::Handle< edm::DetSetVector > timingDigi; + edm::Handle< edm::DetSetVector > timingRecHit; + iEvent.getByToken( totemTimingRecHitToken_, timingRecHit ); + iEvent.getByToken( totemTimingDigiToken_, timingDigi ); + + + for (const auto& digis : *timingDigi){ + const CTPPSDiamondDetId detId(digis.detId()); + for (const auto& digi : digis ){ + histos.db.at(detId.rawId())->Fill(digi.hardwareBoardId()); + histos.sampic.at(detId.rawId())->Fill(digi.hardwareSampicId()); + histos.channel.at(detId.rawId())->Fill(digi.hardwareChannelId()); + } + } + + if (timingRecHit->empty()) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") << "No rechits retrieved from the event content."; + return; + } + + for (const auto& recHits : *timingRecHit) { + const CTPPSDiamondDetId detId( recHits.detId() ); + for (const auto& recHit : recHits ) + histos.timeHisto.at(detId.rawId())->Fill( recHit.time() ); + + } +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms(DQMStore::IBooker& ibook, + edm::Run const& run, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker& histos) const { + ibook.setCurrentFolder(folder_); + std::string ch_name; + const auto& geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + detid.channelName(ch_name); + histos.timeHisto[detid.rawId()]=ibook.book1D(ch_name, ch_name, 1200,-40,40); + histos.db[detid.rawId()]=ibook.bookInt(ch_name+"db"); + histos.sampic[detid.rawId()]=ibook.bookInt(ch_name+"sampic"); + histos.channel[detid.rawId()]=ibook.bookInt(ch_name+"channel"); + } +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("totemTimingDigiTag", edm::InputTag("totemTimingRawToDigi", "TotemTiming")) + ->setComment("input tag for the PPS diamond detectors digi"); + desc.add("totemTimingRecHitTag", edm::InputTag("totemTimingRecHits")) + ->setComment("input tag for the PPS diamond detectors rechits"); + desc.add("folder", "AlCaReco/PPSDiamondSampicTimingCalibrationPCL") + ->setComment("output path for the various DQM plots"); + descriptions.add("PPSDiamondSampicTimingCalibrationPCLWorker", desc); +} + +DEFINE_FWK_MODULE(PPSDiamondSampicTimingCalibrationPCLWorker); diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py index 1415b8c708f01..20bee7ec6c60e 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py @@ -6,7 +6,9 @@ ), outputCommands = cms.untracked.vstring( 'keep *_ALCARECOPPSCalTrackBasedSel_*_*', - 'keep *_ctppsDiamondRawToDigi_*_*' + 'keep *_ctppsDiamondRawToDigi_*_*', + 'keep *_totemTimingRawToDigi_*_*' + # will be updated to add the spatial alignment required collections ) ) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py new file mode 100644 index 0000000000000..dc18556b0324a --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * +from CalibPPS.TimingCalibration.ppsDiamondSampicTimingCalibrationPCLHarvester_cfi import * + diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py new file mode 100644 index 0000000000000..d86911e241cde --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPPSDiamondSampicTimingCalib_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPPSDiamondSampicTimingCalib') + ), + outputCommands = cms.untracked.vstring( + 'keep *_MEtoEDMConvertPPSDiamondSampicTimingCalib_*_*', + ) +) + +OutALCARECOPPSDiamondSampicTimingCalib = OutALCARECOPPSDiamondSampicTimingCalib_noDrop.clone() +OutALCARECOPPSDiamondSampicTimingCalib.outputCommands.insert(0, 'drop *') diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py new file mode 100644 index 0000000000000..8e669abb63642 --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py @@ -0,0 +1,34 @@ +import FWCore.ParameterSet.Config as cms + +from RecoPPS.Configuration.recoCTPPS_cff import diamondSampicLocalReconstruction +from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLWorker_cfi import PPSDiamondSampicTimingCalibrationPCLWorker +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +diamondSampicCalibrationDQM = DQMEDAnalyzer('DiamondSampicCalibrationDQMSource', + tagRecHits = cms.InputTag("totemTimingRecHits"), + verbosity = cms.untracked.uint32(0) +) + +# load DQM framework +from DQM.Integration.config.environment_cfi import * +dqmEnv.subSystemFolder = "CTPPS" +dqmEnv.eventInfoFolder = "EventInfo" +dqmSaver.path = "" +dqmSaver.tag = "CTPPS" + +MEtoEDMConvertPPSDiamondSampicTimingCalib = cms.EDProducer('MEtoEDMConverter', + Name = cms.untracked.string('MEtoEDMConverter'), + Verbosity = cms.untracked.int32(0), + Frequency = cms.untracked.int32(50), + MEPathToSave = cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL'), + deleteAfterCopy = cms.untracked.bool(True), +) + +seqALCARECOPPSDiamondSampicTimingCalib = cms.Sequence( + diamondSampicLocalReconstruction* + PPSDiamondSampicTimingCalibrationPCLWorker* + diamondSampicCalibrationDQM* + dqmEnv* + dqmSaver* + MEtoEDMConvertPPSDiamondSampicTimingCalib +) diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py new file mode 100644 index 0000000000000..af434a75d1c1d --- /dev/null +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("harvester") + +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_Candidate_2021_08_24_17_11_47') + +# Source (histograms) +process.source = cms.Source("DQMRootSource", + fileNames = cms.untracked.vstring("file:worker_output.root"), +) + +# output service for database +process.load('CondCore.CondDB.CondDB_cfi') +process.CondDB.connect = 'sqlite_file:ppsDiamondSampicTiming_calibration.sqlite' # SQLite output + +process.PoolDBOutputService = cms.Service('PoolDBOutputService', + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet( + cms.PSet( + record = cms.string('PPSTimingCalibrationRcd'), + tag = cms.string('DiamondSampicCalibration'), + ) + ) +) + +################ +#geometry +################ +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') + +process.load("CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi") +#process.PPSDiamondSampicTimingCalibrationPCLHarvester.jsonCalibFile=cms.string("initial.cal.json") + +process.p = cms.Path( + process.PPSDiamondSampicTimingCalibrationPCLHarvester +) + +process.schedule = cms.Schedule( + process.p +) + + diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py new file mode 100644 index 0000000000000..87ee1c7071f82 --- /dev/null +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py @@ -0,0 +1,98 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("worker") + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('RecoPPS.Local.totemTimingLocalReconstruction_cff') +process.source = cms.Source("EmptySource") +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000) ) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_Candidate_2021_08_24_17_11_47') + +################ +#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)) + + ) +) + +process.totemTimingRecHits.mergeTimePeaks= cms.bool(False) +process.totemTimingRecHits.timingCalibrationTag= cms.string('GlobalTag:DiamondSampicCalibration') +################ +#geometry +################ +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') + +process.load("CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLWorker_cfi") +process.DQMStore = cms.Service("DQMStore") + +process.dqmOutput = cms.OutputModule("DQMRootOutputModule", + fileName = cms.untracked.string("worker_output.root") +) + +# load DQM framework +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = "CTPPS" +process.dqmEnv.eventInfoFolder = "EventInfo" +process.dqmSaver.path = "" +process.dqmSaver.tag = "CTPPS" + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +process.diamondSampicDQMSource = DQMEDAnalyzer('DiamondSampicCalibrationDQMSource', + tagRecHits = cms.InputTag("totemTimingRecHits"), + verbosity = cms.untracked.uint32(0) +) + +process.path = cms.Path( + process.totemTimingRawToDigi* + process.diamondSampicLocalReconstruction* + process.diamondSampicDQMSource* + process.PPSDiamondSampicTimingCalibrationPCLWorker +) + +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver+ + process.dqmOutput +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration b/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration new file mode 100755 index 0000000000000..3c8c617d6009a --- /dev/null +++ b/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration @@ -0,0 +1,7 @@ +#!/bin/bash + +#---------------------------------------------------------------------------------------------------- + +cmsRun DiamondSampicCalibrationWorker_cfg.py &> log_DiamondSampicCalibrationWorker.log & +wait +cmsRun DiamondSampicCalibrationHarvester_cfg.py &> log_DiamondSampicCalibrationHarvester.log & diff --git a/Configuration/AlCa/python/autoPCL.py b/Configuration/AlCa/python/autoPCL.py index e2825741730a0..5d5a06f7ecd14 100644 --- a/Configuration/AlCa/python/autoPCL.py +++ b/Configuration/AlCa/python/autoPCL.py @@ -8,5 +8,6 @@ 'PromptCalibProdSiStripGainsAAG' : 'SiStripGainsAAG', 'PromptCalibProdLumiPCC': 'LumiPCC', 'PromptCalibProdSiPixel' : 'SiPixelQuality', - 'PromptCalibProdPPS' : 'PPSTimingCalibration' + 'PromptCalibProdPPS' : 'PPSTimingCalibration', + 'PromptCalibProdPPSDiamondSampic' : 'PPSDiamondSampicTimingCalibration' } diff --git a/Configuration/EventContent/python/AlCaRecoOutput_cff.py b/Configuration/EventContent/python/AlCaRecoOutput_cff.py index aab0d9c3fab2f..63abee3b7bf78 100644 --- a/Configuration/EventContent/python/AlCaRecoOutput_cff.py +++ b/Configuration/EventContent/python/AlCaRecoOutput_cff.py @@ -141,6 +141,7 @@ ############################################################### from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_Output_cff import * from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_Output_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalib_Output_cff import * ############################################################### # stream for prompt-calibration @ Tier0 diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 41604bb588ed0..b5bc4fa2773dd 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -11,6 +11,7 @@ from CalibTracker.SiPixelQuality.SiPixelStatusHarvester_cfi import * from CalibTracker.SiPixelQuality.DQMEventInfoSiPixelQuality_cff import * from CalibPPS.TimingCalibration.PPSTimingCalibrationHarvester_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalibHarvester_cff import * from Calibration.TkAlCaRecoProducers.PCLMetadataWriter_cfi import * @@ -223,6 +224,12 @@ timetype = cms.untracked.string('lumiid') ) +ALCAHARVESTPPSDiamondSampicTimingCalibration = ppsDiamondSampicTimingCalibrationPCLHarvester.clone() +ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) +ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), + tag = cms.string('DiamondSampicCalibration'), + timetype = cms.untracked.string('lumiid')) + # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) BeamSpotByLumi = cms.Path(ALCAHARVESTBeamSpotByLumi) @@ -238,6 +245,7 @@ LumiPCC = cms.Path(ALCAHARVESTLumiPCC) SiPixelQuality = cms.Path(dqmEnvSiPixelQuality+ALCAHARVESTSiPixelQuality)#+siPixelPhase1DQMHarvester) PPSTimingCalibration = cms.Path(ALCAHARVESTPPSTimingCalibration) +PPSDiamondSampicTimingCalibration = cms.Path(ALCAHARVESTPPSDiamondSampicTimingCalibration) ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(dqmSaver+pclMetadataWriter) diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index 1ff1ca78ca02c..85188c2823841 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -125,6 +125,7 @@ # Timing calibration from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_cff import * from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalib_cff import * ############################################################### # nonbeam alcas @@ -226,6 +227,7 @@ pathALCARECOMuAlOverlapsGeneralTracks = cms.Path(seqALCARECOMuAlOverlapsGeneralTracks) pathALCARECORpcCalHLT = cms.Path(seqALCARECORpcCalHLT) pathALCARECOPPSTimingCalib = cms.Path(taskALCARECOPPSTimingCalib) +pathALCARECOPPSDiamondSampicTimingCalib = cms.Path(seqALCARECOPPSDiamondSampicTimingCalib) pathALCARECOTkAlBeamHalo = cms.Path(seqALCARECOTkAlBeamHalo*ALCARECOTkAlBeamHaloDQM) pathALCARECOMuAlBeamHaloOverlaps = cms.Path(seqALCARECOMuAlBeamHaloOverlaps) pathALCARECOMuAlBeamHalo = cms.Path(seqALCARECOMuAlBeamHalo) @@ -821,6 +823,15 @@ selectEvents = OutALCARECOPPSTimingCalib.SelectEvents, dataTier = cms.untracked.string('ALCARECO') ) + +ALCARECOStreamPPSDiamondSampicTimingCalib = cms.FilteredStream( + responsible = 'Christopher Misan', + name = 'PPSDiamondSampicTimingCalib', + paths = (pathALCARECOPPSDiamondSampicTimingCalib), + content = OutALCARECOPPSDiamondSampicTimingCalib.outputCommands, + selectEvents = OutALCARECOPPSDiamondSampicTimingCalib.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) ALCARECOStreamPromptCalibProd = cms.FilteredStream( responsible = 'Gianluca Cerminara', diff --git a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc new file mode 100644 index 0000000000000..94c06108bad0c --- /dev/null +++ b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc @@ -0,0 +1,281 @@ +// -*- C++ -*- +// +// Package: DQM/CTPPS/DiamondSampicCalibrationDQMSource +// Class: DiamondSampicCalibrationDQMSource +// +/**\class DiamondSampicCalibrationDQMSource DiamondSampicCalibrationDQMSource.cc SampicDigi/DiamondSampicCalibrationDQMSource/plugins/DiamondSampicCalibrationDQMSource.cc + + Description: DQM module for the diamond sampic offset calibration + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 24 Aug 2021 14:21:17 GMT +// +// + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" +#include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" +#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/Provenance/interface/EventRange.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" + +#include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" + +#include + +//---------------------------------------------------------------------------------------------------- + +class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { +public: + DiamondSampicCalibrationDQMSource(const edm::ParameterSet &); + ~DiamondSampicCalibrationDQMSource() override; + +protected: + void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override; + void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override; + void analyze(const edm::Event &, const edm::EventSetup &) override; + +private: + // Constants + static const double DISPLAY_RESOLUTION_FOR_HITS_MM; // Bin width of histograms + // showing hits and tracks + // (in mm) + static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + + + edm::EDGetTokenT> tokenRecHit_; + edm::ESGetToken geomEsToken_; + unsigned int verbosity_; + edm::TimeValue_t timeOfPreviousEvent_; + + float verticalShiftBot_, verticalShiftTop_; + std::unordered_map horizontalShiftOfDiamond_; + + /// plots related to the whole system + struct GlobalPlots { + GlobalPlots() {} + GlobalPlots(DQMStore::IBooker &ibooker); + }; + + GlobalPlots globalPlot_; + + /// plots related to one Diamond detector package + struct PotPlots { + + // RecHits + MonitorElement *hitDistribution2d = nullptr; + MonitorElement *recHitTime = nullptr; + + PotPlots(){}; + PotPlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map potPlots_; + + /// plots related to one Diamond plane + struct PlanePlots { + PlanePlots() {} + PlanePlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map planePlots_; + + /// plots related to one Diamond channel + struct ChannelPlots { + // RecHits + MonitorElement *recHitTime = nullptr; + + ChannelPlots() {} + ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map channelPlots_; +}; + +//---------------------------------------------------------------------------------------------------- + +// Values for all constants +const double DiamondSampicCalibrationDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05; +const double DiamondSampicCalibrationDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::GlobalPlots::GlobalPlots(DQMStore::IBooker &ibooker) { + ibooker.setCurrentFolder("CTPPS/TimingFastSilicon"); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::PotPlots::PotPlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).rpName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); + + CTPPSDiamondDetId(id).rpName(title, CTPPSDiamondDetId::nFull); + + + hitDistribution2d = ibooker.book2D("hits in planes", + title + " hits in planes;plane number;x (mm)", + 10, + -0.5, + 4.5, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + + + recHitTime = ibooker.book1D("recHit time", title + " time in the recHits; t (ns)", 500, -25, 25); + +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).planeName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).channelName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); + + CTPPSDiamondDetId(id).channelName(title, CTPPSDiamondDetId::nFull); + recHitTime = ibooker.book1D("recHit Time", title + " recHit Time; t (ns)", 500, -25, 25); + +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::DiamondSampicCalibrationDQMSource(const edm::ParameterSet &ps) + :tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + geomEsToken_(esConsumes()), + verbosity_(ps.getUntrackedParameter("verbosity", 0)), + timeOfPreviousEvent_(0) {} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::~DiamondSampicCalibrationDQMSource() {} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) { + // Get detector shifts from the geometry (if present) + const auto& geom = iSetup.getData(geomEsToken_); + for(auto it=geom.beginSensor();it!=geom.endSensor();it++){ + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + + const DetGeomDesc *det = geom.sensorNoThrow(detid); + if(det) + horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth; + else + edm::LogProblem("DiamondSampicCalibrationDQMSource") <<"ERROR: no descriptor for detId"; + } +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &iSetup) { + ibooker.cd(); + ibooker.setCurrentFolder("CTPPS"); + + globalPlot_ = GlobalPlots(ibooker); + const auto& geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + + const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp()); + potPlots_[rpId] = PotPlots(ibooker, rpId); + + const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(),detid.plane()); + planePlots_[plId] = PlanePlots(ibooker, plId); + + const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(),detid.plane(),detid.channel()); + channelPlots_[chId] = ChannelPlots(ibooker, chId); + } +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { + // get event setup data + edm::Handle> timingRecHits; + event.getByToken(tokenRecHit_, timingRecHits); + + // Using TotemTimingDigi + std::set boardSet; + std::unordered_map channelsPerPlane; + std::unordered_map channelsPerPlaneWithTime; + + // End digis + + for (const auto &rechits : *timingRecHits) { + const CTPPSDiamondDetId detId(rechits.detId()); + CTPPSDiamondDetId detId_pot(rechits.detId()); + detId_pot.setPlane(0); + detId_pot.setChannel(0); + CTPPSDiamondDetId detId_plane(rechits.detId()); + detId_plane.setChannel(0); + + for (const auto &rechit : rechits) { + if (potPlots_.find(detId_pot) != potPlots_.end()) { + + float UFSDShift = 0.0; + if (rechit.yWidth() < 3) + UFSDShift = 0.5; + + TH2F* hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); + TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); + int startBin = hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth()); + int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) + potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin + i)); + + //All plots with Time + if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) { + + potPlots_[detId_pot].recHitTime->Fill(rechit.time()); + + if (channelPlots_.find(detId) != channelPlots_.end()) + channelPlots_[detId].recHitTime->Fill(rechit.time()); + + + } + } + } + } + // End RecHits + + timeOfPreviousEvent_ = event.time().value(); +} + +DEFINE_FWK_MODULE(DiamondSampicCalibrationDQMSource); From 9505c7d11971fc558a7b07613c75b0c2d4a1fa4f Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Aug 2021 14:31:34 +0200 Subject: [PATCH 146/923] style and format applied --- ...mondSampicTimingCalibrationPCLHarvester.cc | 91 +++++++++---------- ...DiamondSampicTimingCalibrationPCLWorker.cc | 63 +++++++------ .../DiamondSampicCalibrationDQMSource.cc | 51 +++++------ 3 files changed, 100 insertions(+), 105 deletions(-) diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc index ec107d1bc5b5e..c5459576c1821 100644 --- a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc @@ -69,20 +69,21 @@ class PPSDiamondSampicTimingCalibrationPCLHarvester : public DQMEDHarvester { //------------------------------------------------------------------------------ -PPSDiamondSampicTimingCalibrationPCLHarvester::PPSDiamondSampicTimingCalibrationPCLHarvester(const edm::ParameterSet& iConfig) +PPSDiamondSampicTimingCalibrationPCLHarvester::PPSDiamondSampicTimingCalibrationPCLHarvester( + const edm::ParameterSet& iConfig) : geomEsToken_(esConsumes()), dqmDir_(iConfig.getParameter("dqmDir")), min_entries_(iConfig.getParameter("minEntries")), - jsonCalibFile_(iConfig.getParameter("jsonCalibFile")){ - - if(jsonCalibFile_=="") - timingCalibrationToken_=esConsumes(edm::ESInputTag(iConfig.getParameter("timingCalibrationTag"))); + jsonCalibFile_(iConfig.getParameter("jsonCalibFile")) { + if (jsonCalibFile_.empty()) + timingCalibrationToken_ = esConsumes( + edm::ESInputTag(iConfig.getParameter("timingCalibrationTag"))); } //------------------------------------------------------------------------------ void PPSDiamondSampicTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - if(jsonCalibFile_=="") + if (jsonCalibFile_.empty()) hTimingCalib_ = iSetup.getHandle(timingCalibrationToken_); const auto& geom = iSetup.getData(geomEsToken_); for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { @@ -96,43 +97,42 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRu //------------------------------------------------------------------------------ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibJson(DQMStore::IGetter& iGetter) { - Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; std::string ch_name; pt::ptree node; pt::read_json(jsonCalibFile_, node); const std::string formula = node.get("formula"); - + for (const auto& detid : detids_) { detid.channelName(ch_name); const auto chid = detid.rawId(); - - hists.db[chid]=iGetter.get(dqmDir_+"/"+ch_name+"db"); - hists.sampic[chid]=iGetter.get(dqmDir_+"/"+ch_name+"sampic"); - hists.channel[chid]=iGetter.get(dqmDir_+"/"+ch_name+"channel"); - + + hists.db[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "db"); + hists.sampic[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "sampic"); + hists.channel[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "channel"); + int db = hists.db[chid]->getIntValue(); int sampic = hists.sampic[chid]->getIntValue(); int channel = hists.channel[chid]->getIntValue(); - if(!node.get_child_optional("parameters."+ std::to_string(db))){ + if (!node.get_child_optional("parameters." + std::to_string(db))) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "db "<("time_offset"); - hists.timeHisto[chid] = iGetter.get(dqmDir_+"/"+ch_name); + hists.timeHisto[chid] = iGetter.get(dqmDir_ + "/" + ch_name); if (hists.timeHisto[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve time monitor for detid" << detid; - par.second.put("time_offset",old_time_offset); + par.second.put("time_offset", old_time_offset); continue; } @@ -140,24 +140,23 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibJson(DQMStore::IGetter& edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Not enough entries for channel (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " << min_entries_ << ". Skipping calibration."; - par.second.put("time_offset",old_time_offset); + par.second.put("time_offset", old_time_offset); continue; } new_time_offset = old_time_offset - hists.timeHisto[chid]->getMean(); - par.second.put("time_offset",new_time_offset); + par.second.put("time_offset", new_time_offset); break; } ct++; } } pt::write_json("adc_offsets_prec.cal.json", node); - } //------------------------------------------------------------------------------ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& iGetter) { - PPSTimingCalibration calib=*hTimingCalib_; + PPSTimingCalibration calib = *hTimingCalib_; // book the parameters containers PPSTimingCalibration::ParametersMap params; @@ -165,27 +164,27 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& i Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; std::string ch_name; - const std::string formula = calib.formula(); + const std::string& formula = calib.formula(); for (const auto& detid : detids_) { detid.channelName(ch_name); const auto chid = detid.rawId(); - hists.db[chid]=iGetter.get(dqmDir_+"/"+ch_name+"db"); + hists.db[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "db"); if (hists.db[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve db for detid: " << detid; continue; } - hists.sampic[chid]=iGetter.get(dqmDir_+"/"+ch_name+"sampic"); + hists.sampic[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "sampic"); if (hists.sampic[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve sampic for detid: " << detid; continue; } - hists.channel[chid]=iGetter.get(dqmDir_+"/"+ch_name+"channel"); + hists.channel[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "channel"); if (hists.channel[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve channel hwId for detid: " << detid; @@ -197,32 +196,30 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& i int channel = hists.channel[chid]->getIntValue(); PPSTimingCalibration::Key key; - key.db =db; - key.sampic=sampic; - key.channel=channel; + key.db = db; + key.sampic = sampic; + key.channel = channel; - double timeOffset=calib.timeOffset(db,sampic,channel); - double timePrecision=calib.timePrecision(db,sampic,channel); - if(timeOffset==0&&timePrecision==0){ + double timeOffset = calib.timeOffset(db, sampic, channel); + double timePrecision = calib.timePrecision(db, sampic, channel); + if (timeOffset == 0 && timePrecision == 0) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "No calibration found for db: "< 0 && hists.timeHisto[chid]->getEntries() < min_entries_) { edm::LogInfo("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Not enough entries (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " - << min_entries_ << ". Skipping calibration."; + << "Not enough entries (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " << min_entries_ + << ". Skipping calibration."; continue; } double new_time_offset = timeOffset - hists.timeHisto[chid]->getMean(); time_info[key] = {new_time_offset, timePrecision}; - } - auto calibPPS=PPSTimingCalibration(formula, params, time_info); + auto calibPPS = PPSTimingCalibration(formula, params, time_info); // write the object edm::Service poolDbService; poolDbService->writeOne(&calibPPS, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); - } //------------------------------------------------------------------------------ @@ -253,11 +248,10 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& i void PPSDiamondSampicTimingCalibrationPCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { iBooker.cd(); iBooker.setCurrentFolder(dqmDir_); - if(jsonCalibFile_=="") + if (jsonCalibFile_.empty()) calibDb(iGetter); else calibJson(iGetter); - } //------------------------------------------------------------------------------ @@ -270,7 +264,8 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::fillDescriptions(edm::Config ->setComment("input path for the various DQM plots"); desc.add("minEntries", 1)->setComment("minimal number of hits to extract calibration"); desc.add("jsonCalibFile", "") - ->setComment("input path for json file containing calibration, if none, calibration will be obtained from db instead"); + ->setComment( + "input path for json file containing calibration, if none, calibration will be obtained from db instead"); descriptions.add("PPSDiamondSampicTimingCalibrationPCLHarvester", desc); } diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc index a4f9eb0547546..0977c03f6ee08 100644 --- a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc @@ -42,10 +42,10 @@ struct Histograms_PPSDiamondSampicTimingCalibrationPCLWorker { std::unordered_map db; std::unordered_map sampic; std::unordered_map channel; - }; -class PPSDiamondSampicTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer { +class PPSDiamondSampicTimingCalibrationPCLWorker + : public DQMGlobalEDAnalyzer { public: explicit PPSDiamondSampicTimingCalibrationPCLWorker(const edm::ParameterSet&); ~PPSDiamondSampicTimingCalibrationPCLWorker() override; @@ -58,10 +58,12 @@ class PPSDiamondSampicTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer > totemTimingDigiToken_; + edm::EDGetTokenT> totemTimingDigiToken_; edm::EDGetTokenT> totemTimingRecHitToken_; edm::ESGetToken geomEsToken_; std::string folder_; @@ -70,8 +72,10 @@ class PPSDiamondSampicTimingCalibrationPCLWorker : public DQMGlobalEDAnalyzer >(iConfig.getParameter("totemTimingDigiTag"))), - totemTimingRecHitToken_(consumes>(iConfig.getParameter("totemTimingRecHitTag"))), + : totemTimingDigiToken_( + consumes>(iConfig.getParameter("totemTimingDigiTag"))), + totemTimingRecHitToken_( + consumes>(iConfig.getParameter("totemTimingRecHitTag"))), geomEsToken_(esConsumes()), folder_(iConfig.getParameter("folder")) {} @@ -79,18 +83,18 @@ PPSDiamondSampicTimingCalibrationPCLWorker::~PPSDiamondSampicTimingCalibrationPC //------------------------------------------------------------------------------ -void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze(edm::Event const& iEvent, - edm::EventSetup const& iSetup, - Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const& histos) const { - edm::Handle< edm::DetSetVector > timingDigi; - edm::Handle< edm::DetSetVector > timingRecHit; - iEvent.getByToken( totemTimingRecHitToken_, timingRecHit ); - iEvent.getByToken( totemTimingDigiToken_, timingDigi ); - +void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze( + edm::Event const& iEvent, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const& histos) const { + edm::Handle> timingDigi; + edm::Handle> timingRecHit; + iEvent.getByToken(totemTimingRecHitToken_, timingRecHit); + iEvent.getByToken(totemTimingDigiToken_, timingDigi); - for (const auto& digis : *timingDigi){ + for (const auto& digis : *timingDigi) { const CTPPSDiamondDetId detId(digis.detId()); - for (const auto& digi : digis ){ + for (const auto& digi : digis) { histos.db.at(detId.rawId())->Fill(digi.hardwareBoardId()); histos.sampic.at(detId.rawId())->Fill(digi.hardwareSampicId()); histos.channel.at(detId.rawId())->Fill(digi.hardwareChannelId()); @@ -98,24 +102,25 @@ void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze(edm::Event const& iE } if (timingRecHit->empty()) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") << "No rechits retrieved from the event content."; + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") + << "No rechits retrieved from the event content."; return; } for (const auto& recHits : *timingRecHit) { - const CTPPSDiamondDetId detId( recHits.detId() ); - for (const auto& recHit : recHits ) - histos.timeHisto.at(detId.rawId())->Fill( recHit.time() ); - + const CTPPSDiamondDetId detId(recHits.detId()); + for (const auto& recHit : recHits) + histos.timeHisto.at(detId.rawId())->Fill(recHit.time()); } } //------------------------------------------------------------------------------ -void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms(DQMStore::IBooker& ibook, - edm::Run const& run, - edm::EventSetup const& iSetup, - Histograms_PPSDiamondSampicTimingCalibrationPCLWorker& histos) const { +void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms( + DQMStore::IBooker& ibook, + edm::Run const& run, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker& histos) const { ibook.setCurrentFolder(folder_); std::string ch_name; const auto& geom = iSetup.getData(geomEsToken_); @@ -124,10 +129,10 @@ void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms(DQMStore::IBooke continue; const CTPPSDiamondDetId detid(it->first); detid.channelName(ch_name); - histos.timeHisto[detid.rawId()]=ibook.book1D(ch_name, ch_name, 1200,-40,40); - histos.db[detid.rawId()]=ibook.bookInt(ch_name+"db"); - histos.sampic[detid.rawId()]=ibook.bookInt(ch_name+"sampic"); - histos.channel[detid.rawId()]=ibook.bookInt(ch_name+"channel"); + histos.timeHisto[detid.rawId()] = ibook.book1D(ch_name, ch_name, 1200, -40, 40); + histos.db[detid.rawId()] = ibook.bookInt(ch_name + "db"); + histos.sampic[detid.rawId()] = ibook.bookInt(ch_name + "sampic"); + histos.channel[detid.rawId()] = ibook.bookInt(ch_name + "channel"); } } diff --git a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc index 94c06108bad0c..ea2c0aace6127 100644 --- a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc +++ b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc @@ -64,14 +64,13 @@ class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { // (in mm) static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - edm::EDGetTokenT> tokenRecHit_; edm::ESGetToken geomEsToken_; unsigned int verbosity_; edm::TimeValue_t timeOfPreviousEvent_; float verticalShiftBot_, verticalShiftTop_; - std::unordered_map horizontalShiftOfDiamond_; + std::unordered_map horizontalShiftOfDiamond_; /// plots related to the whole system struct GlobalPlots { @@ -83,7 +82,6 @@ class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { /// plots related to one Diamond detector package struct PotPlots { - // RecHits MonitorElement *hitDistribution2d = nullptr; MonitorElement *recHitTime = nullptr; @@ -118,7 +116,8 @@ class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { // Values for all constants const double DiamondSampicCalibrationDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05; -const double DiamondSampicCalibrationDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; +const double DiamondSampicCalibrationDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = + 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; //---------------------------------------------------------------------------------------------------- @@ -135,7 +134,6 @@ DiamondSampicCalibrationDQMSource::PotPlots::PotPlots(DQMStore::IBooker &ibooker CTPPSDiamondDetId(id).rpName(title, CTPPSDiamondDetId::nFull); - hitDistribution2d = ibooker.book2D("hits in planes", title + " hits in planes;plane number;x (mm)", 10, @@ -145,9 +143,7 @@ DiamondSampicCalibrationDQMSource::PotPlots::PotPlots(DQMStore::IBooker &ibooker -0.5, 18.5); - recHitTime = ibooker.book1D("recHit time", title + " time in the recHits; t (ns)", 500, -25, 25); - } //---------------------------------------------------------------------------------------------------- @@ -167,13 +163,12 @@ DiamondSampicCalibrationDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker CTPPSDiamondDetId(id).channelName(title, CTPPSDiamondDetId::nFull); recHitTime = ibooker.book1D("recHit Time", title + " recHit Time; t (ns)", 500, -25, 25); - } //---------------------------------------------------------------------------------------------------- DiamondSampicCalibrationDQMSource::DiamondSampicCalibrationDQMSource(const edm::ParameterSet &ps) - :tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + : tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), geomEsToken_(esConsumes()), verbosity_(ps.getUntrackedParameter("verbosity", 0)), timeOfPreviousEvent_(0) {} @@ -186,28 +181,30 @@ DiamondSampicCalibrationDQMSource::~DiamondSampicCalibrationDQMSource() {} void DiamondSampicCalibrationDQMSource::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) { // Get detector shifts from the geometry (if present) - const auto& geom = iSetup.getData(geomEsToken_); - for(auto it=geom.beginSensor();it!=geom.endSensor();it++){ + const auto &geom = iSetup.getData(geomEsToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); it++) { if (!CTPPSDiamondDetId::check(it->first)) continue; const CTPPSDiamondDetId detid(it->first); const DetGeomDesc *det = geom.sensorNoThrow(detid); - if(det) + if (det) horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth; else - edm::LogProblem("DiamondSampicCalibrationDQMSource") <<"ERROR: no descriptor for detId"; + edm::LogProblem("DiamondSampicCalibrationDQMSource") << "ERROR: no descriptor for detId"; } } //---------------------------------------------------------------------------------------------------- -void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &iSetup) { +void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooker, + const edm::Run &, + const edm::EventSetup &iSetup) { ibooker.cd(); ibooker.setCurrentFolder("CTPPS"); globalPlot_ = GlobalPlots(ibooker); - const auto& geom = iSetup.getData(geomEsToken_); + const auto &geom = iSetup.getData(geomEsToken_); for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { if (!CTPPSDiamondDetId::check(it->first)) continue; @@ -216,10 +213,10 @@ void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooke const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp()); potPlots_[rpId] = PotPlots(ibooker, rpId); - const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(),detid.plane()); + const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(), detid.plane()); planePlots_[plId] = PlanePlots(ibooker, plId); - const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(),detid.plane(),detid.channel()); + const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel()); channelPlots_[chId] = ChannelPlots(ibooker, chId); } } @@ -248,27 +245,25 @@ void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const e for (const auto &rechit : rechits) { if (potPlots_.find(detId_pot) != potPlots_.end()) { - float UFSDShift = 0.0; if (rechit.yWidth() < 3) - UFSDShift = 0.5; + UFSDShift = 0.5; - TH2F* hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); - TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - int startBin = hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth()); + TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); + TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); + int startBin = + hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth()); int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) - potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin + i)); + for (int i = 0; i < numOfBins; ++i) + potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift, + hitHistoTmpYAxis->GetBinCenter(startBin + i)); //All plots with Time if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) { - potPlots_[detId_pot].recHitTime->Fill(rechit.time()); - + if (channelPlots_.find(detId) != channelPlots_.end()) channelPlots_[detId].recHitTime->Fill(rechit.time()); - - } } } From 3939a2f6874c1288ccbb41798b805c40335b0afa Mon Sep 17 00:00:00 2001 From: swmukher Date: Thu, 26 Aug 2021 15:09:28 +0200 Subject: [PATCH 147/923] using hcal topology properly --- .../plugins/EgammaHLTHcalVarProducerFromRecHit.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index cb8fb1740de82..da4e4f152d6c0 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -88,7 +88,7 @@ EgammaHLTHcalVarProducerFromRecHit::EgammaHLTHcalVarProducerFromRecHit(const edm : edm::EDGetTokenT()), caloGeometryToken_{esConsumes()}, hcalTopologyToken_{esConsumes()}, - hcalChannelQualityToken_{esConsumes()}, + hcalChannelQualityToken_{esConsumes(edm::ESInputTag("", "withTopo"))}, hcalSevLvlComputerToken_{esConsumes()}, caloTowerConstituentsMapToken_{esConsumes()}, putToken_{produces()} { @@ -114,6 +114,7 @@ void EgammaHLTHcalVarProducerFromRecHit::fillDescriptions(edm::ConfigurationDesc desc.add(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate")); desc.add(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo")); + desc.add(("hbheRecHitsTag"), edm::InputTag("hltHbhereco")); desc.add(("doRhoCorrection"), false); desc.add(("rhoMax"), 999999.); desc.add(("rhoScale"), 1.0); From 35da6f2cdea29c86766eee8e5c9e5762e8b18251 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Aug 2021 15:20:37 +0200 Subject: [PATCH 148/923] add missing dependency --- CalibPPS/TimingCalibration/plugins/BuildFile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/CalibPPS/TimingCalibration/plugins/BuildFile.xml b/CalibPPS/TimingCalibration/plugins/BuildFile.xml index b67b7d23683d5..83f19f4dc0ff3 100644 --- a/CalibPPS/TimingCalibration/plugins/BuildFile.xml +++ b/CalibPPS/TimingCalibration/plugins/BuildFile.xml @@ -6,4 +6,5 @@ + From d7742ff255044951d6176cc0a4ae7fa15e48d737 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 25 Aug 2021 21:49:57 +0200 Subject: [PATCH 149/923] Remove redundant PhotonEnergyCorrector::init() call from GEDPhotonProducer::beginRun() It is called unconditionally from GEDPhotonProducer::produce(), I can not see how the call from beginRun() could do anything additional except it would require different set ESGetTokens wihtin PhotonEnergyCorrector etc compared to other users. --- RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 8b80e31f244fd..6f953ca768599 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -51,8 +51,6 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { public: GEDPhotonProducer(const edm::ParameterSet& ps); - void beginRun(edm::Run const& r, edm::EventSetup const& es) final; - void endRun(edm::Run const&, edm::EventSetup const&) final {} void produce(edm::Event& evt, const edm::EventSetup& es) override; private: @@ -360,12 +358,6 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) } } -void GEDPhotonProducer::beginRun(edm::Run const& r, edm::EventSetup const& eventSetup) { - if (!recoStep_.isFinal()) { - photonEnergyCorrector_->init(eventSetup); - } -} - void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eventSetup) { using namespace edm; From cb85cb1034ccb4e7b6492915c000c932a3de38d2 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 26 Aug 2021 10:12:45 -0500 Subject: [PATCH 150/923] Add empty container to Event if there was a problem. --- .../SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc | 6 ++++-- RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc index 7ddd77b57eed5..2d173c32e1b35 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.cc @@ -99,9 +99,10 @@ void SoftPFElectronTagInfoProducer::produce(edm::StreamID, edm::Event& iEvent, c const auto& transientTrackBuilder = iSetup.getData(token_builder); edm::Handle PVCollection = iEvent.getHandle(token_primaryVertex); - if (!PVCollection.isValid()) + if (!PVCollection.isValid()) { + iEvent.emplace(token_put, std::move(theElecTagInfo)); return; - + } reco::ConversionCollection const& hConversions = iEvent.get(token_allConversions); edm::View const& theJetCollection = iEvent.get(token_jets); @@ -110,6 +111,7 @@ void SoftPFElectronTagInfoProducer::produce(edm::StreamID, edm::Event& iEvent, c if (PVCollection->empty() and not theJetCollection.empty() and not theGEDGsfElectronCollection.empty()) { //we would need to access a vertex from the collection but there isn't one. + iEvent.emplace(token_put, std::move(theElecTagInfo)); return; } diff --git a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc index 1e1d7bf554c08..f81ec88868025 100644 --- a/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc +++ b/RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.cc @@ -112,8 +112,10 @@ void SoftPFMuonTagInfoProducer::produce(edm::StreamID, edm::Event& iEvent, const // Declare and open Vertex collection edm::Handle theVertexCollection = iEvent.getHandle(vertexToken); - if (!theVertexCollection.isValid() || theVertexCollection->empty()) + if (!theVertexCollection.isValid() || theVertexCollection->empty()) { + iEvent.emplace(putToken, std::move(theMuonTagInfo)); return; + } const reco::Vertex* vertex = &theVertexCollection->front(); // Build TransientTrackBuilder From 6e29cd397ac0ded29170c317b02e7c14fff94204 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Aug 2021 22:20:02 +0200 Subject: [PATCH 151/923] fix typo in harvester cff --- .../python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py index dc18556b0324a..474c4d2db5e8a 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * -from CalibPPS.TimingCalibration.ppsDiamondSampicTimingCalibrationPCLHarvester_cfi import * +from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi import * From 6fce9dd36b7fc4cd3ae5999bb3e9da1a83372371 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 26 Aug 2021 22:21:49 +0200 Subject: [PATCH 152/923] Add a utility function to print all solids with their shape type --- .../python/printGeomSolids_cff.py | 9 ++ .../PrintGeomInfo/src/PrintGeomSolids.cc | 92 +++++++++++++++++++ .../test/python/runPrintSolid_cfg.py | 51 ++++++++++ 3 files changed, 152 insertions(+) create mode 100644 SimG4Core/PrintGeomInfo/python/printGeomSolids_cff.py create mode 100644 SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc create mode 100644 SimG4Core/PrintGeomInfo/test/python/runPrintSolid_cfg.py diff --git a/SimG4Core/PrintGeomInfo/python/printGeomSolids_cff.py b/SimG4Core/PrintGeomInfo/python/printGeomSolids_cff.py new file mode 100644 index 0000000000000..ec2486253cd81 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/python/printGeomSolids_cff.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms + +from SimG4Core.PrintGeomInfo.printGeomSolids_cfi import * + +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep + +dd4hep.toModify(printGeomSolids, + fromDD4Hep = cms.bool(True), +) diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc new file mode 100644 index 0000000000000..6edaef313eedb --- /dev/null +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc @@ -0,0 +1,92 @@ +// system include files +#include +#include + +// 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 "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/Core/interface/DDSolid.h" +#include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" +#include "DetectorDescription/DDCMS/interface/DDDetector.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "DD4hep/Detector.h" +#include "DD4hep/DD4hepRootPersistency.h" + +#include "TGeoManager.h" +#include "TFile.h" +#include "TSystem.h" + +class PrintGeomSolids : public edm::one::EDAnalyzer<> { +public: + explicit PrintGeomSolids(const edm::ParameterSet&); + ~PrintGeomSolids() override {} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; + +private: + edm::ESGetToken cpvTokenDDD_; + edm::ESGetToken cpvTokenDD4Hep_; + bool fromDD4Hep_; +}; + +PrintGeomSolids::PrintGeomSolids(const edm::ParameterSet& ps) { + fromDD4Hep_ = ps.getParameter("fromDD4Hep"); + if (fromDD4Hep_) + cpvTokenDD4Hep_ = esConsumes(edm::ESInputTag()); + else + cpvTokenDDD_ = esConsumes(edm::ESInputTag()); + + edm::LogVerbatim("PrintGeom") << "PrintGeomSolids created with dd4hep: " << fromDD4Hep_; +} + +void PrintGeomSolids::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("fromDD4Hep", false); + descriptions.add("printGeomSolids", desc); +} + +void PrintGeomSolids::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + int solids(0); + if (fromDD4Hep_) { + edm::ESTransientHandle cpv = iSetup.getTransientHandle(cpvTokenDD4Hep_); + const cms::DDDetector* det = cpv->detector(); + TGeoManager const& geom = det->description()->manager(); + TGeoIterator next(geom.GetTopVolume()); + TGeoNode *node; + TString path; + std::vector names; + while (( node = next())) { + next.GetPath( path ); + std::string name = static_cast(node->GetVolume()->GetName()); + if (std::find(names.begin(), names.end(), name) == names.end()) { + edm::LogVerbatim("PrintGeom") << name << " " << static_cast(node->GetVolume()->GetShape()->GetTitle()); + names.emplace_back(name); + ++solids; + } + } + + } else { + edm::ESTransientHandle cpv = iSetup.getTransientHandle(cpvTokenDDD_); + const auto& gra = cpv->graph(); + for (DDCompactView::Graph::const_adj_iterator git = gra.begin(); git != gra.end(); ++git) { + const DDLogicalPart& ddLP = gra.nodeData(git); + const DDSolid& solid = ddLP.solid(); + edm::LogVerbatim("PrintGeom") << solid.name() << " " << DDSolidShapesName::name(solid.shape()); + ++solids; + } + } + edm::LogVerbatim("PrintGeom") << "\n\nPrintGeomSolids finds " << solids << " solids"; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(PrintGeomSolids); diff --git a/SimG4Core/PrintGeomInfo/test/python/runPrintSolid_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runPrintSolid_cfg.py new file mode 100644 index 0000000000000..bb9e7a06455f3 --- /dev/null +++ b/SimG4Core/PrintGeomInfo/test/python/runPrintSolid_cfg.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('G4PrintGeometry',Run3) +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') + +#from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +#process = cms.Process('G4PrintGeometry',Run3_dd4hep) +#process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') + +process.load('SimGeneral.HepPDTESSource.pdt_cfi') + +process.load('IOMC.RandomEngine.IOMC_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi') +process.load('GeneratorInterface.Core.generatorSmeared_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('SimG4Core.Application.g4SimHits_cfi') +process.load('SimG4Core.PrintGeomInfo.printGeomSolids_cff') + +if hasattr(process,'MessageLogger'): + process.MessageLogger.G4cout=dict() + process.MessageLogger.G4cerr=dict() + process.MessageLogger.PrintGeom=dict() + +process.source = cms.Source("EmptySource") + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(14), + MinEta = cms.double(-3.5), + MaxEta = cms.double(3.5), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(9.99), + MaxE = cms.double(10.01) + ), + AddAntiParticle = cms.bool(False), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.DefaultCutValue = 10. + +process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.printGeomSolids) From 7b9041bf0b38c24b885e4fb6d6ff2f56edde8d57 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 26 Aug 2021 22:38:20 +0200 Subject: [PATCH 153/923] Code check --- SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc index 6edaef313eedb..9dcba9809f383 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc @@ -62,16 +62,17 @@ void PrintGeomSolids::analyze(const edm::Event& iEvent, const edm::EventSetup& i const cms::DDDetector* det = cpv->detector(); TGeoManager const& geom = det->description()->manager(); TGeoIterator next(geom.GetTopVolume()); - TGeoNode *node; + TGeoNode* node; TString path; std::vector names; - while (( node = next())) { - next.GetPath( path ); + while ((node = next())) { + next.GetPath(path); std::string name = static_cast(node->GetVolume()->GetName()); if (std::find(names.begin(), names.end(), name) == names.end()) { - edm::LogVerbatim("PrintGeom") << name << " " << static_cast(node->GetVolume()->GetShape()->GetTitle()); - names.emplace_back(name); - ++solids; + edm::LogVerbatim("PrintGeom") << name << " " + << static_cast(node->GetVolume()->GetShape()->GetTitle()); + names.emplace_back(name); + ++solids; } } From 081ca1b545208602a4f5e46a120847c06be4a462 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 27 Aug 2021 01:30:43 +0200 Subject: [PATCH 154/923] fix typo in alca harvesting --- Configuration/StandardSequences/python/AlCaHarvesting_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index b5bc4fa2773dd..65840d8687250 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -224,7 +224,7 @@ timetype = cms.untracked.string('lumiid') ) -ALCAHARVESTPPSDiamondSampicTimingCalibration = ppsDiamondSampicTimingCalibrationPCLHarvester.clone() +ALCAHARVESTPPSDiamondSampicTimingCalibration = PPSDiamondSampicTimingCalibrationPCLHarvester.clone() ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), tag = cms.string('DiamondSampicCalibration'), From ad771a6b281bde6690cd441a262ab44989ca28c1 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 27 Aug 2021 03:30:55 +0200 Subject: [PATCH 155/923] Set numberOfConcurrentLuminosityBlocks to 1 for ALCA sequences that have EDModules that are not going to support concurrent lumis --- Configuration/AlCa/python/autoAlca.py | 8 ++++++++ Configuration/Applications/python/ConfigBuilder.py | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/autoAlca.py b/Configuration/AlCa/python/autoAlca.py index ab1eec7399b72..51f166826ffe7 100644 --- a/Configuration/AlCa/python/autoAlca.py +++ b/Configuration/AlCa/python/autoAlca.py @@ -124,3 +124,11 @@ def buildList(pdList, matrix): 'allForPromptCosmics' : buildList(['Cosmics'], AlCaRecoMatrix), 'allForExpressCosmics' : buildList(['ExpressCosmics'], AlCaRecoMatrix) } autoAlca.update(AlCaRecoMatrix) + +# list of AlCa sequences that have modules that do not support concurrent LuminosityBlocks +AlCaNoConcurrentLumis = [ + 'PromptCalibProd', # AlcaBeamSpotProducer + 'PromptCalibProdSiPixelAli', # AlignmentProducerAsAnalyzer, MillePedeFileConverter + 'PromptCalibProdBeamSpotHP', # AlcaBeamSpotProducer + 'PromptCalibProdBeamSpotHPLowPU', # AlcaBeamSpotProducer +] diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index ab050086b91ab..f87fe67ec4ce7 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -1275,7 +1275,7 @@ def prepare_ALCA(self, sequence = None, workflow = 'full'): # decide which ALCA paths to use alcaList = sequence.split("+") maxLevel=0 - from Configuration.AlCa.autoAlca import autoAlca + from Configuration.AlCa.autoAlca import autoAlca, AlCaNoConcurrentLumis # support @X from autoAlca.py, and recursion support: i.e T0:@Mu+@EG+... self.expandMapping(alcaList,autoAlca) self.AlCaPaths=[] @@ -1283,6 +1283,10 @@ def prepare_ALCA(self, sequence = None, workflow = 'full'): alcastream = getattr(alcaConfig,name) shortName = name.replace('ALCARECOStream','') if shortName in alcaList and isinstance(alcastream,cms.FilteredStream): + if shortName in AlCaNoConcurrentLumis: + print("Setting numberOfConcurrentLuminosityBlocks=1 because of AlCa sequence {}".format(shortName)) + self._options.nConcurrentLumis = "1" + self._options.nConcurrentIOVs = "1" output = self.addExtraStream(name,alcastream, workflow = workflow) self.executeAndRemember('process.ALCARECOEventContent.outputCommands.extend(process.OutALCARECO'+shortName+'_noDrop.outputCommands)') self.AlCaPaths.append(shortName) From b876620bfdce702e98e895924ae67b18115ce37a Mon Sep 17 00:00:00 2001 From: Srecko Morovic Date: Fri, 27 Aug 2021 09:18:13 +0200 Subject: [PATCH 156/923] ensure bx width of only 12 bits is applied when shifting to avoid UBSAN warning. --- DataFormats/FEDRawData/src/FEDHeader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataFormats/FEDRawData/src/FEDHeader.cc b/DataFormats/FEDRawData/src/FEDHeader.cc index d92b1a2db6713..9faded6cce9a4 100644 --- a/DataFormats/FEDRawData/src/FEDHeader.cc +++ b/DataFormats/FEDRawData/src/FEDHeader.cc @@ -34,8 +34,8 @@ void FEDHeader::set(unsigned char* header, h->eventid = (FED_SLINK_START_MARKER << FED_HCTRLID_SHIFT) | ((triggerType << FED_EVTY_SHIFT) & FED_EVTY_MASK) | ((lvl1ID << FED_LVL1_SHIFT) & FED_LVL1_MASK); - h->sourceid = ((bxID << FED_BXID_SHIFT) & FED_BXID_MASK) | ((sourceID << FED_SOID_SHIFT) & FED_SOID_MASK) | - ((version << FED_VERSION_SHIFT) & FED_VERSION_MASK); + h->sourceid = (((bxID & FED_BXID_WIDTH) << FED_BXID_SHIFT) & FED_BXID_MASK) | + ((sourceID << FED_SOID_SHIFT) & FED_SOID_MASK) | ((version << FED_VERSION_SHIFT) & FED_VERSION_MASK); if (moreHeaders) h->sourceid |= (FED_MORE_HEADERS_WIDTH << FED_MORE_HEADERS_SHIFT); From 718e0d828450eba7c130807efbe659e252d1f5ae Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 27 Aug 2021 09:48:53 +0200 Subject: [PATCH 157/923] pixel unpacking for Run3 --- .../interface/CTPPSPixelDataFormatter.h | 8 +-- .../interface/CTPPSPixelRawToDigi.h | 1 + .../plugins/CTPPSPixelDigiToRaw.cc | 6 +- .../plugins/CTPPSPixelRawToDigi.cc | 4 +- .../python/ctppsRawToDigi_cff.py | 5 ++ .../src/CTPPSPixelDataFormatter.cc | 67 ++++++++++++++----- 6 files changed, 70 insertions(+), 21 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h index dcc0a9c2248a2..f54be4ac9b9c0 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h @@ -71,7 +71,7 @@ class CTPPSPixelDataFormatter { int nWords() const { return m_WordCounter; } - void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); + void interpretRawData(bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); int nDigis() const { return m_DigiCounter; } @@ -83,7 +83,7 @@ class CTPPSPixelDataFormatter { short unsigned int fedch; }; - void formatRawData(unsigned int lvl1_ID, + void formatRawData(bool& isRun3, unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector v_iDdet2fed); @@ -98,8 +98,8 @@ class CTPPSPixelDataFormatter { bool m_IncludeErrors; RPixErrorChecker m_ErrorCheck; - int m_ADC_shift, m_PXID_shift, m_DCOL_shift, m_ROC_shift, m_LINK_shift; - Word32 m_LINK_mask, m_ROC_mask, m_DCOL_mask, m_PXID_mask, m_ADC_mask; + int m_ADC_shift, m_PXID_shift, m_DCOL_shift, m_ROC_shift, m_LINK_shift, m_COL_shift, m_ROW_shift; + Word32 m_LINK_mask, m_ROC_mask, m_DCOL_mask, m_PXID_mask, m_ADC_mask, m_COL_mask, m_ROW_mask; int checkError(const Word32& data) const; diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h index 12604c610320f..679638680fec1 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h @@ -44,5 +44,6 @@ class CTPPSPixelRawToDigi : public edm::stream::EDProducer<> { std::string mappingLabel_; bool includeErrors_; + bool isRun3_; }; #endif diff --git a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc index 38461b1de90c4..0907d376bea02 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc @@ -82,6 +82,7 @@ class CTPPSPixelDigiToRaw : public edm::stream::EDProducer<> { edm::ESGetToken tCTPPSPixelDAQMapping_; std::vector v_iDdet2fed_; CTPPSPixelFramePosition fPos_; + bool isRun3_; }; // @@ -106,6 +107,8 @@ CTPPSPixelDigiToRaw::CTPPSPixelDigiToRaw(const edm::ParameterSet& iConfig) // Define EDProduct type produces(); + + isRun3_ = iConfig.getParameter("isRun3"); } CTPPSPixelDigiToRaw::~CTPPSPixelDigiToRaw() {} @@ -149,7 +152,7 @@ void CTPPSPixelDigiToRaw::produce(edm::Event& iEvent, const edm::EventSetup& iSe std::sort(v_iDdet2fed_.begin(), v_iDdet2fed_.end(), CTPPSPixelDataFormatter::compare); // convert data to raw - formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_); + formatter.formatRawData(isRun3_, iEvent.id().event(), rawdata, digis, v_iDdet2fed_); // pack raw data into collection for (auto it = fedIds_.begin(); it != fedIds_.end(); it++) { @@ -171,6 +174,7 @@ void CTPPSPixelDigiToRaw::produce(edm::Event& iEvent, const edm::EventSetup& iSe // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void CTPPSPixelDigiToRaw::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("isRun3", true); desc.add("InputLabel", edm::InputTag("RPixDetDigitizer")); desc.add("mappingLabel", "RPix"); descriptions.add("ctppsPixelRawData", desc); diff --git a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc index c0002f2bd2703..9856c37e728cf 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc @@ -30,6 +30,7 @@ CTPPSPixelRawToDigi::CTPPSPixelRawToDigi(const edm::ParameterSet& conf) produces>(); + isRun3_ = config_.getParameter("isRun3"); includeErrors_ = config_.getParameter("includeErrors"); mappingLabel_ = config_.getParameter("mappingLabel"); @@ -44,6 +45,7 @@ CTPPSPixelRawToDigi::~CTPPSPixelRawToDigi() { void CTPPSPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("isRun3", true); desc.add("includeErrors", true); desc.add("inputLabel", edm::InputTag("rawDataCollector")); desc.add("mappingLabel", "RPix"); @@ -89,7 +91,7 @@ void CTPPSPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { /// get event data for this fed const FEDRawData& fedRawData = buffers->FEDData(fedId); - formatter.interpretRawData(errorsInEvent, fedId, fedRawData, *collection, errors); + formatter.interpretRawData(isRun3_, errorsInEvent, fedId, fedRawData, *collection, errors); if (includeErrors_) { for (auto const& is : errors) { diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 9151ec8467804..9b653d246c930 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -113,6 +113,11 @@ from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector") +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 +from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = cms.bool(False) ) + # raw-to-digi task and sequence ctppsRawToDigiTask = cms.Task( totemTriggerRawToDigi, diff --git a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc index b42bf70341085..eae9f3045883c 100644 --- a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc +++ b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc @@ -21,13 +21,20 @@ namespace { constexpr int m_ROC_bits = 5; constexpr int m_DCOL_bits = 5; constexpr int m_PXID_bits = 8; + constexpr int m_COL_bits = 6; + constexpr int m_ROW_bits = 7; constexpr int m_ADC_bits = 8; constexpr int min_Dcol = 0; constexpr int max_Dcol = 25; constexpr int min_Pixid = 2; constexpr int max_Pixid = 161; + constexpr int min_COL = 0; + constexpr int max_COL = 51; + constexpr int min_ROW = 0; + constexpr int max_ROW = 79; constexpr int maxRocIndex = 3; - constexpr int maxLinkIndex = 13; + constexpr int maxLinkIndex = 49; + } // namespace CTPPSPixelDataFormatter::CTPPSPixelDataFormatter(std::map const& mapping) @@ -44,6 +51,10 @@ CTPPSPixelDataFormatter::CTPPSPixelDataFormatter(std::map> m_LINK_shift) & m_LINK_mask; int nroc = (ww >> m_ROC_shift) & m_ROC_mask; - int FMC = 0; uint32_t iD = RPixErrorChecker::dummyDetId; //0xFFFFFFFF; //dummyDetId int convroc = nroc - 1; CTPPSPixelFramePosition fPos(fedId, FMC, nlink, convroc); + std::map::const_iterator mit; mit = m_Mapping.find(fPos); if (mit == m_Mapping.end()) { + if (nlink >= maxLinkIndex) { m_ErrorCheck.conversionError(fedId, iD, InvalidLinkId, ww, errors); } else if ((nroc - 1) >= maxRocIndex) { @@ -161,8 +176,10 @@ void CTPPSPixelDataFormatter::interpretRawData( int dcol = (ww >> m_DCOL_shift) & m_DCOL_mask; int pxid = (ww >> m_PXID_shift) & m_PXID_mask; + int col = (ww >> m_COL_shift) & m_COL_mask; + int row = (ww >> m_ROW_shift) & m_ROW_mask; - if (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) { + if (!isRun3 && (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) ) { edm::LogError("CTPPSPixelDataFormatter") << " unphysical dcol and/or pxid " << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " dcol=" << dcol << " pxid=" << pxid; @@ -171,14 +188,27 @@ void CTPPSPixelDataFormatter::interpretRawData( continue; } + if (isRun3 && (col < min_COL || col > max_COL || row < min_ROW || row > max_ROW) ) { + edm::LogError("CTPPSPixelDataFormatter") + << " unphysical col and/or row " + << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " col=" << col << " row=" << row; - std::pair rocPixel; - std::pair modPixel; + m_ErrorCheck.conversionError(fedId, iD, InvalidPixelId, ww, errors); - rocPixel = std::make_pair(dcol, pxid); + continue; + } - modPixel = rocp.toGlobalfromDcol(rocPixel); + std::pair rocPixel; + std::pair modPixel; + if(isRun3){ + rocPixel = std::make_pair(row, col); + modPixel = rocp.toGlobal(rocPixel); + }else{ + rocPixel = std::make_pair(dcol, pxid); + modPixel = rocp.toGlobalfromDcol(rocPixel); + } + CTPPSPixelDigi testdigi(modPixel.first, modPixel.second, adc); if (detDigis) @@ -186,10 +216,11 @@ void CTPPSPixelDataFormatter::interpretRawData( } } -void CTPPSPixelDataFormatter::formatRawData(unsigned int lvl1_ID, +void CTPPSPixelDataFormatter::formatRawData(bool& isRun3, unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector iDdet2fed) { + std::map > words; // translate digis into 32-bit raw words and store in map indexed by Fed m_allDetDigis = 0; @@ -219,11 +250,17 @@ void CTPPSPixelDataFormatter::formatRawData(unsigned int lvl1_ID, nroc = iDdet2fed.at(i).rocch + 1; pps::pixel::ElectronicIndex cabling = {nlink, nroc, dcol, pxid}; - - cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | - (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | (it.adc() << m_ADC_shift); - - words[iDdet2fed.at(i).fedid].push_back(word); + if(isRun3){ + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (rocPixelColumn << m_COL_shift) | (rocPixelRow << m_ROW_shift) | (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + }else{ + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + } m_WordCounter++; m_hasDetDigis++; From 8f390f0269b056a419b2233eba13954a352df254 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 10:02:50 +0200 Subject: [PATCH 158/923] [GCC11] Fix warning: loop variable binds to temporary --- .../CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc b/Validation/CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc index 365049b8da4bc..8ce73e00c3ced 100644 --- a/Validation/CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc +++ b/Validation/CTPPS/plugins/CTPPSProtonReconstructionPlotter.cc @@ -504,9 +504,9 @@ CTPPSProtonReconstructionPlotter::CTPPSProtonReconstructionPlotter(const edm::Pa p_y_R_diffNF_vs_y_R_N_(new TProfile("p_y_R_diffNF_vs_y_R_N", ";y_{RN};y_{RF} - y_{RN}", 100, -20., +20.)), n_non_empty_events_(0) { - for (const std::string §or : {"45", "56"}) { - const unsigned int arm = (sector == "45") ? 0 : 1; - association_cuts_[arm].load(ps.getParameterSet("association_cuts_" + sector)); + for (auto &§or : {"45", "56"}) { + const unsigned int arm = (sector == string("45")) ? 0 : 1; + association_cuts_[arm].load(ps.getParameterSet(string("association_cuts_") + sector)); } } From d02f7484a059374f9b49b665883a9266bd050cc9 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 27 Aug 2021 10:20:34 +0200 Subject: [PATCH 159/923] code format changes --- .../interface/CTPPSPixelDataFormatter.h | 6 ++- .../src/CTPPSPixelDataFormatter.cc | 45 +++++++++---------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h index f54be4ac9b9c0..83062e6fa96bc 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h @@ -71,7 +71,8 @@ class CTPPSPixelDataFormatter { int nWords() const { return m_WordCounter; } - void interpretRawData(bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); + void interpretRawData( + bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); int nDigis() const { return m_DigiCounter; } @@ -83,7 +84,8 @@ class CTPPSPixelDataFormatter { short unsigned int fedch; }; - void formatRawData(bool& isRun3, unsigned int lvl1_ID, + void formatRawData(bool& isRun3, + unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector v_iDdet2fed); diff --git a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc index eae9f3045883c..b7b024b6b17fa 100644 --- a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc +++ b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc @@ -75,7 +75,8 @@ void CTPPSPixelDataFormatter::setErrorStatus(bool errorStatus) { m_ErrorCheck.setErrorStatus(m_IncludeErrors); } -void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& rawData, Collection& digis, Errors& errors) { +void CTPPSPixelDataFormatter::interpretRawData( + bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& rawData, Collection& digis, Errors& errors) { int nWords = rawData.size() / sizeof(Word64); if (nWords == 0) return; @@ -142,7 +143,6 @@ void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent mit = m_Mapping.find(fPos); if (mit == m_Mapping.end()) { - if (nlink >= maxLinkIndex) { m_ErrorCheck.conversionError(fedId, iD, InvalidLinkId, ww, errors); } else if ((nroc - 1) >= maxRocIndex) { @@ -179,7 +179,7 @@ void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent int col = (ww >> m_COL_shift) & m_COL_mask; int row = (ww >> m_ROW_shift) & m_ROW_mask; - if (!isRun3 && (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) ) { + if (!isRun3 && (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid)) { edm::LogError("CTPPSPixelDataFormatter") << " unphysical dcol and/or pxid " << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " dcol=" << dcol << " pxid=" << pxid; @@ -188,7 +188,7 @@ void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent continue; } - if (isRun3 && (col < min_COL || col > max_COL || row < min_ROW || row > max_ROW) ) { + if (isRun3 && (col < min_COL || col > max_COL || row < min_ROW || row > max_ROW)) { edm::LogError("CTPPSPixelDataFormatter") << " unphysical col and/or row " << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " col=" << col << " row=" << row; @@ -201,14 +201,14 @@ void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent std::pair rocPixel; std::pair modPixel; - if(isRun3){ + if (isRun3) { rocPixel = std::make_pair(row, col); modPixel = rocp.toGlobal(rocPixel); - }else{ + } else { rocPixel = std::make_pair(dcol, pxid); modPixel = rocp.toGlobalfromDcol(rocPixel); } - + CTPPSPixelDigi testdigi(modPixel.first, modPixel.second, adc); if (detDigis) @@ -216,11 +216,8 @@ void CTPPSPixelDataFormatter::interpretRawData(bool& isRun3, bool& errorsInEvent } } -void CTPPSPixelDataFormatter::formatRawData(bool& isRun3, unsigned int lvl1_ID, - RawData& fedRawData, - const Digis& digis, - std::vector iDdet2fed) { - +void CTPPSPixelDataFormatter::formatRawData( + bool& isRun3, unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector iDdet2fed) { std::map > words; // translate digis into 32-bit raw words and store in map indexed by Fed m_allDetDigis = 0; @@ -250,17 +247,19 @@ void CTPPSPixelDataFormatter::formatRawData(bool& isRun3, unsigned int lvl1_ID, nroc = iDdet2fed.at(i).rocch + 1; pps::pixel::ElectronicIndex cabling = {nlink, nroc, dcol, pxid}; - if(isRun3){ - cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | - (rocPixelColumn << m_COL_shift) | (rocPixelRow << m_ROW_shift) | (it.adc() << m_ADC_shift); - - words[iDdet2fed.at(i).fedid].push_back(word); - }else{ - cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | - (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | (it.adc() << m_ADC_shift); - - words[iDdet2fed.at(i).fedid].push_back(word); - } + if (isRun3) { + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (rocPixelColumn << m_COL_shift) | (rocPixelRow << m_ROW_shift) | + (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + } else { + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | + (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + } m_WordCounter++; m_hasDetDigis++; From d590a8e305bcfbf897eb25d1403b5f778ed14080 Mon Sep 17 00:00:00 2001 From: swmukher Date: Fri, 27 Aug 2021 12:44:21 +0200 Subject: [PATCH 160/923] code cleanup --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 112 ++++++++---------- 1 file changed, 48 insertions(+), 64 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index da4e4f152d6c0..3b5893ab1a622 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -38,10 +38,10 @@ class EgammaHLTHcalVarProducerFromRecHit : public edm::global::EDProducer<> { private: const bool doEtSum_; - EgammaHcalIsolation::arrayHB eThresHB_; - EgammaHcalIsolation::arrayHB etThresHB_; - EgammaHcalIsolation::arrayHE eThresHE_; - EgammaHcalIsolation::arrayHE etThresHE_; + const EgammaHcalIsolation::arrayHB eThresHB_; + const EgammaHcalIsolation::arrayHB etThresHB_; + const EgammaHcalIsolation::arrayHE eThresHE_; + const EgammaHcalIsolation::arrayHE etThresHE_; const double innerCone_; const double outerCone_; const int depth_; @@ -157,26 +157,45 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand); float isol = 0; + EgammaHcalIsolation::InclusionRule external; + EgammaHcalIsolation::InclusionRule internal; + + if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based + external=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + } + + if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E + external=EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + internal=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + } + + if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal + external=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal=EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + } + + + EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation(external, + outerCone_, + internal, + innerCone_, + eThresHB_, + etThresHB_, + maxSeverityHB_, + eThresHE_, + etThresHE_, + maxSeverityHE_, + iEvent.get(hbheRecHitsTag_), + iSetup.getData(caloGeometryToken_), + iSetup.getData(hcalTopologyToken_), + iSetup.getData(hcalChannelQualityToken_), + iSetup.getData(hcalSevLvlComputerToken_), + iSetup.getData(caloTowerConstituentsMapToken_) + ); + if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based. - EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - outerCone_, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - innerCone_, - eThresHB_, - etThresHB_, - maxSeverityHB_, - eThresHE_, - etThresHE_, - maxSeverityHE_, - iEvent.get(hbheRecHitsTag_), - iSetup.getData(caloGeometryToken_), - iSetup.getData(hcalTopologyToken_), - iSetup.getData(hcalChannelQualityToken_), - iSetup.getData(hcalSevLvlComputerToken_), - iSetup.getData(caloTowerConstituentsMapToken_)); - if (doEtSum_) { //hcal iso isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(),depth_); //depth=0 means all depths } @@ -186,48 +205,13 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, } - if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E - EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, - outerCone_, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - innerCone_, - eThresHB_, - etThresHB_, - maxSeverityHB_, - eThresHE_, - etThresHE_, - maxSeverityHE_, - iEvent.get(hbheRecHitsTag_), - iSetup.getData(caloGeometryToken_), - iSetup.getData(hcalTopologyToken_), - iSetup.getData(hcalChannelQualityToken_), - iSetup.getData(hcalSevLvlComputerToken_), - iSetup.getData(caloTowerConstituentsMapToken_)); - - isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths - } - - if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal - EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation( - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - outerCone_, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, - innerCone_, - eThresHB_, - etThresHB_, - maxSeverityHB_, - eThresHE_, - etThresHE_, - maxSeverityHE_, - iEvent.get(hbheRecHitsTag_), - iSetup.getData(caloGeometryToken_), - iSetup.getData(hcalTopologyToken_), - iSetup.getData(hcalChannelQualityToken_), - iSetup.getData(hcalSevLvlComputerToken_), - iSetup.getData(caloTowerConstituentsMapToken_)); - - isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + if (useSingleTower_) { + if (doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal + isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } + else if (!doEtSum_) { //this is single tower based H/E + isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + } } From 9832be4303cad477bb11b42f3ab5c7a391719ce4 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 27 Aug 2021 13:05:02 +0200 Subject: [PATCH 161/923] adding const --- .../CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h | 4 ++-- .../CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h index 83062e6fa96bc..1f8d0d0b89b2f 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h @@ -72,7 +72,7 @@ class CTPPSPixelDataFormatter { int nWords() const { return m_WordCounter; } void interpretRawData( - bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); + const bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); int nDigis() const { return m_DigiCounter; } @@ -84,7 +84,7 @@ class CTPPSPixelDataFormatter { short unsigned int fedch; }; - void formatRawData(bool& isRun3, + void formatRawData(const bool& isRun3, unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, diff --git a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc index b7b024b6b17fa..983ad51d77cbf 100644 --- a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc +++ b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc @@ -76,7 +76,7 @@ void CTPPSPixelDataFormatter::setErrorStatus(bool errorStatus) { } void CTPPSPixelDataFormatter::interpretRawData( - bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& rawData, Collection& digis, Errors& errors) { + const bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& rawData, Collection& digis, Errors& errors) { int nWords = rawData.size() / sizeof(Word64); if (nWords == 0) return; @@ -216,8 +216,11 @@ void CTPPSPixelDataFormatter::interpretRawData( } } -void CTPPSPixelDataFormatter::formatRawData( - bool& isRun3, unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector iDdet2fed) { +void CTPPSPixelDataFormatter::formatRawData(const bool& isRun3, + unsigned int lvl1_ID, + RawData& fedRawData, + const Digis& digis, + std::vector iDdet2fed) { std::map > words; // translate digis into 32-bit raw words and store in map indexed by Fed m_allDetDigis = 0; From 768dea0e91bcd86c1b9694d06520ac9f56297099 Mon Sep 17 00:00:00 2001 From: Efe Yigitbasi Date: Fri, 27 Aug 2021 13:06:39 +0200 Subject: [PATCH 162/923] Disabled duplicate GEM TP warnings in EMTF GEM unpacker until the data format is fixed --- .../plugins/implementations_stage2/EMTFBlockGEM.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc index 8ad17f728eba0..bfe6d0a845501 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc @@ -227,11 +227,12 @@ namespace l1t { } } // End loop: for (auto const & iHit : *res_hit) - if (exact_duplicate) - edm::LogWarning("L1T|EMTF") << "EMTF unpacked duplicate GEM digis: BX " << Hit_.BX() << ", endcap " - << Hit_.Endcap() << ", station " << Hit_.Station() << ", neighbor " - << Hit_.Neighbor() << ", ring " << Hit_.Ring() << ", chamber " << Hit_.Chamber() - << ", roll " << Hit_.Roll() << ", pad " << Hit_.Pad() << std::endl; + // TODO: Re-enable once GEM TP data format is fixed + // if (exact_duplicate) + // edm::LogWarning("L1T|EMTF") << "EMTF unpacked duplicate GEM digis: BX " << Hit_.BX() << ", endcap " + // << Hit_.Endcap() << ", station " << Hit_.Station() << ", neighbor " + // << Hit_.Neighbor() << ", ring " << Hit_.Ring() << ", chamber " << Hit_.Chamber() + // << ", roll " << Hit_.Roll() << ", pad " << Hit_.Pad() << std::endl; (res->at(iOut)).push_GEM(GEM_); if (!exact_duplicate) From 43d08718434448cffaeb1a7519e416b28dab59b0 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Fri, 27 Aug 2021 13:48:04 +0200 Subject: [PATCH 163/923] adding protections when the path has zero filters --- .../PatAlgos/plugins/PATTriggerProducer.cc | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc index 22c58973252e5..95de1d3466332 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc @@ -469,16 +469,22 @@ void PATTriggerProducer::produce(Event& iEvent, const EventSetup& iSetup) { for (size_t indexPath = 0; indexPath < sizePaths; ++indexPath) { const std::string& namePath = pathNames.at(indexPath); unsigned indexLastFilterPathModules(handleTriggerResults->index(indexPath) + 1); - while (indexLastFilterPathModules > 0) { - --indexLastFilterPathModules; - const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules)); - unsigned indexLastFilterFilters = - handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_)); - if (indexLastFilterFilters < sizeFilters) { - if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool") - continue; - break; + const unsigned sizeModulesPath(hltConfig.size(indexPath)); + //protection for paths with zero filters (needed for reco, digi, etc paths) + if (sizeModulesPath != 0) { + while (indexLastFilterPathModules > 0) { + --indexLastFilterPathModules; + const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules)); + unsigned indexLastFilterFilters = + handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_)); + if (indexLastFilterFilters < sizeFilters) { + if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool") + continue; + break; + } } + } else { + indexLastFilterPathModules = 0; } TriggerPath triggerPath(namePath, indexPath, @@ -489,8 +495,8 @@ void PATTriggerProducer::produce(Event& iEvent, const EventSetup& iSetup) { indexLastFilterPathModules, hltConfig.saveTagsModules(namePath).size()); // add module names to path and states' map - const unsigned sizeModulesPath(hltConfig.size(indexPath)); - assert(indexLastFilterPathModules < sizeModulesPath); + + assert(indexLastFilterPathModules < sizeModulesPath || sizeModulesPath == 0); std::map indicesModules; for (size_t iM = 0; iM < sizeModulesPath; ++iM) { const std::string& nameModule(hltConfig.moduleLabel(indexPath, iM)); From e72505fa019217831b4d922fad55f23d05cf288d Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 14:42:10 +0200 Subject: [PATCH 164/923] [GCC11] Fix warnings: loop variable binds to a temporary --- .../Modules/plugins/QGLikelihoodDBWriter.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index e366ac8a95807..b10dc5cfc3072 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -112,8 +112,8 @@ void QGLikelihoodDBWriter::beginJob() { // The ROOT file contains the binning for each variable, needed to set up the binning grid std::map> gridOfBins; - for (const TString& binVariable : {"eta", "pt", "rho"}) { - if (!getVectorFromFile(f, gridOfBins[binVariable], binVariable + "Bins")) { + for (auto &&binVariable : {"eta", "pt", "rho"}) { + if (!getVectorFromFile(f, gridOfBins[binVariable], TString(binVariable) + "Bins")) { edm::LogError("NoBins") << "Missing bin information for " << binVariable << " in input file" << std::endl; return; } @@ -124,13 +124,13 @@ void QGLikelihoodDBWriter::beginJob() { // Here we do not store the copies, but try to extend the range of the neighbouring category (will result in less comparisons during application phase) std::map, TH1*> pdfs; std::map, QGLikelihoodCategory> categories; - for (const TString& type : {"gluon", "quark"}) { - int qgIndex = (type == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc - for (const TString& likelihoodVar : {"mult", "ptD", "axis2"}) { + for (auto &&type : {"gluon", "quark"}) { + int qgIndex = (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc + for (auto &&likelihoodVar : {"mult", "ptD", "axis2"}) { int varIndex = - (likelihoodVar == "mult" + (TString(likelihoodVar) == "mult" ? 0 - : (likelihoodVar == "ptD" ? 1 : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc + : (TString(likelihoodVar) == "ptD" ? 1 : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc for (int i = 0; i < (int)gridOfBins["eta"].size() - 1; ++i) { for (int j = 0; j < (int)gridOfBins["pt"].size() - 1; ++j) { for (int k = 0; k < (int)gridOfBins["rho"].size() - 1; ++k) { @@ -144,8 +144,8 @@ void QGLikelihoodDBWriter::beginJob() { category.QGIndex = qgIndex; category.VarIndex = varIndex; - TString key = - TString::Format(likelihoodVar + "/" + likelihoodVar + "_" + type + "_eta%d_pt%d_rho%d", i, j, k); + TString key = + TString::Format("%s/%s_%s_eta%d_pt%d_rho%d", likelihoodVar, likelihoodVar, type, i, j, k); TH1* pdf = (TH1*)f->Get(key); if (!pdf) { edm::LogError("NoPDF") << "Could not found pdf with key " << key << " in input file" << std::endl; From 88de6ce6f4d46258dbfd1ef6ea62c20f521e9ab0 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 15:30:02 +0200 Subject: [PATCH 165/923] code-format --- .../Modules/plugins/QGLikelihoodDBWriter.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index b10dc5cfc3072..5e65ca4196911 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -112,7 +112,7 @@ void QGLikelihoodDBWriter::beginJob() { // The ROOT file contains the binning for each variable, needed to set up the binning grid std::map> gridOfBins; - for (auto &&binVariable : {"eta", "pt", "rho"}) { + for (auto&& binVariable : {"eta", "pt", "rho"}) { if (!getVectorFromFile(f, gridOfBins[binVariable], TString(binVariable) + "Bins")) { edm::LogError("NoBins") << "Missing bin information for " << binVariable << " in input file" << std::endl; return; @@ -124,9 +124,9 @@ void QGLikelihoodDBWriter::beginJob() { // Here we do not store the copies, but try to extend the range of the neighbouring category (will result in less comparisons during application phase) std::map, TH1*> pdfs; std::map, QGLikelihoodCategory> categories; - for (auto &&type : {"gluon", "quark"}) { + for (auto&& type : {"gluon", "quark"}) { int qgIndex = (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc - for (auto &&likelihoodVar : {"mult", "ptD", "axis2"}) { + for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { int varIndex = (TString(likelihoodVar) == "mult" ? 0 @@ -144,8 +144,7 @@ void QGLikelihoodDBWriter::beginJob() { category.QGIndex = qgIndex; category.VarIndex = varIndex; - TString key = - TString::Format("%s/%s_%s_eta%d_pt%d_rho%d", likelihoodVar, likelihoodVar, type, i, j, k); + TString key = TString::Format("%s/%s_%s_eta%d_pt%d_rho%d", likelihoodVar, likelihoodVar, type, i, j, k); TH1* pdf = (TH1*)f->Get(key); if (!pdf) { edm::LogError("NoPDF") << "Could not found pdf with key " << key << " in input file" << std::endl; From 64de4e16f5f62a23f888e57396ab76a93c702306 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Fri, 27 Aug 2021 15:41:54 +0200 Subject: [PATCH 166/923] code-format #2 --- .../Modules/plugins/QGLikelihoodDBWriter.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index 5e65ca4196911..a73ea989af8a5 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -125,12 +125,14 @@ void QGLikelihoodDBWriter::beginJob() { std::map, TH1*> pdfs; std::map, QGLikelihoodCategory> categories; for (auto&& type : {"gluon", "quark"}) { - int qgIndex = (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc + int qgIndex = + (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { - int varIndex = - (TString(likelihoodVar) == "mult" - ? 0 - : (TString(likelihoodVar) == "ptD" ? 1 : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc + int varIndex = (TString(likelihoodVar) == "mult" + ? 0 + : (TString(likelihoodVar) == "ptD" + ? 1 + : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc for (int i = 0; i < (int)gridOfBins["eta"].size() - 1; ++i) { for (int j = 0; j < (int)gridOfBins["pt"].size() - 1; ++j) { for (int k = 0; k < (int)gridOfBins["rho"].size() - 1; ++k) { From b1892a6914b2d6008a8b4b001f9fbec372829e81 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 Aug 2021 08:49:55 -0500 Subject: [PATCH 167/923] removed redunadant and commented out code --- .../GsfTracking/src/GsfConstraintAtVertex.cc | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc b/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc index 71c341c826c7c..b0c3cff39518a 100644 --- a/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc +++ b/TrackingTools/GsfTracking/src/GsfConstraintAtVertex.cc @@ -20,22 +20,7 @@ GsfConstraintAtVertex::GsfConstraintAtVertex(const TrackerGeometry* geometry, co : geometry_(geometry), magField_(magField), gsfPropagator_(AnalyticalPropagator(magField, anyDirection)), - tipExtrapolator_(gsfPropagator_) { - //edm::ESHandle geometryHandle; - //setup.get().get(geometryHandle); - geometry_ = geometry; - - //edm::ESHandle magFieldHandle; - //setup.get().get(magFieldHandle); - //magField_ = magFieldHandle.product(); - magField_ = magField; - - // edm::ESHandle propagatorHandle; - // setup.get().get(propagatorName_,propagatorHandle); - // propagator_ = propagatorHandle.product(); - //gsfPropagator_ = std::make_unique(AnalyticalPropagator(magField, anyDirection)); - //tipExtrapolator_ = std::make_unique(*gsfPropagator_); -} + tipExtrapolator_(gsfPropagator_) {} TrajectoryStateOnSurface GsfConstraintAtVertex::constrainAtBeamSpot(const reco::GsfTrack& track, const reco::BeamSpot& beamSpot) const { From 1f32551b0bb64137f591242aa4e69dfa32338489 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 15:56:35 +0200 Subject: [PATCH 168/923] Update QGLikelihoodDBWriter.cc --- JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index a73ea989af8a5..22e293cabb23a 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" @@ -125,12 +126,12 @@ void QGLikelihoodDBWriter::beginJob() { std::map, TH1*> pdfs; std::map, QGLikelihoodCategory> categories; for (auto&& type : {"gluon", "quark"}) { - int qgIndex = + int qgIndex = strcpm(type, "gluon") == 0 ? 1 : 0; (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { - int varIndex = (TString(likelihoodVar) == "mult" + int varIndex = (strcmp(likelihoodVar, "mult") == 0 ? 0 - : (TString(likelihoodVar) == "ptD" + : (strcmp(likelihoodVar, "ptD") == 0 ? 1 : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc for (int i = 0; i < (int)gridOfBins["eta"].size() - 1; ++i) { From fdd8eb13005f7d02d8e8c45cadeda3d282333ffd Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 15:57:41 +0200 Subject: [PATCH 169/923] Update QGLikelihoodDBWriter.cc --- JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index 22e293cabb23a..5287fe0412b8b 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -129,11 +129,11 @@ void QGLikelihoodDBWriter::beginJob() { int qgIndex = strcpm(type, "gluon") == 0 ? 1 : 0; (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { + // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc int varIndex = (strcmp(likelihoodVar, "mult") == 0 ? 0 : (strcmp(likelihoodVar, "ptD") == 0 - ? 1 - : 2)); // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc + ? 1 : 2)); for (int i = 0; i < (int)gridOfBins["eta"].size() - 1; ++i) { for (int j = 0; j < (int)gridOfBins["pt"].size() - 1; ++j) { for (int k = 0; k < (int)gridOfBins["rho"].size() - 1; ++k) { From 68e3ea7b53df2e8220f41bd787a5709ffa620126 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 15:58:36 +0200 Subject: [PATCH 170/923] Update QGLikelihoodDBWriter.cc --- JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index 5287fe0412b8b..959f0777cdb6e 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -126,8 +126,8 @@ void QGLikelihoodDBWriter::beginJob() { std::map, TH1*> pdfs; std::map, QGLikelihoodCategory> categories; for (auto&& type : {"gluon", "quark"}) { + // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc int qgIndex = strcpm(type, "gluon") == 0 ? 1 : 0; - (TString(type) == "gluon"); // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc int varIndex = (strcmp(likelihoodVar, "mult") == 0 From d1703cec367c0b5e5c11dc8fa2037681d765b5f0 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 27 Aug 2021 16:04:37 +0200 Subject: [PATCH 171/923] Update QGLikelihoodDBWriter.cc --- JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index 959f0777cdb6e..f6d4931b4998e 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -127,7 +127,7 @@ void QGLikelihoodDBWriter::beginJob() { std::map, QGLikelihoodCategory> categories; for (auto&& type : {"gluon", "quark"}) { // Keep numbering same as in RecoJets/JetAlgorithms/src/QGLikelihoodCalculator.cc - int qgIndex = strcpm(type, "gluon") == 0 ? 1 : 0; + int qgIndex = strcmp(type, "gluon") == 0 ? 1 : 0; for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc int varIndex = (strcmp(likelihoodVar, "mult") == 0 From 6ef11e6e01f10c6507392f7a59740c812ec35edf Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Fri, 27 Aug 2021 16:06:15 +0200 Subject: [PATCH 172/923] add safety to low R9, improve readabbility of param arrays --- .../EnergyUncertaintyPhotonSpecific.h | 2 + .../src/EnergyUncertaintyPhotonSpecific.cc | 478 ++++-------------- 2 files changed, 92 insertions(+), 388 deletions(-) diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/EnergyUncertaintyPhotonSpecific.h b/RecoEgamma/EgammaPhotonAlgos/interface/EnergyUncertaintyPhotonSpecific.h index 6aceecfc7e314..f1f76cf978d92 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/EnergyUncertaintyPhotonSpecific.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/EnergyUncertaintyPhotonSpecific.h @@ -7,6 +7,8 @@ ** ***/ +#include + #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc b/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc index aafdee3dacfca..66b3db01a2d3c 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc @@ -11,196 +11,47 @@ void EnergyUncertaintyPhotonSpecific::init(const edm::EventSetup& theEventSetup) double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_lowR9(double eta, double brem, double energy) { double et = energy / cosh(eta); - const int nBinsEta = 6; + constexpr int nBinsEta = 6; const double EtaBins[nBinsEta + 1] = {0.0, 0.7, 1.15, 1.44, 1.56, 2.0, 2.5}; - const int nBinsBrem = 6; + constexpr int nBinsBrem = 6; const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0}; - float par0[nBinsEta][nBinsBrem]; - float par1[nBinsEta][nBinsBrem]; - float par2[nBinsEta][nBinsBrem]; - float par3[nBinsEta][nBinsBrem]; - - par0[0][0] = 0.0232291; - par1[0][0] = 0; - par2[0][0] = 0; - par3[0][0] = 0; - - par0[0][1] = 0.00703187; - par1[0][1] = 0.646644; - par2[0][1] = -7.4698; - par3[0][1] = 5.53373e-08; - - par0[0][2] = 0.00692465; - par1[0][2] = 0.292698; - par2[0][2] = 4.16907; - par3[0][2] = 5.61149e-06; - - par0[0][3] = 0.00855993; - par1[0][3] = 0.280843; - par2[0][3] = 4.25527; - par3[0][3] = 9.6404e-07; - - par0[0][4] = 0.00795058; - par1[0][4] = 0.370007; - par2[0][4] = 3.03429; - par3[0][4] = 4.43986e-07; - - par0[0][5] = 0.0107494; - par1[0][5] = 0.276159; - par2[0][5] = 4.44532; - par3[0][5] = 2.58822e-06; - - par0[1][0] = 0.0614866; - par1[1][0] = 0; - par2[1][0] = 0; - par3[1][0] = 0; - - par0[1][1] = 0.00894211; - par1[1][1] = 0.466937; - par2[1][1] = 3.33434; - par3[1][1] = 0.000114835; - - par0[1][2] = 0.0102959; - par1[1][2] = 0.313568; - par2[1][2] = 6.34301; - par3[1][2] = 2.86726e-07; - - par0[1][3] = 0.0128934; - par1[1][3] = 0.302943; - par2[1][3] = 6.35598; - par3[1][3] = 0.00190694; - - par0[1][4] = 0.0130199; - par1[1][4] = 0.505135; - par2[1][4] = 2.52964; - par3[1][4] = 0.120204; - - par0[1][5] = 0.0180839; - par1[1][5] = 0.382134; - par2[1][5] = 5.3388; - par3[1][5] = 3.59921e-07; - - par0[2][0] = 0.0291343; - par1[2][0] = 0; - par2[2][0] = 0; - par3[2][0] = 0; - - par0[2][1] = 0.00876269; - par1[2][1] = 0.375159; - par2[2][1] = 7.11411; - par3[2][1] = 0.0438575; - - par0[2][2] = 0.0120863; - par1[2][2] = 0.397635; - par2[2][2] = 5.97451; - par3[2][2] = 0.0469782; - - par0[2][3] = 0.0112655; - par1[2][3] = 0.856565; - par2[2][3] = -5.76122; - par3[2][3] = 4.99993; - - par0[2][4] = 0.0168267; - par1[2][4] = 0.636468; - par2[2][4] = -1.54548; - par3[2][4] = 4.99992; - - par0[2][5] = 0.0168059; - par1[2][5] = 1.09268; - par2[2][5] = -0.547554; - par3[2][5] = 0.0952985; - - par0[3][0] = 0.158403; - par1[3][0] = 0; - par2[3][0] = 0; - par3[3][0] = 0; - - par0[3][1] = 0.0717431; - par1[3][1] = 1.66981; - par2[3][1] = 6.86275; - par3[3][1] = 0.00543544; - - par0[3][2] = 0.0385666; - par1[3][2] = 3.6319; - par2[3][2] = -3.76633; - par3[3][2] = 6.56718e-05; - - par0[3][3] = 0.0142631; - par1[3][3] = 8.85991; - par2[3][3] = -32.6073; - par3[3][3] = 0.00119538; - - par0[3][4] = 0.0421638; - par1[3][4] = 3.1289; - par2[3][4] = -6.58653; - par3[3][4] = 1.10125e-05; - - par0[3][5] = 0.046331; - par1[3][5] = 1.29951; - par2[3][5] = 1.76117; - par3[3][5] = 0.00204206; - - par0[4][0] = 0.0483944; - par1[4][0] = 0; - par2[4][0] = 0; - par3[4][0] = 0; - - par0[4][1] = 0.0168516; - par1[4][1] = 1.19617; - par2[4][1] = -6.78666; - par3[4][1] = 4.98192; - - par0[4][2] = 0.0243039; - par1[4][2] = 0.994626; - par2[4][2] = -4.26073; - par3[4][2] = 4.99984; - - par0[4][3] = 0.031795; - par1[4][3] = 0.875925; - par2[4][3] = 1.43183; - par3[4][3] = 0.0920944; - - par0[4][4] = 0.0414953; - par1[4][4] = 0.654605; - par2[4][4] = 4.45367; - par3[4][4] = 0.030385; - - par0[4][5] = 0.058031; - par1[4][5] = 0.292915; - par2[4][5] = 8.48307; - par3[4][5] = 0.0134321; - - par0[5][0] = 0.107158; - par1[5][0] = 0; - par2[5][0] = 0; - par3[5][0] = 0; - - par0[5][1] = 0.021685; - par1[5][1] = 0.574207; - par2[5][1] = -0.566981; - par3[5][1] = 0.0120609; - - par0[5][2] = 0.0196619; - par1[5][2] = 0.940217; - par2[5][2] = -6.05845; - par3[5][2] = 0.000193818; - - par0[5][3] = 0.0324734; - par1[5][3] = 0.574766; - par2[5][3] = -5.23571; - par3[5][3] = 4.9419; - - par0[5][4] = 0.0414953; - par1[5][4] = 0.654605; - par2[5][4] = 4.45367; - par3[5][4] = 0.030385; - - par0[5][5] = 0.058031; - par1[5][5] = 0.292915; - par2[5][5] = 8.48307; - par3[5][5] = 0.0134321; + constexpr std::array, nBinsEta> par0 = {{ + {{0.0232291, 0.00703187, 0.00692465, 0.00855993, 0.00795058, 0.0107494}}, + {{0.0614866, 0.00894211, 0.0102959, 0.0128934, 0.0130199, 0.0180839}}, + {{0.0291343, 0.00876269, 0.0120863, 0.0112655, 0.0168267, 0.0168059}}, + {{0.158403, 0.0717431, 0.0385666, 0.0142631, 0.0421638, 0.046331}}, + {{0.0483944, 0.0168516, 0.0243039, 0.031795, 0.0414953, 0.058031}}, + {{0.107158, 0.021685, 0.0196619, 0.0324734, 0.0414953, 0.058031}} + }}; + + constexpr std::array, nBinsEta> par1 = {{ + {{0., 0.646644, 0.292698, 0.280843, 0.370007, 0.276159}}, + {{0., 0.466937, 0.313568, 0.302943, 0.505135, 0.382134}}, + {{0., 0.375159, 0.397635, 0.856565, 0.636468, 1.09268}}, + {{0., 1.66981, 3.6319, 8.85991, 3.1289, 1.29951}}, + {{0., 1.19617, 0.994626, 0.875925, 0.654605, 0.292915}}, + {{0., 0.574207, 0.940217, 0.574766, 0.654605, 0.292915}} + }}; + + constexpr std::array, nBinsEta> par2 = {{ + {{0., -7.4698, 4.16907, 4.25527, 3.03429, 4.44532}}, + {{0., 3.33434, 6.34301, 6.35598, 2.52964, 5.3388}}, + {{0., 7.11411, 5.97451, -5.76122, -1.54548, -0.547554}}, + {{0., 6.86275, -3.76633, -32.6073, -6.58653, 1.76117}}, + {{0., -6.78666, -4.26073, 1.43183, 4.45367, 8.48307}}, + {{0., -0.566981, -6.05845, -5.23571, 4.45367, 8.48307}} + }}; + + constexpr std::array, nBinsEta> par3 = {{ + {{0., 5.53373e-08, 5.61149e-06, 9.6404e-07, 4.43986e-07, 2.58822e-06}}, + {{0., 0.000114835, 2.86726e-07, 0.00190694, 0.120204, 3.59921e-07}}, + {{0., 0.0438575, 0.0469782, 4.99993, 4.99992, 0.0952985}}, + {{0., 0.00543544, 6.56718e-05, 0.00119538, 1.10125e-05, 0.00204206}}, + {{0., 4.98192, 4.99984, 0.0920944, 0.030385, 0.0134321}}, + {{0., 0.0120609, 0.000193818, 4.9419, 0.030385, 0.0134321}} + }}; int iEtaSl = -1; for (int iEta = 0; iEta < nBinsEta; ++iEta) { @@ -224,16 +75,18 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_lowR9(dou iBremSl = nBinsBrem - 1; float uncertainty = 0; - if (et < 5) - uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); - if (et > 200) - uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); + if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) { + if (et < 5) + uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) + + par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); + if (et > 200) + uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) + + par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); - if (et > 5 && et < 200) - uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); + if (et > 5 && et < 200) + uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) + + par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); + } return (uncertainty * energy); } @@ -241,196 +94,47 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_lowR9(dou double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_highR9(double eta, double brem, double energy) { double et = energy / cosh(eta); - const int nBinsEta = 6; + constexpr int nBinsEta = 6; const double EtaBins[nBinsEta + 1] = {0.0, 0.7, 1.15, 1.44, 1.56, 2.0, 2.5}; - const int nBinsBrem = 6; - const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0}; - - float par0[nBinsEta][nBinsBrem]; - float par1[nBinsEta][nBinsBrem]; - float par2[nBinsEta][nBinsBrem]; - float par3[nBinsEta][nBinsBrem]; - - par0[0][0] = 0.00806753; - par1[0][0] = 0.143754; - par2[0][0] = -0.00368104; - par3[0][0] = 0.219829; - - par0[0][1] = 0.00899298; - par1[0][1] = 0.10159; - par2[0][1] = 4.70884; - par3[0][1] = 9.07419e-08; - - par0[0][2] = 0; - par1[0][2] = 0; - par2[0][2] = 0; - par3[0][2] = 0; - - par0[0][3] = 0; - par1[0][3] = 0; - par2[0][3] = 0; - par3[0][3] = 0; - - par0[0][4] = 0; - par1[0][4] = 0; - par2[0][4] = 0; - par3[0][4] = 0; - - par0[0][5] = 0; - par1[0][5] = 0; - par2[0][5] = 0; - par3[0][5] = 0; - - par0[1][0] = 0.00880649; - par1[1][0] = 0.0716169; - par2[1][0] = 5.23856; - par3[1][0] = 0.00632907; - - par0[1][1] = 0.00972275; - par1[1][1] = 0.0752675; - par2[1][1] = 3.35623; - par3[1][1] = 2.49397e-07; - - par0[1][2] = 0; - par1[1][2] = 0; - par2[1][2] = 0; - par3[1][2] = 0; - - par0[1][3] = 0; - par1[1][3] = 0; - par2[1][3] = 0; - par3[1][3] = 0; - - par0[1][4] = 0; - par1[1][4] = 0; - par2[1][4] = 0; - par3[1][4] = 0; - - par0[1][5] = 0; - par1[1][5] = 0; - par2[1][5] = 0; - par3[1][5] = 0; - - par0[2][0] = 0.0101474; - par1[2][0] = -0.332171; - par2[2][0] = -31.8456; - par3[2][0] = 22.543; - - par0[2][1] = 0.0109109; - par1[2][1] = 0.0425903; - par2[2][1] = 6.52561; - par3[2][1] = 2.18593e-08; - - par0[2][2] = 0; - par1[2][2] = 0; - par2[2][2] = 0; - par3[2][2] = 0; - - par0[2][3] = 0; - par1[2][3] = 0; - par2[2][3] = 0; - par3[2][3] = 0; - - par0[2][4] = 0; - par1[2][4] = 0; - par2[2][4] = 0; - par3[2][4] = 0; - - par0[2][5] = 0; - par1[2][5] = 0; - par2[2][5] = 0; - par3[2][5] = 0; - - par0[3][0] = 0.00343003; - par1[3][0] = 11.5791; - par2[3][0] = -112.084; - par3[3][0] = -863.968; - - par0[3][1] = 0.0372159; - par1[3][1] = 1.44028; - par2[3][1] = -40; - par3[3][1] = 0.00102639; - - par0[3][2] = 0; - par1[3][2] = 0; - par2[3][2] = 0; - par3[3][2] = 0; - - par0[3][3] = 0; - par1[3][3] = 0; - par2[3][3] = 0; - par3[3][3] = 0; - - par0[3][4] = 0; - par1[3][4] = 0; - par2[3][4] = 0; - par3[3][4] = 0; - - par0[3][5] = 0; - par1[3][5] = 0; - par2[3][5] = 0; - par3[3][5] = 0; - - par0[4][0] = 0.0192411; - par1[4][0] = 0.0511006; - par2[4][0] = 7.56304; - par3[4][0] = 0.00331583; - - par0[4][1] = 0.0195124; - par1[4][1] = 0.104321; - par2[4][1] = 5.71476; - par3[4][1] = 6.12472e-06; - - par0[4][2] = 0; - par1[4][2] = 0; - par2[4][2] = 0; - par3[4][2] = 0; - - par0[4][3] = 0; - par1[4][3] = 0; - par2[4][3] = 0; - par3[4][3] = 0; - - par0[4][4] = 0; - par1[4][4] = 0; - par2[4][4] = 0; - par3[4][4] = 0; - - par0[4][5] = 0; - par1[4][5] = 0; - par2[4][5] = 0; - par3[4][5] = 0; - - par0[5][0] = 0.0203644; - par1[5][0] = -0.050789; - par2[5][0] = -7.96854; - par3[5][0] = 4.71223; - - par0[5][1] = 0.0198718; - par1[5][1] = 0.106859; - par2[5][1] = 3.54235; - par3[5][1] = 6.89631e-06; - - par0[5][2] = 0; - par1[5][2] = 0; - par2[5][2] = 0; - par3[5][2] = 0; - - par0[5][3] = 0; - par1[5][3] = 0; - par2[5][3] = 0; - par3[5][3] = 0; - - par0[5][4] = 0; - par1[5][4] = 0; - par2[5][4] = 0; - par3[5][4] = 0; - - par0[5][5] = 0; - par1[5][5] = 0; - par2[5][5] = 0; - par3[5][5] = 0; + constexpr int nBinsBrem = 2; + const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0}; + + constexpr std::array, nBinsEta> par0 = {{ + {{0.00806753, 0.00899298}}, + {{0.00880649, 0.00972275}}, + {{0.0101474, 0.0109109}}, + {{0.00343003, 0.0372159}}, + {{0.0192411, 0.0195124}}, + {{0.0203644, 0.0198718}} + }}; + + constexpr std::array, nBinsEta> par1 = {{ + {{0.143754, 0.10159}}, + {{0.0716169, 0.0752675}}, + {{-0.332171, 0.0425903}}, + {{11.5791, 1.44028}}, + {{0.0511006, 0.104321}}, + {{-0.050789, 0.106859}} + }}; + + constexpr std::array, nBinsEta> par2 = {{ + {{-0.00368104, 4.70884}}, + {{5.23856, 3.35623}}, + {{-31.8456, 6.52561}}, + {{-112.084, -40.}}, + {{7.56304, 5.71476}}, + {{-7.96854, 3.54235}} + }}; + + constexpr std::array, nBinsEta> par3 = {{ + {{0.219829, 9.07419e-08}}, + {{0.00632907, 2.49397e-07}}, + {{22.543, 2.18593e-08}}, + {{-863.968, 0.00102639}}, + {{0.00331583, 6.12472e-06}}, + {{4.71223, 6.89631e-06}} + }}; int iEtaSl = -1; for (int iEta = 0; iEta < nBinsEta; ++iEta) { @@ -452,20 +156,18 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_highR9(do iBremSl = 0; if (brem > BremBins[nBinsBrem - 1]) iBremSl = nBinsBrem - 1; - if (brem > 2) - iBremSl = 1; float uncertainty = 0; if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) { if (et < 5) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); else if (et > 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); else if (et >= 5 && et <= 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); } return (uncertainty * energy); From 1369d3022e3038197c1c133466e947abb039d3c6 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Fri, 27 Aug 2021 16:11:25 +0200 Subject: [PATCH 173/923] Code-style --- .../Modules/plugins/QGLikelihoodDBWriter.cc | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc index f6d4931b4998e..3f4219a3d2607 100644 --- a/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc +++ b/JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc @@ -1,26 +1,26 @@ // Author: Benedikt Hegner, Tom Cornelis // Email: benedikt.hegner@cern.ch, tom.cornelis@cern.ch -#include "TFile.h" -#include "TVector.h" -#include "TList.h" -#include "TKey.h" -#include "TH1.h" -#include -#include -#include -#include -#include -#include -#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "TFile.h" +#include "TH1.h" +#include "TKey.h" +#include "TList.h" +#include "TVector.h" +#include +#include +#include +#include +#include +#include class QGLikelihoodDBWriter : public edm::EDAnalyzer { public: @@ -130,10 +130,7 @@ void QGLikelihoodDBWriter::beginJob() { int qgIndex = strcmp(type, "gluon") == 0 ? 1 : 0; for (auto&& likelihoodVar : {"mult", "ptD", "axis2"}) { // Keep order same as in RecoJets/JetProducers/plugins/QGTagger.cc - int varIndex = (strcmp(likelihoodVar, "mult") == 0 - ? 0 - : (strcmp(likelihoodVar, "ptD") == 0 - ? 1 : 2)); + int varIndex = (strcmp(likelihoodVar, "mult") == 0 ? 0 : (strcmp(likelihoodVar, "ptD") == 0 ? 1 : 2)); for (int i = 0; i < (int)gridOfBins["eta"].size() - 1; ++i) { for (int j = 0; j < (int)gridOfBins["pt"].size() - 1; ++j) { for (int k = 0; k < (int)gridOfBins["rho"].size() - 1; ++k) { From f7faeb48b78066174f495a89ad201e81fd31f718 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Fri, 27 Aug 2021 16:13:08 +0200 Subject: [PATCH 174/923] code format --- .../src/EnergyUncertaintyPhotonSpecific.cc | 140 ++++++++---------- 1 file changed, 64 insertions(+), 76 deletions(-) diff --git a/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc b/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc index 66b3db01a2d3c..89440413c60b7 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/EnergyUncertaintyPhotonSpecific.cc @@ -17,41 +17,37 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_lowR9(dou constexpr int nBinsBrem = 6; const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0}; - constexpr std::array, nBinsEta> par0 = {{ - {{0.0232291, 0.00703187, 0.00692465, 0.00855993, 0.00795058, 0.0107494}}, - {{0.0614866, 0.00894211, 0.0102959, 0.0128934, 0.0130199, 0.0180839}}, - {{0.0291343, 0.00876269, 0.0120863, 0.0112655, 0.0168267, 0.0168059}}, - {{0.158403, 0.0717431, 0.0385666, 0.0142631, 0.0421638, 0.046331}}, - {{0.0483944, 0.0168516, 0.0243039, 0.031795, 0.0414953, 0.058031}}, - {{0.107158, 0.021685, 0.0196619, 0.0324734, 0.0414953, 0.058031}} - }}; - - constexpr std::array, nBinsEta> par1 = {{ - {{0., 0.646644, 0.292698, 0.280843, 0.370007, 0.276159}}, - {{0., 0.466937, 0.313568, 0.302943, 0.505135, 0.382134}}, - {{0., 0.375159, 0.397635, 0.856565, 0.636468, 1.09268}}, - {{0., 1.66981, 3.6319, 8.85991, 3.1289, 1.29951}}, - {{0., 1.19617, 0.994626, 0.875925, 0.654605, 0.292915}}, - {{0., 0.574207, 0.940217, 0.574766, 0.654605, 0.292915}} - }}; - - constexpr std::array, nBinsEta> par2 = {{ - {{0., -7.4698, 4.16907, 4.25527, 3.03429, 4.44532}}, - {{0., 3.33434, 6.34301, 6.35598, 2.52964, 5.3388}}, - {{0., 7.11411, 5.97451, -5.76122, -1.54548, -0.547554}}, - {{0., 6.86275, -3.76633, -32.6073, -6.58653, 1.76117}}, - {{0., -6.78666, -4.26073, 1.43183, 4.45367, 8.48307}}, - {{0., -0.566981, -6.05845, -5.23571, 4.45367, 8.48307}} - }}; - - constexpr std::array, nBinsEta> par3 = {{ - {{0., 5.53373e-08, 5.61149e-06, 9.6404e-07, 4.43986e-07, 2.58822e-06}}, - {{0., 0.000114835, 2.86726e-07, 0.00190694, 0.120204, 3.59921e-07}}, - {{0., 0.0438575, 0.0469782, 4.99993, 4.99992, 0.0952985}}, - {{0., 0.00543544, 6.56718e-05, 0.00119538, 1.10125e-05, 0.00204206}}, - {{0., 4.98192, 4.99984, 0.0920944, 0.030385, 0.0134321}}, - {{0., 0.0120609, 0.000193818, 4.9419, 0.030385, 0.0134321}} - }}; + constexpr std::array, nBinsEta> par0 = { + {{{0.0232291, 0.00703187, 0.00692465, 0.00855993, 0.00795058, 0.0107494}}, + {{0.0614866, 0.00894211, 0.0102959, 0.0128934, 0.0130199, 0.0180839}}, + {{0.0291343, 0.00876269, 0.0120863, 0.0112655, 0.0168267, 0.0168059}}, + {{0.158403, 0.0717431, 0.0385666, 0.0142631, 0.0421638, 0.046331}}, + {{0.0483944, 0.0168516, 0.0243039, 0.031795, 0.0414953, 0.058031}}, + {{0.107158, 0.021685, 0.0196619, 0.0324734, 0.0414953, 0.058031}}}}; + + constexpr std::array, nBinsEta> par1 = { + {{{0., 0.646644, 0.292698, 0.280843, 0.370007, 0.276159}}, + {{0., 0.466937, 0.313568, 0.302943, 0.505135, 0.382134}}, + {{0., 0.375159, 0.397635, 0.856565, 0.636468, 1.09268}}, + {{0., 1.66981, 3.6319, 8.85991, 3.1289, 1.29951}}, + {{0., 1.19617, 0.994626, 0.875925, 0.654605, 0.292915}}, + {{0., 0.574207, 0.940217, 0.574766, 0.654605, 0.292915}}}}; + + constexpr std::array, nBinsEta> par2 = { + {{{0., -7.4698, 4.16907, 4.25527, 3.03429, 4.44532}}, + {{0., 3.33434, 6.34301, 6.35598, 2.52964, 5.3388}}, + {{0., 7.11411, 5.97451, -5.76122, -1.54548, -0.547554}}, + {{0., 6.86275, -3.76633, -32.6073, -6.58653, 1.76117}}, + {{0., -6.78666, -4.26073, 1.43183, 4.45367, 8.48307}}, + {{0., -0.566981, -6.05845, -5.23571, 4.45367, 8.48307}}}}; + + constexpr std::array, nBinsEta> par3 = { + {{{0., 5.53373e-08, 5.61149e-06, 9.6404e-07, 4.43986e-07, 2.58822e-06}}, + {{0., 0.000114835, 2.86726e-07, 0.00190694, 0.120204, 3.59921e-07}}, + {{0., 0.0438575, 0.0469782, 4.99993, 4.99992, 0.0952985}}, + {{0., 0.00543544, 6.56718e-05, 0.00119538, 1.10125e-05, 0.00204206}}, + {{0., 4.98192, 4.99984, 0.0920944, 0.030385, 0.0134321}}, + {{0., 0.0120609, 0.000193818, 4.9419, 0.030385, 0.0134321}}}}; int iEtaSl = -1; for (int iEta = 0; iEta < nBinsEta; ++iEta) { @@ -78,14 +74,14 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_lowR9(dou if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) { if (et < 5) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); if (et > 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); if (et > 5 && et < 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); } return (uncertainty * energy); @@ -100,41 +96,33 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_highR9(do constexpr int nBinsBrem = 2; const double BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0}; - constexpr std::array, nBinsEta> par0 = {{ - {{0.00806753, 0.00899298}}, - {{0.00880649, 0.00972275}}, - {{0.0101474, 0.0109109}}, - {{0.00343003, 0.0372159}}, - {{0.0192411, 0.0195124}}, - {{0.0203644, 0.0198718}} - }}; - - constexpr std::array, nBinsEta> par1 = {{ - {{0.143754, 0.10159}}, - {{0.0716169, 0.0752675}}, - {{-0.332171, 0.0425903}}, - {{11.5791, 1.44028}}, - {{0.0511006, 0.104321}}, - {{-0.050789, 0.106859}} - }}; - - constexpr std::array, nBinsEta> par2 = {{ - {{-0.00368104, 4.70884}}, - {{5.23856, 3.35623}}, - {{-31.8456, 6.52561}}, - {{-112.084, -40.}}, - {{7.56304, 5.71476}}, - {{-7.96854, 3.54235}} - }}; - - constexpr std::array, nBinsEta> par3 = {{ - {{0.219829, 9.07419e-08}}, - {{0.00632907, 2.49397e-07}}, - {{22.543, 2.18593e-08}}, - {{-863.968, 0.00102639}}, - {{0.00331583, 6.12472e-06}}, - {{4.71223, 6.89631e-06}} - }}; + constexpr std::array, nBinsEta> par0 = {{{{0.00806753, 0.00899298}}, + {{0.00880649, 0.00972275}}, + {{0.0101474, 0.0109109}}, + {{0.00343003, 0.0372159}}, + {{0.0192411, 0.0195124}}, + {{0.0203644, 0.0198718}}}}; + + constexpr std::array, nBinsEta> par1 = {{{{0.143754, 0.10159}}, + {{0.0716169, 0.0752675}}, + {{-0.332171, 0.0425903}}, + {{11.5791, 1.44028}}, + {{0.0511006, 0.104321}}, + {{-0.050789, 0.106859}}}}; + + constexpr std::array, nBinsEta> par2 = {{{{-0.00368104, 4.70884}}, + {{5.23856, 3.35623}}, + {{-31.8456, 6.52561}}, + {{-112.084, -40.}}, + {{7.56304, 5.71476}}, + {{-7.96854, 3.54235}}}}; + + constexpr std::array, nBinsEta> par3 = {{{{0.219829, 9.07419e-08}}, + {{0.00632907, 2.49397e-07}}, + {{22.543, 2.18593e-08}}, + {{-863.968, 0.00102639}}, + {{0.00331583, 6.12472e-06}}, + {{4.71223, 6.89631e-06}}}}; int iEtaSl = -1; for (int iEta = 0; iEta < nBinsEta; ++iEta) { @@ -161,13 +149,13 @@ double EnergyUncertaintyPhotonSpecific::computePhotonEnergyUncertainty_highR9(do if (iBremSl >= 0 && iBremSl < nBinsBrem && iEtaSl >= 0 && iEtaSl < nBinsEta) { if (et < 5) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl])); else if (et > 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl])); else if (et >= 5 && et <= 200) uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) + - par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); + par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl])); } return (uncertainty * energy); From a1693428569e90fd7f042b8961e367cd42ca37c1 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 Aug 2021 09:33:16 -0500 Subject: [PATCH 175/923] Take ConsumesCollector by value not rvalue reference This is now the recommended way to use the ConsumesCollector as it is trivially copyable. --- RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h index 4ea5ef11fe96e..4bacd8b340742 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h @@ -54,7 +54,7 @@ class EcalClusterLazyToolsBase { class ESGetTokens { public: - ESGetTokens(edm::ConsumesCollector &&cc) + ESGetTokens(edm::ConsumesCollector cc) : caloGeometryToken_{cc.esConsumes()}, caloTopologyToken_{cc.esConsumes()}, ecalIntercalibConstantsToken_{cc.esConsumes()}, From b86c5befe2666e8b36f5d460b6c3374ab1bb00bb Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 27 Aug 2021 16:33:26 +0200 Subject: [PATCH 176/923] Implement centralized pointer ownership and reference-based interface --- .../interface/OnlineDBOutputService.h | 11 +- .../interface/PoolDBOutputService.h | 108 +++++++++++++++--- .../src/PoolDBOutputService.cc | 2 - 3 files changed, 100 insertions(+), 21 deletions(-) diff --git a/CondCore/DBOutputService/interface/OnlineDBOutputService.h b/CondCore/DBOutputService/interface/OnlineDBOutputService.h index b65829cd42685..5577699b60755 100644 --- a/CondCore/DBOutputService/interface/OnlineDBOutputService.h +++ b/CondCore/DBOutputService/interface/OnlineDBOutputService.h @@ -37,7 +37,7 @@ namespace cond { // template - bool writeForNextLumisection(const PayloadType* payload, const std::string& recordName) { + bool writeForNextLumisection(const PayloadType& payload, const std::string& recordName) { cond::Time_t targetTime = getLastLumiProcessed() + m_latencyInLumisections; auto t0 = std::chrono::high_resolution_clock::now(); logger().logInfo() << "Updating lumisection " << targetTime; @@ -73,6 +73,15 @@ namespace cond { return ret; } + // + template + bool writeForNextLumisection(const PayloadType* payloadPtr, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "OnlineDBOutputService::writeForNextLumisection"); + std::unique_ptr payload(payloadPtr); + return writeForNextLumisection(*payload, recordName); + } + private: cond::Time_t getLastLumiProcessed(); diff --git a/CondCore/DBOutputService/interface/PoolDBOutputService.h b/CondCore/DBOutputService/interface/PoolDBOutputService.h index f87e8b0c20a09..1a2b0018548aa 100644 --- a/CondCore/DBOutputService/interface/PoolDBOutputService.h +++ b/CondCore/DBOutputService/interface/PoolDBOutputService.h @@ -58,11 +58,8 @@ namespace cond { std::string tag(const std::string& recordName); bool isNewTagRequest(const std::string& recordName); - // template - Hash writeOne(const T* payload, Time_t time, const std::string& recordName) { - if (!payload) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::writeOne"); + Hash writeOne(const T& payload, Time_t time, const std::string& recordName) { std::lock_guard lock(m_mutex); doStartTransaction(); cond::persistency::TransactionScope scope(m_session.transaction()); @@ -87,7 +84,7 @@ namespace cond { return thePayloadHash; } } - thePayloadHash = m_session.storePayload(*payload); + thePayloadHash = m_session.storePayload(payload); std::string payloadType = cond::demangledName(typeid(T)); if (newTag) { createNewIOV(thePayloadHash, payloadType, time, myrecord); @@ -108,18 +105,77 @@ namespace cond { return thePayloadHash; } + // warning: takes over the ownership of pointer "payload" + template + Hash writeOne(const T* payloadPtr, Time_t time, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::writeOne"); + std::unique_ptr payload(payloadPtr); + std::lock_guard lock(m_mutex); + return writeOne(*payload, time, recordName); + } + + // warning: unlike the previous method, do NOT take over the ownership of payload pointers! + template + void writeMany(const std::map >& iovAndPayloads, const std::string& recordName) { + if (iovAndPayloads.empty()) + return; + std::lock_guard lock(m_mutex); + doStartTransaction(); + cond::persistency::TransactionScope scope(m_session.transaction()); + try { + this->initDB(); + Record& myrecord = this->lookUpRecord(recordName); + m_logger.logInfo() << "Tag mapped to record " << recordName << ": " << myrecord.m_tag; + bool newTag = isNewTagRequest(recordName); + cond::Time_t lastSince; + cond::persistency::IOVEditor editor; + if (newTag) { + std::string payloadType = cond::demangledName(typeid(T)); + editor = m_session.createIov(payloadType, myrecord.m_tag, myrecord.m_timetype, cond::SYNCH_ANY); + editor.setDescription("New Tag"); + } else { + editor = m_session.editIov(myrecord.m_tag); + if (myrecord.m_onlyAppendUpdatePolicy) { + cond::TagInfo_t tInfo; + this->getTagInfo(myrecord.m_idName, tInfo); + lastSince = tInfo.lastInterval.since; + if (lastSince == cond::time::MAX_VAL) + lastSince = 0; + } + } + for (auto& iovEntry : iovAndPayloads) { + Time_t time = iovEntry.first; + auto payload = iovEntry.second; + if (myrecord.m_onlyAppendUpdatePolicy && !newTag) { + if (time <= lastSince) { + m_logger.logInfo() << "Won't append iov with since " << std::to_string(time) + << ", because is less or equal to last available since = " << lastSince; + continue; + } + } + auto payloadHash = m_session.storePayload(*payload); + editor.insert(time, payloadHash); + } + cond::UserLogInfo a = this->lookUpUserLogInfo(myrecord.m_idName); + editor.flush(a.usertext); + if (m_autoCommit) { + doCommitTransaction(); + } + } catch (const std::exception& er) { + cond::throwException(std::string(er.what()), "PoolDBOutputService::writeMany"); + } + scope.close(); + return; + } + // close the IOVSequence setting lastTill void closeIOV(Time_t lastTill, const std::string& recordName); - // this one we need to avoid to adapt client code around... to be removed in the long term! template - void createNewIOV(const T* firstPayloadObj, - cond::Time_t firstSinceTime, - cond::Time_t, - const std::string& recordName) { - if (!firstPayloadObj) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::createNewIOV"); + void createNewIOV(const T& payload, cond::Time_t firstSinceTime, const std::string& recordName) { std::lock_guard lock(m_mutex); + Record& myrecord = this->lookUpRecord(recordName); if (!myrecord.m_isNewTag) { cond::throwException(myrecord.m_tag + " is not a new tag", "PoolDBOutputService::createNewIOV"); @@ -128,7 +184,7 @@ namespace cond { cond::persistency::TransactionScope scope(m_session.transaction()); try { this->initDB(); - Hash payloadId = m_session.storePayload(*firstPayloadObj); + Hash payloadId = m_session.storePayload(payload); createNewIOV(payloadId, cond::demangledName(typeid(T)), firstSinceTime, myrecord); } catch (const std::exception& er) { cond::throwException(std::string(er.what()), "PoolDBOutputService::createNewIov"); @@ -136,11 +192,18 @@ namespace cond { scope.close(); } - // + // this one we need to avoid to adapt client code around... to be removed in the long term! + // warning: takes over the ownership of pointer "payload" template - void appendSinceTime(const T* payloadObj, cond::Time_t sinceTime, const std::string& recordName) { - if (!payloadObj) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::appendSinceTime"); + void createNewIOV(const T* payloadPtr, cond::Time_t firstSinceTime, cond::Time_t, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::createNewIOV"); + std::unique_ptr payload(payloadPtr); + this->createNewIOV(*payload, firstSinceTime, recordName); + } + + template + void appendSinceTime(const T& payload, cond::Time_t sinceTime, const std::string& recordName) { std::lock_guard lock(m_mutex); Record& myrecord = this->lookUpRecord(recordName); if (myrecord.m_isNewTag) { @@ -150,13 +213,22 @@ namespace cond { doStartTransaction(); cond::persistency::TransactionScope scope(m_session.transaction()); try { - appendSinceTime(m_session.storePayload(*payloadObj), sinceTime, myrecord); + appendSinceTime(m_session.storePayload(payload), sinceTime, myrecord); } catch (const std::exception& er) { cond::throwException(std::string(er.what()), "PoolDBOutputService::appendSinceTime"); } scope.close(); } + // warning: takes over the ownership of pointer "payload" + template + void appendSinceTime(const T* payloadPtr, cond::Time_t sinceTime, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::appendSinceTime"); + std::unique_ptr payload(payloadPtr); + this->appendSinceTime(*payload, sinceTime, recordName); + } + void createNewIOV(const std::string& firstPayloadId, cond::Time_t firstSinceTime, const std::string& recordName); bool appendSinceTime(const std::string& payloadId, cond::Time_t sinceTime, const std::string& recordName); diff --git a/CondCore/DBOutputService/src/PoolDBOutputService.cc b/CondCore/DBOutputService/src/PoolDBOutputService.cc index 3f156f23f34f1..af8e999ddcdde 100644 --- a/CondCore/DBOutputService/src/PoolDBOutputService.cc +++ b/CondCore/DBOutputService/src/PoolDBOutputService.cc @@ -287,10 +287,8 @@ bool cond::service::PoolDBOutputService::appendSinceTime(const std::string& payl cond::Time_t time, Record& myrecord) { m_logger.logInfo() << "Updating existing tag " << myrecord.m_tag << ", adding iov with since " << time; - std::string payloadType(""); try { cond::persistency::IOVEditor editor = m_session.editIov(myrecord.m_tag); - payloadType = editor.payloadType(); editor.insert(time, payloadId); cond::UserLogInfo a = this->lookUpUserLogInfo(myrecord.m_idName); editor.flush(a.usertext); From 24dc549159af36150c9251c63a1a4bb3d1f812b8 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 27 Aug 2021 16:35:07 +0200 Subject: [PATCH 177/923] Implement centralized payload pointer ownership and shared_ptr based interface --- CondCore/PopCon/interface/PopCon.h | 61 ++++--------- .../PopCon/interface/PopConSourceHandler.h | 85 +++---------------- 2 files changed, 28 insertions(+), 118 deletions(-) diff --git a/CondCore/PopCon/interface/PopCon.h b/CondCore/PopCon/interface/PopCon.h index a35261ae4f32c..38baeaee8b071 100644 --- a/CondCore/PopCon/interface/PopCon.h +++ b/CondCore/PopCon/interface/PopCon.h @@ -29,7 +29,6 @@ namespace popcon { class PopCon { public: typedef cond::Time_t Time_t; - //typedef cond::Summary Summary; PopCon(const edm::ParameterSet& pset); @@ -38,9 +37,6 @@ namespace popcon { template void write(Source const& source); - template - void writeOne(T* payload, Time_t time); - private: cond::persistency::Session initialize(); void finalize(Time_t lastTill); @@ -75,58 +71,37 @@ namespace popcon { static constexpr const char* const s_version = "5.0"; }; - template - void PopCon::writeOne(T* payload, Time_t time) { - m_dbService->writeOne(payload, time, m_record); - } - - template - void displayHelper(Container const& payloads) { - typename Container::const_iterator it; - for (it = payloads.begin(); it != payloads.end(); it++) - edm::LogInfo("PopCon") << "Since " << (*it).time << std::endl; - } - - template - const std::string displayIovHelper(Container const& payloads) { - if (payloads.empty()) - return std::string("Nothing to transfer;"); - std::ostringstream s; - // when only 1 payload is transferred; - if (payloads.size() == 1) - s << "Since " << (*payloads.begin()).time << "; "; - else { - // when more than one payload are transferred; - s << "first payload Since " << (*payloads.begin()).time << ", " - << "last payload Since " << (*payloads.rbegin()).time << "; "; - } - return s.str(); - } - template void PopCon::write(Source const& source) { typedef typename Source::value_type value_type; typedef typename Source::Container Container; std::pair ret = source(initialize(), m_tagInfo, m_logDBEntry); - Container const& payloads = *ret.first; + Container const& iovs = *ret.first; if (m_LoggingOn) { + std::string msg("Nothing to transfer;"); + size_t niovs = iovs.size(); + if (niovs) { + std::ostringstream s; + if (niovs == 1) { + s << "Since " << (*iovs.begin()).first << "; "; + } else { + s << "first payload Since " << (*iovs.begin()).first << ", " + << "last payload Since " << (*iovs.rbegin()).first << "; "; + } + msg = s.str(); + } std::ostringstream s; - s << "PopCon v" << s_version << "; " << displayIovHelper(payloads) << ret.second; - //s << "PopCon v" << s_version << "; " << cond::userInfo() << displayIovHelper(payloads) << ret.second; + s << "PopCon v" << s_version << "; " << msg << ret.second; m_dbService->setLogHeaderForRecord(m_record, source.id(), s.str()); } - displayHelper(payloads); + for (auto it : iovs) + edm::LogInfo("PopCon") << "Since " << it.first << std::endl; - std::for_each(payloads.begin(), - payloads.end(), - std::bind(&popcon::PopCon::writeOne, - this, - std::bind(&Container::value_type::payload, std::placeholders::_1), - std::bind(&Container::value_type::time, std::placeholders::_1))); + m_dbService->writeMany(iovs, m_record); - finalize(payloads.empty() ? Time_t(0) : payloads.back().time); + finalize(iovs.empty() ? Time_t(0) : iovs.rbegin()->first); } } // namespace popcon diff --git a/CondCore/PopCon/interface/PopConSourceHandler.h b/CondCore/PopCon/interface/PopConSourceHandler.h index ddfa95e66e62d..59f18796e66c4 100644 --- a/CondCore/PopCon/interface/PopConSourceHandler.h +++ b/CondCore/PopCon/interface/PopConSourceHandler.h @@ -32,44 +32,9 @@ namespace popcon { typedef T value_type; typedef PopConSourceHandler self; typedef cond::Time_t Time_t; - typedef cond::Summary Summary; - struct Triplet { - value_type* payload; - Summary* summary; - Time_t time; - }; - - typedef std::vector Container; - - typedef std::vector > OldContainer; - - class Ref { - public: - Ref() : m_dbsession() {} - Ref(cond::persistency::Session& dbsession, const std::string& hash) : m_dbsession(dbsession) { - m_d = m_dbsession.fetchPayload(hash); - } - ~Ref() {} - - Ref(const Ref& ref) : m_dbsession(ref.m_dbsession), m_d(ref.m_d) {} - - Ref& operator=(const Ref& ref) { - m_dbsession = ref.m_dbsession; - m_d = ref.m_d; - return *this; - } - - T const* ptr() const { return m_d.get(); } - - T const* operator->() const { return ptr(); } - // dereference operator - T const& operator*() const { return *ptr(); } - - private: - cond::persistency::Session m_dbsession; - std::shared_ptr m_d; - }; + typedef std::map > Container; + typedef std::unique_ptr Ref; PopConSourceHandler() : m_tagInfo(nullptr), m_logDBEntry(nullptr) {} @@ -78,7 +43,7 @@ namespace popcon { cond::TagInfo_t const& tagInfo() const { return *m_tagInfo; } // return last paylod of the tag - Ref lastPayload() const { return Ref(m_session, tagInfo().lastInterval.payloadId); } + Ref lastPayload() const { return m_session.fetchPayload(tagInfo().lastInterval.payloadId); } // return last successful log entry for the tag in question cond::LogDBEntry_t const& logDBEntry() const { return *m_logDBEntry; } @@ -102,10 +67,11 @@ namespace popcon { Container const& returnData() { getNewObjects(); - if (!m_to_transfer.empty()) - convertFromOld(); - sort(); - return m_triplets; + for (auto item : m_to_transfer) { + std::shared_ptr payload(item.first); + m_iovs.insert(std::make_pair(item.second, payload)); + } + return m_iovs; } std::string const& userTextLog() const { return m_userTextLog; } @@ -117,38 +83,9 @@ namespace popcon { // return a string identifing the source virtual std::string id() const = 0; - void sort() { - std::sort(m_triplets.begin(), - m_triplets.end(), - std::bind(std::less(), - std::bind(&Container::value_type::time, std::placeholders::_1), - std::bind(&Container::value_type::time, std::placeholders::_2))); - } - - // make sure to create a new one each time... - Summary* dummySummary(typename OldContainer::value_type const&) const { - return new cond::GenericSummary("not supplied"); - } - - void convertFromOld() { - std::for_each(m_to_transfer.begin(), - m_to_transfer.end(), - std::bind(&self::add, - this, - std::bind(&OldContainer::value_type::first, std::placeholders::_1), - std::bind(&self::dummySummary, this, std::placeholders::_1), - std::bind(&OldContainer::value_type::second, std::placeholders::_1))); - } - protected: cond::persistency::Session& dbSession() const { return m_session; } - int add(value_type* payload, Summary* summary, Time_t time) { - Triplet t = {payload, summary, time}; - m_triplets.push_back(t); - return m_triplets.size(); - } - private: mutable cond::persistency::Session m_session; @@ -159,12 +96,10 @@ namespace popcon { protected: //vector of payload objects and iovinfo to be transferred //class looses ownership of payload object - OldContainer m_to_transfer; + std::vector > m_to_transfer; - private: - Container m_triplets; + Container m_iovs; - protected: std::string m_userTextLog; }; } // namespace popcon From 0f15cfca881d025495b3b0798e0417ec9addbe19 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 27 Aug 2021 16:37:09 +0200 Subject: [PATCH 178/923] remove unneeded includes --- DQMServices/Core/interface/LegacyIOHelper.h | 11 +---------- DQMServices/Core/src/LegacyIOHelper.cc | 1 + 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/DQMServices/Core/interface/LegacyIOHelper.h b/DQMServices/Core/interface/LegacyIOHelper.h index ada1adbbd5ed9..9e1ae4b506df4 100644 --- a/DQMServices/Core/interface/LegacyIOHelper.h +++ b/DQMServices/Core/interface/LegacyIOHelper.h @@ -2,17 +2,8 @@ #define DQMSERVICES_CORE_LEGACYIOHELPER_H #include "DQMServices/Core/interface/DQMStore.h" -#include -#include -#include "TFile.h" #include "TROOT.h" -#include "TKey.h" -#include "TClass.h" -#include "TSystem.h" -#include "TBufferFile.h" -#include -#include -#include + // This class encapsulates the TDirectory based file format used for DQMGUI // uploads and many other use cases. // This should be part of `DQMFileSaver`, however since DQMServices/Components diff --git a/DQMServices/Core/src/LegacyIOHelper.cc b/DQMServices/Core/src/LegacyIOHelper.cc index fd484a86729e6..83abc3017a3a6 100644 --- a/DQMServices/Core/src/LegacyIOHelper.cc +++ b/DQMServices/Core/src/LegacyIOHelper.cc @@ -9,6 +9,7 @@ #include "TString.h" #include "TSystem.h" #include "TFile.h" +#include "TKey.h" #include void LegacyIOHelper::save(std::string const &filename, From beace2ef731164700028cc582461ee1cbcfbab00 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 27 Aug 2021 16:37:21 +0200 Subject: [PATCH 179/923] Adapted to new PopCon interface --- .../interface/LHCInfoPopConSourceHandler.h | 1 - .../RunInfo/src/LHCInfoPopConSourceHandler.cc | 27 ++++++++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h index b5354952d869f..9a96c57765066 100644 --- a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h +++ b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h @@ -47,7 +47,6 @@ class LHCInfoPopConSourceHandler : public popcon::PopConSourceHandler { std::unique_ptr m_fillPayload; std::shared_ptr m_prevPayload; std::vector > > m_tmpBuffer; - std::vector > m_payloadBuffer; bool m_lastPayloadEmpty = false; }; diff --git a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc index 0ab9ba892f4f9..a1b4ed97e42e9 100644 --- a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc @@ -31,8 +31,7 @@ LHCInfoPopConSourceHandler::LHCInfoPopConSourceHandler(edm::ParameterSet const& m_authpath(pset.getUntrackedParameter("authenticationPath", "")), m_fillPayload(), m_prevPayload(), - m_tmpBuffer(), - m_payloadBuffer() { + m_tmpBuffer() { if (pset.exists("startTime")) { m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); } @@ -773,19 +772,18 @@ bool LHCInfoPopConSourceHandler::getEcalData(cond::persistency::Session& session void LHCInfoPopConSourceHandler::addEmptyPayload(cond::Time_t iov) { bool add = false; - if (m_to_transfer.empty()) { + if (m_iovs.empty()) { if (!m_lastPayloadEmpty) add = true; } else { - LHCInfo* lastAdded = m_to_transfer.back().first; + auto lastAdded = m_iovs.rbegin()->second; if (lastAdded->fillNumber() != 0) { add = true; } } if (add) { auto newPayload = std::make_shared(); - m_to_transfer.push_back(std::make_pair(newPayload.get(), iov)); - m_payloadBuffer.push_back(newPayload); + m_iovs.insert(std::make_pair(iov, newPayload)); m_prevPayload = newPayload; } } @@ -816,26 +814,24 @@ namespace LHCInfoImpl { } size_t transferPayloads(const std::vector>>& buffer, - std::vector>& payloadBuffer, - std::vector>& vecToTransfer, + std::map>& iovsToTransfer, std::shared_ptr& prevPayload) { size_t niovs = 0; for (auto& iov : buffer) { bool add = false; - LHCInfo& payload = *iov.second; + auto payload = iov.second; cond::Time_t since = iov.first; - if (vecToTransfer.empty()) { + if (iovsToTransfer.empty()) { add = true; } else { - LHCInfo& lastAdded = *vecToTransfer.back().first; - if (!comparePayloads(lastAdded, payload)) { + LHCInfo& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { add = true; } } if (add) { niovs++; - vecToTransfer.push_back(std::make_pair(&payload, since)); - payloadBuffer.push_back(iov.second); + iovsToTransfer.insert(std::make_pair(since, payload)); prevPayload = iov.second; } } @@ -965,11 +961,10 @@ void LHCInfoPopConSourceHandler::getNewObjects() { getEcalData(session2, startSampleTime, endSampleTime, updateEcal); session2.transaction().commit(); // - size_t niovs = LHCInfoImpl::transferPayloads(m_tmpBuffer, m_payloadBuffer, m_to_transfer, m_prevPayload); + size_t niovs = LHCInfoImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; m_tmpBuffer.clear(); iovAdded = true; - //if(m_prevPayload->fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() ); if (m_prevPayload->fillNumber() and m_fillPayload->endTime() != 0ULL) addEmptyPayload(m_fillPayload->endTime()); } From 40f6c27aef06bfd2b42270468c6bdb3055501b21 Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 27 Aug 2021 16:42:07 +0200 Subject: [PATCH 180/923] Moving clients holding the payload pointer ownership to the new DBOuputService interface --- .../plugins/WriteEcalMiscalibConstants.cc | 6 +++--- .../plugins/WriteEcalMiscalibConstantsMC.cc | 5 ++--- .../plugins/SiPixelStatusHarvester.cc | 12 ++++++------ .../plugins/DBWriter/DummyCondDBWriter.h | 2 +- .../DBWriter/SiStripFedCablingManipulator.cc | 4 ++-- .../plugins/CorrPCCProducer.cc | 2 -- .../interface/ConditionDBWriter.h | 2 +- .../MFObjects/test/MagFieldConfigDBWriter.cc | 4 ++-- .../test/SiPixelGainCalibrationReadDQMFile.cc | 16 ++++++---------- .../SiStripApvSimulationParametersBuilder.cc | 4 ++-- .../SiStrip/plugins/SiStripBadChannelBuilder.cc | 7 +++---- IOMC/EventVertexGenerators/src/BeamProfile2DB.cc | 3 +-- RecoHI/HiJetAlgos/plugins/UETableProducer.cc | 9 ++++----- 13 files changed, 33 insertions(+), 43 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc index 0847724a04d78..6b85d2ac4cd0e 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc @@ -69,12 +69,12 @@ void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::Ev if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { std::cout << " Creating a new one " << std::endl; - poolDbService->createNewIOV( - Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_); + poolDbService->createNewIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); std::cout << "Done" << std::endl; } else { std::cout << "Old One " << std::endl; - poolDbService->appendSinceTime(Mcal, poolDbService->currentTime(), newTagRequest_); + poolDbService->appendSinceTime( + *Mcal, poolDbService->currentTime(), newTagRequest_); } } } diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc index f43abd36c1b1c..0846c950d1aa0 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc @@ -69,13 +69,12 @@ void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm:: if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { std::cout << " Creating a new one " << std::endl; - poolDbService->createNewIOV( - Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_); + poolDbService->createNewIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); std::cout << "Done" << std::endl; } else { std::cout << "Old One " << std::endl; poolDbService->appendSinceTime( - Mcal, poolDbService->currentTime(), newTagRequest_); + *Mcal, poolDbService->currentTime(), newTagRequest_); } } } diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index 48ea04ec37fa0..15c2dd56a7027 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -194,7 +194,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (debug_ == true) { // only produced for debugging reason cond::Time_t thisIOV = (cond::Time_t)iRun.id().run(); - poolDbService->writeOne(siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); + poolDbService->writeOne(*siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); } // IOV for final payloads. FEDerror25 and pcl @@ -298,7 +298,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet fedError25IOV[it->first] = it->first; if (debug_ == true) // only produced for debugging reason - poolDbService->writeOne(siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); + poolDbService->writeOne(*siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); delete siPixelQuality_FEDerror25; } @@ -556,12 +556,12 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet edm::LuminosityBlockID lu(iRun.id().run(), endLumiBlock_ + 1); cond::Time_t thisIOV = (cond::Time_t)(lu.value()); if (!SiPixelStatusHarvester::equal(lastPrompt, siPixelQualityPermBad)) - poolDbService->writeOne(siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); + poolDbService->writeOne(*siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); // add empty bad components to last lumi+1 IF AND ONLY IF the last payload of other is not equal to empty SiPixelQuality* siPixelQualityDummy = new SiPixelQuality(); if (!SiPixelStatusHarvester::equal(lastOther, siPixelQualityDummy)) - poolDbService->writeOne(siPixelQualityDummy, thisIOV, recordName_ + "_other"); + poolDbService->writeOne(*siPixelQualityDummy, thisIOV, recordName_ + "_other"); delete siPixelQualityDummy; } @@ -657,12 +657,12 @@ void SiPixelStatusHarvester::constructTag(std::map siPixel SiPixelQuality* thisPayload = qIt->second; if (qIt == siPixelQualityTag.begin()) - poolDbService->writeOne(thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOne(*thisPayload, thisIOV, recordName_ + "_" + tagName); else { SiPixelQuality* prevPayload = (std::prev(qIt))->second; if (!SiPixelStatusHarvester::equal(thisPayload, prevPayload)) // only append newIOV if this payload differs wrt last - poolDbService->writeOne(thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOne(*thisPayload, thisIOV, recordName_ + "_" + tagName); } } } diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h index 3e948958f0517..65fa38cdf2db4 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h @@ -68,7 +68,7 @@ void DummyCondDBWriter::endRun(const edm::Run& run, else Time_ = iConfig_.getUntrackedParameter("OpenIovAtTime", 1); - dbservice->writeOne(obj.release(), Time_, rcdName); + dbservice->writeOne(*obj, Time_, rcdName); } else { edm::LogError("SiStripFedCablingBuilder") << "Service is unavailable" << std::endl; } diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc index 4d4432bdca850..20c230a5c48a3 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc @@ -41,12 +41,12 @@ void SiStripFedCablingManipulator::endRun(const edm::Run& run, const edm::EventS edm::LogInfo("SiStripFedCablingManipulator") << "first request for storing objects with Record " << "SiStripFedCablingRcd" << " at time " << Time_ << std::endl; - dbservice->createNewIOV(obj.release(), Time_, dbservice->endOfTime(), "SiStripFedCablingRcd"); + dbservice->createNewIOV(*obj, Time_, "SiStripFedCablingRcd"); } else { edm::LogInfo("SiStripFedCablingManipulator") << "appending a new object to existing tag " << "SiStripFedCablingRcd" << " in since mode " << std::endl; - dbservice->appendSinceTime(obj.release(), Time_, "SiStripFedCablingRcd"); + dbservice->appendSinceTime(*obj, Time_, "SiStripFedCablingRcd"); } } else { edm::LogError("SiStripFedCablingManipulator") << "Service is unavailable" << std::endl; diff --git a/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc index 771cf1b647fd9..7295d4ef88af8 100644 --- a/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc +++ b/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc @@ -580,8 +580,6 @@ void CorrPCCProducer::dqmEndRunProduce(edm::Run const& runSeg, const edm::EventS throw std::runtime_error("PoolDBService required."); } - delete pccCorrections; - histoFile->cd(); corrlumiAvg_h->Write(); scaleFactorAvg_h->Write(); diff --git a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h index 01900addce52d..064dbd6063895 100644 --- a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h +++ b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h @@ -333,7 +333,7 @@ class ConditionDBWriter : public edm::EDAnalyzer { edm::LogInfo("ConditionDBWriter") << "appending a new object to tag " << Record_ << " in since mode " << std::endl; // The Framework will take control over the DB object now, therefore the release. - mydbservice->writeOne(objPointer.release(), since, Record_); + mydbservice->writeOne(*objPointer, since, Record_); } void setTime() { diff --git a/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc b/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc index 47f1f5e4080e6..38a0081ae5d5f 100644 --- a/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc +++ b/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc @@ -45,10 +45,10 @@ void MagFieldConfigDBWriter::endJob() { try { if (dbOutputSvc->isNewTagRequest(record)) { //create mode - dbOutputSvc->writeOne(conf, dbOutputSvc->beginOfTime(), record); + dbOutputSvc->writeOne(*conf, dbOutputSvc->beginOfTime(), record); } else { //append mode. Note: correct PoolDBESSource must be loaded - dbOutputSvc->writeOne(conf, dbOutputSvc->currentTime(), record); + dbOutputSvc->writeOne(*conf, dbOutputSvc->currentTime(), record); } } catch (const cond::Exception& er) { std::cout << er.what() << std::endl; diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc index 26868a87de495..f7e4fe86e332d 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc +++ b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc @@ -459,24 +459,20 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet if (record_ == "SiPixelGainCalibrationForHLTRcd") { std::cout << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { - mydbservice->createNewIOV(theGainCalibrationDbInputHLT.release(), - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationForHLTRcd"); + mydbservice->createNewIOV( + *theGainCalibrationDbInputHLT, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd"); } else { mydbservice->appendSinceTime( - theGainCalibrationDbInputHLT.release(), mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); + *theGainCalibrationDbInputHLT, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); } } else if (record_ == "SiPixelGainCalibrationOfflineRcd") { std::cout << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { - mydbservice->createNewIOV(theGainCalibrationDbInputOffline.release(), - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationOfflineRcd"); + mydbservice->createNewIOV( + *theGainCalibrationDbInputOffline, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd"); } else { mydbservice->appendSinceTime( - theGainCalibrationDbInputOffline.release(), mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); + *theGainCalibrationDbInputOffline, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); } } edm::LogInfo(" --- all OK"); diff --git a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc index 6863d9bf59e58..b5d7e89ae6e4c 100644 --- a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc @@ -23,10 +23,10 @@ void SiStripApvSimulationParametersBuilder::analyze(const edm::Event&, const edm if (mydbservice.isAvailable()) { if (mydbservice->isNewTagRequest("SiStripApvSimulationParametersRcd")) { mydbservice->createNewIOV( - obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripApvSimulationParametersRcd"); + *obj, mydbservice->beginOfTime(), "SiStripApvSimulationParametersRcd"); } else { mydbservice->appendSinceTime( - obj.get(), mydbservice->currentTime(), "SiStripApvSimulationParametersRcd"); + *obj, mydbservice->currentTime(), "SiStripApvSimulationParametersRcd"); } } else { edm::LogError("SiStripApvSimulationParametersBuilder") << "Service is unavailable"; diff --git a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc index eea06c86a5bf7..4252970489e59 100644 --- a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc @@ -79,11 +79,10 @@ std::unique_ptr SiStripBadChannelBuilder::getNewObject() { if (mydbservice.isAvailable()) { if (mydbservice->isNewTagRequest("SiStripBadStripRcd")) { - mydbservice->createNewIOV( - obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripBadStripRcd"); + mydbservice->createNewIOV(*obj, mydbservice->beginOfTime(), "SiStripBadStripRcd"); } else { - //mydbservice->createNewIOV(obj.get(),mydbservice->currentTime(),"SiStripBadStripRcd"); - mydbservice->appendSinceTime(obj.get(), mydbservice->currentTime(), "SiStripBadStripRcd"); + //mydbservice->createNewIOV(*obj, mydbservice->currentTime(),"SiStripBadStripRcd"); + mydbservice->appendSinceTime(*obj, mydbservice->currentTime(), "SiStripBadStripRcd"); } } else { edm::LogError("SiStripBadStripBuilder") << "Service is unavailable" << std::endl; diff --git a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc b/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc index 2b8f5dd27d656..2bc9415b70d70 100644 --- a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc +++ b/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc @@ -103,8 +103,7 @@ void BeamProfile2DB::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ void BeamProfile2DB::endJob() { edm::Service poolDbService; - poolDbService->createNewIOV( - &beamSpot_, poolDbService->beginOfTime(), poolDbService->endOfTime(), "SimBeamSpotObjectsRcd"); + poolDbService->createNewIOV(beamSpot_, poolDbService->beginOfTime(), "SimBeamSpotObjectsRcd"); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/RecoHI/HiJetAlgos/plugins/UETableProducer.cc b/RecoHI/HiJetAlgos/plugins/UETableProducer.cc index ddbe3b50c5d9d..cb8747a40906b 100644 --- a/RecoHI/HiJetAlgos/plugins/UETableProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/UETableProducer.cc @@ -202,19 +202,18 @@ void UETableProducer::endJob() { jme_payload->push_back(JetCorrectorParametersCollection::L1Offset, parameter); if (pool->isNewTagRequest("JetCorrectionsRecord")) { - pool->createNewIOV( - jme_payload.get(), pool->beginOfTime(), pool->endOfTime(), "JetCorrectionsRecord"); + pool->createNewIOV(*jme_payload, pool->beginOfTime(), "JetCorrectionsRecord"); } else { pool->appendSinceTime( - jme_payload.get(), pool->currentTime(), "JetCorrectionsRecord"); + *jme_payload, pool->currentTime(), "JetCorrectionsRecord"); } } else { ue_predictor_pf->values = ue_vec; if (pool->isNewTagRequest("HeavyIonUERcd")) { - pool->createNewIOV(ue_predictor_pf.get(), pool->beginOfTime(), pool->endOfTime(), "HeavyIonUERcd"); + pool->createNewIOV(*ue_predictor_pf, pool->beginOfTime(), "HeavyIonUERcd"); } else { - pool->appendSinceTime(ue_predictor_pf.get(), pool->currentTime(), "HeavyIonUERcd"); + pool->appendSinceTime(*ue_predictor_pf, pool->currentTime(), "HeavyIonUERcd"); } } } From d73e61c2e90863e8c323067870d87cb9b2dbd5f8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 Aug 2021 09:42:29 -0500 Subject: [PATCH 181/923] Added missing esConsumes --- .../EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc | 6 +++--- .../EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h | 1 + RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc b/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc index 5a8d036eaab85..020f7aa27d5a9 100644 --- a/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc +++ b/RecoEcal/EgammaClusterProducers/src/EgammaSCCorrectionMaker.cc @@ -75,6 +75,7 @@ class EgammaSCCorrectionMaker : public edm::stream::EDProducer<> { edm::EDGetTokenT rHInputProducer_; edm::EDGetTokenT sCInputProducer_; edm::InputTag rHTag_; + edm::ESGetToken caloGeomToken_; reco::CaloCluster::AlgoId sCAlgo_; std::string outputCollection_; @@ -88,6 +89,7 @@ EgammaSCCorrectionMaker::EgammaSCCorrectionMaker(const edm::ParameterSet& ps) { rHTag_ = ps.getParameter("recHitProducer"); rHInputProducer_ = consumes(rHTag_); sCInputProducer_ = consumes(ps.getParameter("rawSuperClusterProducer")); + caloGeomToken_ = esConsumes(); std::string sCAlgo_str = ps.getParameter("superClusterAlgo"); // determine which BasicCluster algo we are correcting for @@ -166,9 +168,7 @@ void EgammaSCCorrectionMaker::produce(edm::Event& evt, const edm::EventSetup& es localContCorrectionFunction_->init(es); // get the collection geometry: - edm::ESHandle geoHandle; - es.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; + const CaloGeometry& geometry = es.getData(caloGeomToken_); const CaloSubdetectorGeometry* geometry_p; std::string rHInputCollection = rHTag_.instance(); diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h b/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h index fc66f5bd5837d..f512f93fd9681 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h @@ -52,6 +52,7 @@ class PhotonEnergyCorrector { edm::EDGetTokenT barrelEcalHitsToken_; edm::EDGetTokenT endcapEcalHitsToken_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; + const edm::ESGetToken caloGeomToken_; std::unique_ptr photonUncertaintyCalculator_; }; diff --git a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc index d6547c508c481..cf3964dfa3ec0 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc @@ -11,7 +11,7 @@ #include "RecoEgamma/EgammaPhotonAlgos/interface/EnergyUncertaintyPhotonSpecific.h" PhotonEnergyCorrector::PhotonEnergyCorrector(const edm::ParameterSet& config, edm::ConsumesCollector&& iC) - : ecalClusterToolsESGetTokens_{std::move(iC)} { + : ecalClusterToolsESGetTokens_{iC}, caloGeomToken_{iC.esConsumes()} { minR9Barrel_ = config.getParameter("minR9Barrel"); minR9Endcap_ = config.getParameter("minR9Endcap"); // get the geometry from the event setup: @@ -58,7 +58,7 @@ PhotonEnergyCorrector::PhotonEnergyCorrector(const edm::ParameterSet& config, ed } void PhotonEnergyCorrector::init(const edm::EventSetup& theEventSetup) { - theEventSetup.get().get(theCaloGeom_); + theCaloGeom_ = theEventSetup.getHandle(caloGeomToken_); scEnergyFunction_->init(theEventSetup); scCrackEnergyFunction_->init(theEventSetup); From b3b60bffb235ff2a1cde6e01b8f19f2b535edf01 Mon Sep 17 00:00:00 2001 From: swmukher Date: Fri, 27 Aug 2021 17:31:50 +0200 Subject: [PATCH 182/923] small changes --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index 3b5893ab1a622..d4ee26da16ce1 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -1,7 +1,21 @@ -// -*- C++ -*- -// -// Class: EgammaHLTHcalVarProducerFromRecHit -// +// Class: EgammaHLTHcalVarProducerFromRecHit + +/* + +Author: Swagata Mukherjee + +Date: August 2021 + +This class is similar to the existing class EgammaHLTBcHcalIsolationProducersRegional, +but the new feature in this code is that the HCAL recHits are used instead of the +calotowers which is expected to be phased out sometime in Run3. +The old class can also be used until calotowers stay. After that, one need to switch to this new one. + +As the old producer code, this one also produces either Hcal isolation or H for H/E depending if doEtSum=true or false. +H for H/E = either a single HCCAL tower behind SC, or towers in a cone, and hcal isolation has these tower(s) excluded. +A rho correction can be applied + +*/ #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h" @@ -19,15 +33,6 @@ #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" -//This class is similar to the existing class EgammaHLTBcHcalIsolationProducersRegional, -//but the new feature in this code is that the HCAL recHits are used instead of the -//calotowers which is expected to be phased out sometime in Run3. -//The old class can also be used until calotowers stay. After that, one need to switch to this new one. - -//As the old producer code, this one also produces either Hcal isolation or H for H/E depending if doEtSum=true or false. -//H for H/E = either a single HCCAL tower behind SC, or towers in a cone, and hcal isolation has these tower(s) excluded. -//a rho correction can be applied - class EgammaHLTHcalVarProducerFromRecHit : public edm::global::EDProducer<> { public: explicit EgammaHLTHcalVarProducerFromRecHit(const edm::ParameterSet &); From 0eada5d56f1c0867840f0281cc17d53f640c46cb Mon Sep 17 00:00:00 2001 From: Giacomo Govi Date: Fri, 27 Aug 2021 17:32:08 +0200 Subject: [PATCH 183/923] Cosmetics on comments... --- .../ConditionDBWriter/interface/ConditionDBWriter.h | 1 - CondCore/DBOutputService/interface/PoolDBOutputService.h | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h index 064dbd6063895..139a7ae3b74c6 100644 --- a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h +++ b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h @@ -332,7 +332,6 @@ class ConditionDBWriter : public edm::EDAnalyzer { edm::LogInfo("ConditionDBWriter") << "appending a new object to tag " << Record_ << " in since mode " << std::endl; - // The Framework will take control over the DB object now, therefore the release. mydbservice->writeOne(*objPointer, since, Record_); } diff --git a/CondCore/DBOutputService/interface/PoolDBOutputService.h b/CondCore/DBOutputService/interface/PoolDBOutputService.h index 1a2b0018548aa..b6f56157b29c6 100644 --- a/CondCore/DBOutputService/interface/PoolDBOutputService.h +++ b/CondCore/DBOutputService/interface/PoolDBOutputService.h @@ -105,7 +105,7 @@ namespace cond { return thePayloadHash; } - // warning: takes over the ownership of pointer "payload" + // warning: takes over the ownership of pointer "payload". Deprecated. Please move to the above referece-based function template Hash writeOne(const T* payloadPtr, Time_t time, const std::string& recordName) { if (!payloadPtr) @@ -115,7 +115,6 @@ namespace cond { return writeOne(*payload, time, recordName); } - // warning: unlike the previous method, do NOT take over the ownership of payload pointers! template void writeMany(const std::map >& iovAndPayloads, const std::string& recordName) { if (iovAndPayloads.empty()) @@ -192,8 +191,7 @@ namespace cond { scope.close(); } - // this one we need to avoid to adapt client code around... to be removed in the long term! - // warning: takes over the ownership of pointer "payload" + // warning: takes over the ownership of pointer "payload" - deprecated. Please move to the above reference-based function template void createNewIOV(const T* payloadPtr, cond::Time_t firstSinceTime, cond::Time_t, const std::string& recordName) { if (!payloadPtr) @@ -220,7 +218,7 @@ namespace cond { scope.close(); } - // warning: takes over the ownership of pointer "payload" + // warning: takes over the ownership of pointer "payload" - deprecated. Please move to the above reference-based function template void appendSinceTime(const T* payloadPtr, cond::Time_t sinceTime, const std::string& recordName) { if (!payloadPtr) From 6c4b2f07f0a146676216161d0fd847e3b88ec6ca Mon Sep 17 00:00:00 2001 From: Jack Sisson Date: Fri, 27 Aug 2021 11:02:49 -0500 Subject: [PATCH 184/923] Removed unnecessary include statements --- .../plugins/SiPixelPhase1EfficiencyExtras.cc | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc index 2154cb404d83b..2f33461cee144 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc @@ -21,38 +21,16 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" // DQM Framework -#include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/DQMEDHarvester.h" -// Geometry -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -// DataFormats -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" -#include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" -// -#include -#include -#include -#include -#include using namespace std; using namespace edm; From 1942ef77960aee9efc6e59675bcff9558f5d3d68 Mon Sep 17 00:00:00 2001 From: swmukher Date: Fri, 27 Aug 2021 18:48:48 +0200 Subject: [PATCH 185/923] code checks --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 83 +++++++++---------- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index d4ee26da16ce1..f91ffaab113ab 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -67,7 +67,6 @@ class EgammaHLTHcalVarProducerFromRecHit : public edm::global::EDProducer<> { const edm::ESGetToken hcalSevLvlComputerToken_; const edm::ESGetToken caloTowerConstituentsMapToken_; const edm::EDPutTokenT putToken_; - }; EgammaHLTHcalVarProducerFromRecHit::EgammaHLTHcalVarProducerFromRecHit(const edm::ParameterSet &config) @@ -141,9 +140,8 @@ void EgammaHLTHcalVarProducerFromRecHit::fillDescriptions(edm::ConfigurationDesc } void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, - edm::Event &iEvent, - const edm::EventSetup &iSetup) const { - + edm::Event &iEvent, + const edm::EventSetup &iSetup) const { auto recoEcalCandHandle = iEvent.getHandle(recoEcalCandidateProducer_); double rho = 0.0; @@ -164,62 +162,55 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, float isol = 0; EgammaHcalIsolation::InclusionRule external; EgammaHcalIsolation::InclusionRule internal; - - if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based - external=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - } - if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E - external=EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; - internal=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; } - if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal - external=EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal=EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E + external = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; } + if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + } EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation(external, - outerCone_, - internal, - innerCone_, - eThresHB_, - etThresHB_, - maxSeverityHB_, - eThresHE_, - etThresHE_, - maxSeverityHE_, - iEvent.get(hbheRecHitsTag_), - iSetup.getData(caloGeometryToken_), - iSetup.getData(hcalTopologyToken_), - iSetup.getData(hcalChannelQualityToken_), - iSetup.getData(hcalSevLvlComputerToken_), - iSetup.getData(caloTowerConstituentsMapToken_) - ); - - - if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based. - if (doEtSum_) { //hcal iso - isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(),depth_); //depth=0 means all depths - } - else if (!doEtSum_) { // doEtSum_=False means sum up energy, this is for H/E - isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(),depth_); //depth=0 means all depths + outerCone_, + internal, + innerCone_, + eThresHB_, + etThresHB_, + maxSeverityHB_, + eThresHE_, + etThresHE_, + maxSeverityHE_, + iEvent.get(hbheRecHitsTag_), + iSetup.getData(caloGeometryToken_), + iSetup.getData(hcalTopologyToken_), + iSetup.getData(hcalChannelQualityToken_), + iSetup.getData(hcalSevLvlComputerToken_), + iSetup.getData(caloTowerConstituentsMapToken_)); + + if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based. + if (doEtSum_) { //hcal iso + isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } else if (!doEtSum_) { // doEtSum_=False means sum up energy, this is for H/E + isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(), depth_); //depth=0 means all depths } } - if (useSingleTower_) { - if (doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal - isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths - } - else if (!doEtSum_) { //this is single tower based H/E - isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(),depth_); //depth=0 means all depths + if (doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal + isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } else if (!doEtSum_) { //this is single tower based H/E + isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths } } - if (doRhoCorrection_) { int iEA = -1; auto scEta = std::abs(recoEcalCandRef->superCluster()->eta()); From 88c0620ec2f3fd0c0989d7a2411ddc25eb2c722c Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 27 Aug 2021 18:55:13 +0200 Subject: [PATCH 186/923] solving issue 35033 --- .../CTPPSReco/interface/CTPPSPixelRecHit.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h index 6cbc0d018ded8..cc51dda981676 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h @@ -1,10 +1,10 @@ /* * -* This is a part of CTPPS offline software. -* Author: -* Fabrizio Ferro (ferro@ge.infn.it) -* -*/ + * This is a part of CTPPS offline software. + * Author: + * Fabrizio Ferro (ferro@ge.infn.it) + * + */ #ifndef DataFormats_CTPPSReco_CTPPSPixelRecHit_H #define DataFormats_CTPPSReco_CTPPSPixelRecHit_H @@ -16,10 +16,8 @@ class CTPPSPixelRecHit { public: - CTPPSPixelRecHit() {} - - CTPPSPixelRecHit(LocalPoint lp, - LocalError le, + CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), + LocalError le = LocalError(0., 0., 0.), bool edge = false, bool bad = false, bool rocs = false, From 808b9334ed7d4ee7908033ac136760bffd3b06a3 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 27 Aug 2021 18:57:15 +0200 Subject: [PATCH 187/923] Investigating dd4hep initialization with root name other than cms::OCMS --- DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc | 1 + .../plugins/DreamSensitiveDetectorBuilder.cc | 4 +++- SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc index 103d46920153f..d3d0147f47a68 100644 --- a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc +++ b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc @@ -70,6 +70,7 @@ DDDetectorESProducer::DDDetectorESProducer(const ParameterSet& iConfig) rootDDName_(iConfig.getParameter("rootDDName")), label_(iConfig.getParameter("label")) { usesResources({edm::ESSharedResourceNames::kDD4Hep}); + edm::LogVerbatim("Geometry") << "DDDetectorESProducer::fromDB " << fromDB_ << " appendToDataLabel " << appendToDataLabel_ << " rootDDName " << rootDDName_ << " label " << label_ << " confGeomXMLFiles " << confGeomXMLFiles_; if (rootDDName_ == "MagneticFieldVolumes:MAGF" || rootDDName_ == "cmsMagneticField:MAGF") { auto c = setWhatProduced(this, &DDDetectorESProducer::produceMagField, diff --git a/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc b/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc index a437d887c9696..20a1e1c4a2228 100644 --- a/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc +++ b/SimG4CMS/CherenkovAnalysis/plugins/DreamSensitiveDetectorBuilder.cc @@ -13,8 +13,9 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/ESGetToken.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" class DreamSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { public: @@ -24,6 +25,7 @@ class DreamSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { cpvTokenDD4Hep_ = cc.esConsumes(); else cpvTokenDDD_ = cc.esConsumes(); + edm::LogVerbatim("EcalSim") << "DreamSensitiveDetectorBuilder called with dd4hep flag " << fromDD4Hep_; } void beginRun(const edm::EventSetup& es) final { diff --git a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py index 3fb73b6ee69fe..4dee50fee0ade 100644 --- a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py +++ b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py @@ -7,6 +7,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load("SimG4CMS.CherenkovAnalysis.gun_cff") process.load("Configuration.Geometry.GeometryDD4hep_cff") +process.load("DetectorDescription.DDCMS.DDDetectorESProducer_cfi") process.load("Geometry.HcalCommonData.caloSimulationParameters_cff") process.load('GeneratorInterface.Core.generatorSmeared_cfi') process.load("SimG4Core.Application.g4SimHits_cfi") @@ -24,6 +25,7 @@ if hasattr(process,'MessageLogger'): process.MessageLogger.EcalSim=dict() process.MessageLogger.HCalGeom=dict() + process.MessageLogger.Geometry=dict() process.MessageLogger.CherenkovAnalysis=dict() process.MessageLogger.SimG4CoreGeometry=dict() @@ -37,6 +39,7 @@ process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.cherenkovAnalysis) process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml") +process.DDDetectorESProducer.rootDDName = 'singleDREAM:DREAM' process.generator.PGunParameters.MinE = 10.0 process.generator.PGunParameters.MaxE = 10.0 process.g4SimHits.UseMagneticField = False From 6cc0625047b5b05daad1b81c1c7310ea7dc5c48c Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 27 Aug 2021 19:13:38 +0200 Subject: [PATCH 188/923] Code check --- DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc index d3d0147f47a68..640e24c1db61d 100644 --- a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc +++ b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc @@ -70,7 +70,9 @@ DDDetectorESProducer::DDDetectorESProducer(const ParameterSet& iConfig) rootDDName_(iConfig.getParameter("rootDDName")), label_(iConfig.getParameter("label")) { usesResources({edm::ESSharedResourceNames::kDD4Hep}); - edm::LogVerbatim("Geometry") << "DDDetectorESProducer::fromDB " << fromDB_ << " appendToDataLabel " << appendToDataLabel_ << " rootDDName " << rootDDName_ << " label " << label_ << " confGeomXMLFiles " << confGeomXMLFiles_; + edm::LogVerbatim("Geometry") << "DDDetectorESProducer::fromDB " << fromDB_ << " appendToDataLabel " + << appendToDataLabel_ << " rootDDName " << rootDDName_ << " label " << label_ + << " confGeomXMLFiles " << confGeomXMLFiles_; if (rootDDName_ == "MagneticFieldVolumes:MAGF" || rootDDName_ == "cmsMagneticField:MAGF") { auto c = setWhatProduced(this, &DDDetectorESProducer::produceMagField, From 3a45d604f7c11ded3ac49f47419e0b4fcd5c67b5 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 27 Aug 2021 12:30:15 -0500 Subject: [PATCH 189/923] Removed undefined use of union in getAnyPtr The use of cast generates the exact same assembler code. --- FWCore/Utilities/interface/getAnyPtr.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/FWCore/Utilities/interface/getAnyPtr.h b/FWCore/Utilities/interface/getAnyPtr.h index 7e2c60a35bdbb..0daed4cbe2414 100644 --- a/FWCore/Utilities/interface/getAnyPtr.h +++ b/FWCore/Utilities/interface/getAnyPtr.h @@ -6,18 +6,8 @@ namespace edm { template - inline std::unique_ptr getAnyPtr(void* p, int offset) { - // A union is used to avoid possible copies during the triple cast that would otherwise be needed. - // std::unique_ptr edp(static_cast(static_cast(static_cast(p) + offset))); - union { - void* vp; - unsigned char* ucp; - T* tp; - } pointerUnion; - assert(p != nullptr); - pointerUnion.vp = p; - pointerUnion.ucp += offset; - return std::unique_ptr(pointerUnion.tp); + inline std::unique_ptr getAnyPtr(void *p, int offset) { + return std::unique_ptr(static_cast(static_cast(static_cast(p) + offset))); } } // namespace edm From 0aeb3ade7a95031ed823a7c4302768cf07d36000 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 27 Aug 2021 20:01:52 +0200 Subject: [PATCH 190/923] Make GenHIEventProducer edm::global --- .../HiGenCommon/plugins/GenHIEventProducer.cc | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/GeneratorInterface/HiGenCommon/plugins/GenHIEventProducer.cc b/GeneratorInterface/HiGenCommon/plugins/GenHIEventProducer.cc index f7e25e7fd358f..875af0b0e55df 100644 --- a/GeneratorInterface/HiGenCommon/plugins/GenHIEventProducer.cc +++ b/GeneratorInterface/HiGenCommon/plugins/GenHIEventProducer.cc @@ -23,7 +23,7 @@ Description: // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" @@ -46,58 +46,43 @@ using namespace std; // class decleration // -class GenHIEventProducer : public edm::EDProducer { +class GenHIEventProducer : public edm::global::EDProducer<> { public: explicit GenHIEventProducer(const edm::ParameterSet&); - ~GenHIEventProducer() override; + ~GenHIEventProducer() override = default; private: - void produce(edm::Event&, const edm::EventSetup&) override; - edm::EDGetTokenT > hepmcSrc_; - edm::ESHandle pdt; - edm::ESGetToken pdtToken_; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + const edm::EDGetTokenT > hepmcSrc_; + const edm::ESGetToken pdtToken_; + const edm::EDPutTokenT putToken_; double ptCut_; - bool doParticleInfo_; + const bool doParticleInfo_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // -GenHIEventProducer::GenHIEventProducer(const edm::ParameterSet& iConfig) { - produces(); - hepmcSrc_ = consumes >(iConfig.getParameter("src")); - pdtToken_ = esConsumes(); - doParticleInfo_ = iConfig.getUntrackedParameter("doParticleInfo", false); +GenHIEventProducer::GenHIEventProducer(const edm::ParameterSet& iConfig) + : hepmcSrc_(consumes >(iConfig.getParameter("src"))), + pdtToken_(esConsumes()), + putToken_(produces()), + doParticleInfo_(iConfig.getUntrackedParameter("doParticleInfo", false)) { if (doParticleInfo_) { ptCut_ = iConfig.getParameter("ptCut"); } } -GenHIEventProducer::~GenHIEventProducer() { - // 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 ------------ -void GenHIEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void GenHIEventProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { using namespace edm; - if (!(pdt.isValid())) { - pdt = iSetup.getHandle(pdtToken_); - } + const auto& pdt = iSetup.getData(pdtToken_); double b = -1; int npart = -1; @@ -116,9 +101,8 @@ void GenHIEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet double EtMR = 0; // Normalized of total energy bym double TotEnergy = 0; // Total energy bym - Handle > hepmc; - iEvent.getByToken(hepmcSrc_, hepmc); - MixCollection mix(hepmc.product()); + const auto& hepmc = iEvent.get(hepmcSrc_); + MixCollection mix(&hepmc); if (mix.size() < 1) { throw cms::Exception("MatchVtx") << "Mixing has " << mix.size() << " sub-events, should have been at least 1" @@ -134,7 +118,7 @@ void GenHIEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet if ((*it)->status() != 1) continue; int pdg_id = (*it)->pdg_id(); - const ParticleData* part = pdt->particle(pdg_id); + const ParticleData* part = pdt.particle(pdg_id); int charge = static_cast(part->charge()); if (charge == 0) @@ -189,10 +173,20 @@ void GenHIEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet meanPt /= nCharged; } - std::unique_ptr pGenHI(new edm::GenHIEvent( - b, npart, ncoll, nhard, phi, ecc, nCharged, nChargedMR, meanPt, meanPtMR, EtMR, nChargedPtCut, nChargedPtCutMR)); - - iEvent.put(std::move(pGenHI)); + iEvent.emplace(putToken_, + b, + npart, + ncoll, + nhard, + phi, + ecc, + nCharged, + nChargedMR, + meanPt, + meanPtMR, + EtMR, + nChargedPtCut, + nChargedPtCutMR); } //define this as a plug-in From 18a6fa5e9de9409c694e9fc202e8e7470f13dce8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 Aug 2021 13:48:09 -0500 Subject: [PATCH 191/923] Removed undefined use of union in libminifloat Testing showed use of memcpy produced identical assembly code. --- DataFormats/Math/interface/libminifloat.h | 115 ++++++++-------------- 1 file changed, 40 insertions(+), 75 deletions(-) diff --git a/DataFormats/Math/interface/libminifloat.h b/DataFormats/Math/interface/libminifloat.h index e811b89bca4e7..c4db7de47d3af 100644 --- a/DataFormats/Math/interface/libminifloat.h +++ b/DataFormats/Math/interface/libminifloat.h @@ -4,68 +4,49 @@ #include #include #include +#include // ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf class MiniFloatConverter { public: MiniFloatConverter(); inline static float float16to32(uint16_t h) { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = mantissatable[offsettable[h >> 10] + (h & 0x3ff)] + exponenttable[h >> 10]; - return conv.flt; + uint32_t i32 = mantissatable[offsettable[h >> 10] + (h & 0x3ff)] + exponenttable[h >> 10]; + return bit_cast(i32); } inline static uint16_t float32to16(float x) { return float32to16round(x); } /// Fast implementation, but it crops the number so it biases low inline static uint16_t float32to16crop(float x) { - union { - float flt; - uint32_t i32; - } conv; - conv.flt = x; - return basetable[(conv.i32 >> 23) & 0x1ff] + ((conv.i32 & 0x007fffff) >> shifttable[(conv.i32 >> 23) & 0x1ff]); + uint32_t i32 = bit_cast(x); + return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >> shifttable[(i32 >> 23) & 0x1ff]); } /// Slower implementation, but it rounds to avoid biases inline static uint16_t float32to16round(float x) { - union { - float flt; - uint32_t i32; - } conv; - conv.flt = x; - uint8_t shift = shifttable[(conv.i32 >> 23) & 0x1ff]; + uint32_t i32 = bit_cast(x); + uint8_t shift = shifttable[(i32 >> 23) & 0x1ff]; if (shift == 13) { - uint16_t base2 = (conv.i32 & 0x007fffff) >> 12; + uint16_t base2 = (i32 & 0x007fffff) >> 12; uint16_t base = base2 >> 1; if (((base2 & 1) != 0) && (base < 1023)) base++; - return basetable[(conv.i32 >> 23) & 0x1ff] + base; + return basetable[(i32 >> 23) & 0x1ff] + base; } else { - return basetable[(conv.i32 >> 23) & 0x1ff] + ((conv.i32 & 0x007fffff) >> shifttable[(conv.i32 >> 23) & 0x1ff]); + return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >> shifttable[(i32 >> 23) & 0x1ff]); } } template inline static float reduceMantissaToNbits(const float &f) { static_assert(bits <= 23, "max mantissa size is 23 bits"); constexpr uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - conv.i32 &= mask; - return conv.flt; + uint32_t i32 = bit_cast(f); + i32 &= mask; + return bit_cast(i32); } inline static float reduceMantissaToNbits(const float &f, int bits) { uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - conv.i32 &= mask; - return conv.flt; + uint32_t i32 = bit_cast(f); + i32 &= mask; + return bit_cast(i32); } class ReduceMantissaToNbitsRounding { @@ -77,20 +58,16 @@ class MiniFloatConverter { float operator()(float f) const { constexpr uint32_t low23 = (0x007FFFFF); // mask to keep lowest 23 bits = mantissa constexpr uint32_t hi9 = (0xFF800000); // mask to keep highest 9 bits = the rest - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - if (conv.i32 & test) { // need to round - uint32_t mantissa = (conv.i32 & low23) >> shift; + uint32_t i32 = bit_cast(f); + if (i32 & test) { // need to round + uint32_t mantissa = (i32 & low23) >> shift; if (mantissa < maxn) mantissa++; - conv.i32 = (conv.i32 & hi9) | (mantissa << shift); + i32 = (i32 & hi9) | (mantissa << shift); } else { - conv.i32 &= mask; + i32 &= mask; } - return conv.flt; + return bit_cast(i32); } private: @@ -114,54 +91,34 @@ class MiniFloatConverter { } inline static float max() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x477fe000; // = mantissatable[offsettable[0x1e]+0x3ff]+exponenttable[0x1e] - return conv.flt; + constexpr uint32_t i32 = 0x477fe000; // = mantissatable[offsettable[0x1e]+0x3ff]+exponenttable[0x1e] + return bit_cast(i32); } // Maximum float32 value that gets rounded to max() inline static float max32RoundedToMax16() { - union { - float flt; - uint32_t i32; - } conv; // 2^16 in float32 is the first to result inf in float16, so // 2^16-1 is the last float32 to result max() in float16 - conv.i32 = (0x8f << 23) - 1; - return conv.flt; + constexpr uint32_t i32 = (0x8f << 23) - 1; + return bit_cast(i32); } inline static float min() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x38800000; // = mantissatable[offsettable[1]+0]+exponenttable[1] - return conv.flt; + constexpr uint32_t i32 = 0x38800000; // = mantissatable[offsettable[1]+0]+exponenttable[1] + return bit_cast(i32); } // Minimum float32 value that gets rounded to min() inline static float min32RoundedToMin16() { - union { - float flt; - uint32_t i32; - } conv; // 2^-14-1 in float32 is the first to result denormalized in float16, so // 2^-14 is the first float32 to result min() in float16 - conv.i32 = (0x71 << 23); - return conv.flt; + constexpr uint32_t i32 = (0x71 << 23); + return bit_cast(i32); } inline static float denorm_min() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x33800000; // mantissatable[offsettable[0]+1]+exponenttable[0] - return conv.flt; + constexpr uint32_t i32 = 0x33800000; // mantissatable[offsettable[0]+1]+exponenttable[0] + return bit_cast(i32); } inline static bool isdenorm(uint16_t h) { @@ -170,6 +127,14 @@ class MiniFloatConverter { } private: + //in C++20 we can use std::bit_cast which is constexpr + template + inline static To bit_cast(const From &src) noexcept { + static_assert(sizeof(To) == sizeof(From), "incompatible types"); + To dst; + std::memcpy(&dst, &src, sizeof(To)); + return dst; + } CMS_THREAD_SAFE static uint32_t mantissatable[2048]; CMS_THREAD_SAFE static uint32_t exponenttable[64]; CMS_THREAD_SAFE static uint16_t offsettable[64]; From 8495d05d28ee99d96ac454c36b7974a0ae3217d3 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 26 Aug 2021 23:03:31 +0200 Subject: [PATCH 192/923] Migrate FastSimulation modules to use esConsumes --- .../interface/CalorimetryManager.h | 9 ++-- .../Calorimetry/src/CalorimetryManager.cc | 9 ++-- .../EventProducer/interface/FamosManager.h | 6 +-- .../EventProducer/src/FamosManager.cc | 5 ++- .../EventProducer/src/FamosProducer.cc | 2 +- .../plugins/MuonSimHitProducer.cc | 38 ++++++++-------- .../interface/FastHFShowerLibrary.h | 14 +++--- .../src/FastHFShowerLibrary.cc | 21 +++------ .../interface/Geometry.h | 19 ++++---- .../plugins/FastSimProducer.cc | 37 +++++++++------- .../plugins/FastTrackDeDxProducer.cc | 23 +++++----- .../src/Geometry.cc | 27 ++++++------ .../plugins/TrackCandidateProducer.cc | 44 ++++++++++--------- .../interface/TrackingRecHitAlgorithm.h | 15 +++---- .../plugins/FastTrackerRecHitMatcher.cc | 12 +++-- .../plugins/TrackingRecHitProducer.cc | 32 +++++++------- .../src/TrackingRecHitAlgorithm.cc | 21 +++------ 17 files changed, 163 insertions(+), 171 deletions(-) diff --git a/FastSimulation/Calorimetry/interface/CalorimetryManager.h b/FastSimulation/Calorimetry/interface/CalorimetryManager.h index 47c2ab9e62d41..5922c664a3f45 100644 --- a/FastSimulation/Calorimetry/interface/CalorimetryManager.h +++ b/FastSimulation/Calorimetry/interface/CalorimetryManager.h @@ -15,6 +15,8 @@ #include "FastSimulation/Calorimetry/interface/KKCorrectionFactors.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" + // For the uint32_t //#include #include @@ -37,10 +39,6 @@ class GflashAntiProtonShowerProfile; // FastHFshowerLibrary class FastHFShowerLibrary; -namespace edm { - class ParameterSet; -} - class CalorimetryManager { public: CalorimetryManager(); @@ -48,7 +46,8 @@ class CalorimetryManager { const edm::ParameterSet& fastCalo, const edm::ParameterSet& MuonECALPars, const edm::ParameterSet& MuonHCALPars, - const edm::ParameterSet& fastGflash); + const edm::ParameterSet& fastGflash, + edm::ConsumesCollector&&); ~CalorimetryManager(); // Does the real job diff --git a/FastSimulation/Calorimetry/src/CalorimetryManager.cc b/FastSimulation/Calorimetry/src/CalorimetryManager.cc index 95c6b50d166db..31dd5bfe00988 100644 --- a/FastSimulation/Calorimetry/src/CalorimetryManager.cc +++ b/FastSimulation/Calorimetry/src/CalorimetryManager.cc @@ -2,6 +2,7 @@ //Framework headers #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/EDMException.h" // Fast Simulation headers #include "FastSimulation/ParticlePropagator/interface/ParticlePropagator.h" @@ -56,9 +57,6 @@ //#include "DataFormats/EcalDetId/interface/EcalDetId.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" - //ROOT headers #include "TROOT.h" #include "TH1.h" @@ -77,7 +75,8 @@ CalorimetryManager::CalorimetryManager(FSimEvent* aSimEvent, const edm::ParameterSet& fastCalo, const edm::ParameterSet& fastMuECAL, const edm::ParameterSet& fastMuHCAL, - const edm::ParameterSet& parGflash) + const edm::ParameterSet& parGflash, + edm::ConsumesCollector&& iC) : mySimEvent(aSimEvent), initialized_(false), theMuonEcalEffects(nullptr), @@ -93,7 +92,7 @@ CalorimetryManager::CalorimetryManager(FSimEvent* aSimEvent, theAntiProtonProfile = new GflashAntiProtonShowerProfile(parGflash); // FastHFShowerLibrary - theHFShowerLibrary = new FastHFShowerLibrary(fastCalo); + theHFShowerLibrary = new FastHFShowerLibrary(fastCalo, std::move(iC)); readParameters(fastCalo); diff --git a/FastSimulation/EventProducer/interface/FamosManager.h b/FastSimulation/EventProducer/interface/FamosManager.h index aad3a9291c4a5..bd27b1107c2b7 100644 --- a/FastSimulation/EventProducer/interface/FamosManager.h +++ b/FastSimulation/EventProducer/interface/FamosManager.h @@ -2,6 +2,7 @@ #define FastSimulation_EventProducer_FamosManager_H #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include @@ -10,9 +11,6 @@ namespace HepMC { } namespace edm { - class ParameterSet; - class EventSetup; - class Run; class HepMCProduct; } // namespace edm @@ -29,7 +27,7 @@ class TrackerTopology; class FamosManager { public: /// Constructor - FamosManager(edm::ParameterSet const& p); + FamosManager(edm::ParameterSet const& p, edm::ConsumesCollector&&); /// Destructor ~FamosManager(); diff --git a/FastSimulation/EventProducer/src/FamosManager.cc b/FastSimulation/EventProducer/src/FamosManager.cc index af8f99e7b8fd3..b071b09660be5 100644 --- a/FastSimulation/EventProducer/src/FamosManager.cc +++ b/FastSimulation/EventProducer/src/FamosManager.cc @@ -42,7 +42,7 @@ using namespace HepMC; -FamosManager::FamosManager(edm::ParameterSet const& p) +FamosManager::FamosManager(edm::ParameterSet const& p, edm::ConsumesCollector&& iC) : iEvent(0), myCalorimetry(nullptr), m_pUseMagneticField(p.getParameter("UseMagneticField")), @@ -66,7 +66,8 @@ FamosManager::FamosManager(edm::ParameterSet const& p) p.getParameter("Calorimetry"), p.getParameter("MaterialEffectsForMuonsInECAL"), p.getParameter("MaterialEffectsForMuonsInHCAL"), - p.getParameter("GFlash")); + p.getParameter("GFlash"), + std::move(iC)); } FamosManager::~FamosManager() { diff --git a/FastSimulation/EventProducer/src/FamosProducer.cc b/FastSimulation/EventProducer/src/FamosProducer.cc index 2ca8833441c71..18ae6b56d7371 100644 --- a/FastSimulation/EventProducer/src/FamosProducer.cc +++ b/FastSimulation/EventProducer/src/FamosProducer.cc @@ -48,7 +48,7 @@ FamosProducer::FamosProducer(edm::ParameterSet const& p) { sourceToken = consumes(sourceLabel); // famos manager - famosManager_ = new FamosManager(p); + famosManager_ = new FamosManager(p, consumesCollector()); } FamosProducer::~FamosProducer() { delete famosManager_; } diff --git a/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc b/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc index 37a4dd4d24eb6..afd790060d624 100644 --- a/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc +++ b/FastSimulation/MuonSimHitProducer/plugins/MuonSimHitProducer.cc @@ -93,6 +93,12 @@ class MuonSimHitProducer : public edm::stream::EDProducer<> { // tokens edm::EDGetTokenT > simMuonToken; edm::EDGetTokenT > simVertexToken; + + const edm::ESGetToken magneticFieldESToken_; + const edm::ESGetToken dtGeometryESToken_; + const edm::ESGetToken cscGeometryESToken_; + const edm::ESGetToken rpcGeometryESToken_; + const edm::ESGetToken particleDataTableESToken_; }; //for debug only @@ -102,7 +108,13 @@ class MuonSimHitProducer : public edm::stream::EDProducer<> { // constructors and destructor // MuonSimHitProducer::MuonSimHitProducer(const edm::ParameterSet& iConfig) - : theEstimator(iConfig.getParameter("Chi2EstimatorCut")), propagatorWithoutMaterial(nullptr) { + : theEstimator(iConfig.getParameter("Chi2EstimatorCut")), + propagatorWithoutMaterial(nullptr), + magneticFieldESToken_(esConsumes()), + dtGeometryESToken_(esConsumes(edm::ESInputTag("", "MisAligned"))), + cscGeometryESToken_(esConsumes(edm::ESInputTag("", "MisAligned"))), + rpcGeometryESToken_(esConsumes()), + particleDataTableESToken_(esConsumes()) { // Read relevant parameters readParameters(iConfig.getParameter("MUONS"), iConfig.getParameter("TRACKS"), @@ -126,21 +138,10 @@ MuonSimHitProducer::MuonSimHitProducer(const edm::ParameterSet& iConfig) // ---- method called once each job just before starting event loop ---- void MuonSimHitProducer::beginRun(edm::Run const& run, const edm::EventSetup& es) { //services - edm::ESHandle magField; - edm::ESHandle dtGeometry; - edm::ESHandle cscGeometry; - edm::ESHandle rpcGeometry; - edm::ESHandle propagator; - - es.get().get(magField); - es.get().get("MisAligned", dtGeometry); - es.get().get("MisAligned", cscGeometry); - es.get().get(rpcGeometry); - - magfield = &(*magField); - dtGeom = &(*dtGeometry); - cscGeom = &(*cscGeometry); - rpcGeom = &(*rpcGeometry); + magfield = &es.getData(magneticFieldESToken_); + dtGeom = &es.getData(dtGeometryESToken_); + cscGeom = &es.getData(cscGeometryESToken_); + rpcGeom = &es.getData(rpcGeometryESToken_); bool duringEvent = false; theService->update(es, duringEvent); @@ -160,10 +161,7 @@ void MuonSimHitProducer::beginRun(edm::Run const& run, const edm::EventSetup& es // ------------ method called to produce the data ------------ void MuonSimHitProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // using namespace edm; - // using namespace std; - edm::ESHandle pdg; - iSetup.getData(pdg); + auto pdg = iSetup.getHandle(particleDataTableESToken_); RandomEngineAndDistribution random(iEvent.streamID()); diff --git a/FastSimulation/ShowerDevelopment/interface/FastHFShowerLibrary.h b/FastSimulation/ShowerDevelopment/interface/FastHFShowerLibrary.h index 1c382617ef749..596186392abf7 100644 --- a/FastSimulation/ShowerDevelopment/interface/FastHFShowerLibrary.h +++ b/FastSimulation/ShowerDevelopment/interface/FastHFShowerLibrary.h @@ -6,9 +6,8 @@ /////////////////////////////////////////////////////////////////////////////// #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FastSimulation/Utilities/interface/FamosDebug.h" @@ -18,6 +17,8 @@ #include "SimG4CMS/Calo/interface/CaloHitID.h" #include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h" #include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" +#include "Geometry/HcalCommonData/interface/HcalSimulationConstants.h" +#include "Geometry/Records/interface/HcalSimNumberingRecord.h" #include "SimG4CMS/Calo/interface/HcalNumberingScheme.h" #include "G4ThreeVector.hh" @@ -38,8 +39,8 @@ class RandomEngineAndDistribution; class FastHFShowerLibrary { public: // Constructor and Destructor - FastHFShowerLibrary(edm::ParameterSet const& p); - ~FastHFShowerLibrary() { ; } + FastHFShowerLibrary(edm::ParameterSet const&, edm::ConsumesCollector&&); + ~FastHFShowerLibrary() {} public: void const initHFShowerLibrary(const edm::EventSetup&); @@ -60,5 +61,8 @@ class FastHFShowerLibrary { bool applyFidCut; std::string name; + + const edm::ESGetToken hcalDDDSimConstantsESToken_; + const edm::ESGetToken hcalSimulationConstantsESToken_; }; #endif diff --git a/FastSimulation/ShowerDevelopment/src/FastHFShowerLibrary.cc b/FastSimulation/ShowerDevelopment/src/FastHFShowerLibrary.cc index 8162e2ab791f8..311eeb2c2cd98 100644 --- a/FastSimulation/ShowerDevelopment/src/FastHFShowerLibrary.cc +++ b/FastSimulation/ShowerDevelopment/src/FastHFShowerLibrary.cc @@ -8,13 +8,12 @@ #include "FastSimulation/Event/interface/FSimTrack.h" #include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h" #include "SimG4CMS/Calo/interface/HFFibreFiducial.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/Records/interface/HcalParametersRcd.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalSimulationConstants.h" #include "FWCore/Utilities/interface/Exception.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" @@ -31,8 +30,6 @@ #include "G4ParticleTypes.hh" // STL headers -#include - #include #include #include @@ -41,7 +38,8 @@ static std::once_flag initializeOnce; -FastHFShowerLibrary::FastHFShowerLibrary(edm::ParameterSet const& p) : fast(p) { +FastHFShowerLibrary::FastHFShowerLibrary(edm::ParameterSet const& p, edm::ConsumesCollector&& iC) + : fast(p), hcalDDDSimConstantsESToken_(iC.esConsumes()), hcalSimulationConstantsESToken_(iC.esConsumes()) { edm::ParameterSet m_HS = p.getParameter("HFShowerLibrary"); applyFidCut = m_HS.getParameter("ApplyFiducialCut"); } @@ -49,13 +47,8 @@ FastHFShowerLibrary::FastHFShowerLibrary(edm::ParameterSet const& p) : fast(p) { void const FastHFShowerLibrary::initHFShowerLibrary(const edm::EventSetup& iSetup) { edm::LogInfo("FastCalorimetry") << "initHFShowerLibrary::initialization"; - edm::ESHandle hdc; - iSetup.get().get(hdc); - hcalConstants = hdc.product(); - - edm::ESHandle hdsc; - iSetup.get().get(hdsc); - const HcalSimulationConstants* hsps = hdsc.product(); + hcalConstants = &iSetup.getData(hcalDDDSimConstantsESToken_); + const HcalSimulationConstants* hsps = &iSetup.getData(hcalSimulationConstantsESToken_); std::string name = "HcalHits"; numberingFromDDD = std::make_unique(hcalConstants); diff --git a/FastSimulation/SimplifiedGeometryPropagator/interface/Geometry.h b/FastSimulation/SimplifiedGeometryPropagator/interface/Geometry.h index b3627fb134dec..17e84209b9d79 100644 --- a/FastSimulation/SimplifiedGeometryPropagator/interface/Geometry.h +++ b/FastSimulation/SimplifiedGeometryPropagator/interface/Geometry.h @@ -4,23 +4,21 @@ #include "DataFormats/Math/interface/LorentzVector.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/ForwardSimplifiedGeometry.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/BarrelSimplifiedGeometry.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" +#include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h" /////////////////////////////////////////////// // Author: L. Vanelderen, S. Kurz // Date: 29 May 2017 ////////////////////////////////////////////////////////// -class GeometricSearchTracker; -class MagneticField; - #include -namespace edm { - //class ParameterSet; - class EventSetup; -} // namespace edm - namespace fastsim { class InteractionModel; @@ -32,7 +30,7 @@ namespace fastsim { class Geometry { public: //! Constructor. - Geometry(const edm::ParameterSet& cfg); + Geometry(const edm::ParameterSet&, edm::ConsumesCollector&&); //! Default destructor. ~Geometry(); @@ -168,6 +166,9 @@ namespace fastsim { const bool forwardBoundary_; //!< Hack to interface "old" calo to "new" tracking const edm::ParameterSet trackerBarrelBoundaryCfg_; //!< Hack to interface "old" calo to "new" tracking const edm::ParameterSet trackerForwardBoundaryCfg_; //!< Hack to interface "old" calo to "new" tracking + + edm::ESGetToken geometricSearchTrackerESToken_; + edm::ESGetToken magneticFieldESToken_; }; std::ostream& operator<<(std::ostream& os, const fastsim::Geometry& geometry); } // namespace fastsim diff --git a/FastSimulation/SimplifiedGeometryPropagator/plugins/FastSimProducer.cc b/FastSimulation/SimplifiedGeometryPropagator/plugins/FastSimProducer.cc index 6a974f6c1d202..62af05ae4bf50 100644 --- a/FastSimulation/SimplifiedGeometryPropagator/plugins/FastSimProducer.cc +++ b/FastSimulation/SimplifiedGeometryPropagator/plugins/FastSimProducer.cc @@ -3,6 +3,7 @@ #include // framework +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -10,7 +11,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/StreamID.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESWatcher.h" @@ -92,20 +92,29 @@ class FastSimProducer : public edm::stream::EDProducer<> { std::vector > interactionModels_; //!< All defined interaction models std::map interactionModelMap_; //!< Each interaction model has a unique name static const std::string MESSAGECATEGORY; //!< Category of debugging messages ("FastSimulation") + const edm::ESGetToken particleDataTableESToken_; + edm::ESGetToken caloGeometryESToken_; + edm::ESGetToken caloTopologyESToken_; }; const std::string FastSimProducer::MESSAGECATEGORY = "FastSimulation"; FastSimProducer::FastSimProducer(const edm::ParameterSet& iConfig) : genParticlesToken_(consumes(iConfig.getParameter("src"))), - geometry_(iConfig.getParameter("trackerDefinition")), - caloGeometry_(iConfig.getParameter("caloDefinition")), + geometry_(iConfig.getParameter("trackerDefinition"), consumesCollector()), + caloGeometry_(iConfig.getParameter("caloDefinition"), consumesCollector()), beamPipeRadius_(iConfig.getParameter("beamPipeRadius")), deltaRchargedMother_(iConfig.getParameter("deltaRchargedMother")), particleFilter_(iConfig.getParameter("particleFilter")), _randomEngine(nullptr), simulateCalorimetry(iConfig.getParameter("simulateCalorimetry")), - simulateMuons(iConfig.getParameter("simulateMuons")) { + simulateMuons(iConfig.getParameter("simulateMuons")), + particleDataTableESToken_(esConsumes()) { + if (simulateCalorimetry) { + caloGeometryESToken_ = esConsumes(); + caloTopologyESToken_ = esConsumes(); + } + //---------------- // define interaction models //--------------- @@ -136,7 +145,8 @@ FastSimProducer::FastSimProducer(const edm::ParameterSet& iConfig) iConfig.getParameter("Calorimetry"), iConfig.getParameter("MaterialEffectsForMuonsInECAL"), iConfig.getParameter("MaterialEffectsForMuonsInHCAL"), - iConfig.getParameter("GFlash")); + iConfig.getParameter("GFlash"), + consumesCollector()); } //---------------- @@ -172,8 +182,7 @@ void FastSimProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) std::unique_ptr simVertices_(new edm::SimVertexContainer); // Get the particle data table (in case lifetime or charge of GenParticles not set) - edm::ESHandle pdt; - iSetup.getData(pdt); + auto const& pdt = iSetup.getData(particleDataTableESToken_); // Get the GenParticle collection edm::Handle genParticles; @@ -182,7 +191,7 @@ void FastSimProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Load the ParticleManager which returns the particles that have to be propagated // Creates a fastsim::Particle out of a GenParticle/secondary fastsim::ParticleManager particleManager(*genParticles->GetEvent(), - *pdt, + pdt, beamPipeRadius_, deltaRchargedMother_, particleFilter_, @@ -192,13 +201,11 @@ void FastSimProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Initialize the calorimeter geometry if (simulateCalorimetry) { if (watchCaloGeometry_.check(iSetup) || watchCaloTopology_.check(iSetup)) { - edm::ESHandle pG; - iSetup.get().get(pG); - myCalorimetry->getCalorimeter()->setupGeometry(*pG); + auto const& pG = iSetup.getData(caloGeometryESToken_); + myCalorimetry->getCalorimeter()->setupGeometry(pG); - edm::ESHandle theCaloTopology; - iSetup.get().get(theCaloTopology); - myCalorimetry->getCalorimeter()->setupTopology(*theCaloTopology); + auto const& theCaloTopology = iSetup.getData(caloTopologyESToken_); + myCalorimetry->getCalorimeter()->setupTopology(theCaloTopology); myCalorimetry->getCalorimeter()->initialize(geometry_.getMagneticFieldZ(math::XYZTLorentzVector(0., 0., 0., 0.))); myCalorimetry->getHFShowerLibrary()->initHFShowerLibrary(iSetup); @@ -306,7 +313,7 @@ void FastSimProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) LogDebug(MESSAGECATEGORY) << "\n moving particle to calorimetry: " << *particle; // create FSimTrack (this is the object the old propagation uses) - myFSimTracks.push_back(createFSimTrack(particle.get(), &particleManager, *pdt)); + myFSimTracks.push_back(createFSimTrack(particle.get(), &particleManager, pdt)); // particle was decayed if (!particle->isStable() && particle->remainingProperLifeTimeC() < 1E-10) { continue; diff --git a/FastSimulation/SimplifiedGeometryPropagator/plugins/FastTrackDeDxProducer.cc b/FastSimulation/SimplifiedGeometryPropagator/plugins/FastTrackDeDxProducer.cc index 6d6bc02b8b6a6..1f128ddf632e8 100644 --- a/FastSimulation/SimplifiedGeometryPropagator/plugins/FastTrackDeDxProducer.cc +++ b/FastSimulation/SimplifiedGeometryPropagator/plugins/FastTrackDeDxProducer.cc @@ -26,13 +26,13 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DataFormats/Common/interface/ValueMap.h" #include "DataFormats/TrackReco/interface/DeDxData.h" @@ -71,7 +71,7 @@ class FastTrackDeDxProducer : public edm::stream::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginRun(edm::Run const& run, const edm::EventSetup&) override; + void beginRun(edm::Run const&, const edm::EventSetup&) override; void produce(edm::Event&, const edm::EventSetup&) override; void makeCalibrationMap(const TrackerGeometry& tkGeom); @@ -82,7 +82,6 @@ class FastTrackDeDxProducer : public edm::stream::EDProducer<> { int& NClusterSaturating); // ----------member data --------------------------- - //BaseDeDxEstimator* m_estimator; std::unique_ptr m_estimator; @@ -100,7 +99,7 @@ class FastTrackDeDxProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT simHitsToken; edm::EDGetTokenT simHit2RecHitMapToken; - const edm::ESGetToken tkGeomToken; + edm::ESGetToken tkGeomToken; bool usePixel; bool useStrip; @@ -139,8 +138,7 @@ void FastTrackDeDxProducer::fillDescriptions(edm::ConfigurationDescriptions& des FastTrackDeDxProducer::FastTrackDeDxProducer(const edm::ParameterSet& iConfig) : simHitsToken(consumes(iConfig.getParameter("simHits"))), simHit2RecHitMapToken( - consumes(iConfig.getParameter("simHit2RecHitMap"))), - tkGeomToken(esConsumes()) { + consumes(iConfig.getParameter("simHit2RecHitMap"))) { produces>(); auto cCollector = consumesCollector(); @@ -183,22 +181,25 @@ FastTrackDeDxProducer::FastTrackDeDxProducer(const edm::ParameterSet& iConfig) if (!usePixel && !useStrip) throw cms::Exception("fastsim::SimplifiedGeometry::FastTrackDeDxProducer.cc") << " neither pixel hits nor strips hits will be used to compute de/dx"; + + if (useCalibration) { + tkGeomToken = esConsumes(); + } } // ------------ method called once each job just before starting event loop ------------ void FastTrackDeDxProducer::beginRun(edm::Run const& run, const edm::EventSetup& iSetup) { if (useCalibration && calibGains.empty()) { - edm::ESHandle tkGeom; - iSetup.get().get(tkGeom); - m_off = tkGeom->offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel + auto const& tkGeom = iSetup.getData(tkGeomToken); + m_off = tkGeom.offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel - DeDxTools::makeCalibrationMap(m_calibrationPath, *tkGeom, calibGains, m_off); + DeDxTools::makeCalibrationMap(m_calibrationPath, tkGeom, calibGains, m_off); } m_estimator->beginRun(run, iSetup); } -void FastTrackDeDxProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void FastTrackDeDxProducer::produce(edm::Event& iEvent, const edm::EventSetup&) { auto trackDeDxEstimateAssociation = std::make_unique>(); ValueMap::Filler filler(*trackDeDxEstimateAssociation); diff --git a/FastSimulation/SimplifiedGeometryPropagator/src/Geometry.cc b/FastSimulation/SimplifiedGeometryPropagator/src/Geometry.cc index 2c2cd821c6ff1..902934253a738 100644 --- a/FastSimulation/SimplifiedGeometryPropagator/src/Geometry.cc +++ b/FastSimulation/SimplifiedGeometryPropagator/src/Geometry.cc @@ -1,16 +1,14 @@ //Framework Headers -#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/ESInputTag.h" +#include "FWCore/Utilities/interface/Exception.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/SimplifiedGeometryFactory.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/ForwardSimplifiedGeometry.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/BarrelSimplifiedGeometry.h" -#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" -#include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/UniformEngine/interface/UniformMagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/Geometry.h" #include @@ -21,7 +19,7 @@ using namespace fastsim; Geometry::~Geometry() { ; } -Geometry::Geometry(const edm::ParameterSet& cfg) +Geometry::Geometry(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) : cacheIdentifierTrackerRecoGeometry_(0), cacheIdentifierIdealMagneticField_(0), geometricSearchTracker_(nullptr), @@ -45,7 +43,14 @@ Geometry::Geometry(const edm::ParameterSet& cfg) trackerForwardBoundaryCfg_(forwardBoundary_ ? cfg.getParameter("trackerForwardBoundary") : edm::ParameterSet()) // Hack to interface "old" calo to "new" tracking - {}; +{ + if (useTrackerRecoGeometryRecord_) { + geometricSearchTrackerESToken_ = iC.esConsumes(edm::ESInputTag("", trackerAlignmentLabel_)); + } + if (!useFixedMagneticFieldZ_) { + magneticFieldESToken_ = iC.esConsumes(); + } +} void Geometry::update(const edm::EventSetup& iSetup, const std::map& interactionModelMap) { @@ -59,9 +64,7 @@ void Geometry::update(const edm::EventSetup& iSetup, //---------------- if (iSetup.get().cacheIdentifier() != cacheIdentifierTrackerRecoGeometry_) { if (useTrackerRecoGeometryRecord_) { - edm::ESHandle geometricSearchTrackerHandle; - iSetup.get().get(trackerAlignmentLabel_, geometricSearchTrackerHandle); - geometricSearchTracker_ = &(*geometricSearchTrackerHandle); + geometricSearchTracker_ = &iSetup.getData(geometricSearchTrackerESToken_); } } @@ -75,9 +78,7 @@ void Geometry::update(const edm::EventSetup& iSetup, magneticField_ = ownedMagneticField_.get(); } else // get magnetic field from EventSetup { - edm::ESHandle magneticField; - iSetup.get().get(magneticField); - magneticField_ = &(*magneticField); + magneticField_ = &iSetup.getData(magneticFieldESToken_); } } diff --git a/FastSimulation/Tracking/plugins/TrackCandidateProducer.cc b/FastSimulation/Tracking/plugins/TrackCandidateProducer.cc index bd6ac5afad9b9..974ab0079d196 100644 --- a/FastSimulation/Tracking/plugins/TrackCandidateProducer.cc +++ b/FastSimulation/Tracking/plugins/TrackCandidateProducer.cc @@ -43,7 +43,7 @@ class TrackCandidateProducer : public edm::stream::EDProducer<> { public: explicit TrackCandidateProducer(const edm::ParameterSet& conf); - void produce(edm::Event& e, const edm::EventSetup& es) override; + void produce(edm::Event&, const edm::EventSetup&) override; private: // tokens & labels @@ -52,6 +52,10 @@ class TrackCandidateProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT > hitMasksToken; edm::EDGetTokenT simTrackToken; std::string propagatorLabel; + const edm::ESGetToken magneticFieldESToken_; + const edm::ESGetToken trackerGeometryESToken_; + const edm::ESGetToken trackerTopologyESToken_; + const edm::ESGetToken propagatorESToken_; // other data bool rejectOverlaps; @@ -60,7 +64,13 @@ class TrackCandidateProducer : public edm::stream::EDProducer<> { double maxSeedMatchEstimator; }; -TrackCandidateProducer::TrackCandidateProducer(const edm::ParameterSet& conf) : hitSplitter() { +TrackCandidateProducer::TrackCandidateProducer(const edm::ParameterSet& conf) + : propagatorLabel(conf.getParameter("propagator")), + magneticFieldESToken_(esConsumes()), + trackerGeometryESToken_(esConsumes()), + trackerTopologyESToken_(esConsumes()), + propagatorESToken_(esConsumes(edm::ESInputTag("", propagatorLabel))), + hitSplitter() { // produces produces(); @@ -77,22 +87,14 @@ TrackCandidateProducer::TrackCandidateProducer(const edm::ParameterSet& conf) : maxSeedMatchEstimator = conf.getUntrackedParameter("maxSeedMatchEstimator", 0); rejectOverlaps = conf.getParameter("OverlapCleaning"); splitHits = conf.getParameter("SplitHits"); - propagatorLabel = conf.getParameter("propagator"); } void TrackCandidateProducer::produce(edm::Event& e, const edm::EventSetup& es) { // get records - edm::ESHandle magneticField; - es.get().get(magneticField); - - edm::ESHandle trackerGeometry; - es.get().get(trackerGeometry); - - edm::ESHandle trackerTopology; - es.get().get(trackerTopology); - - edm::ESHandle propagator; - es.get().get(propagatorLabel, propagator); + auto const& magneticField = es.getData(magneticFieldESToken_); + auto const& trackerGeometry = es.getData(trackerGeometryESToken_); + auto const& trackerTopology = es.getData(trackerTopologyESToken_); + auto const& propagator = es.getData(propagatorESToken_); // get products edm::Handle > seeds; @@ -120,7 +122,7 @@ void TrackCandidateProducer::produce(edm::Event& e, const edm::EventSetup& es) { // match hitless seeds to simTracks and find corresponding recHitCombination if (seed.nHits() == 0) { recHitCombinationIndices = SeedMatcher::matchRecHitCombinations( - seed, *recHitCombinations, *simTracks, maxSeedMatchEstimator, *propagator, *magneticField, *trackerGeometry); + seed, *recHitCombinations, *simTracks, maxSeedMatchEstimator, propagator, magneticField, trackerGeometry); } // for normal seeds, retrieve the corresponding recHitCombination from the seed hits else { @@ -176,8 +178,8 @@ void TrackCandidateProducer::produce(edm::Event& e, const edm::EventSetup& es) { // always accept the first hit // also accept a hit if it is not on the layer of the previous hit if (!rejectOverlaps || selectedRecHits.empty() || - (TrackingLayer::createFromDetId(selectedRecHits.back()->geographicalId(), *trackerTopology.product()) != - TrackingLayer::createFromDetId(selectedRecHit->geographicalId(), *trackerTopology.product()))) { + (TrackingLayer::createFromDetId(selectedRecHits.back()->geographicalId(), trackerTopology) != + TrackingLayer::createFromDetId(selectedRecHit->geographicalId(), trackerTopology))) { selectedRecHits.push_back(selectedRecHit); } // else: @@ -207,12 +209,12 @@ void TrackCandidateProducer::produce(edm::Event& e, const edm::EventSetup& es) { // create track candidate state // 1. get seed state (defined on the surface of the most outer hit) DetId seedDetId(seed.startingState().detId()); - const GeomDet* gdet = trackerGeometry->idToDet(seedDetId); + const GeomDet* gdet = trackerGeometry.idToDet(seedDetId); TrajectoryStateOnSurface seedTSOS = - trajectoryStateTransform::transientState(seed.startingState(), &(gdet->surface()), magneticField.product()); + trajectoryStateTransform::transientState(seed.startingState(), &(gdet->surface()), &magneticField); // 2. backPropagate the seedState to the surfuce of the most inner hit - const GeomDet* initialLayer = trackerGeometry->idToDet(hitsForTrackCandidate.front().geographicalId()); - const TrajectoryStateOnSurface initialTSOS = propagator->propagate(seedTSOS, initialLayer->surface()); + const GeomDet* initialLayer = trackerGeometry.idToDet(hitsForTrackCandidate.front().geographicalId()); + const TrajectoryStateOnSurface initialTSOS = propagator.propagate(seedTSOS, initialLayer->surface()); // 3. check validity and transform if (!initialTSOS.isValid()) continue; diff --git a/FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitAlgorithm.h b/FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitAlgorithm.h index 59e7ebc6f22f4..806d3a0c73734 100644 --- a/FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitAlgorithm.h +++ b/FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitAlgorithm.h @@ -2,8 +2,12 @@ #define FastSimulation_TrackingRecHitProducer_TrackingRecHitAlgorithm_H #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitProduct.h" #include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h" @@ -15,14 +19,6 @@ #include #include -namespace edm { - class Event; - class EventSetup; - class ParameterSet; - class ConsumesCollector; - class Stream; -} // namespace edm - class TrackingRecHitAlgorithm { private: const std::string _name; @@ -30,6 +26,9 @@ class TrackingRecHitAlgorithm { const TrackerTopology* _trackerTopology; const TrackerGeometry* _trackerGeometry; const TrackerGeometry* _misalignedTrackerGeometry; + const edm::ESGetToken trackerTopologyESToken_; + const edm::ESGetToken trackerGeometryESToken_; + const edm::ESGetToken misalignedTrackerGeometryESToken_; std::shared_ptr _randomEngine; public: diff --git a/FastSimulation/TrackingRecHitProducer/plugins/FastTrackerRecHitMatcher.cc b/FastSimulation/TrackingRecHitProducer/plugins/FastTrackerRecHitMatcher.cc index 823e470c854cc..cfc11c5b614b6 100644 --- a/FastSimulation/TrackingRecHitProducer/plugins/FastTrackerRecHitMatcher.cc +++ b/FastSimulation/TrackingRecHitProducer/plugins/FastTrackerRecHitMatcher.cc @@ -8,7 +8,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" // fast tracker rechits #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h" @@ -72,11 +71,11 @@ class FastTrackerRecHitMatcher : public edm::stream::EDProducer<> { // ----------member data --------------------------- edm::EDGetTokenT simHitsToken; edm::EDGetTokenT simHit2RecHitMapToken; + const edm::ESGetToken trackerGeometryESToken; }; FastTrackerRecHitMatcher::FastTrackerRecHitMatcher(const edm::ParameterSet& iConfig) - -{ + : trackerGeometryESToken(esConsumes()) { simHitsToken = consumes(iConfig.getParameter("simHits")); simHit2RecHitMapToken = consumes(iConfig.getParameter("simHit2RecHitMap")); @@ -87,8 +86,7 @@ FastTrackerRecHitMatcher::FastTrackerRecHitMatcher(const edm::ParameterSet& iCon void FastTrackerRecHitMatcher::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // services - edm::ESHandle geometry; - iSetup.get().get(geometry); + auto const& geometry = iSetup.getData(trackerGeometryESToken); // input edm::Handle simHits; @@ -150,7 +148,7 @@ void FastTrackerRecHitMatcher::produce(edm::Event& iEvent, const edm::EventSetup // - transform to global coordinates GlobalVector globalSimTrackDir = recHit->det()->surface().toGlobal(localSimTrackDir); // - transform to local coordinates of glued module - const GluedGeomDet* gluedDet = (const GluedGeomDet*)geometry->idToDet(DetId(stripSubDetId.glued())); + const GluedGeomDet* gluedDet = (const GluedGeomDet*)geometry.idToDet(DetId(stripSubDetId.glued())); LocalVector gluedLocalSimTrackDir = gluedDet->surface().toLocal(globalSimTrackDir); // check whether next hit is partner @@ -181,7 +179,7 @@ void FastTrackerRecHitMatcher::produce(edm::Event& iEvent, const edm::EventSetup } // else: create projected hit else { - newRecHit = projectOnly(recHit, geometry->idToDet(detid), gluedDet, gluedLocalSimTrackDir); + newRecHit = projectOnly(recHit, geometry.idToDet(detid), gluedDet, gluedLocalSimTrackDir); } output_recHits->push_back(std::move(newRecHit)); (*output_simHit2RecHitMap)[simHitCounter] = diff --git a/FastSimulation/TrackingRecHitProducer/plugins/TrackingRecHitProducer.cc b/FastSimulation/TrackingRecHitProducer/plugins/TrackingRecHitProducer.cc index d50cb877010b2..a0487ba7d33d6 100644 --- a/FastSimulation/TrackingRecHitProducer/plugins/TrackingRecHitProducer.cc +++ b/FastSimulation/TrackingRecHitProducer/plugins/TrackingRecHitProducer.cc @@ -2,7 +2,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.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/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Run.h" @@ -50,6 +49,9 @@ class TrackingRecHitProducer : public edm::stream::EDProducer<> { std::map _detIdPipes; void setupDetIdPipes(const edm::EventSetup& eventSetup); std::vector _pixelTempStore; // pixel template storage + const edm::ESGetToken siPixelTemplateDBObjectESToken_; + const edm::ESGetToken trackerGeometryESToken_; + const edm::ESGetToken trackerTopologyESToken_; public: TrackingRecHitProducer(const edm::ParameterSet& config); @@ -65,7 +67,10 @@ class TrackingRecHitProducer : public edm::stream::EDProducer<> { ~TrackingRecHitProducer() override; }; -TrackingRecHitProducer::TrackingRecHitProducer(const edm::ParameterSet& config) { +TrackingRecHitProducer::TrackingRecHitProducer(const edm::ParameterSet& config) + : siPixelTemplateDBObjectESToken_(esConsumes()), + trackerGeometryESToken_(esConsumes()), + trackerTopologyESToken_(esConsumes()) { edm::ConsumesCollector consumeCollector = consumesCollector(); const std::vector& pluginConfigs = config.getParameter>("plugins"); @@ -109,20 +114,18 @@ void TrackingRecHitProducer::beginRun(edm::Run const& run, const edm::EventSetup // the pixel algorithms implement beginRun(), for the strip tracker this defaults // to a no-op. - edm::ESHandle templateDBobject; - eventSetup.get().get(templateDBobject); - const SiPixelTemplateDBObject* pixelTemplateDBObject = templateDBobject.product(); + const SiPixelTemplateDBObject& pixelTemplateDBObject = eventSetup.getData(siPixelTemplateDBObjectESToken_); //--- Now that we have the DB object, load the correct templates from the DB. // (They are needed for data and full sim MC, so in a production FastSim // run, everything should already be in the DB.) - if (!SiPixelTemplate::pushfile(*pixelTemplateDBObject, _pixelTempStore)) { + if (!SiPixelTemplate::pushfile(pixelTemplateDBObject, _pixelTempStore)) { throw cms::Exception("TrackingRecHitProducer:") << "SiPixel Templates not loaded correctly from the DB object!" << std::endl; } for (auto& algo : _recHitAlgorithms) { - algo->beginRun(run, eventSetup, pixelTemplateDBObject, _pixelTempStore); + algo->beginRun(run, eventSetup, &pixelTemplateDBObject, _pixelTempStore); } } @@ -133,21 +136,18 @@ void TrackingRecHitProducer::setupDetIdPipes(const edm::EventSetup& eventSetup) trackerTopoRec.cacheIdentifier() != _trackerTopologyCacheID) { _trackerGeometryCacheID = trackerGeomRec.cacheIdentifier(); _trackerTopologyCacheID = trackerTopoRec.cacheIdentifier(); - edm::ESHandle trackerGeometryHandle; - edm::ESHandle trackerTopologyHandle; - trackerGeomRec.get(trackerGeometryHandle); - trackerTopoRec.get(trackerTopologyHandle); - const TrackerGeometry* trackerGeometry = trackerGeometryHandle.product(); - const TrackerTopology* trackerTopology = trackerTopologyHandle.product(); + + const TrackerGeometry& trackerGeometry = trackerGeomRec.get(trackerGeometryESToken_); + const TrackerTopology& trackerTopology = trackerTopoRec.get(trackerTopologyESToken_); _detIdPipes.clear(); //build pipes for all detIds - const std::vector& detIds = trackerGeometry->detIds(); + const std::vector& detIds = trackerGeometry.detIds(); std::vector numberOfDetIdsPerAlgorithm(_recHitAlgorithms.size(), 0); for (const DetId& detId : detIds) { - TrackerDetIdSelector selector(detId, *trackerTopology); + TrackerDetIdSelector selector(detId, trackerTopology); TrackingRecHitPipe pipe; for (unsigned int ialgo = 0; ialgo < _recHitAlgorithms.size(); ++ialgo) { @@ -159,7 +159,7 @@ void TrackingRecHitProducer::setupDetIdPipes(const edm::EventSetup& eventSetup) } if (pipe.size() == 0) { throw cms::Exception("FastSimulation/TrackingRecHitProducer: DetId not configured! (" + - trackerTopology->print(detId) + ")"); + trackerTopology.print(detId) + ")"); } _detIdPipes[detId.rawId()] = pipe; } diff --git a/FastSimulation/TrackingRecHitProducer/src/TrackingRecHitAlgorithm.cc b/FastSimulation/TrackingRecHitProducer/src/TrackingRecHitAlgorithm.cc index ae9b47aa585b3..2ac1c9f781d45 100644 --- a/FastSimulation/TrackingRecHitProducer/src/TrackingRecHitAlgorithm.cc +++ b/FastSimulation/TrackingRecHitProducer/src/TrackingRecHitAlgorithm.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" @@ -15,9 +14,6 @@ #include "FastSimulation/TrackingRecHitProducer/interface/TrackingRecHitProduct.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" - #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -30,6 +26,9 @@ TrackingRecHitAlgorithm::TrackingRecHitAlgorithm(const std::string& name, _trackerTopology(nullptr), _trackerGeometry(nullptr), _misalignedTrackerGeometry(nullptr), + trackerTopologyESToken_(consumesCollector.esConsumes()), + trackerGeometryESToken_(consumesCollector.esConsumes()), + misalignedTrackerGeometryESToken_(consumesCollector.esConsumes(edm::ESInputTag("", "MisAligned"))), _randomEngine(nullptr) {} const TrackerTopology& TrackingRecHitAlgorithm::getTrackerTopology() const { @@ -72,17 +71,9 @@ void TrackingRecHitAlgorithm::beginRun(edm::Run const& run, } void TrackingRecHitAlgorithm::beginEvent(edm::Event& event, const edm::EventSetup& eventSetup) { - edm::ESHandle trackerTopologyHandle; - edm::ESHandle trackerGeometryHandle; - edm::ESHandle misalignedGeometryHandle; - - eventSetup.get().get(trackerTopologyHandle); - eventSetup.get().get(trackerGeometryHandle); - eventSetup.get().get("MisAligned", misalignedGeometryHandle); - - _trackerTopology = trackerTopologyHandle.product(); - _trackerGeometry = trackerGeometryHandle.product(); - _misalignedTrackerGeometry = misalignedGeometryHandle.product(); + _trackerTopology = &eventSetup.getData(trackerTopologyESToken_); + _trackerGeometry = &eventSetup.getData(trackerGeometryESToken_); + _misalignedTrackerGeometry = &eventSetup.getData(misalignedTrackerGeometryESToken_); } TrackingRecHitProductPtr TrackingRecHitAlgorithm::process(TrackingRecHitProductPtr product) const { return product; } From b5cbf9ccf0f77081777c001b9956c7538c992095 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 27 Aug 2021 23:49:39 +0200 Subject: [PATCH 193/923] Add missing header --- FastSimulation/EventProducer/src/FamosProducer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/FastSimulation/EventProducer/src/FamosProducer.cc b/FastSimulation/EventProducer/src/FamosProducer.cc index 18ae6b56d7371..155b0ec337611 100644 --- a/FastSimulation/EventProducer/src/FamosProducer.cc +++ b/FastSimulation/EventProducer/src/FamosProducer.cc @@ -1,3 +1,4 @@ +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" From 9e502cde1909a51d5ad15169f62713687d094aa3 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 28 Aug 2021 00:04:45 +0200 Subject: [PATCH 194/923] Modernize BetaBoostEvtVtxGenerator - Remove unnecessary functions - Make member variables const - Make member functions const - Call GetInvLorentzBoost() only once as there is no randomness (and the result is small) - Make the module edm::global --- .../plugins/BetaBoostEvtVtxGenerator.cc | 137 ++++++------------ 1 file changed, 45 insertions(+), 92 deletions(-) diff --git a/GeneratorInterface/HiGenCommon/plugins/BetaBoostEvtVtxGenerator.cc b/GeneratorInterface/HiGenCommon/plugins/BetaBoostEvtVtxGenerator.cc index c6bd8f7f2015e..4c642e15aae1b 100644 --- a/GeneratorInterface/HiGenCommon/plugins/BetaBoostEvtVtxGenerator.cc +++ b/GeneratorInterface/HiGenCommon/plugins/BetaBoostEvtVtxGenerator.cc @@ -24,8 +24,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/RandomNumberGenerator.h" @@ -49,80 +48,58 @@ namespace CLHEP { class HepRandomEngine; } -class BetaBoostEvtVtxGenerator : public edm::EDProducer { +class BetaBoostEvtVtxGenerator : public edm::global::EDProducer<> { public: BetaBoostEvtVtxGenerator(const edm::ParameterSet& p); /** Copy constructor */ BetaBoostEvtVtxGenerator(const BetaBoostEvtVtxGenerator& p) = delete; /** Copy assignment operator */ BetaBoostEvtVtxGenerator& operator=(const BetaBoostEvtVtxGenerator& rhs) = delete; - ~BetaBoostEvtVtxGenerator() override; + ~BetaBoostEvtVtxGenerator() override = default; /// return a new event vertex - //virtual CLHEP::Hep3Vector * newVertex(); - virtual HepMC::FourVector* newVertex(CLHEP::HepRandomEngine*); - void produce(edm::Event&, const edm::EventSetup&) override; - virtual TMatrixD* GetInvLorentzBoost(); - - /// set resolution in Z in cm - void sigmaZ(double s = 1.0); - - /// set mean in X in cm - void X0(double m = 0) { fX0 = m; } - /// set mean in Y in cm - void Y0(double m = 0) { fY0 = m; } - /// set mean in Z in cm - void Z0(double m = 0) { fZ0 = m; } - - /// set half crossing angle - void Phi(double m = 0) { phi_ = m; } - /// angle between crossing plane and horizontal plane - void Alpha(double m = 0) { alpha_ = m; } - void Beta(double m = 0) { beta_ = m; } - - /// set beta_star - void betastar(double m = 0) { fbetastar = m; } - /// emittance (no the normalized) - void emittance(double m = 0) { femittance = m; } + HepMC::FourVector newVertex(CLHEP::HepRandomEngine*) const; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + TMatrixD GetInvLorentzBoost() const; /// beta function - double BetaFunction(double z, double z0); + double BetaFunction(double z, double z0) const; private: - double alpha_, phi_; - //TMatrixD boost_; - double beta_; - double fX0, fY0, fZ0; - double fSigmaZ; + const double alpha_; // angle between crossing plane and horizontal plane + const double phi_; // half crossing angle + const double beta_; + const double fX0; // mean in X in cm + const double fY0; // mean in Y in cm + const double fZ0; // mean in Z in cm + const double fSigmaZ; // resolution in Z in cm //double fdxdz, fdydz; - double fbetastar, femittance; - double falpha; + const double fbetastar; + const double femittance; // emittance (no the normalized)a - HepMC::FourVector* fVertex; - TMatrixD* boost_; - double fTimeOffset; + const double fTimeOffset; - edm::EDGetTokenT sourceLabel; + const TMatrixD boost_; - bool verbosity_; + const edm::EDGetTokenT sourceLabel; + + const bool verbosity_; }; BetaBoostEvtVtxGenerator::BetaBoostEvtVtxGenerator(const edm::ParameterSet& p) - : fVertex(nullptr), - boost_(nullptr), - fTimeOffset(0), + : alpha_(p.getParameter("Alpha") * radian), + phi_(p.getParameter("Phi") * radian), + beta_(p.getParameter("Beta")), + fX0(p.getParameter("X0") * cm), + fY0(p.getParameter("Y0") * cm), + fZ0(p.getParameter("Z0") * cm), + fSigmaZ(p.getParameter("SigmaZ") * cm), + fbetastar(p.getParameter("BetaStar") * cm), + femittance(p.getParameter("Emittance") * cm), // this is not the normalized emittance + fTimeOffset(p.getParameter("TimeOffset") * ns * c_light), // HepMC time units are mm + boost_(GetInvLorentzBoost()), sourceLabel(consumes(p.getParameter("src"))), verbosity_(p.getUntrackedParameter("verbosity", false)) { - fX0 = p.getParameter("X0") * cm; - fY0 = p.getParameter("Y0") * cm; - fZ0 = p.getParameter("Z0") * cm; - fSigmaZ = p.getParameter("SigmaZ") * cm; - alpha_ = p.getParameter("Alpha") * radian; - phi_ = p.getParameter("Phi") * radian; - fbetastar = p.getParameter("BetaStar") * cm; - femittance = p.getParameter("Emittance") * cm; // this is not the normalized emittance - fTimeOffset = p.getParameter("TimeOffset") * ns * c_light; // HepMC time units are mm - beta_ = p.getParameter("Beta"); if (fSigmaZ <= 0) { throw cms::Exception("Configuration") << "Error in BetaBoostEvtVtxGenerator: " << "Illegal resolution in Z (SigmaZ is negative)"; @@ -131,14 +108,7 @@ BetaBoostEvtVtxGenerator::BetaBoostEvtVtxGenerator(const edm::ParameterSet& p) produces(); } -BetaBoostEvtVtxGenerator::~BetaBoostEvtVtxGenerator() { - delete fVertex; - if (boost_ != nullptr) - delete boost_; -} - -//Hep3Vector* BetaBoostEvtVtxGenerator::newVertex() { -HepMC::FourVector* BetaBoostEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine* engine) { +HepMC::FourVector BetaBoostEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine* engine) const { double X, Y, Z; double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.0, fSigmaZ); @@ -157,27 +127,14 @@ HepMC::FourVector* BetaBoostEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine* e double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.0, fSigmaZ); double T = tmp_sigt + fTimeOffset; - if (fVertex == nullptr) - fVertex = new HepMC::FourVector(); - fVertex->set(X, Y, Z, T); - - return fVertex; + return HepMC::FourVector(X, Y, Z, T); } -double BetaBoostEvtVtxGenerator::BetaFunction(double z, double z0) { +double BetaBoostEvtVtxGenerator::BetaFunction(double z, double z0) const { return sqrt(femittance * (fbetastar + (((z - z0) * (z - z0)) / fbetastar))); } -void BetaBoostEvtVtxGenerator::sigmaZ(double s) { - if (s >= 0) { - fSigmaZ = s; - } else { - throw cms::Exception("LogicError") << "Error in BetaBoostEvtVtxGenerator::sigmaZ: " - << "Illegal resolution in Z (negative)"; - } -} - -TMatrixD* BetaBoostEvtVtxGenerator::GetInvLorentzBoost() { +TMatrixD BetaBoostEvtVtxGenerator::GetInvLorentzBoost() const { //alpha_ = 0; //phi_ = 142.e-6; // if (boost_ != 0 ) return boost_; @@ -232,15 +189,14 @@ TMatrixD* BetaBoostEvtVtxGenerator::GetInvLorentzBoost() { tmpboostXYZ = tmpboostZ * tmpboost; tmpboostXYZ.Invert(); - boost_ = new TMatrixD(tmpboostXYZ); if (verbosity_) { - boost_->Print(); + tmpboostXYZ.Print(); } - return boost_; + return tmpboostXYZ; } -void BetaBoostEvtVtxGenerator::produce(Event& evt, const EventSetup&) { +void BetaBoostEvtVtxGenerator::produce(edm::StreamID, Event& evt, const EventSetup&) const { edm::Service rng; if (!rng.isAvailable()) { throw cms::Exception("Configuration") @@ -249,23 +205,20 @@ void BetaBoostEvtVtxGenerator::produce(Event& evt, const EventSetup&) { } CLHEP::HepRandomEngine* engine = &rng->getEngine(evt.streamID()); - Handle HepUnsmearedMCEvt; - evt.getByToken(sourceLabel, HepUnsmearedMCEvt); + const auto& HepUnsmearedMCEvt = evt.get(sourceLabel); // Copy the HepMC::GenEvent - HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent()); - std::unique_ptr HepMCEvt(new edm::HepMCProduct(genevt)); + auto HepMCEvt = std::make_unique(new HepMC::GenEvent(*HepUnsmearedMCEvt.GetEvent())); // generate new vertex & apply the shift // - HepMCEvt->applyVtxGen(newVertex(engine)); + auto vertex = newVertex(engine); + HepMCEvt->applyVtxGen(&vertex); //HepMCEvt->LorentzBoost( 0., 142.e-6 ); - HepMCEvt->boostToLab(GetInvLorentzBoost(), "vertex"); - HepMCEvt->boostToLab(GetInvLorentzBoost(), "momentum"); + HepMCEvt->boostToLab(&boost_, "vertex"); + HepMCEvt->boostToLab(&boost_, "momentum"); evt.put(std::move(HepMCEvt)); - - return; } #include "FWCore/Framework/interface/MakerMacros.h" From 76078482cb31c0c5367d078e8c04c59cfe89ff5c Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 28 Aug 2021 11:32:29 +0200 Subject: [PATCH 195/923] Get rid of a dead increment in SiStripMonitorClient --- DQM/SiStripMonitorClient/bin/ls_cert.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DQM/SiStripMonitorClient/bin/ls_cert.cc b/DQM/SiStripMonitorClient/bin/ls_cert.cc index 7dce64c99767c..8dc3baf63bf08 100644 --- a/DQM/SiStripMonitorClient/bin/ls_cert.cc +++ b/DQM/SiStripMonitorClient/bin/ls_cert.cc @@ -244,7 +244,6 @@ void ls_cert_type(string iDir, lsd[i] = templs; TDirectory* tempDir = dynamic_cast(file->Get(lsdir.str().c_str())); tempDir->cd(); - int j = 0; TIter nextTemp(tempDir->GetListOfKeys()); TKey* keyTemp; while ((keyTemp = dynamic_cast(nextTemp()))) { @@ -261,14 +260,13 @@ void ls_cert_type(string iDir, std::cout << typecert.c_str() << std::endl; tempvalue = atof(detvalue.c_str()); - for (j = 0; j < smax; j++) { + for (int j = 0; j < smax; j++) { if (strstr(typecert.c_str(), certflag[j].c_str()) != nullptr) v[j][i] = tempvalue; if (debug) std::cout << "Entering value " << tempvalue << " " << v[j][i] << " for " << certflag[j].c_str() << std::endl; } - j = j + 1; } } } From f0631888b37f37f5868ca8c0cd7b3cd9a78862b2 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 28 Aug 2021 14:45:47 +0200 Subject: [PATCH 196/923] Move the plugin files to plugins directory --- .../interface/PrintGeomInfoAction.h | 64 ----------------- .../interface/PrintGeomSummary.h | 51 -------------- .../interface/PrintMaterialBudgetInfo.h | 68 ------------------- .../PrintGeomInfo/interface/PrintSensitive.h | 32 --------- .../PrintGeomInfo/{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/PrintGeomInfoAction.cc | 65 ++++++++++++++++-- .../{src => plugins}/PrintGeomSolids.cc | 0 .../{src => plugins}/PrintGeomSummary.cc | 45 +++++++++++- .../PrintMaterialBudgetInfo.cc | 62 ++++++++++++++++- .../{src => plugins}/PrintSensitive.cc | 29 +++++++- SimG4Core/PrintGeomInfo/src/module.cc | 11 --- 11 files changed, 190 insertions(+), 241 deletions(-) delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintSensitive.h rename SimG4Core/PrintGeomInfo/{ => plugins}/BuildFile.xml (74%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintGeomInfoAction.cc (90%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintGeomSolids.cc (100%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintGeomSummary.cc (85%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintMaterialBudgetInfo.cc (82%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintSensitive.cc (73%) delete mode 100644 SimG4Core/PrintGeomInfo/src/module.cc diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h deleted file mode 100644 index 1ac319ebb449a..0000000000000 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef SimG4Core_PrintGeomInfoAction_H -#define SimG4Core_PrintGeomInfoAction_H - -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "SimG4Core/Notification/interface/Observer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4NavigationHistory.hh" - -#include -#include -#include -#include - -class BeginOfJob; -class BeginOfRun; -class G4LogicalVolume; -class G4VPhysicalVolume; -class G4VSolid; - -typedef std::multimap > mmlvpv; - -class PrintGeomInfoAction : public SimWatcher, public Observer, public Observer { -public: - PrintGeomInfoAction(edm::ParameterSet const& p); - ~PrintGeomInfoAction() override; - -private: - void update(const BeginOfJob* job) override; - void update(const BeginOfRun* run) override; - void dumpSummary(std::ostream& out = std::cout); - void dumpG4LVList(std::ostream& out = std::cout); - void dumpG4LVTree(std::ostream& out = std::cout); - void dumpMaterialList(std::ostream& out = std::cout); - void dumpG4LVLeaf(G4LogicalVolume* lv, unsigned int leafDepth, unsigned int count, std::ostream& out = std::cout); - int countNoTouchables(); - void add1touchable(G4LogicalVolume* lv, int& nTouch); - void dumpHierarchyTreePVLV(std::ostream& out = std::cout); - void dumpHierarchyLeafPVLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpPV(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpSolid(G4VSolid* sol, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpInFile(); - void getTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, unsigned int copym, std::vector& touches); - std::string spacesFromLeafDepth(unsigned int leafDepth); - G4VPhysicalVolume* getTopPV(); - G4LogicalVolume* getTopLV(); - -private: - bool dumpSummary_, dumpLVTree_, dumpLVList_, dumpMaterial_; - bool dumpLV_, dumpSolid_, dumpAtts_, dumpPV_; - bool dumpRotation_, dumpReplica_, dumpTouch_; - bool dumpSense_, dd4hep_; - std::string name_; - int nchar_; - std::string fileMat_, fileSolid_, fileLV_, filePV_, fileTouch_; - bool fileDetail_; - std::vector names_; - G4VPhysicalVolume* theTopPV_; - G4NavigationHistory fHistory_; -}; - -#endif diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h deleted file mode 100644 index b90715e98b867..0000000000000 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef SimG4Core_PrintGeomSummary_H -#define SimG4Core_PrintGeomSummary_H - -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "SimG4Core/Notification/interface/Observer.h" -#include "DetectorDescription/Core/interface/DDSolidShapes.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4NavigationHistory.hh" - -#include -#include -#include -#include -#include - -class BeginOfJob; -class BeginOfRun; -class DDLogicalPart; -class G4LogicalVolume; -class G4VPhysicalVolume; -class G4VSolid; - -class PrintGeomSummary : public SimWatcher, public Observer, public Observer { -public: - PrintGeomSummary(edm::ParameterSet const &p); - ~PrintGeomSummary() override; - -private: - void update(const BeginOfJob *job) override; - void update(const BeginOfRun *run) override; - void addSolid(const DDLogicalPart &part); - void fillLV(G4LogicalVolume *lv); - void fillPV(G4VPhysicalVolume *pv); - void dumpSummary(std::ostream &out, std::string name); - G4VPhysicalVolume *getTopPV(); - void addName(std::string name); - void printSummary(std::ostream &out); - -private: - std::vector nodeNames_; - std::map solidShape_; - std::map solidMap_; - G4VPhysicalVolume *theTopPV_; - std::vector lvs_, touch_; - std::vector sls_; - std::vector pvs_; - std::map > kount_; -}; - -#endif diff --git a/SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h b/SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h deleted file mode 100644 index b6f15711ebe22..0000000000000 --- a/SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SimG4CorePrintGeomInfo_PrintMaterialBudgetInfo_H -#define SimG4CorePrintGeomInfo_PrintMaterialBudgetInfo_H - -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "SimG4Core/Notification/interface/Observer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4NavigationHistory.hh" - -#include -#include -#include -#include - -class BeginOfJob; -class BeginOfRun; -class G4LogicalVolume; -class G4VPhysicalVolume; -class G4VSolid; - -typedef std::map > mpvpv; -typedef std::multimap > mmlvpv; - -class PrintMaterialBudgetInfo : public SimWatcher, - public Observer, - public Observer { -public: - PrintMaterialBudgetInfo(edm::ParameterSet const& p); - ~PrintMaterialBudgetInfo() override; - -private: - void update(const BeginOfJob* job) override{}; - void update(const BeginOfRun* run) override; - void dumpHeader(std::ostream& out = std::cout); - void dumpLaTeXHeader(std::ostream& out = std::cout); - void dumpHierarchyLeaf(G4VPhysicalVolume* pv, - G4LogicalVolume* lv, - unsigned int leafDepth, - std::ostream& weightOut = std::cout, - std::ostream& texOut = std::cout); - void printInfo(G4VPhysicalVolume* pv, - G4LogicalVolume* lv, - unsigned int leafDepth, - std::ostream& weightOut = std::cout, - std::ostream& texOut = std::cout); - void dumpElementMassFraction(std::ostream& elementOut = std::cout); - void dumpLaTeXFooter(std::ostream& out = std::cout); - -private: - std::string name; - int nchar; - mpvpv thePVTree; - G4VPhysicalVolume* theTopPV; - G4NavigationHistory fHistory; - bool volumeFound; - unsigned int levelFound; - std::ofstream weightOutputFile; - std::ofstream elementOutputFile; - std::ofstream texOutputFile; - std::vector elementNames; - std::vector elementTotalWeight; - std::vector elementWeightFraction; - // - std::string stringLaTeXUnderscore(std::string stringname); - std::string stringLaTeXSuperscript(std::string stringname); -}; - -#endif diff --git a/SimG4Core/PrintGeomInfo/interface/PrintSensitive.h b/SimG4Core/PrintGeomInfo/interface/PrintSensitive.h deleted file mode 100644 index b1350c12a63fe..0000000000000 --- a/SimG4Core/PrintGeomInfo/interface/PrintSensitive.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SimG4Core_PrintSensitive_H -#define SimG4Core_PrintSensitive_H - -#include "SimG4Core/Watcher/interface/SimWatcher.h" -#include "SimG4Core/Notification/interface/Observer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "G4NavigationHistory.hh" - -#include -#include - -class BeginOfRun; -class G4VPhysicalVolume; - -class PrintSensitive : public SimWatcher, public Observer { -public: - PrintSensitive(edm::ParameterSet const &p); - ~PrintSensitive() override; - -private: - void update(const BeginOfRun *run) override; - int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out = std::cout); - G4VPhysicalVolume *getTopPV(); - -private: - std::string name_; - int nchar_; - G4NavigationHistory fHistory; -}; - -#endif diff --git a/SimG4Core/PrintGeomInfo/BuildFile.xml b/SimG4Core/PrintGeomInfo/plugins/BuildFile.xml similarity index 74% rename from SimG4Core/PrintGeomInfo/BuildFile.xml rename to SimG4Core/PrintGeomInfo/plugins/BuildFile.xml index 653a8b3bee5f9..ea42c90fd14df 100644 --- a/SimG4Core/PrintGeomInfo/BuildFile.xml +++ b/SimG4Core/PrintGeomInfo/plugins/BuildFile.xml @@ -1,4 +1,3 @@ - @@ -8,3 +7,6 @@ + + + diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc similarity index 90% rename from SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc rename to SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc index f428d816dc131..2585069ba46aa 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc @@ -1,10 +1,11 @@ -#include "SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h" - #include "SimG4Core/Notification/interface/BeginOfJob.h" #include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Math/interface/angle_units.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DetectorDescription/Core/interface/DDCompactView.h" @@ -19,26 +20,71 @@ #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Filter.h" -#include "G4Run.hh" -#include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" -#include "G4VPhysicalVolume.hh" #include "G4LogicalVolume.hh" #include "G4VSolid.hh" #include "G4Material.hh" +#include "G4NavigationHistory.hh" +#include "G4PhysicalVolumeStore.hh" +#include "G4Run.hh" #include "G4Track.hh" -#include "G4VisAttributes.hh" -#include "G4UserLimits.hh" #include "G4TransportationManager.hh" +#include "G4UserLimits.hh" +#include "G4VisAttributes.hh" +#include "G4VPhysicalVolume.hh" #include #include #include #include +#include #include using angle_units::operators::convertRadToDeg; +typedef std::multimap > mmlvpv; + +class PrintGeomInfoAction : public SimWatcher, public Observer, public Observer { +public: + PrintGeomInfoAction(edm::ParameterSet const& p); + ~PrintGeomInfoAction() override; + +private: + void update(const BeginOfJob* job) override; + void update(const BeginOfRun* run) override; + void dumpSummary(std::ostream& out = std::cout); + void dumpG4LVList(std::ostream& out = std::cout); + void dumpG4LVTree(std::ostream& out = std::cout); + void dumpMaterialList(std::ostream& out = std::cout); + void dumpG4LVLeaf(G4LogicalVolume* lv, unsigned int leafDepth, unsigned int count, std::ostream& out = std::cout); + int countNoTouchables(); + void add1touchable(G4LogicalVolume* lv, int& nTouch); + void dumpHierarchyTreePVLV(std::ostream& out = std::cout); + void dumpHierarchyLeafPVLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); + void dumpLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); + void dumpPV(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); + void dumpSolid(G4VSolid* sol, unsigned int leafDepth, std::ostream& out = std::cout); + void dumpTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); + void dumpInFile(); + void getTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, unsigned int copym, std::vector& touches); + std::string spacesFromLeafDepth(unsigned int leafDepth); + G4VPhysicalVolume* getTopPV(); + G4LogicalVolume* getTopLV(); + +private: + bool dumpSummary_, dumpLVTree_, dumpLVList_, dumpMaterial_; + bool dumpLV_, dumpSolid_, dumpAtts_, dumpPV_; + bool dumpRotation_, dumpReplica_, dumpTouch_; + bool dumpSense_, dd4hep_; + std::string name_; + int nchar_; + std::string fileMat_, fileSolid_, fileLV_, filePV_, fileTouch_; + bool fileDetail_; + std::vector names_; + G4VPhysicalVolume* theTopPV_; + G4NavigationHistory fHistory_; +}; + PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { dumpSummary_ = p.getUntrackedParameter("DumpSummary", true); dumpLVTree_ = p.getUntrackedParameter("DumpLVTree", true); @@ -538,3 +584,8 @@ G4VPhysicalVolume *PrintGeomInfoAction::getTopPV() { } G4LogicalVolume *PrintGeomInfoAction::getTopLV() { return theTopPV_->GetLogicalVolume(); } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(PrintGeomInfoAction); diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomSolids.cc similarity index 100% rename from SimG4Core/PrintGeomInfo/src/PrintGeomSolids.cc rename to SimG4Core/PrintGeomInfo/plugins/PrintGeomSolids.cc diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomSummary.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc similarity index 85% rename from SimG4Core/PrintGeomInfo/src/PrintGeomSummary.cc rename to SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc index d33113318dcf0..346899e7718fe 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomSummary.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc @@ -1,16 +1,18 @@ -#include "SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h" - #include "SimG4Core/Notification/interface/BeginOfJob.h" #include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDFilter.h" #include "DetectorDescription/Core/interface/DDFilteredView.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" #include "DetectorDescription/Core/interface/DDSolid.h" +#include "DetectorDescription/Core/interface/DDSolidShapes.h" #include "DetectorDescription/Core/interface/DDSplit.h" #include "DetectorDescription/Core/interface/DDValue.h" @@ -21,13 +23,45 @@ #include "G4LogicalVolume.hh" #include "G4VSolid.hh" #include "G4Material.hh" +#include "G4NavigationHistory.hh" #include "G4Track.hh" #include "G4VisAttributes.hh" #include "G4UserLimits.hh" #include "G4TransportationManager.hh" -#include +#include +#include +#include #include +#include +#include + +class PrintGeomSummary : public SimWatcher, public Observer, public Observer { +public: + PrintGeomSummary(edm::ParameterSet const &p); + ~PrintGeomSummary() override; + +private: + void update(const BeginOfJob *job) override; + void update(const BeginOfRun *run) override; + void addSolid(const DDLogicalPart &part); + void fillLV(G4LogicalVolume *lv); + void fillPV(G4VPhysicalVolume *pv); + void dumpSummary(std::ostream &out, std::string name); + G4VPhysicalVolume *getTopPV(); + void addName(std::string name); + void printSummary(std::ostream &out); + +private: + std::vector nodeNames_; + std::map solidShape_; + std::map solidMap_; + G4VPhysicalVolume *theTopPV_; + std::vector lvs_, touch_; + std::vector sls_; + std::vector pvs_; + std::map > kount_; +}; PrintGeomSummary::PrintGeomSummary(const edm::ParameterSet& p) : theTopPV_(nullptr) { std::vector defNames; @@ -215,3 +249,8 @@ void PrintGeomSummary::printSummary(std::ostream& out) { out << "Shape [" << k << "] " << shape << " # " << (itr->second).first << " : " << (itr->second).second << G4endl; } } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(PrintGeomSummary); diff --git a/SimG4Core/PrintGeomInfo/src/PrintMaterialBudgetInfo.cc b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc similarity index 82% rename from SimG4Core/PrintGeomInfo/src/PrintMaterialBudgetInfo.cc rename to SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc index e5eed4192dcd8..56e02d6de72b2 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintMaterialBudgetInfo.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc @@ -1,10 +1,11 @@ -#include "SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h" - #include "SimG4Core/Notification/interface/BeginOfJob.h" #include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDFilter.h" @@ -20,6 +21,7 @@ #include "G4LogicalVolume.hh" #include "G4VSolid.hh" #include "G4Material.hh" +#include "G4NavigationHistory.hh" #include "G4Track.hh" #include "G4VisAttributes.hh" #include "G4UserLimits.hh" @@ -27,7 +29,58 @@ #include "G4UnitsTable.hh" #include "Randomize.hh" +#include +#include #include +#include +#include + +typedef std::map > mpvpv; +typedef std::multimap > mmlvpv; + +class PrintMaterialBudgetInfo : public SimWatcher, + public Observer, + public Observer { +public: + PrintMaterialBudgetInfo(edm::ParameterSet const& p); + ~PrintMaterialBudgetInfo() override; + +private: + void update(const BeginOfJob* job) override{}; + void update(const BeginOfRun* run) override; + void dumpHeader(std::ostream& out = std::cout); + void dumpLaTeXHeader(std::ostream& out = std::cout); + void dumpHierarchyLeaf(G4VPhysicalVolume* pv, + G4LogicalVolume* lv, + unsigned int leafDepth, + std::ostream& weightOut = std::cout, + std::ostream& texOut = std::cout); + void printInfo(G4VPhysicalVolume* pv, + G4LogicalVolume* lv, + unsigned int leafDepth, + std::ostream& weightOut = std::cout, + std::ostream& texOut = std::cout); + void dumpElementMassFraction(std::ostream& elementOut = std::cout); + void dumpLaTeXFooter(std::ostream& out = std::cout); + +private: + std::string name; + int nchar; + mpvpv thePVTree; + G4VPhysicalVolume* theTopPV; + G4NavigationHistory fHistory; + bool volumeFound; + unsigned int levelFound; + std::ofstream weightOutputFile; + std::ofstream elementOutputFile; + std::ofstream texOutputFile; + std::vector elementNames; + std::vector elementTotalWeight; + std::vector elementWeightFraction; + // + std::string stringLaTeXUnderscore(std::string stringname); + std::string stringLaTeXSuperscript(std::string stringname); +}; PrintMaterialBudgetInfo::PrintMaterialBudgetInfo(const edm::ParameterSet& p) { name = p.getUntrackedParameter("Name", "*"); @@ -303,3 +356,8 @@ std::string PrintMaterialBudgetInfo::stringLaTeXSuperscript(std::string stringna return stringoutput; } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(PrintMaterialBudgetInfo); diff --git a/SimG4Core/PrintGeomInfo/src/PrintSensitive.cc b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc similarity index 73% rename from SimG4Core/PrintGeomInfo/src/PrintSensitive.cc rename to SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc index 9d1cdb2f12482..5a0d74bd5454b 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintSensitive.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc @@ -1,14 +1,34 @@ -#include "SimG4Core/PrintGeomInfo/interface/PrintSensitive.h" - #include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimWatcher.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "G4Run.hh" #include "G4VPhysicalVolume.hh" #include "G4LogicalVolume.hh" +#include "G4NavigationHistory.hh" #include "G4TransportationManager.hh" #include #include +#include +#include + +class PrintSensitive : public SimWatcher, public Observer { +public: + PrintSensitive(edm::ParameterSet const &p); + ~PrintSensitive() override; + +private: + void update(const BeginOfRun *run) override; + int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out = std::cout); + G4VPhysicalVolume *getTopPV(); + +private: + std::string name_; + int nchar_; + G4NavigationHistory fHistory; +}; PrintSensitive::PrintSensitive(const edm::ParameterSet &p) { name_ = p.getUntrackedParameter("Name", "*"); @@ -66,3 +86,8 @@ int PrintSensitive::dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, boo G4VPhysicalVolume *PrintSensitive::getTopPV() { return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume(); } + +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_SIMWATCHER(PrintSensitive); diff --git a/SimG4Core/PrintGeomInfo/src/module.cc b/SimG4Core/PrintGeomInfo/src/module.cc deleted file mode 100644 index efc9bab12520f..0000000000000 --- a/SimG4Core/PrintGeomInfo/src/module.cc +++ /dev/null @@ -1,11 +0,0 @@ -#include "SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h" -#include "SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h" -#include "SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h" -#include "SimG4Core/PrintGeomInfo/interface/PrintSensitive.h" -#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" - -DEFINE_SIMWATCHER(PrintGeomInfoAction); -DEFINE_SIMWATCHER(PrintGeomSummary); -DEFINE_SIMWATCHER(PrintMaterialBudgetInfo); -DEFINE_SIMWATCHER(PrintSensitive); From b8a9bf4febb078465177f82967e8728e213d07a6 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 28 Aug 2021 15:16:15 +0200 Subject: [PATCH 197/923] Code check --- .../plugins/PrintGeomInfoAction.cc | 44 ++++++++++--------- .../PrintGeomInfo/plugins/PrintGeomSummary.cc | 30 ++++++------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc index 2585069ba46aa..19f42c1bc4536 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc @@ -42,34 +42,36 @@ using angle_units::operators::convertRadToDeg; -typedef std::multimap > mmlvpv; +typedef std::multimap > mmlvpv; -class PrintGeomInfoAction : public SimWatcher, public Observer, public Observer { +class PrintGeomInfoAction : public SimWatcher, + public Observer, + public Observer { public: - PrintGeomInfoAction(edm::ParameterSet const& p); + PrintGeomInfoAction(edm::ParameterSet const &p); ~PrintGeomInfoAction() override; private: - void update(const BeginOfJob* job) override; - void update(const BeginOfRun* run) override; - void dumpSummary(std::ostream& out = std::cout); - void dumpG4LVList(std::ostream& out = std::cout); - void dumpG4LVTree(std::ostream& out = std::cout); - void dumpMaterialList(std::ostream& out = std::cout); - void dumpG4LVLeaf(G4LogicalVolume* lv, unsigned int leafDepth, unsigned int count, std::ostream& out = std::cout); + void update(const BeginOfJob *job) override; + void update(const BeginOfRun *run) override; + void dumpSummary(std::ostream &out = std::cout); + void dumpG4LVList(std::ostream &out = std::cout); + void dumpG4LVTree(std::ostream &out = std::cout); + void dumpMaterialList(std::ostream &out = std::cout); + void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out = std::cout); int countNoTouchables(); - void add1touchable(G4LogicalVolume* lv, int& nTouch); - void dumpHierarchyTreePVLV(std::ostream& out = std::cout); - void dumpHierarchyLeafPVLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpLV(G4LogicalVolume* lv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpPV(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpSolid(G4VSolid* sol, unsigned int leafDepth, std::ostream& out = std::cout); - void dumpTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, std::ostream& out = std::cout); + void add1touchable(G4LogicalVolume *lv, int &nTouch); + void dumpHierarchyTreePVLV(std::ostream &out = std::cout); + void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout); + void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout); + void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout); + void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out = std::cout); + void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout); void dumpInFile(); - void getTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, unsigned int copym, std::vector& touches); + void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector &touches); std::string spacesFromLeafDepth(unsigned int leafDepth); - G4VPhysicalVolume* getTopPV(); - G4LogicalVolume* getTopLV(); + G4VPhysicalVolume *getTopPV(); + G4LogicalVolume *getTopLV(); private: bool dumpSummary_, dumpLVTree_, dumpLVList_, dumpMaterial_; @@ -81,7 +83,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer names_; - G4VPhysicalVolume* theTopPV_; + G4VPhysicalVolume *theTopPV_; G4NavigationHistory fHistory_; }; diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc index 346899e7718fe..7a839100e5ca6 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomSummary.cc @@ -36,31 +36,31 @@ #include #include -class PrintGeomSummary : public SimWatcher, public Observer, public Observer { +class PrintGeomSummary : public SimWatcher, public Observer, public Observer { public: - PrintGeomSummary(edm::ParameterSet const &p); + PrintGeomSummary(edm::ParameterSet const& p); ~PrintGeomSummary() override; private: - void update(const BeginOfJob *job) override; - void update(const BeginOfRun *run) override; - void addSolid(const DDLogicalPart &part); - void fillLV(G4LogicalVolume *lv); - void fillPV(G4VPhysicalVolume *pv); - void dumpSummary(std::ostream &out, std::string name); - G4VPhysicalVolume *getTopPV(); + void update(const BeginOfJob* job) override; + void update(const BeginOfRun* run) override; + void addSolid(const DDLogicalPart& part); + void fillLV(G4LogicalVolume* lv); + void fillPV(G4VPhysicalVolume* pv); + void dumpSummary(std::ostream& out, std::string name); + G4VPhysicalVolume* getTopPV(); void addName(std::string name); - void printSummary(std::ostream &out); + void printSummary(std::ostream& out); private: std::vector nodeNames_; std::map solidShape_; std::map solidMap_; - G4VPhysicalVolume *theTopPV_; - std::vector lvs_, touch_; - std::vector sls_; - std::vector pvs_; - std::map > kount_; + G4VPhysicalVolume* theTopPV_; + std::vector lvs_, touch_; + std::vector sls_; + std::vector pvs_; + std::map> kount_; }; PrintGeomSummary::PrintGeomSummary(const edm::ParameterSet& p) : theTopPV_(nullptr) { From 98cb80d8a03cf7064536e8e69ea2e900767d926e Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 28 Aug 2021 17:05:39 +0200 Subject: [PATCH 198/923] initalize flag in SiStripQualityChecker --- DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc b/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc index fb3b6885196d6..ac55780183d9f 100644 --- a/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc +++ b/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc @@ -230,7 +230,7 @@ void SiStripQualityChecker::fillDetectorStatus(DQMStore& dqm_store, const SiStri continue; dqm_store.cd(dname); ++xbin; - float flag; + float flag = 0; fillSubDetStatus(dqm_store, cabling, local_mes, xbin, flag); global_flag += flag; } From 2ebda5c1f8fc7ad772e970a9260627ee0e5f5268 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti Date: Sat, 28 Aug 2021 19:01:49 +0200 Subject: [PATCH 199/923] Replace specific forward layer with the general mother class --- RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc index b69ebc1227664..14377ebefbda9 100644 --- a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc +++ b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc @@ -16,9 +16,7 @@ #include "DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h" #include "RecoMTD/DetLayers/interface/MTDTrayBarrelLayer.h" -#include "RecoMTD/DetLayers/interface/MTDDetTray.h" -#include "RecoMTD/DetLayers/interface/MTDRingForwardDoubleLayer.h" -#include "RecoMTD/DetLayers/interface/MTDDetRing.h" +#include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" #include "DataFormats/ForwardDetId/interface/BTLDetId.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" @@ -886,7 +884,7 @@ TransientTrackingRecHit::ConstRecHitContainer TrackExtenderWithMTDT(ilay)->specificSurface(); + const BoundDisk& disk = static_cast(ilay)->specificSurface(); const double diskZ = disk.position().z(); if (tsos.globalPosition().z() * diskZ < 0) From 5089c527b8f45a7435cfda60110f58032569290c Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sat, 28 Aug 2021 20:04:40 +0200 Subject: [PATCH 200/923] Initialize member var in class DQClient --- DQM/HcalCommon/src/DQClient.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/DQM/HcalCommon/src/DQClient.cc b/DQM/HcalCommon/src/DQClient.cc index b611a4800cd82..8d04c4072140e 100644 --- a/DQM/HcalCommon/src/DQClient.cc +++ b/DQM/HcalCommon/src/DQClient.cc @@ -8,6 +8,7 @@ namespace hcaldqm { edm::ConsumesCollector &iC) : DQModule(ps), _taskname(taskname), + _totalLS(0), _maxProcessedLS(0), hcalDbServiceToken_(iC.esConsumes()), runInfoToken_(iC.esConsumes()), From fbd882ab0229aa9c429a80f5fd5e3470382bfd18 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sat, 28 Aug 2021 21:55:38 +0200 Subject: [PATCH 201/923] Initialize enum field in CaloPoint class --- FastSimulation/CaloGeometryTools/src/CaloPoint.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FastSimulation/CaloGeometryTools/src/CaloPoint.cc b/FastSimulation/CaloGeometryTools/src/CaloPoint.cc index 9cc1aa453b304..052fa1e3bd5cd 100644 --- a/FastSimulation/CaloGeometryTools/src/CaloPoint.cc +++ b/FastSimulation/CaloGeometryTools/src/CaloPoint.cc @@ -24,10 +24,12 @@ CaloPoint::CaloPoint(const DetId& cell, CaloDirection side, const XYZPoint& posi CaloPoint::CaloPoint(DetId::Detector det, const XYZPoint& position) : XYZPoint(position), detector_(det) { subdetector_ = 0; layer_ = 0; + side_ = CaloDirection::NONE; } //preshower CaloPoint::CaloPoint(DetId::Detector detector, int subdetn, int layer, const XYZPoint& position) : XYZPoint(position), detector_(detector), subdetector_(subdetn), layer_(layer) { cellid_ = DetId(); + side_ = CaloDirection::NONE; } From b11c199848d642f884b8e82c7f2ec39644b7842c Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 28 Aug 2021 23:53:53 +0200 Subject: [PATCH 202/923] Make sure the dd4hep algorithms provide the namespace to all created solids/volumes --- .../plugins/dd4hep/DDCutTubsFromPoints.cc | 2 + .../plugins/dd4hep/DDPixBarLayerAlgo.cc | 46 ++--- .../dd4hep/DDPixBarLayerUpgradeAlgo.cc | 36 ++-- .../plugins/dd4hep/DDPixFwdDiskAlgo.cc | 12 +- .../plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc | 5 +- .../plugins/dd4hep/DDTECCoolAlgo.cc | 10 +- .../plugins/dd4hep/DDTECModuleAlgo.cc | 40 ++-- .../plugins/dd4hep/DDTECOptoHybAlgo.cc | 10 +- .../plugins/dd4hep/DDTECPhiAlgo.cc | 6 +- .../plugins/dd4hep/DDTECPhiAltAlgo.cc | 6 +- .../plugins/dd4hep/DDTIBLayerAlgo.cc | 119 ++++++------ .../plugins/dd4hep/DDTIDAxialCableAlgo.cc | 6 +- .../plugins/dd4hep/DDTIDModuleAlgo.cc | 113 ++++++------ .../plugins/dd4hep/DDTIDModulePosAlgo.cc | 44 ++--- .../plugins/dd4hep/DDTIDRingAlgo.cc | 8 +- .../plugins/dd4hep/DDTOBAxCableAlgo.cc | 46 ++--- .../plugins/dd4hep/DDTOBRadCableAlgo.cc | 76 ++++---- .../plugins/dd4hep/DDTOBRodAlgo.cc | 80 ++++---- .../plugins/dd4hep/DDTrackerLinear.cc | 6 +- .../plugins/dd4hep/DDTrackerPhiAlgo.cc | 10 +- .../plugins/dd4hep/DDTrackerPhiAltAlgo.cc | 6 +- .../plugins/dd4hep/DDTrackerRingAlgo.cc | 14 +- .../plugins/dd4hep/DDTrackerXYZPosAlgo.cc | 6 +- .../plugins/dd4hep/DDTrackerZPosAlgo.cc | 6 +- .../test/python/dd4hepRun3_cfg.py | 171 ++++++++++++++++++ 25 files changed, 529 insertions(+), 355 deletions(-) create mode 100644 Geometry/TrackerCommonData/test/python/dd4hepRun3_cfg.py diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc index 65876a8e3188d..4ea566aa7c510 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc @@ -192,6 +192,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext segments[segments.size() - 1], dd4hep::Position(0., 0., offsets[segments.size() - 1] - shift)); + edm::LogVerbatim("TrackerGeom") << "DDCutTubsFromPoints: " << solid.name() << " Union solid with " << segments.size() << " segments"; + // remove the common offset from the input, to get sth. aligned at z=0. float offset = -shift + (min_z + 0.5 * (max_z - min_z)); diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc index 033f1c6a203eb..4679d578c0ab3 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc @@ -14,7 +14,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h DDAlgoArguments args(ctxt, e); string parentName = args.parentName(); - LogDebug("PixelGeom") << "+++ Parsing arguments for Algorithm:" << args.name << " rParent:" << parentName; + edm::LogVerbatim("PixelGeom") << "+++ Parsing arguments for Algorithm:" << args.name << " rParent:" << parentName; string genMat = args.value("GeneralMaterial"); int number = args.value("Ladders"); double layerDz = args.value("LayerDz"); @@ -26,7 +26,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h double coolDist = args.value("CoolDist"); string coolMat = args.value("CoolMaterial"); string tubeMat = args.value("CoolTubeMaterial"); - LogDebug("PixelGeom") << "Parent " << parentName << " NameSpace " << ns.name() << "\n" + edm::LogVerbatim("PixelGeom") << "Parent " << parentName << " NameSpace " << ns.name() << "\n" << "\tLadders " << number << "\tGeneral Material " << genMat << "\tLength " << layerDz << "\tSensorEdge " << sensorEdge << "\tSpecification of Cooling Pieces:\n" << "\tLength " << coolDz << " Width " << coolWidth << " Side " << coolSide @@ -35,7 +35,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h vector ladder = args.value >("LadderName"); vector ladderWidth = args.value >("LadderWidth"); vector ladderThick = args.value >("LadderThick"); - LogDebug("PixelGeom") << "Full Ladder " << ladder[0] << " width/thickness " << ladderWidth[0] << ", " + edm::LogVerbatim("PixelGeom") << "Full Ladder " << ladder[0] << " width/thickness " << ladderWidth[0] << ", " << ladderThick[0] << "\tHalf Ladder " << ladder[1] << " width/thickness " << ladderWidth[1] << ", " << ladderThick[1]; @@ -48,38 +48,38 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h double rmin = (coolDist - 0.5 * (d1 + d2)) * cos(0.5 * dphi) - 0.5 * ladderThick[0]; double rmax = (coolDist + 0.5 * (d1 + d2)) * cos(0.5 * dphi) + 0.5 * ladderThick[0]; double rmxh = rmax - 0.5 * ladderThick[0] + ladderThick[1]; - LogDebug("PixelGeom") << "Rmin/Rmax " << rmin << ", " << rmax << " d1/d2 " << d1 << ", " << d2 << " x1/x2 " << x1 + edm::LogVerbatim("PixelGeom") << "Rmin/Rmax " << rmin << ", " << rmax << " d1/d2 " << d1 << ", " << d2 << " x1/x2 " << x1 << ", " << x2; double rtmi = rmin + 0.5 * ladderThick[0] - ladderThick[1]; double rtmx = sqrt(rmxh * rmxh + ladderWidth[1] * ladderWidth[1]); - Solid solid = ns.addSolid(idName, Tube(rtmi, rtmx, 0.5 * layerDz, 0, 2_pi)); - LogDebug("PixelGeom") << "IDname " << idName << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) + Solid solid = ns.addSolid(ns.prepend(idName), Tube(rtmi, rtmx, 0.5 * layerDz, 0, 2_pi)); + edm::LogVerbatim("PixelGeom") << "IDname " << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rtmi << " Rout " << rtmx << " ZHalf " << 0.5 * layerDz; - Volume layer = ns.addVolume(Volume(idName, solid, ns.material(genMat))); + Volume layer = ns.addVolume(Volume(solid.name(), solid, ns.material(genMat))); double rr = 0.5 * (rmax + rmin); double dr = 0.5 * (rmax - rmin); double h1 = 0.5 * coolSide * cos(0.5 * dphi); std::string name = idName + "CoolTube"; - solid = ns.addSolid(name, Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); - LogDebug("PixelGeom") << "Solid " << solid.name() << " Trap made of " << tubeMat << " of dimensions " << 0.5 * coolDz + solid = ns.addSolid(ns.prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); + edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << tubeMat << " of dimensions " << 0.5 * coolDz << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " << d2 << ", " << d1 << ", 0"; - Volume coolTube = ns.addVolume(Volume(name, solid, description.material(tubeMat))); + Volume coolTube = ns.addVolume(Volume(solid.name(), solid, description.material(tubeMat))); h1 -= coolThick; d1 -= coolThick; d2 -= coolThick; name = idName + "Coolant"; - solid = ns.addSolid(name, Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); - LogDebug("PixelGeom") << "Solid " << solid.name() << " Trap made of " << coolMat << " of dimensions " << 0.5 * coolDz + solid = ns.addSolid(ns.prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); + edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << coolMat << " of dimensions " << 0.5 * coolDz << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " << d2 << ", " << d1 << ", 0"; - Volume cool = ns.addVolume(Volume(name, solid, description.material(coolMat))); + Volume cool = ns.addVolume(Volume(solid.name(), solid, description.material(coolMat))); pv = coolTube.placeVolume(cool, 1); - LogDebug("PixelGeom") << "Cool " << cool.name() << " number 1 positioned in " << coolTube.name() + edm::LogVerbatim("PixelGeom") << "Cool " << cool.name() << " number 1 positioned in " << coolTube.name() << " at (0,0,0) with no rotation"; string ladderFull = ladder[0]; @@ -102,7 +102,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h rots = idName + std::to_string(copy); phix = phi - 90_deg; phiy = 90_deg + phix; - LogDebug("PixelGeom") << "Creating a new " + edm::LogVerbatim("PixelGeom") << "Creating a new " << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); @@ -111,7 +111,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot, tran)); if (!pv.isValid()) { } - LogDebug("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " + edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; iup = -1; @@ -120,14 +120,14 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h rots = idName + std::to_string(copy); phix = phi + 90_deg; phiy = 90_deg + phix; - LogDebug("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); //cpv.position(ladderHalf, layer, copy, tran, rot); pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot, tran)); if (!pv.isValid()) { } - LogDebug("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " + edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; } else { @@ -140,7 +140,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h else phix = phi + 90_deg; phiy = phix + 90._deg; - LogDebug("PixelGeom") << "DDPixBarLayerAlgo test: Creating a new " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerAlgo test: Creating a new " << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); @@ -149,7 +149,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h pv = layer.placeVolume(ladderFullVol, copy, Transform3D(rot, tran)); if (!pv.isValid()) { } - LogDebug("PixelGeom") << "test: " << ladderFullVol.name() << " number " << copy << " positioned in " + edm::LogVerbatim("PixelGeom") << "test: " << ladderFullVol.name() << " number " << copy << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; } @@ -160,17 +160,17 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h if (iup > 0) phix += 180_deg; phiy = phix + 90._deg; - LogDebug("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); pv = layer.placeVolume(coolTube, i + 1, Transform3D(rot, tran)); if (!pv.isValid()) { } - LogDebug("PixelGeom") << "coolTube: " << coolTube.name() << " number " << i + 1 << " positioned in " << layer.name() + edm::LogVerbatim("PixelGeom") << "coolTube: " << coolTube.name() << " number " << i + 1 << " positioned in " << layer.name() << " at " << tran << " with " << rot; } - LogDebug("PixelGeom") << "Layer: " << layer.name(); + edm::LogVerbatim("PixelGeom") << "Layer: " << layer.name(); return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc index d8dc3312562c9..9c1273625d487 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc @@ -35,13 +35,13 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { double ladderOffset = args.value("LadderOffset"); int outerFirst = args.value("OuterFirst"); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Parent " << parentName << " NameSpace " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Parent " << parentName << " NameSpace " << ns.objName(parentName) << "\n\tLadders " << number << "\tGeneral Material " << genMat << "\tLength " << layerDz << "\tSpecification of Cooling Pieces:\n" << "\tLength " << coolDz << "\tThickness of Shell " << coolThick << "\tRadial distance " << coolDist << "\tMaterials " << coolMat << ", " << tubeMat << std::endl; - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Full Ladder " << ladder << " width/thickness " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Full Ladder " << ladder << " width/thickness " << ladderWidth << ", " << ladderThick; double dphi = 2_pi / (double)number; @@ -52,27 +52,27 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { std::string name = ns.objName(parentName); - dd4hep::Solid solid = ns.addSolid(name, dd4hep::Tube(rtmi, rtmx, 0.5 * layerDz, 0., 2._pi)); + dd4hep::Solid solid = ns.addSolid(ns.prepend(name), dd4hep::Tube(rtmi, rtmx, 0.5 * layerDz, 0., 2._pi)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << ns.name() << " Tubs made of " << genMat + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << genMat << " from 0. to " << convertRadToDeg(2_pi) << " with Rin " << rtmi << " Rout " << rtmx << " ZHalf " << 0.5 * layerDz; dd4hep::Volume layer = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(genMat))); // Full Tubes - solid = ns.addSolid(name + "CoolTube", dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0., 2_pi)); + solid = ns.addSolid(ns.prepend(name + "CoolTube"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0., 2_pi)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " << 0.5 * coolDz; dd4hep::Volume coolTube = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(tubeMat))); // Half Tubes - solid = ns.addSolid(name + "CoolTubeHalf", dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0, 1_pi)); + solid = ns.addSolid(ns.prepend(name + "CoolTubeHalf"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0, 1_pi)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " << 0.5 * coolDz; @@ -81,9 +81,9 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { // Full Coolant name = ns.objName(parentName); - solid = ns.addSolid(name + "Coolant", dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 2_pi)); + solid = ns.addSolid(ns.prepend(name + "Coolant"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 2_pi)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick << " ZHalf " << 0.5 * coolDz; @@ -91,14 +91,14 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { coolTube.placeVolume(cool, 1, dd4hep::Transform3D(dd4hep::Rotation3D(), dd4hep::Position(0., 0., 0.))); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " << coolTube.name() << " at (0,0,0) with no rotation"; // Half Coolant - solid = ns.addSolid(name + "CoolantHalf", dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi)); + solid = ns.addSolid(ns.prepend(name + "CoolantHalf"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick << " ZHalf " << 0.5 * coolDz; @@ -106,7 +106,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { coolTubeHalf.placeVolume(coolHalf, 1, dd4hep::Transform3D(dd4hep::Rotation3D(), dd4hep::Position(0., 0., 0.))); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " << coolTube.name() << " at (0,0,0) with no rotation"; int copy = 1, iup = (-1) * outerFirst; int copyoffset = number + 2; @@ -146,7 +146,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { phiy = phix + 90._deg; - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; @@ -155,7 +155,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { // FixMe : Would need ns.vecStr layer.placeVolume(ns.volume(ladder), copy, dd4hep::Transform3D(rot, tran)); - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << ladder << " number " << copy << " positioned in " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << ladder << " number " << copy << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; @@ -170,7 +170,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { phiy = phix + 90._deg; - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; @@ -196,7 +196,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { copyoffset++; } - LogDebug("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << coolTube.name() << " number " << i + 1 + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << coolTube.name() << " number " << i + 1 << " positioned in " << layer.name() << " at " << tran << " with " << rot; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc index cc62ea472ea8e..76bba83f1ea68 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc @@ -51,14 +51,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Volume child = ns.volume(childName); - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) << ", " << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " << anchorR; for (int iBlade = 0; iBlade < nBlades; ++iBlade) { - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] << " zshift " << bladeZShift[iBlade]; } @@ -86,13 +86,13 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext auto irot = ctxt.rotations.find(ns.prepend(rotstr)); if (irot != ctxt.rotations.end()) { - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo test: Creating a new " + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo test: Creating a new " << "rotation: " << rotstr << "\t" << convertRadToDeg(thetx) << ", " << convertRadToDeg(phix) << ", " << convertRadToDeg(thety) << ", " << convertRadToDeg(phiy) << ", " << convertRadToDeg(thetz) << ", " << convertRadToDeg(phiz); - edm::LogVerbatim("TrackerGeom") << "Rotation Matrix (" << convertRadToDeg(phi) << ", " + edm::LogVerbatim("PixelGeom") << "Rotation Matrix (" << convertRadToDeg(phi) << ", " << convertRadToDeg(bladeAngle) << ", " << convertRadToDeg(bladeTilt) << ") " << cos(phi) * cos(bladeAngle) << ", " << (-sin(phi) * cos(bladeTilt) + cos(phi) * sin(bladeAngle) * sin(bladeTilt)) @@ -112,14 +112,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Position tran(xpos, ypos, zpos); pv = mother.placeVolume(child, copyNo, dd4hep::Transform3D(rot, tran)); - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo test: " << pv.name() << ": " << childName << " number " + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo test: " << pv.name() << ": " << childName << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rot; } copyNo++; } - edm::LogVerbatim("TrackerGeom") << "Finished...."; + edm::LogVerbatim("PixelGeom") << "Finished...."; return cms::s_executed; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc index 486e550951737..3821141b46748 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc @@ -35,6 +35,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext startCopyNo = args.find("StartCopyNo") ? args.value("StartCopyNo") : 0; nBlades = args.value("NumberOfBlades"); bladeAngle = args.value("BladeAngle"); + bladeTilt = -1. * args.value("BladeTilt"); zPlane = args.value("BladeCommonZ"); anchorR = args.value("AnchorRadius"); @@ -47,14 +48,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Volume child = ns.volume(childName); - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) << ", " << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " << anchorR; for (int iBlade = 0; iBlade < nBlades; ++iBlade) { - edm::LogVerbatim("TrackerGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] + edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] << " zshift " << bladeZShift[iBlade]; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc index 2c0e1b25ab434..fb5fabb142663 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc @@ -20,15 +20,15 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector coolInsert = args.value >("CoolInsert"); Volume mother = ns.volume(args.parentName()); - LogDebug("TECGeom") << "DDTECCoolAlgo debug: Parent " << mother.name() << " NameSpace " << ns.name() + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Parent " << mother.name() << " NameSpace " << ns.name() << " at radial Position " << rPosition; if (phiPosition.size() == coolInsert.size()) { for (int i = 0; i < (int)(phiPosition.size()); i++) { - LogDebug("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: " << coolInsert.at(i) << " at Phi " + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: " << coolInsert.at(i) << " at Phi " << convertRadToDeg(phiPosition.at(i)); } } else { - LogDebug("TECGeom") << "DDTECCoolAlgo ERROR: Number of inserts does not match the numer of PhiPositions!"; + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo ERROR: Number of inserts does not match the numer of PhiPositions!"; } int copyNo = startCopyNo; @@ -41,11 +41,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // place inserts Position tran(xpos, ypos, 0.0); mother.placeVolume(child, copyNo, tran); - LogDebug("TECGeom") << "DDTECCoolAlgo test " << child.name() << "[" << copyNo << "] positioned in " << mother.name() + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo test " << child.name() << "[" << copyNo << "] positioned in " << mother.name() << " at " << tran << " phi " << convertRadToDeg(phiPosition.at(i)) << " r " << rPosition; copyNo++; } - LogDebug("TECGeom") << "DDTECCoolAlgo Finished...."; + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo Finished...."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECModuleAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECModuleAlgo.cc index 3d5c3285375be..7cf8e84d0d268 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECModuleAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECModuleAlgo.cc @@ -197,11 +197,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, if (isStereo) bl1 = 0.5 * sideFrameLWidthLow; solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid: " << name << " " << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz << ", " << thet << ", 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume sideFrameLeft(name, solid, ns.material(sideFrameMat)); + Volume sideFrameLeft(ns.prepend(name), solid, ns.material(sideFrameMat)); ns.addVolumeNS(sideFrameLeft); //translate double xpos = -0.5 * topFrameBotWidth + bl2 + tan(fabs(thet)) * dz; @@ -235,11 +235,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, if (isStereo) bl1 = 0.5 * sideFrameRWidthLow; solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz << ", " << thet << ", 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume sideFrameRight(name, solid, ns.material(sideFrameMat)); + Volume sideFrameRight(ns.prepend(name), solid, ns.material(sideFrameMat)); ns.addVolumeNS(sideFrameRight); //translate xpos = 0.5 * topFrameBotWidth - bl2 - tan(fabs(thet)) * dz; @@ -275,10 +275,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // ^-- this calculates the lower left angel of the tipped trapezoid, which is the SideFframe... solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << siFrSuppBoxMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume siFrSuppBox(name, solid, matter); + Volume siFrSuppBox(ns.prepend(name), solid, matter); ns.addVolumeNS(siFrSuppBox); //translate xpos = 0.5 * topFrameBotWidth - sideFrameRWidth - bl1 - siFrSuppBoxYPos[i] * tan(fabs(thet)); @@ -311,10 +312,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double dy = 0.5 * hybridThick; dz = 0.5 * hybridHeight; solid = Box(dx, dy, dz); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << hybridMat << " of dimensions " << dx << ", " << dy << ", " << dz; - Volume hybrid(name, solid, ns.material(hybridMat)); + Volume hybrid(ns.prepend(name), solid, ns.material(hybridMat)); ns.addVolumeNS(hybrid); ypos = hybridZ; @@ -335,7 +336,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, h1 = 0.5 * waferThick; dz = 0.5 * fullHeight; solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << waferMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; @@ -364,11 +365,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, bl1 = tmp; } solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << activeMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0"; - Volume active(name, solid, ns.material(activeMat)); + Volume active(ns.prepend(name), solid, ns.material(activeMat)); ns.addVolumeNS(active); wafer.placeVolume( @@ -392,11 +393,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, bl1 = tmp; } solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0); - ns.addSolidNS(name, solid); + ns.addSolidNS(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << inactiveMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0"; - Volume inactive(name, solid, ns.material(inactiveMat)); + Volume inactive(ns.prepend(name), solid, ns.material(inactiveMat)); ns.addVolumeNS(inactive); ypos = inactivePos - 0.5 * activeHeight; @@ -454,11 +455,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); - ns.addSolid(name, solid); + ns.addSolid(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << topFrameMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume topFrame(name, solid, ns.material(topFrameMat)); + Volume topFrame(ns.prepend(name), solid, ns.material(topFrameMat)); ns.addVolumeNS(topFrame); if (isStereo) { @@ -471,7 +472,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, thet = atan((bl1 - bl2) / (2. * dz)); solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); - ns.addSolid(name, solid); + ns.addSolid(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << topFrameMat << " of dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; @@ -507,10 +508,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dz = 0.5 * siReenforceHeight[i]; bl1 = bl2 = 0.5 * siReenforceWidth[i]; solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); + ns.addSolid(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << matter.name() << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume siReenforce(name, solid, matter); + Volume siReenforce(ns.prepend(name), solid, matter); ns.addVolumeNS(siReenforce); //translate xpos = 0; @@ -542,18 +544,20 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, h1 = 0.5 * bridgeThick; dz = 0.5 * bridgeHeight; solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); + ns.addSolid(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << bridgeMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume bridge(name, solid, ns.material(bridgeMat)); + Volume bridge(ns.prepend(name), solid, ns.material(bridgeMat)); ns.addVolumeNS(bridge); name = idName + "BridgeGap"; bl1 = 0.5 * bridgeSep; solid = Box(bl1, h1, dz); + ns.addSolid(ns.prepend(name), solid); edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << genMat << " of dimensions " << bl1 << ", " << h1 << ", " << dz; - Volume bridgeGap(name, solid, ns.material(genMat)); + Volume bridgeGap(ns.prepend(name), solid, ns.material(genMat)); ns.addVolumeNS(bridgeGap); /* PlacedVolume pv = */ bridge.placeVolume(bridgeGap, 1); edm::LogVerbatim("TECGeom") << "Solid: " << bridgeGap.name() << " number 1 positioned in " << bridge.name() diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc index dbb0849494589..08c21b72917bc 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc @@ -20,8 +20,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Volume child = ns.volume(args.value("ChildName")); Volume mother = ns.volume(args.parentName()); - LogDebug("TECGeom") << "Parent " << mother.name() << " Child " << child.name() << " NameSpace " << ns.name(); - LogDebug("TECGeom") << "Height of the Hybrid " << optoHeight << " and Width " << optoWidth << "Rpos " << rpos + edm::LogVerbatim("TECGeom") << "Parent " << mother.name() << " Child " << child.name() << " NameSpace " << ns.name(); + edm::LogVerbatim("TECGeom") << "Height of the Hybrid " << optoHeight << " and Width " << optoWidth << "Rpos " << rpos << " Zpos " << zpos << " StartCopyNo " << startCopyNo << " Number " << angles.size(); // given r positions are for the lower left corner @@ -45,18 +45,18 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rotation = ns.rotation(ns.prepend(rotstr)); } else { double theta = 90._deg; - LogDebug("TECGeom") << "test: Creating a new " + edm::LogVerbatim("TECGeom") << "test: Creating a new " << "rotation: " << rotstr << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.); } } mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - LogDebug("TECGeom") << "test " << child.name() << " number " << copyNo << " positioned in " << mother.name() + edm::LogVerbatim("TECGeom") << "test " << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rotation; copyNo++; } - LogDebug("TECGeom") << "<<== End of DDTECOptoHybAlgo construction ..."; + edm::LogVerbatim("TECGeom") << "<<== End of DDTECOptoHybAlgo construction ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc index 755a242d1960d..c9ce7dc29f9a6 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc @@ -21,12 +21,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int startCopyNo = args.find("StartCopyNo") ? args.value("StartCopyNo") : 1; //Start copy number int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number - LogDebug("TECGeom") << "debug: Parameters for " + edm::LogVerbatim("TECGeom") << "debug: Parameters for " << "positioning--" << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo; - LogDebug("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); if (number > 0) { double theta = 90._deg; @@ -37,7 +37,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0, 0); Position tran(0., 0., (i % 2 == 0) ? zIn : zOut); /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - LogDebug("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() + edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc index f917bfda3a6b1..f093dacbc2cad 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc @@ -22,12 +22,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int startCopyNo = args.find("StartCopyNo") ? args.value("StartCopyNo") : 1; //Start copy number int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number - LogDebug("TECGeom") << "debug: Parameters for " + edm::LogVerbatim("TECGeom") << "debug: Parameters for " << "positioning--" << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo; - LogDebug("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); if (number > 0) { double theta = 90._deg; @@ -38,7 +38,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, 0e0, 0e0, theta, phiz); Position tran(radius * cos(phiz), radius * sin(phiz), (i % 2 == 0) ? zIn : zOut); mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - LogDebug("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() + edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc index 77eb4d493534c..e37b9aa95ae27 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc @@ -93,73 +93,73 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex << " positioned: " << pvl.motherVol()->GetName() << " " << pvl.position(); }; - LogDebug("TIBGeom") << "Parent " << mother << " NameSpace " << ns.name() << " General Material " << genMat; - LogDebug("TIBGeom") << "Lower layer Radius " << radiusLo << " Number " << stringsLo << " String " << detectorLo; - LogDebug("TIBGeom") << "Upper layer Radius " << radiusUp << " Number " << stringsUp << " String " << detectorUp; - LogDebug("TIBGeom") << "Cylinder Material/thickness " << cylinderMat << " " << cylinderT << " Rib Material " << ribMat + edm::LogVerbatim("TIBGeom") << "Parent " << mother << " NameSpace " << ns.name() << " General Material " << genMat; + edm::LogVerbatim("TIBGeom") << "Lower layer Radius " << radiusLo << " Number " << stringsLo << " String " << detectorLo; + edm::LogVerbatim("TIBGeom") << "Upper layer Radius " << radiusUp << " Number " << stringsUp << " String " << detectorUp; + edm::LogVerbatim("TIBGeom") << "Cylinder Material/thickness " << cylinderMat << " " << cylinderT << " Rib Material " << ribMat << " at " << ribW.size() << " positions with width/phi"; for (unsigned int i = 0; i < ribW.size(); i++) { - LogDebug("TIBGeom") << "\tribW[" << i << "] = " << ribW[i] << "\tribPhi[" << i + edm::LogVerbatim("TIBGeom") << "\tribW[" << i << "] = " << ribW[i] << "\tribPhi[" << i << "] = " << convertRadToDeg(ribPhi[i]); } - LogDebug("TIBGeom") << "DOHM Primary " + edm::LogVerbatim("TIBGeom") << "DOHM Primary " << " Material " << dohmPrimMaterial << " Length " << dohmPrimL; - LogDebug("TIBGeom") << "DOHM Aux " + edm::LogVerbatim("TIBGeom") << "DOHM Aux " << " Material " << dohmAuxMaterial << " Length " << dohmAuxL; for (double i : dohmListFW) { if (i > 0.) - LogDebug("TIBGeom") << "DOHM Primary at FW Position " << i; + edm::LogVerbatim("TIBGeom") << "DOHM Primary at FW Position " << i; if (i < 0.) - LogDebug("TIBGeom") << "DOHM Aux at FW Position " << -i; + edm::LogVerbatim("TIBGeom") << "DOHM Aux at FW Position " << -i; } for (double i : dohmListBW) { if (i > 0.) - LogDebug("TIBGeom") << "DOHM Primary at BW Position " << i; + edm::LogVerbatim("TIBGeom") << "DOHM Primary at BW Position " << i; if (i < 0.) - LogDebug("TIBGeom") << "DOHM Aux at BW Position " << -i; + edm::LogVerbatim("TIBGeom") << "DOHM Aux at BW Position " << -i; } - LogDebug("TIBGeom") << "FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz << ", " << fwIntPillarDPhi; + edm::LogVerbatim("TIBGeom") << "FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz << ", " << fwIntPillarDPhi; for (unsigned int i = 0; i < fwIntPillarZ.size(); i++) { if (fwIntPillarPhi[i] > 0.) { - LogDebug("TIBGeom") << " at positions [z, phi] " << fwIntPillarZ[i] << " " << fwIntPillarPhi[i]; + edm::LogVerbatim("TIBGeom") << " at positions [z, phi] " << fwIntPillarZ[i] << " " << fwIntPillarPhi[i]; } } - LogDebug("TIBGeom") << "BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz << ", " << bwIntPillarDPhi; + edm::LogVerbatim("TIBGeom") << "BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz << ", " << bwIntPillarDPhi; for (unsigned int i = 0; i < bwIntPillarZ.size(); i++) { if (bwIntPillarPhi[i] > 0.) { - LogDebug("TIBGeom") << " at positions [z, phi] " << bwIntPillarZ[i] << " " << bwIntPillarPhi[i]; + edm::LogVerbatim("TIBGeom") << " at positions [z, phi] " << bwIntPillarZ[i] << " " << bwIntPillarPhi[i]; } } - LogDebug("TIBGeom") << "FW External Pillar [Dz, DPhi] " << fwExtPillarDz << ", " << fwExtPillarDPhi; + edm::LogVerbatim("TIBGeom") << "FW External Pillar [Dz, DPhi] " << fwExtPillarDz << ", " << fwExtPillarDPhi; for (unsigned int i = 0; i < fwExtPillarZ.size(); i++) { if (fwExtPillarPhi[i] > 0.) { - LogDebug("TIBGeom") << " at positions [z, phi] " << fwExtPillarZ[i] << " " << fwExtPillarPhi[i]; + edm::LogVerbatim("TIBGeom") << " at positions [z, phi] " << fwExtPillarZ[i] << " " << fwExtPillarPhi[i]; } } - LogDebug("TIBGeom") << "BW External Pillar [Dz, DPhi] " << bwExtPillarDz << ", " << bwExtPillarDPhi; + edm::LogVerbatim("TIBGeom") << "BW External Pillar [Dz, DPhi] " << bwExtPillarDz << ", " << bwExtPillarDPhi; for (unsigned int i = 0; i < bwExtPillarZ.size(); i++) { if (bwExtPillarPhi[i] > 0.) { - LogDebug("TIBGeom") << " at positions [z, phi] " << bwExtPillarZ[i] << " " << bwExtPillarPhi[i]; + edm::LogVerbatim("TIBGeom") << " at positions [z, phi] " << bwExtPillarZ[i] << " " << bwExtPillarPhi[i]; } } const string& idName = mother; double rmin = MFRingInR; double rmax = MFRingOutR; - Solid solid = ns.addSolidNS(idName, Tube(rmin, rmax, 0.5 * layerL)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) + Solid solid = ns.addSolidNS(ns.prepend(idName), Tube(rmin, rmax, 0.5 * layerL)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rmin << " Rout " << rmax << " ZHalf " << 0.5 * layerL; - Volume layer = ns.addVolumeNS(Volume(idName, solid, ns.material(genMat))); + Volume layer = ns.addVolumeNS(Volume(ns.prepend(idName), solid, ns.material(genMat))); //Internal layer first double rin = rmin + MFRingT; // double rout = 0.5*(radiusLo+radiusUp-cylinderT); double rout = cylinderInR; string name = idName + "Down"; - solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; - Volume layerIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); + Volume layerIn = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = layer.placeVolume(layerIn, 1); LogPosition(pv); @@ -180,10 +180,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = cylinderInR + cylinderT; rout = rmax - MFRingT; name = idName + "Up"; - solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; - Volume layerOut = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); + Volume layerOut = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = layer.placeVolume(layerOut, 1); LogPosition(pv); @@ -208,10 +208,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = cylinderInR; rout = cylinderInR + cylinderT; name = idName + "Cylinder"; - solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << cylinderMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << cylinderMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; - Volume cylinder = ns.addVolumeNS(Volume(name, solid, ns.material(cylinderMat))); + Volume cylinder = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(cylinderMat))); pv = layer.placeVolume(cylinder, 1); LogPosition(pv); @@ -221,10 +221,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin += supportT; rout -= supportT; name = idName + "CylinderIn"; - solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; - Volume cylinderIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); + Volume cylinderIn = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = cylinder.placeVolume(cylinderIn, 1); LogPosition(pv); @@ -232,10 +232,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex // Filler Rings // name = idName + "Filler"; - solid = ns.addSolidNS(name, Tube(rin, rout, fillerDz)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << fillerMat << " from " << 0. << " to " + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, fillerDz)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << fillerMat << " from " << 0. << " to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << fillerDz; - Volume cylinderFiller = ns.addVolumeNS(Volume(name, solid, ns.material(fillerMat))); + Volume cylinderFiller = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(fillerMat))); pv = cylinderIn.placeVolume(cylinderFiller, 1, Position(0.0, 0.0, 0.5 * layerL - fillerDz)); LogPosition(pv); @@ -252,11 +252,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex double dz = 0.5 * layerL - 2. * fillerDz; double _rmi = std::min(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); double _rma = std::max(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); - solid = ns.addSolidNS(name, Tube(_rmi, _rma, dz, -0.5 * width, 0.5 * width)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width) + solid = ns.addSolidNS(ns.prepend(name), Tube(_rmi, _rma, dz, -0.5 * width, 0.5 * width)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width) << " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5 * dd4hep::mm << " Rout " << rout - 0.5 * dd4hep::mm << " ZHalf " << dz; - Volume cylinderRib = ns.addVolumeNS(Volume(name, solid, matrib)); + Volume cylinderRib = ns.addVolumeNS(Volume(ns.prepend(name), solid, matrib)); double phix = ribPhi[i]; double theta = 90_deg; double phiy = phix + 90._deg; @@ -273,11 +273,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = MFRingInR; rout = rin + MFRingT; name = idName + "InnerMFRing"; - solid = ns.addSolidNS(name, Tube(rin, rout, MFRingDz)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << MFIntRingMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, MFRingDz)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFIntRingMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz; - Volume inmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFIntRingMat))); + Volume inmfr = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(MFIntRingMat))); pv = layer.placeVolume(inmfr, 1, Position(0.0, 0.0, -0.5 * layerL + MFRingDz)); LogPosition(pv); @@ -289,11 +289,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rout = MFRingOutR; rin = rout - MFRingT; name = idName + "OuterMFRing"; - solid = ns.addSolidNS(name, Tube(rin, rout, MFRingDz)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << MFExtRingMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, MFRingDz)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFExtRingMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz; - Volume outmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFExtRingMat))); + Volume outmfr = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(MFExtRingMat))); pv = layer.placeVolume(outmfr, 1, Position(0.0, 0.0, -0.5 * layerL + MFRingDz)); LogPosition(pv); pv = layer.placeVolume(outmfr, 2, Position(0.0, 0.0, +0.5 * layerL - MFRingDz)); @@ -308,12 +308,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = centRing1par[2]; rout = centRing1par[3]; name = idName + "CentRing1"; - solid = ns.addSolidNS(name, Tube(rin, rout, centDz)); + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, centDz)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; - Volume cent1 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat))); + Volume cent1 = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(centMat))); pv = layer.placeVolume(cent1, 1, Position(0.0, 0.0, centZ)); LogPosition(pv); // Ring 2 @@ -322,11 +322,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = centRing2par[2]; rout = centRing2par[3]; name = idName + "CentRing2"; - solid = ns.addSolidNS(name, Tube(rin, rout, centDz)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, centDz)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; - Volume cent2 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat))); + Volume cent2 = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(centMat))); pv = layer.placeVolume(cent2, 1, Position(0e0, 0e0, centZ)); LogPosition(pv); @@ -341,9 +341,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF); double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz; - solid = ns.addSolidNS( - name, Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff)); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << dohmCarrierMaterial << " from " << dohmCarrierPhiOff + solid = ns.addSolidNS(ns.prepend(name), Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << dohmCarrierMaterial << " from " << dohmCarrierPhiOff << " to " << 180._deg - dohmCarrierPhiOff << " with Rin " << dohmCarrierRin << " Rout " << MFRingOutR << " ZHalf " << dohmCarrierDz; @@ -367,7 +366,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex switch (j) { case 0: name = idName + "DOHMCarrierFW"; - dohmCarrier = ns.addVolumeNS(Volume(name, solid, ns.material(dohmCarrierMaterial))); + dohmCarrier = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(dohmCarrierMaterial))); dohmList = dohmListFW; tran = Position(0., 0., dohmCarrierZ); rotstr = idName + "FwUp"; @@ -387,7 +386,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex break; case 2: name = idName + "DOHMCarrierBW"; - dohmCarrier = ns.addVolumeNS(Volume(name, solid, ns.material(dohmCarrierMaterial))); + dohmCarrier = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(dohmCarrierMaterial))); dohmList = dohmListBW; tran = Position(0., 0., -dohmCarrierZ); rotstr = idName + "BwUp"; @@ -490,9 +489,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex break; } - solid = ns.addSolidNS(name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, pillarDPhi)); - Volume Pillar = ns.addVolumeNS(Volume(name, solid, ns.material(pillarMaterial))); - LogDebug("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi << " to " + solid = ns.addSolidNS(ns.prepend(name), Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, pillarDPhi)); + Volume Pillar = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(pillarMaterial))); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi << " to " << pillarDPhi << " with Rin " << pillarRin << " Rout " << pillarRout << " ZHalf " << pillarDz; Position pillarTran; Rotation3D pillarRota; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDAxialCableAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDAxialCableAlgo.cc index 07fdc959f2695..daf7c3ab9c92f 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDAxialCableAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDAxialCableAlgo.cc @@ -107,7 +107,7 @@ namespace { std::string name = childName + std::to_string(k); - Solid solid = ns.addSolid(name, Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ)); + Solid solid = ns.addSolid(ns.prepend(name), Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ)); LogVerbatim("TIDGeom") << "DDTIDAxialCableAlgo test: " << solid.name() << " Polycone made of " << matIn << " from " << convertRadToDeg(-0.5 * width) << " to " << convertRadToDeg(0.5 * width) @@ -142,7 +142,7 @@ namespace { std::string name = childName + std::to_string(zposWheel.size()); - Solid solid = ns.addSolid(name, Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ)); + Solid solid = ns.addSolid(ns.prepend(name), Polycone(-0.5 * width, width, pconRmin, pconRmax, pconZ)); LogVerbatim("TIDGeom") << "DDTIDAxialCableAlgo test: " << solid.name() << " Polycone made of " << matIn << " from " << convertRadToDeg(-0.5 * width) << " to " << convertRadToDeg(0.5 * width) << " and with " @@ -157,7 +157,7 @@ namespace { // Cable in the outer part name = childName + std::to_string(zposWheel.size() + 1); r = rTop - r; - solid = ns.addSolid(name, Tube(r, rTop, 0.5 * (zEnd - zBend), -0.5 * width, width)); + solid = ns.addSolid(ns.prepend(name), Tube(r, rTop, 0.5 * (zEnd - zBend), -0.5 * width, width)); LogVerbatim("TIDGeom") << "DDTIDAxialCableAlgo test: " << solid.name() << " Tubs made of " << matOut << " from " << convertRadToDeg(-0.5 * width) << " to " << convertRadToDeg(0.5 * width) << " with Rin " diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc index 7c89675fac138..93c9ce8f4060b 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc @@ -73,41 +73,41 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double coolThick = args.dble("CoolInsertThick"); // thickness double coolWidth = args.dble("CoolInsertWidth"); // width - LogDebug("TIDGeom") << "Parent " << mother << " General Material " << genMat << " Detector Planes " << detectorN; + edm::LogVerbatim("TIDGeom") << "Parent " << mother << " General Material " << genMat << " Detector Planes " << detectorN; - LogDebug("TIDGeom") << "ModuleThick " << moduleThick << " Detector Tilt " << convertRadToDeg(detTilt) << " Height " + edm::LogVerbatim("TIDGeom") << "ModuleThick " << moduleThick << " Detector Tilt " << convertRadToDeg(detTilt) << " Height " << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) " << dlBottom << " dl(Hybrid) " << dlHybrid << " doComponents " << doComponents; - LogDebug("TIDGeom") << "" << boxFrameName << " Material " << boxFrameMat << " Thickness " << boxFrameThick + edm::LogVerbatim("TIDGeom") << "" << boxFrameName << " Material " << boxFrameMat << " Thickness " << boxFrameThick << " width " << boxFrameWidth << " height " << boxFrameHeight << " Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << sideFrameName[i] << " Material " << sideFrameMat << " Width " << sideFrameWidth + edm::LogVerbatim("TIDGeom") << sideFrameName[i] << " Material " << sideFrameMat << " Width " << sideFrameWidth << " Thickness " << sideFrameThick << " Overlap " << sideFrameOver << " Hole " << holeFrameName[i]; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << kaptonName[i] << " Material " << kaptonMat << " Thickness " << kaptonThick << " Overlap " + edm::LogVerbatim("TIDGeom") << kaptonName[i] << " Material " << kaptonMat << " Thickness " << kaptonThick << " Overlap " << kaptonOver << " Hole " << holeKaptonName[i]; - LogDebug("TIDGeom") << "Wafer Material " << waferMat << " Side Width Top " << sideWidthTop << " Side Width Bottom " + edm::LogVerbatim("TIDGeom") << "Wafer Material " << waferMat << " Side Width Top " << sideWidthTop << " Side Width Bottom " << sideWidthBottom; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\twaferName[" << i << "] = " << waferName[i]; + edm::LogVerbatim("TIDGeom") << "\twaferName[" << i << "] = " << waferName[i]; - LogDebug("TIDGeom") << "Active Material " << activeMat << " Height " << activeHeight << " rotated by " << activeRot; + edm::LogVerbatim("TIDGeom") << "Active Material " << activeMat << " Height " << activeHeight << " rotated by " << activeRot; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << " translated by (0," << -0.5 * backplaneThick[i] << ",0)\tactiveName[" << i + edm::LogVerbatim("TIDGeom") << " translated by (0," << -0.5 * backplaneThick[i] << ",0)\tactiveName[" << i << "] = " << activeName[i] << " of thickness " << waferThick[i] - backplaneThick[i]; - LogDebug("TIDGeom") << "" << hybridName << " Material " << hybridMat << " Height " << hybridHeight << " Width " + edm::LogVerbatim("TIDGeom") << "" << hybridName << " Material " << hybridMat << " Height " << hybridHeight << " Width " << hybridWidth << " Thickness " << hybridThick; - LogDebug("TIDGeom") << "Pitch Adapter Material " << pitchMat << " Height " << pitchHeight << " Thickness " + edm::LogVerbatim("TIDGeom") << "Pitch Adapter Material " << pitchMat << " Height " << pitchHeight << " Thickness " << pitchThick; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\tpitchName[" << i << "] = " << pitchName[i]; - LogDebug("TIDGeom") << "Cool Element Material " << coolMat << " Height " << coolHeight << " Thickness " << coolThick + edm::LogVerbatim("TIDGeom") << "\tpitchName[" << i << "] = " << pitchName[i]; + edm::LogVerbatim("TIDGeom") << "Cool Element Material " << coolMat << " Height " << coolHeight << " Thickness " << coolThick << " Width " << coolWidth; string name = mother; @@ -150,9 +150,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double dx, dy; double dz = 0.5 * (boxFrameHeight + sideFrameHeight); - Solid solid = ns.addSolidNS(name, Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); - /* Volume module = */ ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 + Solid solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); + /* Volume module = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; if (doComponents) { @@ -161,30 +161,30 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dx = 0.5 * boxFrameWidth; dy = 0.5 * boxFrameThick; dz = 0.5 * boxFrameHeight; - solid = ns.addSolidNS(name, Box(dx, dy, dz)); - LogDebug("TIDGeom") << solid.name() << " Box made of " << boxFrameMat << " of dimensions " << dx << ", " << dy + solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << boxFrameMat << " of dimensions " << dx << ", " << dy << ", " << dz; - /* Volume boxFrame = */ ns.addVolumeNS(Volume(name, solid, ns.material(boxFrameMat))); + /* Volume boxFrame = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(boxFrameMat))); // Hybrid name = hybridName; dx = 0.5 * hybridWidth; dy = 0.5 * hybridThick; dz = 0.5 * hybridHeight; - solid = ns.addSolidNS(name, Box(dx, dy, dz)); - LogDebug("TIDGeom") << solid.name() << " Box made of " << hybridMat << " of dimensions " << dx << ", " << dy << ", " + solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << hybridMat << " of dimensions " << dx << ", " << dy << ", " << dz; - /* Volume hybrid = */ ns.addVolumeNS(Volume(name, solid, ns.material(hybridMat))); + /* Volume hybrid = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(hybridMat))); // Cool Insert name = coolName; dx = 0.5 * coolWidth; dy = 0.5 * coolThick; dz = 0.5 * coolHeight; - solid = ns.addSolidNS(name, Box(dx, dy, dz)); - LogDebug("TIDGeom") << solid.name() << " Box made of " << coolMat << " of dimensions " << dx << ", " << dy << ", " + solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << coolMat << " of dimensions " << dx << ", " << dy << ", " << dz; - /* Volume cool = */ ns.addVolumeNS(Volume(name, solid, ns.material(coolMat))); + /* Volume cool = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(coolMat))); // Loop over detectors to be placed for (int k = 0; k < detectorN; k++) { @@ -202,11 +202,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } h1 = 0.5 * sideFrameThick; dz = 0.5 * sideFrameHeight; - solid = ns.addSolidNS(name, Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz << ", 0, 0, " + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; - Volume sideFrame = ns.addVolumeNS(Volume(name, solid, ns.material(sideFrameMat))); + Volume sideFrame = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(sideFrameMat))); std::string rotstr, rotns; Rotation3D rot; @@ -225,14 +225,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, zpos = bottomFrameHeight + 0.5 * dz - 0.5 * sideFrameHeight; } dz /= 2.; - solid = ns.addSolidNS(name, Trap(dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; - Volume holeFrame = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); + Volume holeFrame = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); rot = ns.rotation(holeFrameRot[k]); sideFrame.placeVolume(holeFrame, 1, Transform3D(rot, Position(0e0, 0e0, zpos))); // copyNr=1 - LogDebug("TIDGeom") << holeFrame.name() << " number 1 positioned in " << sideFrame.name() << " at (0,0," << zpos + edm::LogVerbatim("TIDGeom") << holeFrame.name() << " number 1 positioned in " << sideFrame.name() << " at (0,0," << zpos << ") with no rotation"; // Kapton circuit @@ -264,8 +264,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // For the stereo create the uncut solid, the solid to be removed and then the subtraction solid if (k == 1) { // Uncut solid - Solid solidUncut = - ns.addSolidNS(kaptonName[k] + "Uncut", Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); + Solid solidUncut = ns.addSolidNS(ns.prepend(kaptonName[k] + "Uncut"), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); // Piece to be cut dz = (dlHybrid > dlTop) ? 0.5 * dlTop : 0.5 * dlBottom; @@ -273,23 +272,21 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, bbl1 = fabs(dz * sin(detTilt)); bbl2 = bbl1 * 0.000001; double thet = atan((bbl1 - bbl2) / (2 * dz)); - Solid solidCut = - ns.addSolidNS(kaptonName[k] + "Cut", Trap(dz, thet, 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); + Solid solidCut = ns.addSolidNS(ns.prepend(kaptonName[k] + "Cut"), Trap(dz, thet, 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); // Subtraction Solid name = kaptonName[k]; rot = ns.rotation("tidmodpar:9PYX"); xpos = -0.5 * fullHeight * sin(detTilt); zpos = 0.5 * kaptonHeight - bbl2; - solid = - ns.addSolidNS(name, SubtractionSolid(solidUncut, solidCut, Transform3D(rot, Position(xpos, 0.0, zpos)))); + solid = ns.addSolidNS(ns.prepend(name), SubtractionSolid(solidUncut, solidCut, Transform3D(rot, Position(xpos, 0.0, zpos)))); } else { name = kaptonName[k]; - solid = ns.addSolidNS(name, Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); } - Volume kapton = ns.addVolumeNS(Volume(name, solid, ns.material(kaptonMat))); - LogDebug("TIDGeom") << solid.name() << " SUBTRACTION SOLID Trap made of " << kaptonMat << " of dimensions " << dz + Volume kapton = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(kaptonMat))); + edm::LogVerbatim("TIDGeom") << solid.name() << " SUBTRACTION SOLID Trap made of " << kaptonMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; @@ -313,14 +310,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, zpos = -0.5 * (kaptonHeight - kaptonExtraHeight - dz); } dz /= 2.; - solid = ns.addSolidNS(name, Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; - Volume holeKapton = ns.addVolumeNS(Volume(name, solid, ns.material(genMat))); + Volume holeKapton = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); rot = ns.rotation(holeKaptonRot[k]); kapton.placeVolume(holeKapton, 1, Transform3D(rot, Position(xpos, 0.0, zpos))); - LogDebug("TIDGeom") << holeKapton.name() << " number 1 positioned in " << kapton.name() << " at (0,0," << zpos + edm::LogVerbatim("TIDGeom") << holeKapton.name() << " number 1 positioned in " << kapton.name() << " at (0,0," << zpos << ") with no rotation"; // Wafer @@ -334,10 +331,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } h1 = 0.5 * waferThick[k]; dz = 0.5 * fullHeight; - solid = ns.addSolidNS(name, Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << waferMat << " of dimensions " << dz << ", 0, 0, " << h1 + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << waferMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; - Volume wafer = ns.addVolumeNS(Volume(name, solid, ns.material(waferMat))); + Volume wafer = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(waferMat))); // Active name = activeName[k]; @@ -350,14 +347,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } dz = 0.5 * (waferThick[k] - backplaneThick[k]); // inactive backplane h1 = 0.5 * activeHeight; - solid = ns.addSolidNS(name, Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << activeMat << " of dimensions " << dz << ", 0, 0, " + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << activeMat << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0"; - Volume active = ns.addVolumeNS(Volume(name, solid, ns.material(activeMat))); + Volume active = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(activeMat))); rot = ns.rotation(activeRot); Position tran(0.0, -0.5 * backplaneThick[k], 0.0); // from the definition of the wafer local axes wafer.placeVolume(active, 1, Transform3D(rot, tran)); // inactive backplane copyNr=1 - LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " << wafer.name() + edm::LogVerbatim("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " << wafer.name() << " at " << tran << " with " << rot; //Pitch Adapter @@ -371,8 +368,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dx = dz; dy = 0.5 * pitchThick; dz = 0.5 * pitchHeight; - solid = ns.addSolidNS(name, Box(dx, dy, dz)); - LogDebug("TIDGeom") << solid.name() << " Box made of " << pitchMat << " of dimensions" + solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << pitchMat << " of dimensions" << " " << dx << ", " << dy << ", " << dz; } else { h1 = 0.5 * pitchThick; @@ -384,15 +381,15 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, bl2 -= pitchStereoTol; double thet = atan((bl1 - bl2) / (2. * dz)); - solid = ns.addSolidNS(name, Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); - LogDebug("TIDGeom") << solid.name() << " Trap made of " << pitchMat << " of " + solid = ns.addSolidNS(ns.prepend(name), Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << pitchMat << " of " << "dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; } - /* Volume pa = */ ns.addVolumeNS(Volume(name, solid, ns.material(pitchMat))); + /* Volume pa = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(pitchMat))); } } - LogDebug("TIDGeom") << "<<== End of DDTIDModuleAlgo construction ..."; + edm::LogVerbatim("TIDGeom") << "<<== End of DDTIDModuleAlgo construction ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc index 90930bfec9a77..eb63799eb19ed 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc @@ -65,27 +65,27 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double sidSpacersWidth = args.dble("SideSpacersWidth"); // width double sidSpacersRadShift = args.dble("SideSpacersShift"); // - LogDebug("TIDGeom") << "Parent " << parentName << " Detector Planes " << detectorN; - LogDebug("TIDGeom") << "Detector Tilt " << convertRadToDeg(detTilt) << " Height " << fullHeight << " dl(Top) " + edm::LogVerbatim("TIDGeom") << "Parent " << parentName << " Detector Planes " << detectorN; + edm::LogVerbatim("TIDGeom") << "Detector Tilt " << convertRadToDeg(detTilt) << " Height " << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) " << dlBottom << " dl(Hybrid) " << dlHybrid; - LogDebug("TIDGeom") << boxFrameName << " positioned at Z"; + edm::LogVerbatim("TIDGeom") << boxFrameName << " positioned at Z"; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\tboxFrameZ[" << i << "] = " << boxFrameZ[i]; - LogDebug("TIDGeom") << "\t Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver; + edm::LogVerbatim("TIDGeom") << "\tboxFrameZ[" << i << "] = " << boxFrameZ[i]; + edm::LogVerbatim("TIDGeom") << "\t Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\tsideFrame[" << i << "] = " << sideFrameName[i] << " positioned at Z " << sideFrameZ[i] + edm::LogVerbatim("TIDGeom") << "\tsideFrame[" << i << "] = " << sideFrameName[i] << " positioned at Z " << sideFrameZ[i] << " with rotation " << sideFrameRot[i]; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\tkapton[" << i << "] = " << kaptonName[i] << " positioned at Z " << kaptonZ[i] + edm::LogVerbatim("TIDGeom") << "\tkapton[" << i << "] = " << kaptonName[i] << " positioned at Z " << kaptonZ[i] << " with rotation " << kaptonRot[i]; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << waferName[i] << " positioned at Z " << waferZ[i] << " with rotation " << waferRot[i]; - LogDebug("TIDGeom") << hybridName << " Height " << hybridHeight << " Z"; + edm::LogVerbatim("TIDGeom") << waferName[i] << " positioned at Z " << waferZ[i] << " with rotation " << waferRot[i]; + edm::LogVerbatim("TIDGeom") << hybridName << " Height " << hybridHeight << " Z"; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << "\thybridZ[" << i << "] = " << hybridZ[i]; - LogDebug("TIDGeom") << "Pitch Adapter Height " << pitchHeight; + edm::LogVerbatim("TIDGeom") << "\thybridZ[" << i << "] = " << hybridZ[i]; + edm::LogVerbatim("TIDGeom") << "Pitch Adapter Height " << pitchHeight; for (int i = 0; i < detectorN; i++) - LogDebug("TIDGeom") << pitchName[i] << " position at Z " << pitchZ[i] << " with rotation " << pitchRot[i]; + edm::LogVerbatim("TIDGeom") << pitchName[i] << " position at Z " << pitchZ[i] << " with rotation " << pitchRot[i]; string name; double botfr; // width of side frame at the the bottom of the modules @@ -162,7 +162,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, for (int j2 = 0; j2 < 2; j2++) { copy++; parentVol.placeVolume(ns.volume(name), copy, Position(xpos, ypos, zpos)); - LogDebug("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " + edm::LogVerbatim("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " << Position(xpos, ypos, zpos) << " with " << rot; xpos = -xpos; } @@ -180,7 +180,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } zpos = zBotSpacers - zCenter; parentVol.placeVolume(ns.volume(name), 1, Position(0.0, ypos, zpos)); - LogDebug("TIDGeom") << name << " number " << 1 << " positioned in " << parentName << " at " + edm::LogVerbatim("TIDGeom") << name << " number " << 1 << " positioned in " << parentName << " at " << Position(0.0, ypos, zpos) << " with no rotation"; // Side Spacers (Alumina) name = sidSpacersName; @@ -211,7 +211,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, thetax = 90._deg + thetaz; rot = makeRotation3D(thetax, phix, thetay, phiy, thetaz, phiz); parentVol.placeVolume(ns.volume(name), copy, Transform3D(rot, Position(xpos, ypos, zpos))); - LogDebug("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " + edm::LogVerbatim("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " << Position(xpos, ypos, zpos) << " with " << rot; xpos = -xpos; thetaz = -thetaz; @@ -235,7 +235,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(waferRot[k]); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); // copyNr=k+1 - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " << rot; //Pitch Adapter @@ -256,7 +256,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(pitchRot[k]); tran = Position(xpos, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); // copyNr=k+1 - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " << rot; // Hybrid @@ -271,7 +271,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, zpos = zHybrid - zCenter; tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, tran); // copyNr=k+1 - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran; // Box frame name = boxFrameName; @@ -285,7 +285,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, zpos = zBoxFrame - zCenter; tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, tran); // copyNr=k+1 - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran; // Side frame name = sideFrameName[k]; @@ -300,7 +300,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(sideFrameRot[k]); tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " << rot; // Kapton circuit name = kaptonName[k]; @@ -322,10 +322,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(kaptonRot[k]); tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); - LogDebug("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " << rot; } - LogDebug("TIDGeom") << "<<== End of DDTIDModulePosAlgo positioning ..."; + edm::LogVerbatim("TIDGeom") << "<<== End of DDTIDModulePosAlgo positioning ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc index 88faaf5ac6668..ebb0f11a9e253 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc @@ -22,9 +22,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double sICC = args.value("ICCShift"); //Shift of ICC per to R vector zICC = args.value >("ICCZ"); // in Z - LogDebug("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1] << "\tICC " + edm::LogVerbatim("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1] << "\tICC " << iccName << "\tNameSpace " << ns.name(); - LogDebug("TIDGeom") << "Parameters for positioning--" + edm::LogVerbatim("TIDGeom") << "Parameters for positioning--" << " StartAngle " << convertRadToDeg(startAngle) << " Copy Numbers " << number << " Modules at R " << rModule << " Z " << zModule[0] << ", " << zModule[1] << " ICCs at R " << rICC << " Z " << zICC[0] << ", " << zICC[1]; @@ -63,7 +63,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, thetay, phiy, theta, phiz); // int copyNr = i+1; /* PlacedVolume pv = */ mother.placeVolume(module, i + 1, Transform3D(rotation, trmod)); - LogDebug("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << trmod + edm::LogVerbatim("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << trmod << " with " << rotation; //Now the ICC if (i % 2 == 0) { @@ -78,7 +78,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // int copyNr = i+1; Position tricc(xpos, ypos, zpos); /* PlacedVolume pv = */ mother.placeVolume(icc, i + 1, Transform3D(rotation, tricc)); - LogDebug("TIDGeom") << iccName << " number " << i + 1 << " positioned in " << mother.name() << " at " << tricc + edm::LogVerbatim("TIDGeom") << icc.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << tricc << " with " << rotation; } return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc index c59c9f268e94e..a3e9074ae3987 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc @@ -22,25 +22,25 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector sectorMaterial_C = args.vecStr("SectorMaterial_C"); // Material for the C sectors for (int i = 0; i < (int)(sectorNumber.size()); i++) - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: sectorNumber[" << i << "] = " << sectorNumber[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: sectorNumber[" << i << "] = " << sectorNumber[i]; - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Axial Service Sectors half-length " << sectorDz << "\tRin " + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: Axial Service Sectors half-length " << sectorDz << "\tRin " << sectorRin << "\tRout = " << sectorRout << "\tPhi of sectors position:"; for (int i = 0; i < (int)(sectorNumber.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tPhi = " << sectorStartPhi[i]; - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts"; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tPhi = " << sectorStartPhi[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts"; // - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 A"; + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 A"; for (int i = 0; i < (int)(sectorNumber.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_A = " << sectorMaterial_A[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tsectorMaterial_A = " << sectorMaterial_A[i]; // - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 B"; + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 B"; for (int i = 0; i < (int)(sectorNumber.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_B = " << sectorMaterial_B[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tsectorMaterial_B = " << sectorMaterial_B[i]; // - LogDebug("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 C"; + edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: Sector/3 C"; for (int i = 0; i < (int)(sectorNumber.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tsectorMaterial_C = " << sectorMaterial_C[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tsectorMaterial_C = " << sectorMaterial_C[i]; string tubsName = args.parentName(); Volume tubsVol = ns.volume(tubsName); @@ -62,43 +62,43 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rout = sectorRout; startphi = sectorStartPhi[i]; deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B); - solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi)); - LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_A[i] << " from " + solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_A[i] << " from " << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; - Volume sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_A[i]))); + Volume sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_A[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 - LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName + edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName << " with no translation and no rotation"; // Second Part: B name = "TOBAxService_" + sectorNumber[i] + "B"; startphi += deltaphi; deltaphi = sectorDeltaPhi_B; - solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi)); - LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_B[i] << " from " + solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_B[i] << " from " << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; - sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_B[i]))); + sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_B[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 - LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName + edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName << " with no translation and no rotation"; // Third Part: C name = "TOBAxService_" + sectorNumber[i] + "C"; startphi += deltaphi; deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B); - solid = ns.addSolid(name, Tube(rin, rout, dz, startphi, startphi + deltaphi)); - LogDebug("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_C[i] << " from " + solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_C[i] << " from " << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; - sectorLogic = ns.addVolume(Volume(name, solid, ns.material(sectorMaterial_C[i]))); + sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_C[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 - LogDebug("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName + edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName << " with no translation and no rotation"; } - LogDebug("TOBGeom") << "<<== End of DDTOBAxCableAlgo construction ..."; + edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBAxCableAlgo construction ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc index 2fc9115960983..088e54e0c2d3b 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc @@ -34,31 +34,31 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector names = args.vecStr("RingName"); // Names of layers string parentName = args.parentName(); - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << ns.name(); - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz << "\tRMax " << rMax + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << ns.name(); + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz << "\tRMax " << rMax << "\tCable Thickness " << cableT << "\tRadii of disk position and cable materials:"; for (int i = 0; i < (int)(rodRin.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " << cableM[i]; - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " << cableM[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT << "\tMaterials: "; for (int i = 0; i < (int)(connM.size()); i++) - LogDebug("TOBGeom") << "\tconnM[" << i << "] = " << connM[i]; - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin << " Rout = " << coolRout1 + edm::LogVerbatim("TOBGeom") << "\tconnM[" << i << "] = " << connM[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin << " Rout = " << coolRout1 << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1 << "\t Material = " << coolM1 << "\t Radial positions:"; for (int i = 0; i < (int)(coolR1.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; for (int i = 0; i < (int)(coolR2.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i]; - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin << " Rout = " << coolRout2 + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin << " Rout = " << coolRout2 << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2 << "\t Material = " << coolM2 << "\t Radial positions:"; for (int i = 0; i < (int)(coolR1.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; for (int i = 0; i < (int)(coolR2.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i]; for (int i = 0; i < (int)(names.size()); i++) - LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i]; Volume disk = ns.volume(parentName); // Loop over sub disks @@ -70,48 +70,48 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // Cooling Manifolds name = "TOBCoolingManifold" + names[i] + "a"; dz = coolRout1; - solid = ns.addSolid(name, Torus(coolR1[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); - LogDebug("TOBGeom") << name << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " + solid = ns.addSolid(ns.prepend(name), Torus(coolR1[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin << " Rout " << coolRout1 << " R torus " << coolR1[i]; - Volume coolManifoldLogic_a = ns.addVolume(Volume(name, solid, ns.material(coolM1))); + Volume coolManifoldLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1))); Position r1(0, 0, (dz - diskDz)); disk.placeVolume(coolManifoldLogic_a, i + 1, r1); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 << " with no rotation"; // Cooling Fluid (in Cooling Manifold) name = "TOBCoolingManifoldFluid" + names[i] + "a"; - solid = ns.addSolid(name, Torus(coolR1[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); - LogDebug("TOBGeom") << name << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " + solid = ns.addSolid(ns.prepend(name), Torus(coolR1[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin << " Rout " << coolRout2 << " R torus " << coolR1[i]; - Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(name, solid, ns.material(coolM2))); + Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2))); coolManifoldLogic_a.placeVolume(coolManifoldFluidLogic_a, i + 1); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << coolM2 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2 << " with no translation and no rotation"; name = "TOBCoolingManifold" + names[i] + "r"; dz = coolRout1; - solid = ns.addSolid(name, Torus(coolR2[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); - LogDebug("TOBGeom") << name << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " + solid = ns.addSolid(ns.prepend(name), Torus(coolR2[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin << " Rout " << coolRout1 << " R torus " << coolR2[i]; - Volume coolManifoldLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM1))); + Volume coolManifoldLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1))); r1 = Position(0, 0, (dz - diskDz)); disk.placeVolume(coolManifoldLogic_r, i + 1, r1); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 << " with no rotation"; // Cooling Fluid (in Cooling Manifold) name = "TOBCoolingManifoldFluid" + names[i] + "r"; - solid = ns.addSolid(name, Torus(coolR2[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); - LogDebug("TOBGeom") << name << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " + solid = ns.addSolid(ns.prepend(name), Torus(coolR2[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin << " Rout " << coolRout2 << " R torus " << coolR2[i]; - Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM2))); + Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2))); coolManifoldLogic_r.placeVolume(coolManifoldFluidLogic_r, i + 1); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << coolM2 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2 << " with no translation and no rotation"; // Connectors @@ -119,13 +119,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dz = 0.5 * connT; rin = 0.5 * (rodRin[i] + rodRout[i]) - 0.5 * connW; rout = 0.5 * (rodRin[i] + rodRout[i]) + 0.5 * connW; - solid = ns.addSolid(name, Tube(rin, rout, dz)); - LogDebug("TOBGeom") << name << " Tubs made of " << connM[i] << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << connM[i] << " from 0 to " << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; - Volume connLogic = ns.addVolume(Volume(name, solid, ns.material(connM[i]))); + Volume connLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(connM[i]))); Position r2(0, 0, (dz - diskDz)); disk.placeVolume(connLogic, i + 1, r2); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r2 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r2 << " with no rotation"; // Now the radial cable @@ -144,19 +144,19 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, pgonRmax.emplace_back(rout); pgonRmax.emplace_back(rout); pgonRmax.emplace_back(rout); - solid = ns.addSolid(name, Polycone(0, 2_pi, pgonRmin, pgonRmax, pgonZ)); - LogDebug("TOBGeom") << name << " Polycone made of " << cableM[i] << " from 0 to " << convertRadToDeg(2_pi) + solid = ns.addSolid(ns.prepend(name), Polycone(0, 2_pi, pgonRmin, pgonRmax, pgonZ)); + edm::LogVerbatim("TOBGeom") << solid.name() << " Polycone made of " << cableM[i] << " from 0 to " << convertRadToDeg(2_pi) << " and with " << pgonZ.size() << " sections"; for (int ii = 0; ii < (int)(pgonZ.size()); ii++) - LogDebug("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii] + edm::LogVerbatim("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii]; - Volume cableLogic = ns.addVolume(Volume(name, solid, ns.material(cableM[i]))); + Volume cableLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(cableM[i]))); Position r3(0, 0, (diskDz - (i + 0.5) * cableT)); disk.placeVolume(cableLogic, i + 1, r3); // i+1 - LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r3 + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r3 << " with no rotation"; } - LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ..."; + edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc index 7fc4c111a3d57..b628a33c4fcd1 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc @@ -65,55 +65,55 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector aohY = args.vecDble("AOHy"); // AOH translation with respect small-ICC center (Y) vector aohZ = args.vecDble("AOHz"); // AOH translation with respect small-ICC center (Z) - LogDebug("TOBGeom") << "Parent " << parentName << " Central " << central << " NameSpace " << ns.name() << "\tShift " + edm::LogVerbatim("TOBGeom") << "Parent " << parentName << " Central " << central << " NameSpace " << ns.name() << "\tShift " << shift; for (int i = 0; i < (int)(sideRod.size()); i++) { - LogDebug("TOBGeom") << sideRod[i] << " to be positioned " << sideRodX.size() << " times at y = " << sideRodY[i] + edm::LogVerbatim("TOBGeom") << sideRod[i] << " to be positioned " << sideRodX.size() << " times at y = " << sideRodY[i] << " z = " << sideRodZ[i] << " and x"; for (double j : sideRodX) - LogDebug("TOBGeom") << "\tsideRodX[" << i << "] = " << j; + edm::LogVerbatim("TOBGeom") << "\tsideRodX[" << i << "] = " << j; } - LogDebug("TOBGeom") << endRod1 << " to be " + edm::LogVerbatim("TOBGeom") << endRod1 << " to be " << "positioned " << endRod1Y.size() << " times at"; for (int i = 0; i < (int)(endRod1Y.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\ty = " << endRod1Y[i] << "\tz = " << endRod1Z[i]; - LogDebug("TOBGeom") << endRod2 << " to be " + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\ty = " << endRod1Y[i] << "\tz = " << endRod1Z[i]; + edm::LogVerbatim("TOBGeom") << endRod2 << " to be " << "positioned at y = " << endRod2Y << " z = " << endRod2Z; - LogDebug("TOBGeom") << cable << " to be " + edm::LogVerbatim("TOBGeom") << cable << " to be " << "positioned at z = " << cableZ; - LogDebug("TOBGeom") << clamp << " to be " + edm::LogVerbatim("TOBGeom") << clamp << " to be " << "positioned " << clampX.size() << " times at"; for (int i = 0; i < (int)(clampX.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tx = " << clampX[i] << "\tz = " << clampZ[i]; - LogDebug("TOBGeom") << sideCool << " to be " + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << clampX[i] << "\tz = " << clampZ[i]; + edm::LogVerbatim("TOBGeom") << sideCool << " to be " << "positioned " << sideCoolX.size() << " times at"; for (int i = 0; i < (int)(sideCoolX.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tx = " << sideCoolX[i] << "\ty = " << sideCoolY[i] + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideCoolX[i] << "\ty = " << sideCoolY[i] << "\tz = " << sideCoolZ[i]; - LogDebug("TOBGeom") << endCool << " to be " + edm::LogVerbatim("TOBGeom") << endCool << " to be " << "positioned with " << endCoolRot << " rotation at" << " y = " << endCoolY << " z = " << endCoolZ; - LogDebug("TOBGeom") << optFibre << " to be " + edm::LogVerbatim("TOBGeom") << optFibre << " to be " << "positioned " << optFibreX.size() << " times at"; for (int i = 0; i < (int)(optFibreX.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tx = " << optFibreX[i] << "\tz = " << optFibreZ[i]; - LogDebug("TOBGeom") << sideClamp1 << " to be " + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << optFibreX[i] << "\tz = " << optFibreZ[i]; + edm::LogVerbatim("TOBGeom") << sideClamp1 << " to be " << "positioned " << sideClampX.size() << " times at"; for (int i = 0; i < (int)(sideClampX.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp1DZ[i]; - LogDebug("TOBGeom") << sideClamp2 << " to be " + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp1DZ[i]; + edm::LogVerbatim("TOBGeom") << sideClamp2 << " to be " << "positioned " << sideClampX.size() << " times at"; for (int i = 0; i < (int)(sideClampX.size()); i++) - LogDebug("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp2DZ[i]; - LogDebug("TOBGeom") << "DDTOBRodAlgo debug:\t" << module << " positioned " << moduleRot.size() << " times"; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp2DZ[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRodAlgo debug:\t" << module << " positioned " << moduleRot.size() << " times"; for (int i = 0; i < (int)(moduleRot.size()); i++) - LogDebug("TOBGeom") << "\tRotation " << moduleRot[i] << "\ty = " << moduleY[i] << "\tz = " << moduleZ[i]; - LogDebug("TOBGeom") << "DDTOBRodAlgo debug:\t" << connect.size() << " ICC positioned with no rotation"; + edm::LogVerbatim("TOBGeom") << "\tRotation " << moduleRot[i] << "\ty = " << moduleY[i] << "\tz = " << moduleZ[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRodAlgo debug:\t" << connect.size() << " ICC positioned with no rotation"; for (int i = 0; i < (int)(connect.size()); i++) - LogDebug("TOBGeom") << "\t" << connect[i] << "\ty = " << connectY[i] << "\tz = " << connectZ[i]; - LogDebug("TOBGeom") << "DDTOBRodAlgo debug:\t" << aohName << " AOH will be positioned on ICC's"; + edm::LogVerbatim("TOBGeom") << "\t" << connect[i] << "\ty = " << connectY[i] << "\tz = " << connectZ[i]; + edm::LogVerbatim("TOBGeom") << "DDTOBRodAlgo debug:\t" << aohName << " AOH will be positioned on ICC's"; for (int i = 0; i < (int)(aohCopies.size()); i++) - LogDebug("TOBGeom") << " copies " << aohCopies[i] << "\tx = " << aohX[i] << "\ty = " << aohY[i] + edm::LogVerbatim("TOBGeom") << " copies " << aohCopies[i] << "\tx = " << aohX[i] << "\ty = " << aohY[i] << "\tz = " << aohZ[i]; const string& centName = central; @@ -127,7 +127,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(sideRodX[j], sideRodY[i], sideRodZ[i]); child = sideRod[i]; rod.placeVolume(ns.volume(child), j + 1, r); - LogDebug("TOBGeom") << child << " number " << j + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << j + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } } @@ -136,7 +136,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(clampX[i], 0, shift + clampZ[i]); child = clamp; rod.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } // Side Cooling tubes @@ -144,7 +144,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(sideCoolX[i], sideCoolY[i], shift + sideCoolZ[i]); child = sideCool; rod.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } // Optical Fibres @@ -152,7 +152,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(optFibreX[i], 0, shift + optFibreZ[i]); child = optFibre; rod.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -162,7 +162,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(sideClampX[i], moduleY[j], shift + moduleZ[j] + sideClamp1DZ[i]); child = sideClamp1; rod.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } for (int i = 0; i < (int)(sideClamp2DZ.size()); i++) { @@ -170,7 +170,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(sideClampX[i], moduleY[j], shift + moduleZ[j] + sideClamp2DZ[i]); child = sideClamp2; rod.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r << " with no rotation"; } @@ -180,13 +180,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(0, endRod1Y[i], shift + endRod1Z[i]); child = endRod1; cent.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r << " with no rotation"; } Position r1(0, endRod2Y, shift + endRod2Z); child = endRod2; cent.placeVolume(ns.volume(child), 1, r1); - LogDebug("TOBGeom") << child << " number 1 " + edm::LogVerbatim("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r1 << " with no rotation"; // End cooling tubes @@ -194,14 +194,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, const Rotation3D& rot2 = ns.rotation(endCoolRot); child = endCool; cent.placeVolume(ns.volume(child), 1, Transform3D(rot2, r2)); - LogDebug("TOBGeom") << child << " number 1 " + edm::LogVerbatim("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r2 << " with " << rot2; //Mother cable Position r3(0, 0, shift + cableZ); child = cable; cent.placeVolume(ns.volume(child), 1, r3); - LogDebug("TOBGeom") << child << " number 1 " + edm::LogVerbatim("TOBGeom") << child << " number 1 " << "positioned in " << centName << " at " << r3 << " with no rotation"; //Modules @@ -210,7 +210,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, const Rotation3D& rot = ns.rotation(moduleRot[i]); child = module; cent.placeVolume(ns.volume(child), i + 1, Transform3D(rot, r)); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r << " with " + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r << " with " << rot; } @@ -219,7 +219,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(0, connectY[i], shift + connectZ[i]); child = connect[i]; cent.placeVolume(ns.volume(child), i + 1, r); - LogDebug("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r << " with no rotation"; } @@ -232,7 +232,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position r(aohX[i] + 0, aohY[i] + connectY[i], aohZ[i] + shift + connectZ[i]); child = aohName; cent.placeVolume(ns.volume(child), copyNumber, r); - LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r << " with no rotation"; // if two copies add a copy with (-aohX,-aohZ) translation if (aohCopies[i] == 2) { @@ -240,7 +240,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, r = Position(-aohX[i] + 0, aohY[i] + connectY[i], -aohZ[i] + shift + connectZ[i]); child = aohName; cent.placeVolume(ns.volume(child), copyNumber, r); - LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r + edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r << " with no rotation"; } // if four copies add 3 copies with (-aohX,+aohZ) (-aohX,-aohZ) (+aohX,+aohZ) and translations @@ -263,13 +263,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, cent.placeVolume(ns.volume(child), copyNumber, rr); // copyNumber break; } - LogDebug("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << rr + edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << rr << " with no rotation"; } } } } - LogDebug("TOBGeom") << "<<== End of DDTOBRodAlgo construction ..."; + edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBRodAlgo construction ..."; return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc index 98ee3d30f2838..91fda21ae8957 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc @@ -21,8 +21,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Volume mother = ns.volume(args.parentName()); Volume child = ns.volume(args.value("ChildName")); - LogDebug("TrackerGeom") << "DDTrackerLinear +++ Executing Algorithm. rParent:" << mother.name(); - LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + edm::LogVerbatim("TrackerGeom") << "DDTrackerLinear +++ Executing Algorithm. rParent:" << mother.name(); + edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name() << "\tNumber " << number << "\tAxis (theta/phi) " << theta / dd4hep::deg << ", " << phi / dd4hep::deg << "\t(Offset/Delta) " << offset << ", " << delta << "\tCentre " << centre[0] << ", " << centre[1] << ", " << centre[2] << "\tRotation " << rotMat; @@ -36,7 +36,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position tran = base + (offset + double(i) * delta) * direction; mother.placeVolume(child, ci, Transform3D(rot, tran)); - LogDebug("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran + edm::LogVerbatim("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran << " with " << rot; } return cms::s_executed; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc index 02112cab990d4..60587db4e80bf 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc @@ -22,18 +22,18 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double tilt = args.value("Tilt"); if (numcopies != int(phi.size())) { - LogDebug("TrackerGeom") << "error: Parameter " + edm::LogVerbatim("TrackerGeom") << "error: Parameter " << "NumCopies does not agree with the size " << "of the Phi vector. It was adjusted to " << "be the size of the Phi vector and may " << "lead to crashes or errors."; } - LogDebug("TrackerGeom") << "debug: Parameters for position" + edm::LogVerbatim("TrackerGeom") << "debug: Parameters for position" << "ing:: " << " Radius " << radius << " Tilt " << tilt << " Copies " << phi.size() << " at"; for (int i = 0; i < (int)(phi.size()); i++) - LogDebug("TrackerGeom") << "\t[" << i << "] phi = " << phi[i] << " z = " << zpos[i]; - LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + edm::LogVerbatim("TrackerGeom") << "\t[" << i << "] phi = " << phi[i] << " z = " << zpos[i]; + edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); double theta = 90._deg; @@ -46,7 +46,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rot = makeRotation3D(theta, phix, theta, phiy, 0., 0.); Position tran(xpos, ypos, zpos[i]); /* PlacedVolume pv = */ mother.placeVolume(child, ci, Transform3D(rot, tran)); - LogDebug("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " << mother.name() + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran << " with " << rot; ci = ci + incrcn; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc index df4961a5775d8..a6b30faf3981b 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc @@ -23,8 +23,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int startCopyNo = args.find("StartCopyNo") ? args.value("StartCopyNo") : 1; //Start copy number int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number - LogDebug("TrackerGeom") << "Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); - LogDebug("TrackerGeom") << "Parameters for positioning-- Tilt " << tilt << "\tStartAngle " + edm::LogVerbatim("TrackerGeom") << "Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + edm::LogVerbatim("TrackerGeom") << "Parameters for positioning-- Tilt " << tilt << "\tStartAngle " << convertRadToDeg(startAngle) << "\tRangeAngle " << convertRadToDeg(rangeAngle) << "\tRin " << radiusIn << "\tRout " << radiusOut << "\t ZPos " << zpos << "\tCopy Numbers " << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo; @@ -59,7 +59,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } Position tran(xpos, ypos, zpos); /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - LogDebug("TrackerGeom") << "" << child.name() << " number " << copyNo << " positioned in " << mother.name() + edm::LogVerbatim("TrackerGeom") << "" << child.name() << " number " << copyNo << " positioned in " << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc index 3423bb31fd81d..1a60725e622b6 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc @@ -39,19 +39,19 @@ namespace { } } - LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parameters for position" + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo debug: Parameters for position" << "ing:: n " << n << " Start, Range, Delta " << convertRadToDeg(startAngle) << " " << convertRadToDeg(rangeAngle) << " " << convertRadToDeg(delta) << " Radius " << radius << " Centre " << center[0] << ", " << center[1] << ", " << center[2]; - LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parent " << parentName << "\tChild " << childName + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo debug: Parent " << parentName << "\tChild " << childName << " NameSpace " << ns.name(); Rotation3D flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix; // Identity matrix // flipMatrix calculus if (isFlipped) { - LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << "\t90., 180., " << "90., 90., " << "180., 0."; @@ -59,7 +59,7 @@ namespace { } // tiltMatrix calculus if (isZPlus) { - LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 180., " << convertRadToDeg(90._deg - tiltAngle) << ", 0."; tiltMatrix = makeRotation3D(90._deg, 90._deg, tiltAngle, 180._deg, 90._deg - tiltAngle, 0._deg); @@ -67,7 +67,7 @@ namespace { tiltMatrix *= flipMatrix; } } else { - LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 0., " << convertRadToDeg(90._deg + tiltAngle) << ", 0."; tiltMatrix = makeRotation3D(90._deg, 90._deg, tiltAngle, 0._deg, 90._deg + tiltAngle, 0._deg); @@ -86,7 +86,7 @@ namespace { double phix = phi; double phiy = phix + 90._deg; if (phix != 0.) { - LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) << ", 0., 0."; phiRotMatrix = makeRotation3D(theta, phix, theta, phiy, 0., 0.); @@ -102,7 +102,7 @@ namespace { // Positions child with respect to parent mother.placeVolume(child, copy, Transform3D(globalRotMatrix, tran)); - LogDebug("TrackerGeom") << "DDTrackerRingAlgo test " << child.data()->GetName() << " number " << copy + edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test " << child.data()->GetName() << " number " << copy << " positioned in " << mother.data()->GetName() << " at " << tran << " with " << globalRotMatrix; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc index 3261a1b2afc25..a8a93a91b197a 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc @@ -18,11 +18,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector zvec = args.value >("ZPositions"); // Z positions vector rotMat = args.value >("Rotations"); // Names of rotation matrices - LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo << "\tNumber " << xvec.size() << ", " << yvec.size() << ", " << zvec.size(); for (int i = 0; i < (int)(zvec.size()); i++) { - LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" << i + edm::LogVerbatim("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; } @@ -32,7 +32,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, /* PlacedVolume pv = */ rotMat[i] != "NULL" ? mother.placeVolume(child, copy, Transform3D(ns.rotation(rotMat[i]), tran)) : mother.placeVolume(child, tran); - LogDebug("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() << " at " << tran << " with " << rot; } return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc index 59a2e07564480..e2d01d5f4a629 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc @@ -16,11 +16,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector zvec = args.value >("ZPositions"); // Z positions vector rotMat = args.value >("Rotations"); // Names of rotation matrices - LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo << "\tNumber " << zvec.size(); for (int i = 0; i < (int)(zvec.size()); i++) - LogDebug("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; + edm::LogVerbatim("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; for (int i = 0, copy = startCopyNo; i < (int)(zvec.size()); i++, copy += incrCopyNo) { Position tran(0, 0, zvec[i]); @@ -28,7 +28,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, /* PlacedVolume pv = */ rotMat[i] != "NULL" ? mother.placeVolume(child, copy, Transform3D(ns.rotation(rotMat[i]), tran)) : mother.placeVolume(child, copy, tran); - LogDebug("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() << " at " << tran << " with " << rot; } return 1; diff --git a/Geometry/TrackerCommonData/test/python/dd4hepRun3_cfg.py b/Geometry/TrackerCommonData/test/python/dd4hepRun3_cfg.py new file mode 100644 index 0000000000000..676d3c3568a9b --- /dev/null +++ b/Geometry/TrackerCommonData/test/python/dd4hepRun3_cfg.py @@ -0,0 +1,171 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep + +process = cms.Process('SIM',Run3_dd4hep) + +# 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.GeometryDD4hepExtended2021Reco_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.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.TrackerGeom=dict() + process.MessageLogger.PixelGeom=dict() + process.MessageLogger.TIBGeom=dict() + process.MessageLogger.TIDGeom=dict() + process.MessageLogger.TOBGeom=dict() + process.MessageLogger.TECGeom=dict() + +# Input source +process.source = cms.Source("EmptySource") + +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( + + ), + 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('TTbar_14TeV_TuneCP5_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:step1.root'), + outputCommands = process.FEVTDEBUGEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + +process.generator = cms.EDFilter("Pythia8GeneratorFilter", + PythiaParameters = cms.PSet( + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ), + processParameters = cms.vstring( + 'Top:gg2ttbar = on ', + 'Top:qqbar2ttbar = on ', + '6:m0 = 175 ' + ), + pythia8CP5Settings = cms.vstring( + 'Tune:pp 14', + 'Tune:ee 7', + 'MultipartonInteractions:ecmPow=0.03344', + 'MultipartonInteractions:bProfile=2', + 'MultipartonInteractions:pT0Ref=1.41', + 'MultipartonInteractions:coreRadius=0.7634', + 'MultipartonInteractions:coreFraction=0.63', + 'ColourReconnection:range=5.176', + 'SigmaTotal:zeroAXB=off', + 'SpaceShower:alphaSorder=2', + 'SpaceShower:alphaSvalue=0.118', + 'SigmaProcess:alphaSvalue=0.118', + 'SigmaProcess:alphaSorder=2', + 'MultipartonInteractions:alphaSvalue=0.118', + 'MultipartonInteractions:alphaSorder=2', + 'TimeShower:alphaSorder=2', + 'TimeShower:alphaSvalue=0.118', + 'SigmaTotal:mode = 0', + 'SigmaTotal:sigmaEl = 21.89', + 'SigmaTotal:sigmaTot = 100.309', + 'PDF:pSet=LHAPDF6:NNPDF31_nnlo_as_0118' + ), + pythia8CommonSettings = cms.vstring( + 'Tune:preferLHAPDF = 2', + 'Main:timesAllowErrors = 10000', + 'Check:epTolErr = 0.01', + 'Beams:setProductionScalesFromLHEF = off', + 'SLHA:minMassSM = 1000.', + 'ParticleDecays:limitTau0 = on', + 'ParticleDecays:tau0Max = 10', + 'ParticleDecays:allowPhotonRadiation = on' + ) + ), + comEnergy = cms.double(14000.0), + filterEfficiency = cms.untracked.double(1.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + pythiaPylistVerbosity = cms.untracked.int32(0) +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# 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.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.endjob_step,process.FEVTDEBUGoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + +# Customisation from command line + +# 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 From 7533c07d41eb90e43d30dedbd5d10f12d147dc40 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 29 Aug 2021 00:05:29 +0200 Subject: [PATCH 203/923] Code check --- .../plugins/dd4hep/DDCutTubsFromPoints.cc | 3 +- .../plugins/dd4hep/DDPixBarLayerAlgo.cc | 67 +++++----- .../dd4hep/DDPixBarLayerUpgradeAlgo.cc | 51 ++++---- .../plugins/dd4hep/DDPixFwdDiskAlgo.cc | 44 +++---- .../plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc | 10 +- .../plugins/dd4hep/DDTECCoolAlgo.cc | 9 +- .../plugins/dd4hep/DDTECOptoHybAlgo.cc | 8 +- .../plugins/dd4hep/DDTECPhiAlgo.cc | 15 +-- .../plugins/dd4hep/DDTECPhiAltAlgo.cc | 15 +-- .../plugins/dd4hep/DDTIBLayerAlgo.cc | 68 +++++----- .../plugins/dd4hep/DDTIDModuleAlgo.cc | 116 ++++++++++-------- .../plugins/dd4hep/DDTIDModulePosAlgo.cc | 30 ++--- .../plugins/dd4hep/DDTIDRingAlgo.cc | 18 +-- .../plugins/dd4hep/DDTOBAxCableAlgo.cc | 20 +-- .../plugins/dd4hep/DDTOBRadCableAlgo.cc | 79 ++++++------ .../plugins/dd4hep/DDTOBRodAlgo.cc | 66 +++++----- .../plugins/dd4hep/DDTrackerLinear.cc | 11 +- .../plugins/dd4hep/DDTrackerPhiAlgo.cc | 18 +-- .../plugins/dd4hep/DDTrackerPhiAltAlgo.cc | 14 ++- .../plugins/dd4hep/DDTrackerRingAlgo.cc | 30 ++--- .../plugins/dd4hep/DDTrackerXYZPosAlgo.cc | 12 +- .../plugins/dd4hep/DDTrackerZPosAlgo.cc | 8 +- 22 files changed, 374 insertions(+), 338 deletions(-) diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc index 4ea566aa7c510..a47686ce0b66b 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDCutTubsFromPoints.cc @@ -192,7 +192,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext segments[segments.size() - 1], dd4hep::Position(0., 0., offsets[segments.size() - 1] - shift)); - edm::LogVerbatim("TrackerGeom") << "DDCutTubsFromPoints: " << solid.name() << " Union solid with " << segments.size() << " segments"; + edm::LogVerbatim("TrackerGeom") << "DDCutTubsFromPoints: " << solid.name() << " Union solid with " << segments.size() + << " segments"; // remove the common offset from the input, to get sth. aligned at z=0. float offset = -shift + (min_z + 0.5 * (max_z - min_z)); diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc index 4679d578c0ab3..ee2ba9af28c93 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerAlgo.cc @@ -27,17 +27,17 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h string coolMat = args.value("CoolMaterial"); string tubeMat = args.value("CoolTubeMaterial"); edm::LogVerbatim("PixelGeom") << "Parent " << parentName << " NameSpace " << ns.name() << "\n" - << "\tLadders " << number << "\tGeneral Material " << genMat << "\tLength " << layerDz - << "\tSensorEdge " << sensorEdge << "\tSpecification of Cooling Pieces:\n" - << "\tLength " << coolDz << " Width " << coolWidth << " Side " << coolSide - << " Thickness of Shell " << coolThick << " Radial distance " << coolDist << " Materials " - << coolMat << ", " << tubeMat; + << "\tLadders " << number << "\tGeneral Material " << genMat << "\tLength " << layerDz + << "\tSensorEdge " << sensorEdge << "\tSpecification of Cooling Pieces:\n" + << "\tLength " << coolDz << " Width " << coolWidth << " Side " << coolSide + << " Thickness of Shell " << coolThick << " Radial distance " << coolDist + << " Materials " << coolMat << ", " << tubeMat; vector ladder = args.value >("LadderName"); vector ladderWidth = args.value >("LadderWidth"); vector ladderThick = args.value >("LadderThick"); edm::LogVerbatim("PixelGeom") << "Full Ladder " << ladder[0] << " width/thickness " << ladderWidth[0] << ", " - << ladderThick[0] << "\tHalf Ladder " << ladder[1] << " width/thickness " << ladderWidth[1] - << ", " << ladderThick[1]; + << ladderThick[0] << "\tHalf Ladder " << ladder[1] << " width/thickness " + << ladderWidth[1] << ", " << ladderThick[1]; const std::string idName = ns.objName(parentName); double dphi = 2_pi / number; @@ -48,14 +48,15 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h double rmin = (coolDist - 0.5 * (d1 + d2)) * cos(0.5 * dphi) - 0.5 * ladderThick[0]; double rmax = (coolDist + 0.5 * (d1 + d2)) * cos(0.5 * dphi) + 0.5 * ladderThick[0]; double rmxh = rmax - 0.5 * ladderThick[0] + ladderThick[1]; - edm::LogVerbatim("PixelGeom") << "Rmin/Rmax " << rmin << ", " << rmax << " d1/d2 " << d1 << ", " << d2 << " x1/x2 " << x1 - << ", " << x2; + edm::LogVerbatim("PixelGeom") << "Rmin/Rmax " << rmin << ", " << rmax << " d1/d2 " << d1 << ", " << d2 << " x1/x2 " + << x1 << ", " << x2; double rtmi = rmin + 0.5 * ladderThick[0] - ladderThick[1]; double rtmx = sqrt(rmxh * rmxh + ladderWidth[1] * ladderWidth[1]); Solid solid = ns.addSolid(ns.prepend(idName), Tube(rtmi, rtmx, 0.5 * layerDz, 0, 2_pi)); - edm::LogVerbatim("PixelGeom") << "IDname " << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rtmi << " Rout " << rtmx << " ZHalf " << 0.5 * layerDz; + edm::LogVerbatim("PixelGeom") << "IDname " << solid.name() << " Tubs made of " << genMat << " from 0 to " + << convertRadToDeg(2_pi) << " with Rin " << rtmi << " Rout " << rtmx << " ZHalf " + << 0.5 * layerDz; Volume layer = ns.addVolume(Volume(solid.name(), solid, ns.material(genMat))); double rr = 0.5 * (rmax + rmin); @@ -63,9 +64,9 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h double h1 = 0.5 * coolSide * cos(0.5 * dphi); std::string name = idName + "CoolTube"; solid = ns.addSolid(ns.prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); - edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << tubeMat << " of dimensions " << 0.5 * coolDz - << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " << d2 << ", " << d1 - << ", 0"; + edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << tubeMat << " of dimensions " + << 0.5 * coolDz << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " + << d2 << ", " << d1 << ", 0"; Volume coolTube = ns.addVolume(Volume(solid.name(), solid, description.material(tubeMat))); h1 -= coolThick; @@ -73,14 +74,14 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h d2 -= coolThick; name = idName + "Coolant"; solid = ns.addSolid(ns.prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0)); - edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << coolMat << " of dimensions " << 0.5 * coolDz - << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " << d2 << ", " << d1 - << ", 0"; + edm::LogVerbatim("PixelGeom") << "Solid " << solid.name() << " Trap made of " << coolMat << " of dimensions " + << 0.5 * coolDz << ", 0, 0, " << h1 << ", " << d2 << ", " << d1 << ", 0, " << h1 << ", " + << d2 << ", " << d1 << ", 0"; Volume cool = ns.addVolume(Volume(solid.name(), solid, description.material(coolMat))); pv = coolTube.placeVolume(cool, 1); edm::LogVerbatim("PixelGeom") << "Cool " << cool.name() << " number 1 positioned in " << coolTube.name() - << " at (0,0,0) with no rotation"; + << " at (0,0,0) with no rotation"; string ladderFull = ladder[0]; string ladderHalf = ladder[1]; @@ -103,16 +104,16 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h phix = phi - 90_deg; phiy = 90_deg + phix; edm::LogVerbatim("PixelGeom") << "Creating a new " - << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); //cpv.position(ladderHalf, layer, copy, tran, rot); pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot, tran)); if (!pv.isValid()) { } - edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " - << layer.name() << " at " << tran << " with " << rot; + edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy + << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; iup = -1; rrr = rr - dr - 0.5 * (ladderThick[1] - ladderThick[0]); @@ -120,15 +121,15 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h rots = idName + std::to_string(copy); phix = phi + 90_deg; phiy = 90_deg + phix; - edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) + << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); //cpv.position(ladderHalf, layer, copy, tran, rot); pv = layer.placeVolume(ladderHalfVol, copy, Transform3D(rot, tran)); if (!pv.isValid()) { } - edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy << " positioned in " - << layer.name() << " at " << tran << " with " << rot; + edm::LogVerbatim("PixelGeom") << "ladderHalfVol: " << ladderHalfVol.name() << " number " << copy + << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; } else { iup = -iup; @@ -141,8 +142,8 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h phix = phi + 90_deg; phiy = phix + 90._deg; edm::LogVerbatim("PixelGeom") << "DDPixBarLayerAlgo test: Creating a new " - << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); //cpv.position(ladderFull, layer, copy, tran, rot); @@ -150,7 +151,7 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h if (!pv.isValid()) { } edm::LogVerbatim("PixelGeom") << "test: " << ladderFullVol.name() << " number " << copy << " positioned in " - << layer.name() << " at " << tran << " with " << rot; + << layer.name() << " at " << tran << " with " << rot; copy++; } rrr = coolDist * cos(0.5 * dphi); @@ -160,15 +161,15 @@ static long algorithm(Detector& description, cms::DDParsingContext& ctxt, xml_h if (iup > 0) phix += 180_deg; phiy = phix + 90._deg; - edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + edm::LogVerbatim("PixelGeom") << "Creating a new rotation: " << rots << "\t90., " << convertRadToDeg(phix) + << ", 90.," << convertRadToDeg(phiy) << ", 0, 0"; rot = makeRotation3D(90_deg, phix, 90_deg, phiy, 0., 0.); pv = layer.placeVolume(coolTube, i + 1, Transform3D(rot, tran)); if (!pv.isValid()) { } - edm::LogVerbatim("PixelGeom") << "coolTube: " << coolTube.name() << " number " << i + 1 << " positioned in " << layer.name() - << " at " << tran << " with " << rot; + edm::LogVerbatim("PixelGeom") << "coolTube: " << coolTube.name() << " number " << i + 1 << " positioned in " + << layer.name() << " at " << tran << " with " << rot; } edm::LogVerbatim("PixelGeom") << "Layer: " << layer.name(); return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc index 9c1273625d487..84e0052e5d327 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixBarLayerUpgradeAlgo.cc @@ -36,13 +36,13 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { int outerFirst = args.value("OuterFirst"); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Parent " << parentName << " NameSpace " - << ns.objName(parentName) << "\n\tLadders " << number << "\tGeneral Material " << genMat - << "\tLength " << layerDz << "\tSpecification of Cooling Pieces:\n" - << "\tLength " << coolDz << "\tThickness of Shell " << coolThick << "\tRadial distance " - << coolDist << "\tMaterials " << coolMat << ", " << tubeMat << std::endl; + << ns.objName(parentName) << "\n\tLadders " << number << "\tGeneral Material " << genMat + << "\tLength " << layerDz << "\tSpecification of Cooling Pieces:\n" + << "\tLength " << coolDz << "\tThickness of Shell " << coolThick << "\tRadial distance " + << coolDist << "\tMaterials " << coolMat << ", " << tubeMat << std::endl; edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo debug: Full Ladder " << ladder << " width/thickness " - << ladderWidth << ", " << ladderThick; + << ladderWidth << ", " << ladderThick; double dphi = 2_pi / (double)number; double x2 = coolDist * sin(0.5 * dphi); @@ -55,8 +55,8 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { dd4hep::Solid solid = ns.addSolid(ns.prepend(name), dd4hep::Tube(rtmi, rtmx, 0.5 * layerDz, 0., 2._pi)); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << genMat - << " from 0. to " << convertRadToDeg(2_pi) << " with Rin " << rtmi << " Rout " << rtmx - << " ZHalf " << 0.5 * layerDz; + << " from 0. to " << convertRadToDeg(2_pi) << " with Rin " << rtmi << " Rout " << rtmx + << " ZHalf " << 0.5 * layerDz; dd4hep::Volume layer = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(genMat))); @@ -64,8 +64,8 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { solid = ns.addSolid(ns.prepend(name + "CoolTube"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0., 2_pi)); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat - << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " - << 0.5 * coolDz; + << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " + << 0.5 * coolDz; dd4hep::Volume coolTube = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(tubeMat))); @@ -73,8 +73,8 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { solid = ns.addSolid(ns.prepend(name + "CoolTubeHalf"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0, 1_pi)); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf - << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " - << 0.5 * coolDz; + << " from 0 to " << convertRadToDeg(2_pi) << " with Rout " << coolRadius << " ZHalf " + << 0.5 * coolDz; dd4hep::Volume coolTubeHalf = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(tubeMatHalf))); @@ -84,30 +84,31 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { solid = ns.addSolid(ns.prepend(name + "Coolant"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 2_pi)); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMat - << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick - << " ZHalf " << 0.5 * coolDz; + << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick + << " ZHalf " << 0.5 * coolDz; dd4hep::Volume cool = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(coolMat))); coolTube.placeVolume(cool, 1, dd4hep::Transform3D(dd4hep::Rotation3D(), dd4hep::Position(0., 0., 0.))); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " - << coolTube.name() << " at (0,0,0) with no rotation"; + << coolTube.name() << " at (0,0,0) with no rotation"; // Half Coolant - solid = ns.addSolid(ns.prepend(name + "CoolantHalf"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi)); + solid = + ns.addSolid(ns.prepend(name + "CoolantHalf"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi)); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << solid.name() << " Tubs made of " << tubeMatHalf - << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick - << " ZHalf " << 0.5 * coolDz; + << " from 0 to " << convertRadToDeg(2._pi) << " with Rout " << coolRadius - coolThick + << " ZHalf " << 0.5 * coolDz; dd4hep::Volume coolHalf = ns.addVolume(dd4hep::Volume(solid.name(), solid, ns.material(coolMatHalf))); coolTubeHalf.placeVolume(coolHalf, 1, dd4hep::Transform3D(dd4hep::Rotation3D(), dd4hep::Position(0., 0., 0.))); edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << cool.name() << " number 1 positioned in " - << coolTube.name() << " at (0,0,0) with no rotation"; + << coolTube.name() << " at (0,0,0) with no rotation"; int copy = 1, iup = (-1) * outerFirst; int copyoffset = number + 2; @@ -147,16 +148,16 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { phiy = phix + 90._deg; edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " - << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + << convertRadToDeg(phiy) << ", 0, 0"; rot = cms::makeRotation3D(90._deg, phix, 90._deg, phiy, 0., 0.); // FixMe : Would need ns.vecStr layer.placeVolume(ns.volume(ladder), copy, dd4hep::Transform3D(rot, tran)); - edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << ladder << " number " << copy << " positioned in " - << layer.name() << " at " << tran << " with " << rot; + edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << ladder << " number " << copy + << " positioned in " << layer.name() << " at " << tran << " with " << rot; copy++; @@ -171,8 +172,8 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { phiy = phix + 90._deg; edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: Creating a new " - << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + << "rotation: " << rots << "\t90., " << convertRadToDeg(phix) << ", 90.," + << convertRadToDeg(phiy) << ", 0, 0"; tran = dd4hep::Position(rrr * cos(phi) - x2 * sin(phi), rrr * sin(phi) + x2 * cos(phi), 0.); @@ -197,7 +198,7 @@ static long algorithm(dd4hep::Detector&, cms::DDParsingContext& ctxt, xml_h e) { } edm::LogVerbatim("PixelGeom") << "DDPixBarLayerUpgradeAlgo test: " << coolTube.name() << " number " << i + 1 - << " positioned in " << layer.name() << " at " << tran << " with " << rot; + << " positioned in " << layer.name() << " at " << tran << " with " << rot; } return cms::s_executed; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc index 76bba83f1ea68..64e4efc988d71 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixFwdDiskAlgo.cc @@ -52,14 +52,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Volume child = ns.volume(childName); edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() - << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " - << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) - << ", " << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " - << anchorR; + << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " + << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) << ", " + << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " + << anchorR; for (int iBlade = 0; iBlade < nBlades; ++iBlade) { edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] - << " zshift " << bladeZShift[iBlade]; + << " zshift " << bladeZShift[iBlade]; } double deltaPhi = 360.0_deg / (double)nBlades; @@ -87,23 +87,23 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext if (irot != ctxt.rotations.end()) { edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo test: Creating a new " - << "rotation: " << rotstr << "\t" << convertRadToDeg(thetx) << ", " - << convertRadToDeg(phix) << ", " << convertRadToDeg(thety) << ", " - << convertRadToDeg(phiy) << ", " << convertRadToDeg(thetz) << ", " - << convertRadToDeg(phiz); + << "rotation: " << rotstr << "\t" << convertRadToDeg(thetx) << ", " + << convertRadToDeg(phix) << ", " << convertRadToDeg(thety) << ", " + << convertRadToDeg(phiy) << ", " << convertRadToDeg(thetz) << ", " + << convertRadToDeg(phiz); edm::LogVerbatim("PixelGeom") << "Rotation Matrix (" << convertRadToDeg(phi) << ", " - << convertRadToDeg(bladeAngle) << ", " << convertRadToDeg(bladeTilt) << ") " - << cos(phi) * cos(bladeAngle) << ", " - << (-sin(phi) * cos(bladeTilt) + cos(phi) * sin(bladeAngle) * sin(bladeTilt)) - << ", " - << (sin(phi) * sin(bladeTilt) + cos(phi) * sin(bladeAngle) * cos(bladeTilt)) - << ", " << sin(phi) * cos(bladeAngle) << ", " - << (cos(phi) * cos(bladeTilt) + sin(phi) * sin(bladeAngle) * sin(bladeTilt)) - << ", " - << (-cos(phi) * sin(bladeTilt) + sin(phi) * sin(bladeAngle) * cos(bladeTilt)) - << ", " << -sin(bladeAngle) << ", " << cos(bladeAngle) * sin(bladeTilt) << ", " - << cos(bladeAngle) * cos(bladeTilt); + << convertRadToDeg(bladeAngle) << ", " << convertRadToDeg(bladeTilt) << ") " + << cos(phi) * cos(bladeAngle) << ", " + << (-sin(phi) * cos(bladeTilt) + cos(phi) * sin(bladeAngle) * sin(bladeTilt)) + << ", " + << (sin(phi) * sin(bladeTilt) + cos(phi) * sin(bladeAngle) * cos(bladeTilt)) + << ", " << sin(phi) * cos(bladeAngle) << ", " + << (cos(phi) * cos(bladeTilt) + sin(phi) * sin(bladeAngle) * sin(bladeTilt)) + << ", " + << (-cos(phi) * sin(bladeTilt) + sin(phi) * sin(bladeAngle) * cos(bladeTilt)) + << ", " << -sin(bladeAngle) << ", " << cos(bladeAngle) * sin(bladeTilt) << ", " + << cos(bladeAngle) * cos(bladeTilt); rot = cms::makeRotation3D(thetx, phix, thety, phiy, thetz, phiz); } double xpos = anchorR * (-sin(phi) * cos(bladeTilt) + cos(phi) * sin(bladeAngle) * sin(bladeTilt)); @@ -113,8 +113,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Position tran(xpos, ypos, zpos); pv = mother.placeVolume(child, copyNo, dd4hep::Transform3D(rot, tran)); edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo test: " << pv.name() << ": " << childName << " number " - << copyNo << " positioned in " << mother.name() << " at " << tran << " with " - << rot; + << copyNo << " positioned in " << mother.name() << " at " << tran << " with " + << rot; } copyNo++; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc index 3821141b46748..d782654dd41f2 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc @@ -49,14 +49,14 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext dd4hep::Volume child = ns.volume(childName); edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name() - << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " - << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) - << ", " << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " - << anchorR; + << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) " + << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) << ", " + << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius " + << anchorR; for (int iBlade = 0; iBlade < nBlades; ++iBlade) { edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade] - << " zshift " << bladeZShift[iBlade]; + << " zshift " << bladeZShift[iBlade]; } double deltaPhi = 360.0_deg / (double)nBlades; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc index fb5fabb142663..09873bd42c187 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECCoolAlgo.cc @@ -21,11 +21,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Volume mother = ns.volume(args.parentName()); edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Parent " << mother.name() << " NameSpace " << ns.name() - << " at radial Position " << rPosition; + << " at radial Position " << rPosition; if (phiPosition.size() == coolInsert.size()) { for (int i = 0; i < (int)(phiPosition.size()); i++) { edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: " << coolInsert.at(i) << " at Phi " - << convertRadToDeg(phiPosition.at(i)); + << convertRadToDeg(phiPosition.at(i)); } } else { edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo ERROR: Number of inserts does not match the numer of PhiPositions!"; @@ -41,8 +41,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // place inserts Position tran(xpos, ypos, 0.0); mother.placeVolume(child, copyNo, tran); - edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo test " << child.name() << "[" << copyNo << "] positioned in " << mother.name() - << " at " << tran << " phi " << convertRadToDeg(phiPosition.at(i)) << " r " << rPosition; + edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo test " << child.name() << "[" << copyNo << "] positioned in " + << mother.name() << " at " << tran << " phi " << convertRadToDeg(phiPosition.at(i)) + << " r " << rPosition; copyNo++; } edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo Finished...."; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc index 08c21b72917bc..e44f3e0cde58f 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECOptoHybAlgo.cc @@ -22,7 +22,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, edm::LogVerbatim("TECGeom") << "Parent " << mother.name() << " Child " << child.name() << " NameSpace " << ns.name(); edm::LogVerbatim("TECGeom") << "Height of the Hybrid " << optoHeight << " and Width " << optoWidth << "Rpos " << rpos - << " Zpos " << zpos << " StartCopyNo " << startCopyNo << " Number " << angles.size(); + << " Zpos " << zpos << " StartCopyNo " << startCopyNo << " Number " << angles.size(); // given r positions are for the lower left corner rpos += optoHeight / 2; @@ -46,14 +46,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } else { double theta = 90._deg; edm::LogVerbatim("TECGeom") << "test: Creating a new " - << "rotation: " << rotstr << "\t90., " << convertRadToDeg(phix) << ", 90.," - << convertRadToDeg(phiy) << ", 0, 0"; + << "rotation: " << rotstr << "\t90., " << convertRadToDeg(phix) << ", 90.," + << convertRadToDeg(phiy) << ", 0, 0"; rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.); } } mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); edm::LogVerbatim("TECGeom") << "test " << child.name() << " number " << copyNo << " positioned in " << mother.name() - << " at " << tran << " with " << rotation; + << " at " << tran << " with " << rotation; copyNo++; } edm::LogVerbatim("TECGeom") << "<<== End of DDTECOptoHybAlgo construction ..."; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc index c9ce7dc29f9a6..d03e66ce3eb8c 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAlgo.cc @@ -22,11 +22,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number edm::LogVerbatim("TECGeom") << "debug: Parameters for " - << "positioning--" - << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " << convertRadToDeg(incrAngle) - << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " << number << " Start/Increment " - << startCopyNo << ", " << incrCopyNo; - edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + << "positioning--" + << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " + << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " + << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo; + edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + << ns.name(); if (number > 0) { double theta = 90._deg; @@ -37,8 +38,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0, 0); Position tran(0., 0., (i % 2 == 0) ? zIn : zOut); /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() - << " at " << tran << " with " << rotation; + edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " + << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc index f093dacbc2cad..2250e2d3ee095 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTECPhiAltAlgo.cc @@ -23,11 +23,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number edm::LogVerbatim("TECGeom") << "debug: Parameters for " - << "positioning--" - << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " << convertRadToDeg(incrAngle) - << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " << number << " Start/Increment " - << startCopyNo << ", " << incrCopyNo; - edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + << "positioning--" + << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " + << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " + << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo; + edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + << ns.name(); if (number > 0) { double theta = 90._deg; @@ -38,8 +39,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, 0e0, 0e0, theta, phiz); Position tran(radius * cos(phiz), radius * sin(phiz), (i % 2 == 0) ? zIn : zOut); mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name() - << " at " << tran << " with " << rotation; + edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " + << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc index e37b9aa95ae27..2777ac977bdce 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc @@ -94,18 +94,20 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex }; edm::LogVerbatim("TIBGeom") << "Parent " << mother << " NameSpace " << ns.name() << " General Material " << genMat; - edm::LogVerbatim("TIBGeom") << "Lower layer Radius " << radiusLo << " Number " << stringsLo << " String " << detectorLo; - edm::LogVerbatim("TIBGeom") << "Upper layer Radius " << radiusUp << " Number " << stringsUp << " String " << detectorUp; - edm::LogVerbatim("TIBGeom") << "Cylinder Material/thickness " << cylinderMat << " " << cylinderT << " Rib Material " << ribMat - << " at " << ribW.size() << " positions with width/phi"; + edm::LogVerbatim("TIBGeom") << "Lower layer Radius " << radiusLo << " Number " << stringsLo << " String " + << detectorLo; + edm::LogVerbatim("TIBGeom") << "Upper layer Radius " << radiusUp << " Number " << stringsUp << " String " + << detectorUp; + edm::LogVerbatim("TIBGeom") << "Cylinder Material/thickness " << cylinderMat << " " << cylinderT << " Rib Material " + << ribMat << " at " << ribW.size() << " positions with width/phi"; for (unsigned int i = 0; i < ribW.size(); i++) { edm::LogVerbatim("TIBGeom") << "\tribW[" << i << "] = " << ribW[i] << "\tribPhi[" << i - << "] = " << convertRadToDeg(ribPhi[i]); + << "] = " << convertRadToDeg(ribPhi[i]); } edm::LogVerbatim("TIBGeom") << "DOHM Primary " - << " Material " << dohmPrimMaterial << " Length " << dohmPrimL; + << " Material " << dohmPrimMaterial << " Length " << dohmPrimL; edm::LogVerbatim("TIBGeom") << "DOHM Aux " - << " Material " << dohmAuxMaterial << " Length " << dohmAuxL; + << " Material " << dohmAuxMaterial << " Length " << dohmAuxL; for (double i : dohmListFW) { if (i > 0.) edm::LogVerbatim("TIBGeom") << "DOHM Primary at FW Position " << i; @@ -148,7 +150,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex double rmax = MFRingOutR; Solid solid = ns.addSolidNS(ns.prepend(idName), Tube(rmin, rmax, 0.5 * layerL)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rmin << " Rout " << rmax << " ZHalf " << 0.5 * layerL; + << " with Rin " << rmin << " Rout " << rmax << " ZHalf " << 0.5 * layerL; Volume layer = ns.addVolumeNS(Volume(ns.prepend(idName), solid, ns.material(genMat))); //Internal layer first @@ -158,7 +160,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex string name = idName + "Down"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; + << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; Volume layerIn = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = layer.placeVolume(layerIn, 1); LogPosition(pv); @@ -182,7 +184,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex name = idName + "Up"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; + << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; Volume layerOut = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = layer.placeVolume(layerOut, 1); LogPosition(pv); @@ -209,8 +211,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rout = cylinderInR + cylinderT; name = idName + "Cylinder"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << cylinderMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << cylinderMat << " from 0 to " + << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " + << 0.5 * layerL; Volume cylinder = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(cylinderMat))); pv = layer.placeVolume(cylinder, 1); LogPosition(pv); @@ -223,7 +226,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex name = idName + "CylinderIn"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, 0.5 * layerL)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; + << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL; Volume cylinderIn = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); pv = cylinder.placeVolume(cylinderIn, 1); LogPosition(pv); @@ -234,7 +237,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex name = idName + "Filler"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, fillerDz)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << fillerMat << " from " << 0. << " to " - << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << fillerDz; + << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " + << fillerDz; Volume cylinderFiller = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(fillerMat))); pv = cylinderIn.placeVolume(cylinderFiller, 1, Position(0.0, 0.0, 0.5 * layerL - fillerDz)); LogPosition(pv); @@ -253,9 +257,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex double _rmi = std::min(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); double _rma = std::max(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); solid = ns.addSolidNS(ns.prepend(name), Tube(_rmi, _rma, dz, -0.5 * width, 0.5 * width)); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width) - << " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5 * dd4hep::mm << " Rout " - << rout - 0.5 * dd4hep::mm << " ZHalf " << dz; + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " + << -0.5 * convertRadToDeg(width) << " to " << 0.5 * convertRadToDeg(width) + << " with Rin " << rin + 0.5 * dd4hep::mm << " Rout " << rout - 0.5 * dd4hep::mm + << " ZHalf " << dz; Volume cylinderRib = ns.addVolumeNS(Volume(ns.prepend(name), solid, matrib)); double phix = ribPhi[i]; double theta = 90_deg; @@ -274,8 +279,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rout = rin + MFRingT; name = idName + "InnerMFRing"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, MFRingDz)); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFIntRingMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz; + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFIntRingMat << " from 0 to " + << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " + << MFRingDz; Volume inmfr = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(MFIntRingMat))); @@ -290,8 +296,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex rin = rout - MFRingT; name = idName + "OuterMFRing"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, MFRingDz)); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFExtRingMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz; + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << MFExtRingMat << " from 0 to " + << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " + << MFRingDz; Volume outmfr = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(MFExtRingMat))); pv = layer.placeVolume(outmfr, 1, Position(0.0, 0.0, -0.5 * layerL + MFRingDz)); @@ -311,7 +318,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, centDz)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; + << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; Volume cent1 = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(centMat))); pv = layer.placeVolume(cent1, 1, Position(0.0, 0.0, centZ)); @@ -324,7 +331,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex name = idName + "CentRing2"; solid = ns.addSolidNS(ns.prepend(name), Tube(rin, rout, centDz)); edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; + << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz; Volume cent2 = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(centMat))); pv = layer.placeVolume(cent2, 1, Position(0e0, 0e0, centZ)); @@ -341,10 +348,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF); double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz; - solid = ns.addSolidNS(ns.prepend(name), Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff)); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << dohmCarrierMaterial << " from " << dohmCarrierPhiOff - << " to " << 180._deg - dohmCarrierPhiOff << " with Rin " << dohmCarrierRin << " Rout " - << MFRingOutR << " ZHalf " << dohmCarrierDz; + solid = ns.addSolidNS( + ns.prepend(name), + Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff)); + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << dohmCarrierMaterial << " from " + << dohmCarrierPhiOff << " to " << 180._deg - dohmCarrierPhiOff << " with Rin " + << dohmCarrierRin << " Rout " << MFRingOutR << " ZHalf " << dohmCarrierDz; // Define FW and BW carrier logical volume and // place DOHM Primary and auxiliary modules inside it @@ -491,8 +500,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex solid = ns.addSolidNS(ns.prepend(name), Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, pillarDPhi)); Volume Pillar = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(pillarMaterial))); - edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi << " to " - << pillarDPhi << " with Rin " << pillarRin << " Rout " << pillarRout << " ZHalf " << pillarDz; + edm::LogVerbatim("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi + << " to " << pillarDPhi << " with Rin " << pillarRin << " Rout " << pillarRout + << " ZHalf " << pillarDz; Position pillarTran; Rotation3D pillarRota; int pillarReplica = 0; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc index 93c9ce8f4060b..a00d7d8ccf3b1 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModuleAlgo.cc @@ -73,42 +73,44 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double coolThick = args.dble("CoolInsertThick"); // thickness double coolWidth = args.dble("CoolInsertWidth"); // width - edm::LogVerbatim("TIDGeom") << "Parent " << mother << " General Material " << genMat << " Detector Planes " << detectorN; + edm::LogVerbatim("TIDGeom") << "Parent " << mother << " General Material " << genMat << " Detector Planes " + << detectorN; - edm::LogVerbatim("TIDGeom") << "ModuleThick " << moduleThick << " Detector Tilt " << convertRadToDeg(detTilt) << " Height " - << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) " << dlBottom << " dl(Hybrid) " << dlHybrid - << " doComponents " << doComponents; + edm::LogVerbatim("TIDGeom") << "ModuleThick " << moduleThick << " Detector Tilt " << convertRadToDeg(detTilt) + << " Height " << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) " << dlBottom + << " dl(Hybrid) " << dlHybrid << " doComponents " << doComponents; edm::LogVerbatim("TIDGeom") << "" << boxFrameName << " Material " << boxFrameMat << " Thickness " << boxFrameThick - << " width " << boxFrameWidth << " height " << boxFrameHeight << " Extra Height at Bottom " - << bottomFrameHeight << " Overlap " << bottomFrameOver; + << " width " << boxFrameWidth << " height " << boxFrameHeight + << " Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << sideFrameName[i] << " Material " << sideFrameMat << " Width " << sideFrameWidth - << " Thickness " << sideFrameThick << " Overlap " << sideFrameOver << " Hole " - << holeFrameName[i]; + << " Thickness " << sideFrameThick << " Overlap " << sideFrameOver << " Hole " + << holeFrameName[i]; for (int i = 0; i < detectorN; i++) - edm::LogVerbatim("TIDGeom") << kaptonName[i] << " Material " << kaptonMat << " Thickness " << kaptonThick << " Overlap " - << kaptonOver << " Hole " << holeKaptonName[i]; + edm::LogVerbatim("TIDGeom") << kaptonName[i] << " Material " << kaptonMat << " Thickness " << kaptonThick + << " Overlap " << kaptonOver << " Hole " << holeKaptonName[i]; - edm::LogVerbatim("TIDGeom") << "Wafer Material " << waferMat << " Side Width Top " << sideWidthTop << " Side Width Bottom " - << sideWidthBottom; + edm::LogVerbatim("TIDGeom") << "Wafer Material " << waferMat << " Side Width Top " << sideWidthTop + << " Side Width Bottom " << sideWidthBottom; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << "\twaferName[" << i << "] = " << waferName[i]; - edm::LogVerbatim("TIDGeom") << "Active Material " << activeMat << " Height " << activeHeight << " rotated by " << activeRot; + edm::LogVerbatim("TIDGeom") << "Active Material " << activeMat << " Height " << activeHeight << " rotated by " + << activeRot; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << " translated by (0," << -0.5 * backplaneThick[i] << ",0)\tactiveName[" << i - << "] = " << activeName[i] << " of thickness " << waferThick[i] - backplaneThick[i]; + << "] = " << activeName[i] << " of thickness " << waferThick[i] - backplaneThick[i]; - edm::LogVerbatim("TIDGeom") << "" << hybridName << " Material " << hybridMat << " Height " << hybridHeight << " Width " - << hybridWidth << " Thickness " << hybridThick; + edm::LogVerbatim("TIDGeom") << "" << hybridName << " Material " << hybridMat << " Height " << hybridHeight + << " Width " << hybridWidth << " Thickness " << hybridThick; edm::LogVerbatim("TIDGeom") << "Pitch Adapter Material " << pitchMat << " Height " << pitchHeight << " Thickness " - << pitchThick; + << pitchThick; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << "\tpitchName[" << i << "] = " << pitchName[i]; - edm::LogVerbatim("TIDGeom") << "Cool Element Material " << coolMat << " Height " << coolHeight << " Thickness " << coolThick - << " Width " << coolWidth; + edm::LogVerbatim("TIDGeom") << "Cool Element Material " << coolMat << " Height " << coolHeight << " Thickness " + << coolThick << " Width " << coolWidth; string name = mother; double sidfr = sideFrameWidth - sideFrameOver; // width of side frame on the sides of module @@ -152,8 +154,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Solid solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); /* Volume module = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 - << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " + << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 + << ", 0"; if (doComponents) { //Box frame @@ -162,8 +165,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dy = 0.5 * boxFrameThick; dz = 0.5 * boxFrameHeight; solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << boxFrameMat << " of dimensions " << dx << ", " << dy - << ", " << dz; + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << boxFrameMat << " of dimensions " << dx << ", " + << dy << ", " << dz; /* Volume boxFrame = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(boxFrameMat))); // Hybrid @@ -172,8 +175,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dy = 0.5 * hybridThick; dz = 0.5 * hybridHeight; solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << hybridMat << " of dimensions " << dx << ", " << dy << ", " - << dz; + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << hybridMat << " of dimensions " << dx << ", " << dy + << ", " << dz; /* Volume hybrid = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(hybridMat))); // Cool Insert @@ -182,8 +185,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dy = 0.5 * coolThick; dz = 0.5 * coolHeight; solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << coolMat << " of dimensions " << dx << ", " << dy << ", " - << dz; + edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << coolMat << " of dimensions " << dx << ", " << dy + << ", " << dz; /* Volume cool = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(coolMat))); // Loop over detectors to be placed @@ -203,9 +206,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, h1 = 0.5 * sideFrameThick; dz = 0.5 * sideFrameHeight; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz << ", 0, 0, " - << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 - << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << sideFrameMat << " of dimensions " << dz + << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 + << ", " << bbl2 << ", 0"; Volume sideFrame = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(sideFrameMat))); std::string rotstr, rotns; @@ -226,14 +229,15 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } dz /= 2.; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 - << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " + << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 + << ", 0"; Volume holeFrame = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); rot = ns.rotation(holeFrameRot[k]); sideFrame.placeVolume(holeFrame, 1, Transform3D(rot, Position(0e0, 0e0, zpos))); // copyNr=1 - edm::LogVerbatim("TIDGeom") << holeFrame.name() << " number 1 positioned in " << sideFrame.name() << " at (0,0," << zpos - << ") with no rotation"; + edm::LogVerbatim("TIDGeom") << holeFrame.name() << " number 1 positioned in " << sideFrame.name() << " at (0,0," + << zpos << ") with no rotation"; // Kapton circuit double kaptonExtraHeight = 0; // kapton extra height in the stereo @@ -264,7 +268,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // For the stereo create the uncut solid, the solid to be removed and then the subtraction solid if (k == 1) { // Uncut solid - Solid solidUncut = ns.addSolidNS(ns.prepend(kaptonName[k] + "Uncut"), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); + Solid solidUncut = + ns.addSolidNS(ns.prepend(kaptonName[k] + "Uncut"), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); // Piece to be cut dz = (dlHybrid > dlTop) ? 0.5 * dlTop : 0.5 * dlBottom; @@ -272,23 +277,25 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, bbl1 = fabs(dz * sin(detTilt)); bbl2 = bbl1 * 0.000001; double thet = atan((bbl1 - bbl2) / (2 * dz)); - Solid solidCut = ns.addSolidNS(ns.prepend(kaptonName[k] + "Cut"), Trap(dz, thet, 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); + Solid solidCut = + ns.addSolidNS(ns.prepend(kaptonName[k] + "Cut"), Trap(dz, thet, 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0)); // Subtraction Solid name = kaptonName[k]; rot = ns.rotation("tidmodpar:9PYX"); xpos = -0.5 * fullHeight * sin(detTilt); zpos = 0.5 * kaptonHeight - bbl2; - solid = ns.addSolidNS(ns.prepend(name), SubtractionSolid(solidUncut, solidCut, Transform3D(rot, Position(xpos, 0.0, zpos)))); + solid = ns.addSolidNS(ns.prepend(name), + SubtractionSolid(solidUncut, solidCut, Transform3D(rot, Position(xpos, 0.0, zpos)))); } else { name = kaptonName[k]; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); } Volume kapton = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(kaptonMat))); - edm::LogVerbatim("TIDGeom") << solid.name() << " SUBTRACTION SOLID Trap made of " << kaptonMat << " of dimensions " << dz - << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " - << bbl2 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " SUBTRACTION SOLID Trap made of " << kaptonMat + << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 + << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; // Hole in the kapton below the wafer name = holeKaptonName[k]; @@ -311,14 +318,15 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } dz /= 2.; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0., 0., h1, bbl1, bbl1, 0., h1, bbl2, bbl2, 0.)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " << h1 - << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << genMat << " of dimensions " << dz << ", 0, 0, " + << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 + << ", 0"; Volume holeKapton = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(genMat))); rot = ns.rotation(holeKaptonRot[k]); kapton.placeVolume(holeKapton, 1, Transform3D(rot, Position(xpos, 0.0, zpos))); - edm::LogVerbatim("TIDGeom") << holeKapton.name() << " number 1 positioned in " << kapton.name() << " at (0,0," << zpos - << ") with no rotation"; + edm::LogVerbatim("TIDGeom") << holeKapton.name() << " number 1 positioned in " << kapton.name() << " at (0,0," + << zpos << ") with no rotation"; // Wafer name = waferName[k]; @@ -332,8 +340,9 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, h1 = 0.5 * waferThick[k]; dz = 0.5 * fullHeight; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << waferMat << " of dimensions " << dz << ", 0, 0, " << h1 - << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << waferMat << " of dimensions " << dz + << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 + << ", " << bl2 << ", 0"; Volume wafer = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(waferMat))); // Active @@ -348,14 +357,15 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dz = 0.5 * (waferThick[k] - backplaneThick[k]); // inactive backplane h1 = 0.5 * activeHeight; solid = ns.addSolidNS(ns.prepend(name), Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0)); - edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << activeMat << " of dimensions " << dz << ", 0, 0, " - << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0"; + edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << activeMat << " of dimensions " << dz + << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 + << ", " << bl1 << ", 0"; Volume active = ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(activeMat))); rot = ns.rotation(activeRot); Position tran(0.0, -0.5 * backplaneThick[k], 0.0); // from the definition of the wafer local axes wafer.placeVolume(active, 1, Transform3D(rot, tran)); // inactive backplane copyNr=1 - edm::LogVerbatim("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " << wafer.name() - << " at " << tran << " with " << rot; + edm::LogVerbatim("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " + << wafer.name() << " at " << tran << " with " << rot; //Pitch Adapter name = pitchName[k]; @@ -370,7 +380,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, dz = 0.5 * pitchHeight; solid = ns.addSolidNS(ns.prepend(name), Box(dx, dy, dz)); edm::LogVerbatim("TIDGeom") << solid.name() << " Box made of " << pitchMat << " of dimensions" - << " " << dx << ", " << dy << ", " << dz; + << " " << dx << ", " << dy << ", " << dz; } else { h1 = 0.5 * pitchThick; bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt); @@ -383,8 +393,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double thet = atan((bl1 - bl2) / (2. * dz)); solid = ns.addSolidNS(ns.prepend(name), Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0)); edm::LogVerbatim("TIDGeom") << solid.name() << " Trap made of " << pitchMat << " of " - << "dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", " << bl1 - << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; + << "dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", " + << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0"; } /* Volume pa = */ ns.addVolumeNS(Volume(ns.prepend(name), solid, ns.material(pitchMat))); } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc index eb63799eb19ed..13ac75c25b683 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDModulePosAlgo.cc @@ -67,17 +67,17 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, edm::LogVerbatim("TIDGeom") << "Parent " << parentName << " Detector Planes " << detectorN; edm::LogVerbatim("TIDGeom") << "Detector Tilt " << convertRadToDeg(detTilt) << " Height " << fullHeight << " dl(Top) " - << dlTop << " dl(Bottom) " << dlBottom << " dl(Hybrid) " << dlHybrid; + << dlTop << " dl(Bottom) " << dlBottom << " dl(Hybrid) " << dlHybrid; edm::LogVerbatim("TIDGeom") << boxFrameName << " positioned at Z"; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << "\tboxFrameZ[" << i << "] = " << boxFrameZ[i]; edm::LogVerbatim("TIDGeom") << "\t Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver; for (int i = 0; i < detectorN; i++) - edm::LogVerbatim("TIDGeom") << "\tsideFrame[" << i << "] = " << sideFrameName[i] << " positioned at Z " << sideFrameZ[i] - << " with rotation " << sideFrameRot[i]; + edm::LogVerbatim("TIDGeom") << "\tsideFrame[" << i << "] = " << sideFrameName[i] << " positioned at Z " + << sideFrameZ[i] << " with rotation " << sideFrameRot[i]; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << "\tkapton[" << i << "] = " << kaptonName[i] << " positioned at Z " << kaptonZ[i] - << " with rotation " << kaptonRot[i]; + << " with rotation " << kaptonRot[i]; for (int i = 0; i < detectorN; i++) edm::LogVerbatim("TIDGeom") << waferName[i] << " positioned at Z " << waferZ[i] << " with rotation " << waferRot[i]; edm::LogVerbatim("TIDGeom") << hybridName << " Height " << hybridHeight << " Z"; @@ -163,7 +163,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, copy++; parentVol.placeVolume(ns.volume(name), copy, Position(xpos, ypos, zpos)); edm::LogVerbatim("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " - << Position(xpos, ypos, zpos) << " with " << rot; + << Position(xpos, ypos, zpos) << " with " << rot; xpos = -xpos; } } @@ -181,7 +181,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, zpos = zBotSpacers - zCenter; parentVol.placeVolume(ns.volume(name), 1, Position(0.0, ypos, zpos)); edm::LogVerbatim("TIDGeom") << name << " number " << 1 << " positioned in " << parentName << " at " - << Position(0.0, ypos, zpos) << " with no rotation"; + << Position(0.0, ypos, zpos) << " with no rotation"; // Side Spacers (Alumina) name = sidSpacersName; ypos = sidSpacersZ; @@ -212,7 +212,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = makeRotation3D(thetax, phix, thetay, phiy, thetaz, phiz); parentVol.placeVolume(ns.volume(name), copy, Transform3D(rot, Position(xpos, ypos, zpos))); edm::LogVerbatim("TIDGeom") << name << " number " << copy << " positioned in " << parentName << " at " - << Position(xpos, ypos, zpos) << " with " << rot; + << Position(xpos, ypos, zpos) << " with " << rot; xpos = -xpos; thetaz = -thetaz; } @@ -235,8 +235,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(waferRot[k]); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); // copyNr=k+1 - edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " - << rot; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran + << " with " << rot; //Pitch Adapter name = pitchName[k]; @@ -256,8 +256,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(pitchRot[k]); tran = Position(xpos, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); // copyNr=k+1 - edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " - << rot; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran + << " with " << rot; // Hybrid name = hybridName; @@ -300,8 +300,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(sideFrameRot[k]); tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); - edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " - << rot; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran + << " with " << rot; // Kapton circuit name = kaptonName[k]; ypos = kaptonZ[k]; @@ -322,8 +322,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rot = ns.rotation(kaptonRot[k]); tran = Position(0, ypos, zpos); parentVol.placeVolume(ns.volume(name), k + 1, Transform3D(rot, tran)); - edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran << " with " - << rot; + edm::LogVerbatim("TIDGeom") << name << " number " << k + 1 << " positioned in " << parentName << " at " << tran + << " with " << rot; } edm::LogVerbatim("TIDGeom") << "<<== End of DDTIDModulePosAlgo positioning ..."; return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc index ebb0f11a9e253..50f4a47ea7331 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTIDRingAlgo.cc @@ -22,12 +22,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, double sICC = args.value("ICCShift"); //Shift of ICC per to R vector zICC = args.value >("ICCZ"); // in Z - edm::LogVerbatim("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1] << "\tICC " - << iccName << "\tNameSpace " << ns.name(); + edm::LogVerbatim("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1] + << "\tICC " << iccName << "\tNameSpace " << ns.name(); edm::LogVerbatim("TIDGeom") << "Parameters for positioning--" - << " StartAngle " << convertRadToDeg(startAngle) << " Copy Numbers " << number << " Modules at R " - << rModule << " Z " << zModule[0] << ", " << zModule[1] << " ICCs at R " << rICC << " Z " - << zICC[0] << ", " << zICC[1]; + << " StartAngle " << convertRadToDeg(startAngle) << " Copy Numbers " << number + << " Modules at R " << rModule << " Z " << zModule[0] << ", " << zModule[1] + << " ICCs at R " << rICC << " Z " << zICC[0] << ", " << zICC[1]; double theta = 90._deg; double phiy = 0._deg; double dphi = 2_pi / number; @@ -63,8 +63,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rotation = makeRotation3D(theta, phix, thetay, phiy, theta, phiz); // int copyNr = i+1; /* PlacedVolume pv = */ mother.placeVolume(module, i + 1, Transform3D(rotation, trmod)); - edm::LogVerbatim("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << trmod - << " with " << rotation; + edm::LogVerbatim("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " + << trmod << " with " << rotation; //Now the ICC if (i % 2 == 0) { zpos = zICC[0]; @@ -78,8 +78,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, // int copyNr = i+1; Position tricc(xpos, ypos, zpos); /* PlacedVolume pv = */ mother.placeVolume(icc, i + 1, Transform3D(rotation, tricc)); - edm::LogVerbatim("TIDGeom") << icc.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << tricc - << " with " << rotation; + edm::LogVerbatim("TIDGeom") << icc.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " + << tricc << " with " << rotation; } return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc index a3e9074ae3987..e20a0aa80f93f 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBAxCableAlgo.cc @@ -25,7 +25,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: sectorNumber[" << i << "] = " << sectorNumber[i]; edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: Axial Service Sectors half-length " << sectorDz << "\tRin " - << sectorRin << "\tRout = " << sectorRout << "\tPhi of sectors position:"; + << sectorRin << "\tRout = " << sectorRout << "\tPhi of sectors position:"; for (int i = 0; i < (int)(sectorNumber.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tPhi = " << sectorStartPhi[i]; edm::LogVerbatim("TOBGeom") << "DDTOBAxCableAlgo debug: List of materials for the sectors/3 parts"; @@ -64,12 +64,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B); solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_A[i] << " from " - << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " - << rin << " Rout " << rout << " ZHalf " << dz; + << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) + << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; Volume sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_A[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName - << " with no translation and no rotation"; + << " with no translation and no rotation"; // Second Part: B name = "TOBAxService_" + sectorNumber[i] + "B"; @@ -77,13 +77,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, deltaphi = sectorDeltaPhi_B; solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_B[i] << " from " - << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " - << rin << " Rout " << rout << " ZHalf " << dz; + << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) + << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_B[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName - << " with no translation and no rotation"; + << " with no translation and no rotation"; // Third Part: C name = "TOBAxService_" + sectorNumber[i] + "C"; @@ -91,12 +91,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, deltaphi = 0.5 * (widthphi - sectorDeltaPhi_B); solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz, startphi, startphi + deltaphi)); edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << sectorMaterial_C[i] << " from " - << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) << " with Rin " - << rin << " Rout " << rout << " ZHalf " << dz; + << convertRadToDeg(startphi) << " to " << convertRadToDeg((startphi + deltaphi)) + << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; sectorLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(sectorMaterial_C[i]))); tubsVol.placeVolume(sectorLogic, i + 1); // copyNr: i+1 edm::LogVerbatim("TOBGeom") << sectorLogic.name() << " number " << i + 1 << " positioned in " << tubsName - << " with no translation and no rotation"; + << " with no translation and no rotation"; } edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBAxCableAlgo construction ..."; return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc index 088e54e0c2d3b..0d793b05d9e8c 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRadCableAlgo.cc @@ -36,23 +36,26 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, string parentName = args.parentName(); edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << ns.name(); edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz << "\tRMax " << rMax - << "\tCable Thickness " << cableT << "\tRadii of disk position and cable materials:"; + << "\tCable Thickness " << cableT << "\tRadii of disk position and cable materials:"; for (int i = 0; i < (int)(rodRin.size()); i++) - edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " << cableM[i]; + edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " + << cableM[i]; edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT - << "\tMaterials: "; + << "\tMaterials: "; for (int i = 0; i < (int)(connM.size()); i++) edm::LogVerbatim("TOBGeom") << "\tconnM[" << i << "] = " << connM[i]; - edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin << " Rout = " << coolRout1 - << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1 - << "\t Material = " << coolM1 << "\t Radial positions:"; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin + << " Rout = " << coolRout1 << "\t Phi start = " << coolStartPhi1 + << " Phi Range = " << coolDeltaPhi1 << "\t Material = " << coolM1 + << "\t Radial positions:"; for (int i = 0; i < (int)(coolR1.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; for (int i = 0; i < (int)(coolR2.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i]; - edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin << " Rout = " << coolRout2 - << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2 - << "\t Material = " << coolM2 << "\t Radial positions:"; + edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin + << " Rout = " << coolRout2 << "\t Phi start = " << coolStartPhi2 + << " Phi Range = " << coolDeltaPhi2 << "\t Material = " << coolM2 + << "\t Radial positions:"; for (int i = 0; i < (int)(coolR1.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i]; for (int i = 0; i < (int)(coolR2.size()); i++) @@ -71,48 +74,52 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, name = "TOBCoolingManifold" + names[i] + "a"; dz = coolRout1; solid = ns.addSolid(ns.prepend(name), Torus(coolR1[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " - << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin << " Rout " - << coolRout1 << " R torus " << coolR1[i]; + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " + << convertRadToDeg(coolStartPhi1) << " to " + << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin + << " Rout " << coolRout1 << " R torus " << coolR1[i]; Volume coolManifoldLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1))); Position r1(0, 0, (dz - diskDz)); disk.placeVolume(coolManifoldLogic_a, i + 1, r1); // i+1 - edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 - << " with no rotation"; + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " + << r1 << " with no rotation"; // Cooling Fluid (in Cooling Manifold) name = "TOBCoolingManifoldFluid" + names[i] + "a"; solid = ns.addSolid(ns.prepend(name), Torus(coolR1[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " - << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin << " Rout " - << coolRout2 << " R torus " << coolR1[i]; + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " + << convertRadToDeg(coolStartPhi2) << " to " + << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin + << " Rout " << coolRout2 << " R torus " << coolR1[i]; Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2))); coolManifoldLogic_a.placeVolume(coolManifoldFluidLogic_a, i + 1); // i+1 edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2 - << " with no translation and no rotation"; + << " with no translation and no rotation"; name = "TOBCoolingManifold" + names[i] + "r"; dz = coolRout1; solid = ns.addSolid(ns.prepend(name), Torus(coolR2[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " << convertRadToDeg(coolStartPhi1) << " to " - << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin << " Rout " - << coolRout1 << " R torus " << coolR2[i]; + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM1 << " from " + << convertRadToDeg(coolStartPhi1) << " to " + << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin + << " Rout " << coolRout1 << " R torus " << coolR2[i]; Volume coolManifoldLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1))); r1 = Position(0, 0, (dz - diskDz)); disk.placeVolume(coolManifoldLogic_r, i + 1, r1); // i+1 - edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1 - << " with no rotation"; + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " + << r1 << " with no rotation"; // Cooling Fluid (in Cooling Manifold) name = "TOBCoolingManifoldFluid" + names[i] + "r"; solid = ns.addSolid(ns.prepend(name), Torus(coolR2[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " << convertRadToDeg(coolStartPhi2) << " to " - << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin << " Rout " - << coolRout2 << " R torus " << coolR2[i]; + edm::LogVerbatim("TOBGeom") << solid.name() << " Torus made of " << coolM2 << " from " + << convertRadToDeg(coolStartPhi2) << " to " + << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin + << " Rout " << coolRout2 << " R torus " << coolR2[i]; Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2))); coolManifoldLogic_r.placeVolume(coolManifoldFluidLogic_r, i + 1); // i+1 edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2 - << " with no translation and no rotation"; + << " with no translation and no rotation"; // Connectors name = "TOBConn" + names[i]; @@ -120,13 +127,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, rin = 0.5 * (rodRin[i] + rodRout[i]) - 0.5 * connW; rout = 0.5 * (rodRin[i] + rodRout[i]) + 0.5 * connW; solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << connM[i] << " from 0 to " << convertRadToDeg(2_pi) - << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; + edm::LogVerbatim("TOBGeom") << solid.name() << " Tubs made of " << connM[i] << " from 0 to " + << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz; Volume connLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(connM[i]))); Position r2(0, 0, (dz - diskDz)); disk.placeVolume(connLogic, i + 1, r2); // i+1 - edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r2 - << " with no rotation"; + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " + << r2 << " with no rotation"; // Now the radial cable name = "TOBRadServices" + names[i]; @@ -145,16 +152,16 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, pgonRmax.emplace_back(rout); pgonRmax.emplace_back(rout); solid = ns.addSolid(ns.prepend(name), Polycone(0, 2_pi, pgonRmin, pgonRmax, pgonZ)); - edm::LogVerbatim("TOBGeom") << solid.name() << " Polycone made of " << cableM[i] << " from 0 to " << convertRadToDeg(2_pi) - << " and with " << pgonZ.size() << " sections"; + edm::LogVerbatim("TOBGeom") << solid.name() << " Polycone made of " << cableM[i] << " from 0 to " + << convertRadToDeg(2_pi) << " and with " << pgonZ.size() << " sections"; for (int ii = 0; ii < (int)(pgonZ.size()); ii++) edm::LogVerbatim("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii] - << "\tRmax = " << pgonRmax[ii]; + << "\tRmax = " << pgonRmax[ii]; Volume cableLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(cableM[i]))); Position r3(0, 0, (diskDz - (i + 0.5) * cableT)); disk.placeVolume(cableLogic, i + 1, r3); // i+1 - edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " << r3 - << " with no rotation"; + edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at " + << r3 << " with no rotation"; } edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ..."; return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc index b628a33c4fcd1..f4bb6591017a0 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTOBRodAlgo.cc @@ -65,44 +65,44 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector aohY = args.vecDble("AOHy"); // AOH translation with respect small-ICC center (Y) vector aohZ = args.vecDble("AOHz"); // AOH translation with respect small-ICC center (Z) - edm::LogVerbatim("TOBGeom") << "Parent " << parentName << " Central " << central << " NameSpace " << ns.name() << "\tShift " - << shift; + edm::LogVerbatim("TOBGeom") << "Parent " << parentName << " Central " << central << " NameSpace " << ns.name() + << "\tShift " << shift; for (int i = 0; i < (int)(sideRod.size()); i++) { - edm::LogVerbatim("TOBGeom") << sideRod[i] << " to be positioned " << sideRodX.size() << " times at y = " << sideRodY[i] - << " z = " << sideRodZ[i] << " and x"; + edm::LogVerbatim("TOBGeom") << sideRod[i] << " to be positioned " << sideRodX.size() + << " times at y = " << sideRodY[i] << " z = " << sideRodZ[i] << " and x"; for (double j : sideRodX) edm::LogVerbatim("TOBGeom") << "\tsideRodX[" << i << "] = " << j; } edm::LogVerbatim("TOBGeom") << endRod1 << " to be " - << "positioned " << endRod1Y.size() << " times at"; + << "positioned " << endRod1Y.size() << " times at"; for (int i = 0; i < (int)(endRod1Y.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\ty = " << endRod1Y[i] << "\tz = " << endRod1Z[i]; edm::LogVerbatim("TOBGeom") << endRod2 << " to be " - << "positioned at y = " << endRod2Y << " z = " << endRod2Z; + << "positioned at y = " << endRod2Y << " z = " << endRod2Z; edm::LogVerbatim("TOBGeom") << cable << " to be " - << "positioned at z = " << cableZ; + << "positioned at z = " << cableZ; edm::LogVerbatim("TOBGeom") << clamp << " to be " - << "positioned " << clampX.size() << " times at"; + << "positioned " << clampX.size() << " times at"; for (int i = 0; i < (int)(clampX.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << clampX[i] << "\tz = " << clampZ[i]; edm::LogVerbatim("TOBGeom") << sideCool << " to be " - << "positioned " << sideCoolX.size() << " times at"; + << "positioned " << sideCoolX.size() << " times at"; for (int i = 0; i < (int)(sideCoolX.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideCoolX[i] << "\ty = " << sideCoolY[i] - << "\tz = " << sideCoolZ[i]; + << "\tz = " << sideCoolZ[i]; edm::LogVerbatim("TOBGeom") << endCool << " to be " - << "positioned with " << endCoolRot << " rotation at" - << " y = " << endCoolY << " z = " << endCoolZ; + << "positioned with " << endCoolRot << " rotation at" + << " y = " << endCoolY << " z = " << endCoolZ; edm::LogVerbatim("TOBGeom") << optFibre << " to be " - << "positioned " << optFibreX.size() << " times at"; + << "positioned " << optFibreX.size() << " times at"; for (int i = 0; i < (int)(optFibreX.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << optFibreX[i] << "\tz = " << optFibreZ[i]; edm::LogVerbatim("TOBGeom") << sideClamp1 << " to be " - << "positioned " << sideClampX.size() << " times at"; + << "positioned " << sideClampX.size() << " times at"; for (int i = 0; i < (int)(sideClampX.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp1DZ[i]; edm::LogVerbatim("TOBGeom") << sideClamp2 << " to be " - << "positioned " << sideClampX.size() << " times at"; + << "positioned " << sideClampX.size() << " times at"; for (int i = 0; i < (int)(sideClampX.size()); i++) edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tx = " << sideClampX[i] << "\tdz = " << sideClamp2DZ[i]; edm::LogVerbatim("TOBGeom") << "DDTOBRodAlgo debug:\t" << module << " positioned " << moduleRot.size() << " times"; @@ -114,7 +114,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, edm::LogVerbatim("TOBGeom") << "DDTOBRodAlgo debug:\t" << aohName << " AOH will be positioned on ICC's"; for (int i = 0; i < (int)(aohCopies.size()); i++) edm::LogVerbatim("TOBGeom") << " copies " << aohCopies[i] << "\tx = " << aohX[i] << "\ty = " << aohY[i] - << "\tz = " << aohZ[i]; + << "\tz = " << aohZ[i]; const string& centName = central; string child; @@ -128,7 +128,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = sideRod[i]; rod.placeVolume(ns.volume(child), j + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << j + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } } // Clamps @@ -137,7 +137,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = clamp; rod.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } // Side Cooling tubes for (int i = 0; i < (int)(sideCoolX.size()); i++) { @@ -145,7 +145,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = sideCool; rod.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } // Optical Fibres for (int i = 0; i < (int)(optFibreX.size()); i++) { @@ -153,7 +153,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = optFibre; rod.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } // Side Clamps @@ -163,7 +163,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = sideClamp1; rod.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } for (int i = 0; i < (int)(sideClamp2DZ.size()); i++) { int j = i / 2; @@ -171,7 +171,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = sideClamp2; rod.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << rodName << " at " << r - << " with no rotation"; + << " with no rotation"; } Volume cent = ns.volume(centName); @@ -181,13 +181,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = endRod1; cent.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r - << " with no rotation"; + << " with no rotation"; } Position r1(0, endRod2Y, shift + endRod2Z); child = endRod2; cent.placeVolume(ns.volume(child), 1, r1); edm::LogVerbatim("TOBGeom") << child << " number 1 " - << "positioned in " << centName << " at " << r1 << " with no rotation"; + << "positioned in " << centName << " at " << r1 << " with no rotation"; // End cooling tubes Position r2(0, endCoolY, shift + endCoolZ); @@ -195,14 +195,14 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = endCool; cent.placeVolume(ns.volume(child), 1, Transform3D(rot2, r2)); edm::LogVerbatim("TOBGeom") << child << " number 1 " - << "positioned in " << centName << " at " << r2 << " with " << rot2; + << "positioned in " << centName << " at " << r2 << " with " << rot2; //Mother cable Position r3(0, 0, shift + cableZ); child = cable; cent.placeVolume(ns.volume(child), 1, r3); edm::LogVerbatim("TOBGeom") << child << " number 1 " - << "positioned in " << centName << " at " << r3 << " with no rotation"; + << "positioned in " << centName << " at " << r3 << " with no rotation"; //Modules for (int i = 0; i < (int)(moduleRot.size()); i++) { @@ -210,8 +210,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, const Rotation3D& rot = ns.rotation(moduleRot[i]); child = module; cent.placeVolume(ns.volume(child), i + 1, Transform3D(rot, r)); - edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r << " with " - << rot; + edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r + << " with " << rot; } //Connectors (ICC, CCUM, ...) @@ -220,7 +220,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = connect[i]; cent.placeVolume(ns.volume(child), i + 1, r); edm::LogVerbatim("TOBGeom") << child << " number " << i + 1 << " positioned in " << centName << " at " << r - << " with no rotation"; + << " with no rotation"; } //AOH (only on ICCs) @@ -233,7 +233,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = aohName; cent.placeVolume(ns.volume(child), copyNumber, r); edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r - << " with no rotation"; + << " with no rotation"; // if two copies add a copy with (-aohX,-aohZ) translation if (aohCopies[i] == 2) { copyNumber++; @@ -241,7 +241,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, child = aohName; cent.placeVolume(ns.volume(child), copyNumber, r); edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << r - << " with no rotation"; + << " with no rotation"; } // if four copies add 3 copies with (-aohX,+aohZ) (-aohX,-aohZ) (+aohX,+aohZ) and translations if (aohCopies[i] == 4) { @@ -263,8 +263,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, cent.placeVolume(ns.volume(child), copyNumber, rr); // copyNumber break; } - edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " << rr - << " with no rotation"; + edm::LogVerbatim("TOBGeom") << child << " number " << copyNumber << " positioned in " << centName << " at " + << rr << " with no rotation"; } } } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc index 91fda21ae8957..8a512cf1e49b2 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerLinear.cc @@ -23,9 +23,10 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, edm::LogVerbatim("TrackerGeom") << "DDTrackerLinear +++ Executing Algorithm. rParent:" << mother.name(); edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " - << ns.name() << "\tNumber " << number << "\tAxis (theta/phi) " << theta / dd4hep::deg << ", " - << phi / dd4hep::deg << "\t(Offset/Delta) " << offset << ", " << delta << "\tCentre " - << centre[0] << ", " << centre[1] << ", " << centre[2] << "\tRotation " << rotMat; + << ns.name() << "\tNumber " << number << "\tAxis (theta/phi) " << theta / dd4hep::deg + << ", " << phi / dd4hep::deg << "\t(Offset/Delta) " << offset << ", " << delta + << "\tCentre " << centre[0] << ", " << centre[1] << ", " << centre[2] << "\tRotation " + << rotMat; Position direction(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta)); Position base(centre[0], centre[1], centre[2]); @@ -36,8 +37,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Position tran = base + (offset + double(i) * delta) * direction; mother.placeVolume(child, ci, Transform3D(rot, tran)); - edm::LogVerbatim("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at " << tran - << " with " << rot; + edm::LogVerbatim("TrackerGeom") << child.name() << " number " << ci << " positioned in " << mother.name() << " at " + << tran << " with " << rot; } return cms::s_executed; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc index 60587db4e80bf..23bdb2141ca9c 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAlgo.cc @@ -23,18 +23,18 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, if (numcopies != int(phi.size())) { edm::LogVerbatim("TrackerGeom") << "error: Parameter " - << "NumCopies does not agree with the size " - << "of the Phi vector. It was adjusted to " - << "be the size of the Phi vector and may " - << "lead to crashes or errors."; + << "NumCopies does not agree with the size " + << "of the Phi vector. It was adjusted to " + << "be the size of the Phi vector and may " + << "lead to crashes or errors."; } edm::LogVerbatim("TrackerGeom") << "debug: Parameters for position" - << "ing:: " - << " Radius " << radius << " Tilt " << tilt << " Copies " << phi.size() << " at"; + << "ing:: " + << " Radius " << radius << " Tilt " << tilt << " Copies " << phi.size() << " at"; for (int i = 0; i < (int)(phi.size()); i++) edm::LogVerbatim("TrackerGeom") << "\t[" << i << "] phi = " << phi[i] << " z = " << zpos[i]; edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " - << ns.name(); + << ns.name(); double theta = 90._deg; int ci = startcn; @@ -46,8 +46,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, Rotation3D rot = makeRotation3D(theta, phix, theta, phiy, 0., 0.); Position tran(xpos, ypos, zpos[i]); /* PlacedVolume pv = */ mother.placeVolume(child, ci, Transform3D(rot, tran)); - edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " << mother.name() - << " at " << tran << " with " << rot; + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " + << mother.name() << " at " << tran << " with " << rot; ci = ci + incrcn; } return 1; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc index a6b30faf3981b..591f20cb799a2 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerPhiAltAlgo.cc @@ -23,11 +23,13 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, int startCopyNo = args.find("StartCopyNo") ? args.value("StartCopyNo") : 1; //Start copy number int incrCopyNo = args.find("IncrCopyNo") ? args.value("IncrCopyNo") : 1; //Increment in copy number - edm::LogVerbatim("TrackerGeom") << "Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name(); + edm::LogVerbatim("TrackerGeom") << "Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " + << ns.name(); edm::LogVerbatim("TrackerGeom") << "Parameters for positioning-- Tilt " << tilt << "\tStartAngle " - << convertRadToDeg(startAngle) << "\tRangeAngle " << convertRadToDeg(rangeAngle) << "\tRin " - << radiusIn << "\tRout " << radiusOut << "\t ZPos " << zpos << "\tCopy Numbers " << number - << " Start/Increment " << startCopyNo << ", " << incrCopyNo; + << convertRadToDeg(startAngle) << "\tRangeAngle " << convertRadToDeg(rangeAngle) + << "\tRin " << radiusIn << "\tRout " << radiusOut << "\t ZPos " << zpos + << "\tCopy Numbers " << number << " Start/Increment " << startCopyNo << ", " + << incrCopyNo; if (number > 0) { double theta = 90._deg; @@ -59,8 +61,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, } Position tran(xpos, ypos, zpos); /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation, tran)); - edm::LogVerbatim("TrackerGeom") << "" << child.name() << " number " << copyNo << " positioned in " << mother.name() - << " at " << tran << " with " << rotation; + edm::LogVerbatim("TrackerGeom") << "" << child.name() << " number " << copyNo << " positioned in " + << mother.name() << " at " << tran << " with " << rotation; copyNo += incrCopyNo; } } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc index 1a60725e622b6..45239a3631533 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerRingAlgo.cc @@ -40,36 +40,36 @@ namespace { } edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo debug: Parameters for position" - << "ing:: n " << n << " Start, Range, Delta " << convertRadToDeg(startAngle) << " " - << convertRadToDeg(rangeAngle) << " " << convertRadToDeg(delta) << " Radius " << radius - << " Centre " << center[0] << ", " << center[1] << ", " << center[2]; + << "ing:: n " << n << " Start, Range, Delta " << convertRadToDeg(startAngle) << " " + << convertRadToDeg(rangeAngle) << " " << convertRadToDeg(delta) << " Radius " + << radius << " Centre " << center[0] << ", " << center[1] << ", " << center[2]; edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo debug: Parent " << parentName << "\tChild " << childName - << " NameSpace " << ns.name(); + << " NameSpace " << ns.name(); Rotation3D flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix; // Identity matrix // flipMatrix calculus if (isFlipped) { edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " - << "\t90., 180., " - << "90., 90., " - << "180., 0."; + << "\t90., 180., " + << "90., 90., " + << "180., 0."; flipMatrix = makeRotation3D(90._deg, 180._deg, 90._deg, 90._deg, 180._deg, 0._deg); } // tiltMatrix calculus if (isZPlus) { edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " - << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 180., " - << convertRadToDeg(90._deg - tiltAngle) << ", 0."; + << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 180., " + << convertRadToDeg(90._deg - tiltAngle) << ", 0."; tiltMatrix = makeRotation3D(90._deg, 90._deg, tiltAngle, 180._deg, 90._deg - tiltAngle, 0._deg); if (isFlipped) { tiltMatrix *= flipMatrix; } } else { edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " - << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 0., " - << convertRadToDeg(90._deg + tiltAngle) << ", 0."; + << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 0., " + << convertRadToDeg(90._deg + tiltAngle) << ", 0."; tiltMatrix = makeRotation3D(90._deg, 90._deg, tiltAngle, 0._deg, 90._deg + tiltAngle, 0._deg); if (isFlipped) { tiltMatrix *= flipMatrix; @@ -87,8 +87,8 @@ namespace { double phiy = phix + 90._deg; if (phix != 0.) { edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " - << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) - << ", 0., 0."; + << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy) + << ", 0., 0."; phiRotMatrix = makeRotation3D(theta, phix, theta, phiy, 0., 0.); } @@ -103,8 +103,8 @@ namespace { // Positions child with respect to parent mother.placeVolume(child, copy, Transform3D(globalRotMatrix, tran)); edm::LogVerbatim("TrackerGeom") << "DDTrackerRingAlgo test " << child.data()->GetName() << " number " << copy - << " positioned in " << mother.data()->GetName() << " at " << tran << " with " - << globalRotMatrix; + << " positioned in " << mother.data()->GetName() << " at " << tran << " with " + << globalRotMatrix; copy += incrCopyNo; phi += delta; diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc index a8a93a91b197a..c653ee9dc95d8 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerXYZPosAlgo.cc @@ -19,11 +19,11 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector rotMat = args.value >("Rotations"); // Names of rotation matrices edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " - << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo - << "\tNumber " << xvec.size() << ", " << yvec.size() << ", " << zvec.size(); + << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo + << "\tNumber " << xvec.size() << ", " << yvec.size() << ", " << zvec.size(); for (int i = 0; i < (int)(zvec.size()); i++) { - edm::LogVerbatim("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" << i - << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; + edm::LogVerbatim("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" + << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; } for (int i = 0, copy = startCopyNo; i < (int)(zvec.size()); i++, copy += incrCopyNo) { @@ -32,8 +32,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, /* PlacedVolume pv = */ rotMat[i] != "NULL" ? mother.placeVolume(child, copy, Transform3D(ns.rotation(rotMat[i]), tran)) : mother.placeVolume(child, tran); - edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() - << " at " << tran << " with " << rot; + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " + << mother.name() << " at " << tran << " with " << rot; } return 1; } diff --git a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc index e2d01d5f4a629..0a32d96ad7099 100644 --- a/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc +++ b/Geometry/TrackerCommonData/plugins/dd4hep/DDTrackerZPosAlgo.cc @@ -17,8 +17,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, vector rotMat = args.value >("Rotations"); // Names of rotation matrices edm::LogVerbatim("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " - << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo - << "\tNumber " << zvec.size(); + << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo + << "\tNumber " << zvec.size(); for (int i = 0; i < (int)(zvec.size()); i++) edm::LogVerbatim("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i]; @@ -28,8 +28,8 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, /* PlacedVolume pv = */ rotMat[i] != "NULL" ? mother.placeVolume(child, copy, Transform3D(ns.rotation(rotMat[i]), tran)) : mother.placeVolume(child, copy, tran); - edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name() - << " at " << tran << " with " << rot; + edm::LogVerbatim("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " + << mother.name() << " at " << tran << " with " << rot; } return 1; } From 436d6be5b4433575668381a4d1817825950ba38e Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sun, 29 Aug 2021 00:18:07 +0200 Subject: [PATCH 204/923] Initialize fields in ProcessCallGraph and HLTRegionalEcalResonanceFilter --- HLTrigger/Timer/interface/ProcessCallGraph.h | 1 + HLTrigger/special/plugins/HLTRegionalEcalResonanceFilter.cc | 2 ++ 2 files changed, 3 insertions(+) diff --git a/HLTrigger/Timer/interface/ProcessCallGraph.h b/HLTrigger/Timer/interface/ProcessCallGraph.h index 1d78e110c8b43..5953303c33ea8 100644 --- a/HLTrigger/Timer/interface/ProcessCallGraph.h +++ b/HLTrigger/Timer/interface/ProcessCallGraph.h @@ -30,6 +30,7 @@ class ProcessCallGraph { edm::ModuleDescription module_; edm::EDMModuleType type_; bool scheduled_; + NodeType() : scheduled_(false){}; }; // directed graph, with `NodeType` properties attached to each vertex diff --git a/HLTrigger/special/plugins/HLTRegionalEcalResonanceFilter.cc b/HLTrigger/special/plugins/HLTRegionalEcalResonanceFilter.cc index 72dc5b0e82eba..6d9ee051402f5 100644 --- a/HLTrigger/special/plugins/HLTRegionalEcalResonanceFilter.cc +++ b/HLTrigger/special/plugins/HLTRegionalEcalResonanceFilter.cc @@ -22,6 +22,8 @@ HLTRegionalEcalResonanceFilter::HLTRegionalEcalResonanceFilter(const edm::Parame endcapHitsToken_ = consumes(endcapHits_); endcapClustersToken_ = consumes(endcapClusters_); + store5x5RecHitEB_ = false; + doSelBarrel_ = iConfig.getParameter("doSelBarrel"); if (doSelBarrel_) { From 773673c9d7b4f1752e6270876693a1a9c62bb26d Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Sun, 29 Aug 2021 02:34:55 +0300 Subject: [PATCH 205/923] init field to false, constructor didn't work --- HLTrigger/Timer/interface/ProcessCallGraph.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/HLTrigger/Timer/interface/ProcessCallGraph.h b/HLTrigger/Timer/interface/ProcessCallGraph.h index 5953303c33ea8..5b7fcea82ef75 100644 --- a/HLTrigger/Timer/interface/ProcessCallGraph.h +++ b/HLTrigger/Timer/interface/ProcessCallGraph.h @@ -29,8 +29,7 @@ class ProcessCallGraph { struct NodeType { edm::ModuleDescription module_; edm::EDMModuleType type_; - bool scheduled_; - NodeType() : scheduled_(false){}; + bool scheduled_ = false; }; // directed graph, with `NodeType` properties attached to each vertex From e49c73c2ec80e2729218e4ac5c41f63e968bfcb9 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Sun, 29 Aug 2021 16:31:38 +0200 Subject: [PATCH 206/923] remove the deprecated detIdInfoInMultiCluster and add some comments --- .../LCToSCAssociatorByEnergyScoreImpl.h | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index 90227027e33dd..b11f2937bd644 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -15,6 +15,10 @@ namespace edm { } namespace hgcal { + // This structure is used both for LayerClusters and SimClusters storing the id and the fraction of a hit + // that belongs to the LayerCluster or SimCluster. The meaning of the operator is extremely important since + // this struct will be used inside maps and other containers and when searching for one particular occurence + // only the clusterId member will be used in the check skipping the fraction part. struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -25,13 +29,15 @@ namespace hgcal { } }; - struct detIdInfoInMultiCluster { - bool operator==(const detIdInfoInMultiCluster &o) const { return multiclusterId == o.multiclusterId; }; - unsigned int multiclusterId; - long unsigned int clusterId; - float fraction; - }; - + // For a simCluster it stores: + // 1. Its id: simClusterId. + // 2. The energy that the simCluster deposited in a specific layer and it was reconstructed. + // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed + // and doesn't have any matched rechits are disgarded. + // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the simCluster under study + // together with the energy that the Layercluster reconstructed from the SimClusters and the score. The energy + // is not the energy of the LayerCluster, but the energy coming from the SimCluster. So, there will be energy of + // the LayerCluster that is disregarded here, since there may be LayerCluster's cells that the SimCluster didn't contributed. struct simClusterOnLayer { unsigned int simClusterId; float energy = 0; @@ -40,7 +46,12 @@ namespace hgcal { }; typedef std::vector>> layerClusterToSimCluster; + // This is used to save the simClusterOnLayer structure for all simClusters in each layer. + // This is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector> simClusterToLayerCluster; + //This is the output of the makeConnections function that contain all the work with SC2LC and LC2SC + //association. It will be read by the relevant associateRecoToSim and associateSimToReco functions to + //provide the final product. typedef std::tuple association; } // namespace hgcal From f2cf603f5f1a326944d1a6e9b2d5fb82fe170c24 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 09:53:56 +0200 Subject: [PATCH 207/923] comments on the LCToSC associator --- .../LCToSCAssociatorByEnergyScoreImpl.cc | 40 +++++++++++++------ .../LCToSCAssociatorByEnergyScoreImpl.h | 11 +++-- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc index 6c900753c53d5..38ea2e2d7023a 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc @@ -35,9 +35,10 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( } nSimClusters = sCIndices.size(); - // Initialize lcsInSimCluster. To be returned outside, since it contains the - // information to compute the SimCluster-To-LayerCluster score. - // lcsInSimCluster[scId][layerId]: + // Initialize lcsInSimCluster. It contains the simClusterOnLayer structure for all simClusters in each layer and + // among other the information to compute the SimCluster-To-LayerCluster score. It is one of the two objects that + // build the output of the makeConnections function. + // lcsInSimCluster[scId][layerId] hgcal::simClusterToLayerCluster lcsInSimCluster; lcsInSimCluster.resize(nSimClusters); for (unsigned int i = 0; i < nSimClusters; ++i) { @@ -50,6 +51,10 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( } // Fill detIdToSimClusterId_Map and update lcsInSimCluster + // The detIdToSimClusterId_Map is used to connect a hit Detid (key) with all the SimClusters that + // contributed to that hit by storing the SimCluster id and the fraction of the hit. Observe here + // that in contrast to the CaloParticle case there is no merging and summing of the fractions, which + // in the CaloParticle's case was necessary due to the multiple SimClusters of a single CaloParticle. std::unordered_map> detIdToSimClusterId_Map; for (const auto& scId : sCIndices) { const auto& hits_and_fractions = simClusters[scId].hits_and_fractions(); @@ -76,6 +81,7 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "lcsInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; for (size_t sc = 0; sc < lcsInSimCluster.size(); ++sc) { LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; for (size_t sclay = 0; sclay < lcsInSimCluster[sc].size(); ++sclay) { @@ -84,7 +90,6 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( << " SimClusterIdx: " << lcsInSimCluster[sc][sclay].simClusterId << std::endl; LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Energy: " << lcsInSimCluster[sc][sclay].energy << std::endl; - LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; double tot_energy = 0.; for (auto const& haf : lcsInSimCluster[sc][sclay].hits_and_fractions) { LogDebug("LCToSCAssociatorByEnergyScoreImpl") @@ -105,6 +110,10 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; + // At this point here if you activate the printing you will notice cases where in a + // specific detId there are more that one SimClusters contributing with fractions less than 1. + // This is important since it effects the score computation, since the fraction is also in the + // denominator of the score formula. for (auto const& sclu : sc.second) { LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction @@ -114,12 +123,14 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( #endif // Fill detIdToLayerClusterId_Map and scsInLayerCluster; update lcsInSimCluster + // The detIdToLayerClusterId_Map is used to connect a hit Detid (key) with all the LayerClusters that + // contributed to that hit by storing the LayerCluster id and the fraction of the corresponding hit. std::unordered_map> detIdToLayerClusterId_Map; - // this contains the ids of the simclusters contributing with at least one - // hit to the layer cluster and the reconstruction error. To be returned - // since this contains the information to compute the - // LayerCluster-To-SimCluster score. - hgcal::layerClusterToSimCluster scsInLayerCluster; //[lcId][scId]->(energy,score) + // scsInLayerCluster together with lcsInSimCluster are the two objects that are used to build the + // output of the makeConnections function. scsInLayerCluster connects a LayerCluster with + // all the SimClusters that share at least one cell with the LayerCluster and for each pair (LC,SC) + // it stores the score. + hgcal::layerClusterToSimCluster scsInLayerCluster; //[lcId][scId]->(score) scsInLayerCluster.resize(nLayerClusters); for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) { @@ -343,7 +354,8 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( continue; } - // Compute the correct normalization + // Compute the correct normalization. + // It is the inverse of the denominator of the LCToSC score formula. Observe that this is the sum of the squares. float invLayerClusterEnergyWeight = 0.f; for (auto const& haf : clusters[lcId].hitsAndFractions()) { invLayerClusterEnergyWeight += @@ -399,6 +411,7 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( int lcWithMaxEnergyInSC = -1; //energy of the most energetic LC from all that were linked to SC float maxEnergyLCinSC = 0.f; + //Energy of the SC scId on layer layerId that was reconstructed. float SCenergy = lcsInSimCluster[scId][layerId].energy; //most energetic LC from all LCs linked to SC over SC energy. float SCEnergyFractionInLC = 0.f; @@ -422,7 +435,7 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( << "\t" << std::setw(18) << lcWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyLCinSC << "\t" << std::setw(20) << SCEnergyFractionInLC << "\n"; #endif - // Compute the correct normalization + // Compute the correct normalization. Observe that this is the sum of the squares. float invSCEnergyWeight = 0.f; for (auto const& haf : lcsInSimCluster[scId][layerId].hits_and_fractions) { invSCEnergyWeight += std::pow(haf.second * hitMap_->at(haf.first)->energy(), 2); @@ -477,8 +490,9 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( << (lcPair.second.first / SCenergy) << "\n"; } #endif - } - } + } // End of loop over layers + } // End of loop over SimClusters + return {scsInLayerCluster, lcsInSimCluster}; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index b11f2937bd644..24e3ae6e62298 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -29,11 +29,11 @@ namespace hgcal { } }; - // For a simCluster it stores: + // This introduces a simCluster on layer concept. For a simCluster it stores: // 1. Its id: simClusterId. // 2. The energy that the simCluster deposited in a specific layer and it was reconstructed. // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed - // and doesn't have any matched rechits are disgarded. + // and doesn't have any matched rechits are disregarded. // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the simCluster under study // together with the energy that the Layercluster reconstructed from the SimClusters and the score. The energy // is not the energy of the LayerCluster, but the energy coming from the SimCluster. So, there will be energy of @@ -45,12 +45,15 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; + // This object connects a LayerCluster, identified through its id (lcId), with a vector containing all the SimClusters + // (via their ids (scIds)) that share at least one cell with the LayerCluster. For that pair (lcId,scId) it + // stores the score. typedef std::vector>> layerClusterToSimCluster; // This is used to save the simClusterOnLayer structure for all simClusters in each layer. - // This is not exactly what is returned outside, but out of its entries, the output object is build. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector> simClusterToLayerCluster; //This is the output of the makeConnections function that contain all the work with SC2LC and LC2SC - //association. It will be read by the relevant associateRecoToSim and associateSimToReco functions to + //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to //provide the final product. typedef std::tuple association; } // namespace hgcal From e5047f5346d4e0cce78f9d62d8b002fb655537a2 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 09:59:47 +0200 Subject: [PATCH 208/923] deprecated multicluster structure --- .../plugins/LCToCPAssociatorByEnergyScoreImpl.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index 346c3d64d2bba..cf2968aff9f56 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -25,13 +25,6 @@ namespace hgcal { } }; - struct detIdInfoInMultiCluster { - bool operator==(const detIdInfoInMultiCluster &o) const { return multiclusterId == o.multiclusterId; }; - unsigned int multiclusterId; - long unsigned int clusterId; - float fraction; - }; - struct caloParticleOnLayer { unsigned int caloParticleId; float energy = 0; From 1f2ba6890bd8bcd09ad587d88bc1f4bcb55a5623 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Mon, 30 Aug 2021 11:10:22 +0200 Subject: [PATCH 209/923] update scoring plane z positions --- .../CTPPS/python/simu_config/profile_2016_postTS2_cff.py | 9 +++++---- .../CTPPS/python/simu_config/profile_2016_preTS2_cff.py | 9 +++++---- Validation/CTPPS/python/simu_config/year_2017_cff.py | 4 ++-- Validation/CTPPS/python/simu_config/year_2018_cff.py | 4 ++-- Validation/CTPPS/python/simu_config/year_2021_cff.py | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py index 246e82feef14e..1542db2032c8f 100644 --- a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py @@ -18,10 +18,11 @@ scoringPlanes = cms.VPSet( # z in cm - cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.6) ), # RP 002, strip - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.1) ), # RP 003, strip - cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.6) ), # RP 102, strip - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.1) ), # RP 103, strip + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip ) ), diff --git a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py index cb7098c90e66d..f68e365b2597a 100644 --- a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py @@ -18,10 +18,11 @@ scoringPlanes = cms.VPSet( # z in cm - cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.6) ), # RP 002, strip - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.1) ), # RP 003, strip - cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.6) ), # RP 102, strip - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.1) ), # RP 103, strip + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip ) ), diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py index b9759119a9855..8a39857850966 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_cff.py @@ -17,11 +17,11 @@ scoringPlanes = cms.VPSet( # z in cm - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.1) ), # RP 003, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.1) ), # RP 103, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel ) diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index 461551db4081b..37915a804049a 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -17,11 +17,11 @@ scoringPlanes = cms.VPSet( # z in cm - cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.1) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.1) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel ) diff --git a/Validation/CTPPS/python/simu_config/year_2021_cff.py b/Validation/CTPPS/python/simu_config/year_2021_cff.py index c8310d1f41a0b..d50bc0ba42b4b 100644 --- a/Validation/CTPPS/python/simu_config/year_2021_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2021_cff.py @@ -16,12 +16,12 @@ scoringPlanes = cms.VPSet( # z in cm - cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.1) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.1) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel From d0fdb6daa65bc909bbe74daea915065ee2c0fab7 Mon Sep 17 00:00:00 2001 From: Salavat Date: Mon, 30 Aug 2021 12:24:13 +0200 Subject: [PATCH 210/923] CaloTower initialization fix --- DataFormats/CaloTowers/src/CaloTower.cc | 27 +++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/DataFormats/CaloTowers/src/CaloTower.cc b/DataFormats/CaloTowers/src/CaloTower.cc index cb9c3eb6db4ca..d62e497a36c92 100644 --- a/DataFormats/CaloTowers/src/CaloTower.cc +++ b/DataFormats/CaloTowers/src/CaloTower.cc @@ -6,6 +6,9 @@ CaloTower::CaloTower() { outerE_ = 0; emLvl1_ = 0; hadLvl1_ = 0; + subdet_ = HcalEmpty; + inHO_ = false; + inHBHEgap_ = false; } CaloTower::CaloTower(const CaloTowerDetId& id, @@ -25,7 +28,11 @@ CaloTower::CaloTower(const CaloTowerDetId& id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} + hadLvl1_(hcal_tp) { + subdet_ = HcalEmpty; + inHO_ = false; + inHBHEgap_ = false; +} CaloTower::CaloTower(const CaloTowerDetId& id, double emE, @@ -44,7 +51,11 @@ CaloTower::CaloTower(const CaloTowerDetId& id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} + hadLvl1_(hcal_tp) { + subdet_ = HcalEmpty; + inHO_ = false; + inHBHEgap_ = false; +} CaloTower::CaloTower(CaloTowerDetId id, float emE, @@ -65,7 +76,11 @@ CaloTower::CaloTower(CaloTowerDetId id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} + hadLvl1_(hcal_tp) { + subdet_ = HcalEmpty; + inHO_ = false; + inHBHEgap_ = false; +} CaloTower::CaloTower(CaloTowerDetId id, float emE, @@ -86,7 +101,11 @@ CaloTower::CaloTower(CaloTowerDetId id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} + hadLvl1_(hcal_tp) { + subdet_ = HcalEmpty; + inHO_ = false; + inHBHEgap_ = false; +} // recalculated momentum-related quantities wrt user provided vertex Z position From 84335eb3f67db718c8e6d99a3ab19545bd6cccc3 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 30 Aug 2021 12:27:21 +0200 Subject: [PATCH 211/923] removed lexical_cast boost dependency --- L1Trigger/GlobalTriggerAnalyzer/src/L1GtTrigReport.cc | 4 +--- L1Trigger/GlobalTriggerAnalyzer/src/L1RetrieveL1Extra.cc | 2 -- L1Trigger/L1TCommon/interface/Mask.h | 3 --- L1Trigger/L1TCommon/src/Mask.cc | 4 ++-- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtTrigReport.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtTrigReport.cc index cf1b9d385f056..6ed0feba5f46b 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtTrigReport.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtTrigReport.cc @@ -26,8 +26,6 @@ #include #include -#include "boost/lexical_cast.hpp" - // user include files #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" @@ -473,7 +471,7 @@ void L1GtTrigReport::analyze(const edm::Event& iEvent, const edm::EventSetup& ev std::string ttName = itAlgo->first; int ttBitNumber = (itAlgo->second).algoBitNumber(); - // std::string ttName = boost::lexical_cast(iTechTrig); + // std::string ttName = std::to_string(iTechTrig); // int ttBitNumber = iTechTrig; // the result before applying the trigger masks is available diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1RetrieveL1Extra.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1RetrieveL1Extra.cc index 1deeea1c62130..053fcca323c44 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1RetrieveL1Extra.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1RetrieveL1Extra.cc @@ -25,8 +25,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "boost/lexical_cast.hpp" - // constructor L1RetrieveL1Extra::L1RetrieveL1Extra(const edm::ParameterSet& paramSet, edm::ConsumesCollector&& iC) : // diff --git a/L1Trigger/L1TCommon/interface/Mask.h b/L1Trigger/L1TCommon/interface/Mask.h index 2afa467d5e937..8ae40c4b3b40b 100644 --- a/L1Trigger/L1TCommon/interface/Mask.h +++ b/L1Trigger/L1TCommon/interface/Mask.h @@ -2,9 +2,6 @@ #define L1Trigger_L1TCommon_Mask_h #include -//boost libraries -#include - namespace l1t { class Mask { diff --git a/L1Trigger/L1TCommon/src/Mask.cc b/L1Trigger/L1TCommon/src/Mask.cc index 36d9f54a89509..bd2c34f9f7f41 100644 --- a/L1Trigger/L1TCommon/src/Mask.cc +++ b/L1Trigger/L1TCommon/src/Mask.cc @@ -4,13 +4,13 @@ namespace l1t { Mask::Mask(std::string id, std::string procRole) { id_ = id; - port_ = boost::lexical_cast(id.substr(id.find_last_not_of("0123456789") + 1)); + port_ = std::stoi(id.substr(id.find_last_not_of("0123456789") + 1)); procRole_ = procRole; } void Mask::setPort(std::string id) { id_ = id; - port_ = boost::lexical_cast(id.substr(id.find_last_not_of("0123456789") + 1)); + port_ = std::stoi(id.substr(id.find_last_not_of("0123456789") + 1)); } } // namespace l1t From 1c23b82beaa646504f5d5241c627f636ef8e7a13 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Mon, 30 Aug 2021 19:00:40 +0800 Subject: [PATCH 212/923] Remove unused headers in DataFormats package. --- .../BTauReco/interface/PFCombinedTauTagInfo.h | 192 ------- .../BTauReco/interface/PFIsolatedTauTagInfo.h | 147 ----- DataFormats/BTauReco/interface/TrackIPData.h | 23 - DataFormats/Common/interface/NewPolicy.h | 13 - DataFormats/Common/interface/OwnArray.h | 506 ------------------ .../Common/interface/TransientDataFrame.h | 51 -- .../Common/interface/debugging_allocator.h | 80 --- DataFormats/Common/test/OwnArray_t.cpp | 188 ------- DataFormats/Common/test/testOwnArray.cc | 139 ----- .../interface/private/extTkRotation.h | 366 ------------- .../interface/private/newTkRotation.h | 366 ------------- .../GeometryVector/interface/OnePiRange.h | 133 ----- .../interface/private/extBasic2DVector.h | 264 --------- .../interface/PFClusterMETCollection.h | 23 - DataFormats/Math/interface/SSEArray.h | 111 ---- DataFormats/Math/interface/private/AVXVec.h | 187 ------- .../interface/PFBlockElementFwd.h | 15 - .../interface/PFBlockElementSuperClusterFwd.h | 11 - .../interface/PFClusterShapeAssociation.h | 31 -- .../interface/PFParticleFwd.h | 27 - .../interface/PFSuperClusterFwd.h | 27 - .../interface/PFTrajectoryPointFwd.h | 27 - .../interface/BranchDescriptionIndex.h | 31 -- .../Provenance/interface/TypeInBranchType.h | 62 --- .../RPCDigi/interface/RPCDigiL1Linkfwd.h | 4 - .../interface/PixelDigiCollectionfwd.h | 4 - .../interface/ConstantsForSummaryPlots.h | 10 - .../SiStripDigi/interface/SiStripDigifwd.h | 4 - .../interface/SiPixelRecHitfwd.h | 4 - .../interface/BasicTrajectorySeed.h | 9 - 30 files changed, 3055 deletions(-) delete mode 100644 DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/TrackIPData.h delete mode 100644 DataFormats/Common/interface/NewPolicy.h delete mode 100644 DataFormats/Common/interface/OwnArray.h delete mode 100644 DataFormats/Common/interface/TransientDataFrame.h delete mode 100644 DataFormats/Common/interface/debugging_allocator.h delete mode 100644 DataFormats/Common/test/OwnArray_t.cpp delete mode 100644 DataFormats/Common/test/testOwnArray.cc delete mode 100644 DataFormats/GeometrySurface/interface/private/extTkRotation.h delete mode 100644 DataFormats/GeometrySurface/interface/private/newTkRotation.h delete mode 100644 DataFormats/GeometryVector/interface/OnePiRange.h delete mode 100644 DataFormats/GeometryVector/interface/private/extBasic2DVector.h delete mode 100644 DataFormats/METReco/interface/PFClusterMETCollection.h delete mode 100644 DataFormats/Math/interface/SSEArray.h delete mode 100644 DataFormats/Math/interface/private/AVXVec.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFParticleFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h delete mode 100644 DataFormats/Provenance/interface/BranchDescriptionIndex.h delete mode 100644 DataFormats/Provenance/interface/TypeInBranchType.h delete mode 100644 DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h delete mode 100644 DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h delete mode 100644 DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h delete mode 100644 DataFormats/SiStripDigi/interface/SiStripDigifwd.h delete mode 100644 DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h delete mode 100644 DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h diff --git a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h b/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h deleted file mode 100644 index aa7354fb2659e..0000000000000 --- a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef DataFormats_BTauReco_PFCombinedTauTagInfo_h -#define DataFormats_BTauReco_PFCombinedTauTagInfo_h - -/* class PFCombinedTauTagInfo - * Extended object for the Particle Flow Tau Combination algorithm, - * created: Apr 21 2007, - * revised: Jun 23 2007, - * author: Ludovic Houchu. - */ - -#include -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" -#include "DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h" - - - - -namespace reco { - class PFCombinedTauTagInfo : public BaseTagInfo{ - public: - PFCombinedTauTagInfo() { - candidate_selectedByPFChargedHadrCands_=false; - electronTagged_=false; - muonTagged_=false; - PFChargedHadrCands_.clear(); - selectedPFChargedHadrCands_.clear(); - signalPFChargedHadrCands_.clear(); - isolPFChargedHadrCands_.clear(); - leadPFChargedHadrCandsignedSipt_=NAN; - leadPFChargedHadrCandsignedSip3D_=NAN; - signedSflightpath_=NAN; - PFChargedHadrCandsEtJetEtRatio_=NAN; - PFNeutrHadrCandsE_=NAN; - PFNeutrHadrCandsN_=std::numeric_limits::quiet_NaN(); - PFNeutrHadrCandsRadius_=NAN; - PFGammaCandsE_=NAN; - isolPFGammaCandsE_=NAN; - PFGammaCandsN_=std::numeric_limits::quiet_NaN(); - PFGammaCandsRadius_=NAN; - PFGammaCandsEJetalternatERatio_=NAN; - isolPFGammaCandsEJetalternatERatio_=NAN; - PFGammaCandsERatio_=NAN; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - ECALEtleadPFChargedHadrCandPtRatio_=NAN; - HCALEtleadPFChargedHadrCandPtRatio_=NAN; - } - virtual ~PFCombinedTauTagInfo() {}; - - //the reference to the PFJet; - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //the reference to the PFIsolatedTauTagInfo; - const PFIsolatedTauTagInfoRef& isolatedtautaginfoRef()const{return PFIsolatedTauTagInfoRef_;} - void setisolatedtautaginfoRef(const PFIsolatedTauTagInfoRef x) {PFIsolatedTauTagInfoRef_=x;} - - //the PF charged hadron candidates contained in the PF Jet; - const PFCandidateRefVector& PFChargedHadrCands()const{return PFChargedHadrCands_;} - void setPFChargedHadrCands(const PFCandidateRefVector& x) {PFChargedHadrCands_=x;} - - //the PF charged hadron candidates considered in the isolation strip and signal cone selections; - const PFCandidateRefVector& selectedPFChargedHadrCands()const{return selectedPFChargedHadrCands_;} - void setselectedPFChargedHadrCands(const PFCandidateRefVector& x) {selectedPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside signal cone; - const PFCandidateRefVector& signalPFChargedHadrCands()const{return signalPFChargedHadrCands_;} - void setsignalPFChargedHadrCands(const PFCandidateRefVector& x) {signalPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside isolation band; - const PFCandidateRefVector& isolPFChargedHadrCands()const{return isolPFChargedHadrCands_;} - void setisolPFChargedHadrCands(const PFCandidateRefVector& x) {isolPFChargedHadrCands_=x;} - - virtual PFCombinedTauTagInfo* clone() const{return new PFCombinedTauTagInfo(*this );} - - // float JetTag::discriminator() returns 0. if candidate did not pass PF charged hadron candidates selection, - // 1. if candidate passed PF charged hadron candidates selection and did not contain PF gamma candidate(s), - // 0<= <=1 if candidate passed PF charged hadron candidates selection, contained PF gamma candidate(s) and went through the likelihood ratio mechanism, - // NaN the values of the likelihood functions PDFs are 0 (test the result of discriminator() with bool isnan(.)); - //computed with the parameters taken from the RecoTauTag/PFCombinedTauTag/data/ .cfi files - - bool selectedByPFChargedHadrCands()const{return(candidate_selectedByPFChargedHadrCands_);} - void setselectedByPFChargedHadrCands(bool x){candidate_selectedByPFChargedHadrCands_=x;} - - bool electronTagged()const{return(electronTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, e-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setelectronTagged(bool x){electronTagged_=x;} - - bool muonTagged()const{return(muonTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, mu-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setmuonTagged(bool x){muonTagged_=x;} - - double leadPFChargedHadrCandsignedSipt()const{return (leadPFChargedHadrCandsignedSipt_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSipt(double x){leadPFChargedHadrCandsignedSipt_=x;} - - double leadPFChargedHadrCandsignedSip3D()const{return(leadPFChargedHadrCandsignedSip3D_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSip3D(double x){leadPFChargedHadrCandsignedSip3D_=x;} - - double signedSflightpath()const{return (signedSflightpath_);} // NaN : failure, did not build a SV.; - void setsignedSflightpath(double x){signedSflightpath_=x;} - - // Et_PFchargedhadrcands/Etjet; - double PFChargedHadrCandsEtJetEtRatio()const{return(PFChargedHadrCandsEtJetEtRatio_);} - void setPFChargedHadrCandsEtJetEtRatio(double x){PFChargedHadrCandsEtJetEtRatio_=x;} - - // PF neutral hadron candidates E sum; - double PFNeutrHadrCandsE()const{return(PFNeutrHadrCandsE_);} - void setPFNeutrHadrCandsE(double x){PFNeutrHadrCandsE_=x;} - - int PFNeutrHadrCandsN()const{return(PFNeutrHadrCandsN_);} - void setPFNeutrHadrCandsN(int x){PFNeutrHadrCandsN_=x;} - - //mean DR_PFNeutrHadrcands-lead.PFcand.; - double PFNeutrHadrCandsRadius()const{return(PFNeutrHadrCandsRadius_);} // NaN : PFNeutrHadrCandsN()=0; - void setPFNeutrHadrCandsRadius(double x){PFNeutrHadrCandsRadius_=x;} - - // PF gamma candidates E sum; - double PFGammaCandsE()const{return(PFGammaCandsE_);} - void setPFGammaCandsE(double x){PFGammaCandsE_=x;} - - // isol. band PF gamma candidates E sum; - double isolPFGammaCandsE()const{return(isolPFGammaCandsE_);} - void setisolPFGammaCandsE(double x){isolPFGammaCandsE_=x;} - - int PFGammaCandsN()const{return(PFGammaCandsN_);} - void setPFGammaCandsN(int x){PFGammaCandsN_=x;} - - //mean DR_PFgammacands-lead.PFcand.; - double PFGammaCandsRadius()const{return(PFGammaCandsRadius_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsRadius(double x){PFGammaCandsRadius_=x;} - - // E_PFgammacands / (E_PFgammacands + E_PFchargedhadrcands); - double PFGammaCandsEJetalternatERatio()const{return(PFGammaCandsEJetalternatERatio_);} - void setPFGammaCandsEJetalternatERatio(double x){PFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / (E_PFgammacands + E_PFchargedhadrcands); - double isolPFGammaCandsEJetalternatERatio()const{return(isolPFGammaCandsEJetalternatERatio_);} - void setisolPFGammaCandsEJetalternatERatio(double x){isolPFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / E_PFgammacands; - double PFGammaCandsERatio()const{return(PFGammaCandsERatio_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsERatio(double x){PFGammaCandsERatio_=x;} - - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} // rec. charged hadr. candidates + rec. gamma candidates combined; - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - // EtECAL*/Pt_lead.PFcand. *using ECAL cell hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double ECALEtleadPFChargedHadrCandPtRatio()const{return(ECALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setECALEtleadPFChargedHadrCandPtRatio(double x){ECALEtleadPFChargedHadrCandPtRatio_=x;} - - // EtHCAL**/Pt_lead.PFcand.; **using HCAL tower hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double HCALEtleadPFChargedHadrCandPtRatio()const{return(HCALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setHCALEtleadPFChargedHadrCandPtRatio(double x){HCALEtleadPFChargedHadrCandPtRatio_=x;} - private: - PFJetRef PFJetRef_; - PFIsolatedTauTagInfoRef PFIsolatedTauTagInfoRef_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector selectedPFChargedHadrCands_; - PFCandidateRefVector signalPFChargedHadrCands_; - PFCandidateRefVector isolPFChargedHadrCands_; - bool candidate_selectedByPFChargedHadrCands_; - bool electronTagged_; - bool muonTagged_; - double leadPFChargedHadrCandsignedSipt_; - double leadPFChargedHadrCandsignedSip3D_; - double signedSflightpath_; - double PFChargedHadrCandsEtJetEtRatio_; - double PFNeutrHadrCandsE_; - int PFNeutrHadrCandsN_; - double PFNeutrHadrCandsRadius_; - double PFGammaCandsE_; - double isolPFGammaCandsE_; - int PFGammaCandsN_; - double PFGammaCandsRadius_; - double PFGammaCandsEJetalternatERatio_; - double isolPFGammaCandsEJetalternatERatio_; - double PFGammaCandsERatio_; - math::XYZTLorentzVector alternatLorentzVect_; - double ECALEtleadPFChargedHadrCandPtRatio_; - double HCALEtleadPFChargedHadrCandPtRatio_; - }; - - DECLARE_EDM_REFS( PFCombinedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFCombinedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h b/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h deleted file mode 100644 index 1a279e21e2ee3..0000000000000 --- a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef DataFormats_BTauReco_PFIsolatedTauTagInfo_h -#define DataFormats_BTauReco_PFIsolatedTauTagInfo_h - -/* class PFIsolatedTauTagInfo - * Extended object for the Particle Flow Tau Isolation algorithm, - * contains the result and the methods used in the PFConeIsolation Algorithm - * created: Apr 21 2007, - * revised: Jun 23 2007, - * authors: Simone Gennai, Ludovic Houchu - */ - -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" - -#include "Math/GenVector/PxPyPzE4D.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" - - - - - - -const int PFChargedHadrCand_codenumber=1; -const int PFNeutrHadrCand_codenumber=5; -const int PFGammaCand_codenumber=4; - -const int PFRecTrack_codenumber=1; -const int PFRecECALClus_codenumber=4; -const int PFRecHCALClus_codenumber=5; - -namespace reco{ - class PFIsolatedTauTagInfo : public BaseTagInfo{ - public: - PFIsolatedTauTagInfo() {} - PFIsolatedTauTagInfo(PFCandidateRefVector PFCands){ - initialPFCands_=PFCands; - PFCands_=PFCands; - for(PFCandidateRefVector::const_iterator iPFCand=PFCands_.begin();iPFCand!=PFCands_.end();iPFCand++){ - if ((**iPFCand).particleId()==PFChargedHadrCand_codenumber) initialPFChargedHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFNeutrHadrCand_codenumber) initialPFNeutrHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFGammaCand_codenumber) initialPFGammaCands_.push_back(*iPFCand); - } - PFChargedHadrCands_=initialPFChargedHadrCands_; - PFNeutrHadrCands_=initialPFNeutrHadrCands_; - PFGammaCands_=initialPFGammaCands_; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - passedtrackerisolation_=false; - passedECALisolation_=false; - } - virtual ~PFIsolatedTauTagInfo(){}; - virtual PFIsolatedTauTagInfo* clone()const{return new PFIsolatedTauTagInfo(*this);} - - //get the PFCandidates's which compose the PF jet and may be have been filtered by filterPFChargedHadrCands(.,.,.,.,.,.), filterPFNeutrHadrCands(.), filterPFGammaCands(.) member functions - const PFCandidateRefVector& PFCands() const {return PFCands_;} - const PFCandidateRefVector& PFChargedHadrCands() const {return PFChargedHadrCands_;} - const PFCandidateRefVector& PFNeutrHadrCands() const {return PFNeutrHadrCands_;} - const PFCandidateRefVector& PFGammaCands() const {return PFGammaCands_;} - - // rec. jet Lorentz-vector combining charged hadr. PFCandidate's and gamma PFCandidate's - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - //the reference to the PFJet - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //JetTag::discriminator() computed with the parameters taken from the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - - // true if a lead. PFCandidate exists and no charged hadron PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedtrackerisolation()const{return passedtrackerisolation_;} - void setpassedtrackerisolation(bool x){passedtrackerisolation_=x;} - - // true if a lead. PFCandidate exists and no gamma PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedECALisolation()const{return passedECALisolation_;} - void setpassedECALisolation(bool x){passedECALisolation_=x;} - - //methods to be used to recompute the isolation with a new set of parameters - double discriminatorByIsolPFCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - - // return all PFCandidate's in a cone of size "conesize" around a direction "myVector" - const PFCandidateRefVector PFCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - - // return all PFCandidate's in a band defined by inner(size "innercone_size") and outer(size "outercone_size") cones around a direction "myVector" - const PFCandidateRefVector PFCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - - //return the leading PFCandidate in a given cone around the jet axis or a given direction - const PFCandidateRef leadPFCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - - void filterPFChargedHadrCands(double ChargedHadrCand_tkminPt,int ChargedHadrCand_tkminPixelHitsn,int ChargedHadrCand_tkminTrackerHitsn,double ChargedHadrCand_tkmaxipt,double ChargedHadrCand_tkmaxChi2,double ChargedHadrCand_tktorefpointDZ,bool UsePVconstraint,double PVtx_Z,bool UseOnlyChargedHadr_for_LeadCand,double LeadChargedHadrCandtoJet_MatchingConeSize,double LeadChargedHadrCand_minPt); - void filterPFNeutrHadrCands(double NeutrHadrCand_HcalclusminEt); - void filterPFGammaCands(double GammaCand_EcalclusminEt); - void removefilters(); - private: - PFJetRef PFJetRef_; - PFCandidateRefVector initialPFCands_; - PFCandidateRefVector PFCands_; - PFCandidateRefVector initialPFChargedHadrCands_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector initialPFNeutrHadrCands_; - PFCandidateRefVector PFNeutrHadrCands_; - PFCandidateRefVector initialPFGammaCands_; - PFCandidateRefVector PFGammaCands_; - math::XYZTLorentzVector alternatLorentzVect_; - bool passedtrackerisolation_; - bool passedECALisolation_; - }; - - DECLARE_EDM_REFS( PFIsolatedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFIsolatedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/TrackIPData.h b/DataFormats/BTauReco/interface/TrackIPData.h deleted file mode 100644 index 4ac87ce7eb346..0000000000000 --- a/DataFormats/BTauReco/interface/TrackIPData.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TrackIPData_h -#define TrackIPData_h - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h" - -#include "DataFormats/JetReco/interface/JetTracksAssociation.h" - -namespace reco { - - -struct TrackIPData -{ - Measurement1D impactParameter3D; - Measurement1D impactParameter2D; - //float decayLen; - //float decayLenError; -}; - -} -#endif - diff --git a/DataFormats/Common/interface/NewPolicy.h b/DataFormats/Common/interface/NewPolicy.h deleted file mode 100644 index d66ae410ee192..0000000000000 --- a/DataFormats/Common/interface/NewPolicy.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DataFormats_Common_NewPolicy_h -#define DataFormats_Common_NewPolicy_h - -namespace edm { - template - struct NewPolicy{ - static T * clone(const T & t) { - return new T(t); - } - }; -} - -#endif diff --git a/DataFormats/Common/interface/OwnArray.h b/DataFormats/Common/interface/OwnArray.h deleted file mode 100644 index 73976f87bf97e..0000000000000 --- a/DataFormats/Common/interface/OwnArray.h +++ /dev/null @@ -1,506 +0,0 @@ -#ifndef DataFormats_Common_OwnArray_h -#define DataFormats_Common_OwnArray_h - -#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/fillPtrVector.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/setPtr.h" -#include "DataFormats/Common/interface/traits.h" - -#if defined CMS_USE_DEBUGGING_ALLOCATOR -#include "DataFormats/Common/interface/debugging_allocator.h" -#endif -#include "FWCore/Utilities/interface/EDMException.h" - -#include -#include -#include -#include - -namespace edm { - class ProductID; - template > - class OwnArray { - private: - typedef OwnArray self; - typedef std::vector base; - public: - typedef unsigned int size_type; - typedef T value_type; - typedef T* pointer; - typedef T& reference; - typedef T const& const_reference; - typedef P policy_type; - - class iterator; - class const_iterator { - public: - typedef T value_type; - typedef T* pointer; - typedef T const& reference; - typedef ptrdiff_t difference_type; - typedef typename base::const_iterator::iterator_category iterator_category; - const_iterator(pointer const * it) : i(it) { } - const_iterator(iterator const& it) : i(it.i) { } - const_iterator() {} - const_iterator& operator++() { ++i; return *this; } - const_iterator operator++(int) { const_iterator ci = *this; ++i; return ci; } - const_iterator& operator--() { --i; return *this; } - const_iterator operator--(int) { const_iterator ci = *this; --i; return ci; } - difference_type operator-(const_iterator const& o) const { return i - o.i; } - const_iterator operator+(difference_type n) const { return const_iterator(i + n); } - const_iterator operator-(difference_type n) const { return const_iterator(i - n); } - bool operator<(const_iterator const& o) const { return i < o.i; } - bool operator==(const_iterator const& ci) const { return i == ci.i; } - bool operator!=(const_iterator const& ci) const { return i != ci.i; } - T const& operator *() const { return **i; } - // operator T const*() const { return & **i; } - T const* operator->() const { return & (operator*()); } - const_iterator & operator +=(difference_type d) { i += d; return *this; } - const_iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *const_iterator(i+d); } // for boost::iterator_range [] - private: - pointer const * i; - }; - class iterator { - public: - typedef T value_type; - typedef T * pointer; - typedef T & reference; - typedef ptrdiff_t difference_type; - typedef typename base::iterator::iterator_category iterator_category; - iterator(pointer * it) : i(it) { } - iterator() {} - iterator& operator++() { ++i; return *this; } - iterator operator++(int) { iterator ci = *this; ++i; return ci; } - iterator& operator--() { --i; return *this; } - iterator operator--(int) { iterator ci = *this; --i; return ci; } - difference_type operator-(iterator const& o) const { return i - o.i; } - iterator operator+(difference_type n) const { return iterator(i + n); } - iterator operator-(difference_type n) const { return iterator(i - n); } - bool operator<(iterator const& o) const { return i < o.i; } - bool operator==(iterator const& ci) const { return i == ci.i; } - bool operator!=(iterator const& ci) const { return i != ci.i; } - T & operator *() const { return **i; } - // operator T *() const { return & **i; } - //T *& get() { return *i; } - T * operator->() const { return & (operator*()); } - iterator & operator +=(difference_type d) { i += d; return *this; } - iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *iterator(i+d); } // for boost::iterator_range [] - private: - pointer * i; - friend class const_iterator; - friend class OwnArray; - }; - - - OwnArray(); - OwnArray(size_type); - OwnArray(OwnArray const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - OwnArray(OwnArray&&); -#endif - - ~OwnArray(); - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - size_type size() const; - bool empty() const; - reference operator[](size_type); - const_reference operator[](size_type) const; - - self& operator=(self const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - self& operator=(self&&); -#endif - - - void reserve(size_t){} - size_type capacity() const { return MAX_SIZE;} - template void push_back(D*& d); - template void push_back(D* const& d); - template void push_back(std::unique_ptr d); - void push_back(T const& valueToCopy); - bool is_back_safe() const; - void pop_back(); - reference back(); - const_reference back() const; - reference front(); - const_reference front() const; - pointer const * data() const; - void clear(); - iterator erase(iterator pos); - iterator erase(iterator first, iterator last); - template - void sort(S s); - void sort(); - - void swap(self& other); - - void fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const; - - void setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const; - - void fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const; - - - //Used by ROOT storage - CMS_CLASS_VERSION(11) - - private: - void destroy(); - template - struct Ordering { - Ordering(O const& c) : comp(c) { } - bool operator()(T const* t1, T const* t2) const { - return comp(*t1, *t2); - } - private: - O comp; - }; - template - static Ordering ordering(O const& comp) { - return Ordering(comp); - } - pointer data_[MAX_SIZE]; - size_type size_; - }; - - template - inline OwnArray::OwnArray() : data_{{0}}, size_(0) { - } - - template - inline OwnArray::OwnArray(size_type n) : data_{{0}}, size_(n) { - } - - template - inline OwnArray::OwnArray(OwnArray const& o) : size_(o.size()) { - size_type current = 0; - for (const_iterator i = o.begin(), e = o.end(); i != e; ++i,++current) - data_[current] = policy_type::clone(*i); - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray::OwnArray(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - } -#endif - - template - inline OwnArray::~OwnArray() { - destroy(); - } - - template - inline OwnArray& OwnArray::operator=(OwnArray const& o) { - OwnArray temp(o); - swap(temp); - return *this; - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray& OwnArray::operator=(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - return *this; - } -#endif - - - template - inline typename OwnArray::iterator OwnArray::begin() { - return iterator(data_); - } - - template - inline typename OwnArray::iterator OwnArray::end() { - return iterator(data_+size()); - } - - template - inline typename OwnArray::const_iterator OwnArray::begin() const { - return const_iterator(data_); - } - - template - inline typename OwnArray::const_iterator OwnArray::end() const { - return const_iterator(data_+size()); - } - - template - inline typename OwnArray::size_type OwnArray::size() const { - return size_; - } - - template - inline bool OwnArray::empty() const { - return 0==size_; - } - - template - inline typename OwnArray::reference OwnArray::operator[](size_type n) { - return *data_[n]; - } - - template - inline typename OwnArray::const_reference OwnArray::operator[](size_type n) const { - return *data_[n]; - } - - template - template - inline void OwnArray::push_back(D*& d) { - // C++ does not yet support rvalue references, so d should only be - // able to bind to an lvalue. - // This should be called only for lvalues. - data_[size_++]=d; - d = 0; - } - - template - template - inline void OwnArray::push_back(D* const& d) { - - // C++ allows d to be bound to an lvalue or rvalue. But the other - // signature should be a better match for an lvalue (because it - // does not require an lvalue->rvalue conversion). Thus this - // signature should only be chosen for rvalues. - data_[size_++]=d; - } - - - template - template - inline void OwnArray::push_back(std::unique_ptr d) { - data_[size_++]=d.release(); - } - - - template - inline void OwnArray::push_back(T const& d) { - data_[size_++]=policy_type::clone(d); - } - - - template - inline void OwnArray::pop_back() { - // We have to delete the pointed-to thing, before we squeeze it - // out of the vector... - delete data_[--size_]; - } - - template - inline bool OwnArray::is_back_safe() const { - return data_[size_-1] != 0; - } - - template - inline typename OwnArray::reference OwnArray::back() { - pointer result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::const_reference OwnArray::back() const { - pointer const * result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::reference OwnArray::front() { - return *data_[0]; - } - - template - inline typename OwnArray::const_reference OwnArray::front() const { - return *data_[0]; - } - - template - inline void OwnArray::destroy() { - pointer * b = data_, * e = data_+size(); - for(pointer * i = b; i != e; ++ i) - delete * i; - } - - template - inline typename OwnArray::pointer const * OwnArray::data() const { - return data_; - } - - template - inline void OwnArray::clear() { - destroy(); - size_=0; - } - - template - typename OwnArray::iterator OwnArray::erase(iterator pos) { - pointer * b = pos.i; - delete *b; - pointer * e = data_+size(); - for(pointer * i = b; i != e-1; ++ i) *i = *(i+1); - size_--; - return iterator(b); - } - - template - typename OwnArray::iterator OwnArray::erase(iterator first, iterator last) { - pointer * b = first.i, * e = last.i; - for(pointer * i = b; i != e; ++ i) delete * i; - pointer * l = data_+size(); - auto ib=b; - for(pointer * i = e; i != l; ++i) *(ib++) = *i; - size_ -= (e-b); - return iterator(b); - } - - template template - void OwnArray::sort(S comp) { - std::sort(data_, data_+size(), ordering(comp)); - } - - template - void OwnArray::sort() { - std::sort(data_, data_+size(), ordering(std::less())); - } - - template - inline void OwnArray::swap(OwnArray& other) { - std::swap_ranges(data_,data_+M, other.data_); - } - - template - void OwnArray::fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const { - typedef Ref ref_type ; - typedef reftobase::RefHolder holder_type; - - size_type numElements = this->size(); - pointers.reserve(numElements); - helpers.reserve(numElements); - size_type key = 0; - for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) { - - if (*i == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::fillView() we have intercepted an attempt to put a null pointer\n" - "into a View and that is not allowed. It is probably an error that the null\n" - "pointer was in the OwnArray in the first place.\n"); - } - else { - pointers.push_back(*i); - holder_type h(ref_type(id, *i, key,this)); - helpers.push_back(&h); - } - } - } - - template - inline void swap(OwnArray& a, OwnArray& b) { - a.swap(b); - } - - //---------------------------------------------------------------------- - // - // Free function template to support creation of Views. - - template - inline - void - fillView(OwnArray const& obj, - ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) { - obj.fillView(id, pointers, helpers); - } - - - template - struct has_fillView > { - static bool const value = true; - }; - - - // Free function templates to support the use of edm::Ptr. - - template - inline - void - OwnArray::setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const { - detail::reallySetPtr >(*this, toType, index, ptr); - } - - template - inline - void - setPtr(OwnArray const& obj, - std::type_info const& toType, - unsigned long index, - void const*& ptr) { - obj.setPtr(toType, index, ptr); - } - - template - inline - void - OwnArray::fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const { - detail::reallyfillPtrVector(*this, toType, indices, ptrs); - } - - - template - inline - void - fillPtrVector(OwnArray const& obj, - std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) { - obj.fillPtrVector(toType, indices, ptrs); - } - - - template - struct has_setPtr > { - static bool const value = true; - }; - - -} - - -#endif diff --git a/DataFormats/Common/interface/TransientDataFrame.h b/DataFormats/Common/interface/TransientDataFrame.h deleted file mode 100644 index bc77c8df6cb16..0000000000000 --- a/DataFormats/Common/interface/TransientDataFrame.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef DataFormats_Common_TransientDataFrame_h -#define DataFormats_Common_TransientDataFrame_h - -#include "DataFormats/Common/interface/DataFrame.h" -#include - -namespace edm { - - /* a fixed size array of 16bit words belonging to - * a "channel" identified by an 32bit id - * - * FIXME interface to be finalized once use-cases fully identified - * - */ - template - class TransientDataFrame { - public: - - typedef DataFrame::data_type data_type; - typedef DataFrame::id_type id_type; - - TransientDataFrame() {} - TransientDataFrame( id_type i) : m_id(i) {} - TransientDataFrame(DataFrame const & iframe) : - m_id(iframe.id()) - { - data_type const * p = iframe.begin(); - std::copy(p,p+SIZE,m_data); - } - - int size() const { return SIZE;} - - data_type operator[](size_t i) const { - return m_data[i]; - } - - data_type & operator[](size_t i) { - return m_data[i]; - } - - id_type id() const { return m_id; } - - private: - id_type m_id; - data_type m_data[SIZE]; - - }; - -} - -#endif // DataFormats_Common_TransientDataFrame_h diff --git a/DataFormats/Common/interface/debugging_allocator.h b/DataFormats/Common/interface/debugging_allocator.h deleted file mode 100644 index 528386613f77b..0000000000000 --- a/DataFormats/Common/interface/debugging_allocator.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef DataFormatsCommonDebuggingAllocator -#define DataFormatsCommonDebuggingAllocator - -//--------------------------------------------------------------------- -// -// This file declares and defines an allocator class template. -// This allocator is intended for use with the memory checking tool -// valgrind. It is a minimum conformant implementation which makes sure -// not use use any unitialized memory, and so it causes no spurious error -// reports from valgrind. -// -// The intended use is in the declarations of objects from STL templates, -// e.g. -// typedef vector > vint; -// etc. -// -//--------------------------------------------------------------------- - -#include -#include - -namespace edm -{ - template - class debugging_allocator - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T const* const_pointer; - typedef T& reference; - typedef T const& const_reference; - typedef T value_type; - - template struct rebind { typedef debugging_allocator other; }; - - - debugging_allocator() noexcept : dummy('x') { } - - debugging_allocator(debugging_allocator const&) noexcept : dummy('c') { } - - template debugging_allocator(debugging_allocator const&) noexcept : dummy('u') { } - - ~debugging_allocator() noexcept { }; - - pointer address(reference value) const {return &value;} - - const_pointer address(const_reference value) const {return &value; } - - size_type max_size() const noexcept { return std::numeric_limits::max()/sizeof(T); } - - pointer allocate(size_type num, void const* hint = 0) - { - // allocate objects with global new - return (pointer)(::operator new(num*sizeof(T))); - } - - void construct(pointer p, T const& value) { new((void*)p)T(value); } - - void destroy(pointer p) { p->~T(); } - - void deallocate(pointer p, size_type num) { ::operator delete((void*)p); } - - private: - char dummy; - - }; - - // instances of all specializations of this allocator are equal - template - bool operator== (debugging_allocator const&, debugging_allocator const&) noexcept { return true; } - - template - bool operator!= (debugging_allocator const&, debugging_allocator const&) noexcept { return false; } - -} //namespace edm - - -#endif diff --git a/DataFormats/Common/test/OwnArray_t.cpp b/DataFormats/Common/test/OwnArray_t.cpp deleted file mode 100644 index 14afce3c5f1d7..0000000000000 --- a/DataFormats/Common/test/OwnArray_t.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include -#include - -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - - -struct Base -{ - virtual ~Base(); - virtual Base* clone() const = 0; -}; - -Base::~Base() {} - -struct Derived : Base -{ - explicit Derived(int n); - Derived(Derived const& other); - Derived& operator=(Derived const& other); - virtual ~Derived(); - void swap(Derived& other); - virtual Derived* clone() const; - - edm::propagate_const pointer; -}; - -Derived::Derived(int n) : pointer(new int(n)) { } - -Derived::Derived(Derived const& other) : pointer(new int(*other.pointer)) { } - -Derived& Derived::operator=(Derived const& other) -{ - Derived temp(other); - swap(temp); - return *this; -} - -void Derived::swap(Derived& other) -{ - std::swap(pointer, other.pointer); -} - -void swap(Derived& a, Derived& b) -{ - a.swap(b); -} - -Derived::~Derived() -{ - delete pointer.get(); -} - -Derived* -Derived::clone() const -{ - return new Derived(*this); -} - - - -void same_guy_twice() -{ - edm::OwnArray vec; - Base* p = new Derived(1); - - vec.push_back(p); - vec.push_back(p); -} - -void two_different_owners() -{ - edm::OwnArray v1,v2; - Base* p = new Derived(1); - v1.push_back(p); - v2.push_back(p); -} - -// void guy_on_stack() -// { -// edm::OwnArray v; -// Derived d(10); -// v.push_back(&d); -// } - -void copy_good_vec() -{ - // v1 is perfectly fine... - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - //v1.push_back(new Derived(100)); - - // But what if we copy him? - edm::OwnArray v2(v1); -} - -void assign_to_other() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - edm::OwnArray v2; - v2 = v1; -} - -void assign_to_self() -{ - // Self-assignment happens, often by accident... - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1 = v1; -} - -void pop_one() -{ - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1.pop_back(); -} - -void back_with_null_pointer() -{ - edm::OwnArray v; - Base* p = 0; - v.push_back(p); - try - { - v.back(); - assert("Failed to throw a required exception in OwnArray_t"==0); - } - catch (edm::Exception& x) - { - // this is expected. - } - catch (...) - { - throw; - } -} - -void take_an_rvalue() -{ - edm::OwnArray v; - v.push_back(new Derived(101)); - Derived d(102); - v.push_back(d.clone()); -} - -void take_an_lvalue() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - assert(p == 0); -} - -void take_an_auto_ptr() -{ - edm::OwnArray v1; - std::unique_ptr p = std::make_unique(100); - v1.push_back(p); - assert(p.get() == 0); -} - -int main() -{ - edm::OwnArray vec; - vec.push_back(new Derived(100)); - edm::OwnArray* p = new edm::OwnArray; - p->push_back(new Derived(2)); - delete p; - // same_guy_twice(); - // two_different_owners(); - // guy_on_stack(); - copy_good_vec(); - assign_to_other(); - assign_to_self(); - pop_one(); - back_with_null_pointer(); - - take_an_rvalue(); - take_an_lvalue(); - take_an_auto_ptr(); -} diff --git a/DataFormats/Common/test/testOwnArray.cc b/DataFormats/Common/test/testOwnArray.cc deleted file mode 100644 index 498a76f77e4ad..0000000000000 --- a/DataFormats/Common/test/testOwnArray.cc +++ /dev/null @@ -1,139 +0,0 @@ -// -#include "cppunit/extensions/HelperMacros.h" -#include -#include -#include -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - -class testOwnArray : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(testOwnArray); - CPPUNIT_TEST(checkAll); - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {} - void tearDown() {} - void checkAll(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(testOwnArray); - -namespace testOA { - struct Dummy { - Dummy(int n, bool * r) : value(n), ref(r) { } - ~Dummy() { * ref = true; } - int value; - bool operator<(const Dummy & o) const { - return value < o.value; - } - private: - edm::propagate_const ref; - }; - - struct DummyComp { - bool operator()(const Dummy& d1, const Dummy& d2) const { - return d1.value < d2.value; - } - }; - - class a { - public: - virtual ~a() {} - virtual int f() const = 0; - }; - - class ClassB : public a { - public: - ClassB(int i) : ii(i) {memset(&waste, 0, sizeof(waste));} - virtual ~ClassB() {} - virtual int f() const { return ii; } - int ii; - private: - char waste[1024*1024]; - }; - - class ss { - public: - bool operator() (const a & a1, const a & a2) const { - return (a1.f() > a2.f()); - } - }; - - inline std::ostream& operator<<(std::ostream& os, const a & aa) { - os << aa.f(); - return os; - } -} - -void testOwnArray::checkAll() { - edm::OwnArray v; - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - bool deleted[4] = { false, false, false, false }; - v.push_back(new testOA::Dummy(0, deleted + 0)); - v.push_back(new testOA::Dummy(1, deleted + 1)); - v.push_back(new testOA::Dummy(2, deleted + 2)); - v.push_back(new testOA::Dummy(3, deleted + 3)); - CPPUNIT_ASSERT(v.size() == 4); - auto i = v.begin(); - auto ci = i; - * ci; - v.sort(); - v.sort(testOA::DummyComp()); - CPPUNIT_ASSERT(!v.empty()); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 1); - CPPUNIT_ASSERT(v[2].value == 2); - CPPUNIT_ASSERT(v[3].value == 3); - i = v.begin() + 1; - v.erase( i ); - CPPUNIT_ASSERT(!deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - CPPUNIT_ASSERT(v.size() == 3); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 2); - CPPUNIT_ASSERT(v[2].value == 3); - auto b = v.begin(), e = b + 1; - v.erase(b, e); - CPPUNIT_ASSERT(v.size() == 2); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - v.clear(); - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(deleted[2]); - CPPUNIT_ASSERT(deleted[3]); - { - edm::OwnArray v; - testOA::a * aa = new testOA::ClassB(2); - v.push_back(aa); - aa = new testOA::ClassB(1); - v.push_back(aa); - aa = new testOA::ClassB(3); - v.push_back(aa); - v.sort(testOA::ss()); - std::cout << "OwnArray : dumping contents" << std::endl; - std::copy(v.begin(), - v.end(), - std::ostream_iterator(std::cout, "\t")); - - edm::Ptr ptr_v; - unsigned long index(0); - void const * data = &v[0]; - v.setPtr( typeid(testOA::a), index, data ); - testOA::a const * data_a = static_cast(data); - testOA::ClassB const * data_b = dynamic_cast(data_a); - CPPUNIT_ASSERT( data != 0); - CPPUNIT_ASSERT( data_a != 0); - CPPUNIT_ASSERT( data_b != 0); - if(data_b != 0) { // To silence Coverity - CPPUNIT_ASSERT( data_b->f() == 3); - } - } -} diff --git a/DataFormats/GeometrySurface/interface/private/extTkRotation.h b/DataFormats/GeometrySurface/interface/private/extTkRotation.h deleted file mode 100644 index f1c2aa2a67aeb..0000000000000 --- a/DataFormats/GeometrySurface/interface/private/extTkRotation.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef Geom_newTkRotation_H -#define Geom_newTkRotation_H - -#include "DataFormats/GeometryVector/interface/Basic2DVector.h" -#include "DataFormats/GeometryVector/interface/Basic3DVector.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "DataFormats/Math/interface/ExtVec.h" - - -#include - -template class TkRotation; -template class TkRotation2D; - -template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); -template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); - -namespace geometryDetails { - void TkRotationErr1(); - void TkRotationErr2(); - -} - - -/** Rotaion matrix used by Surface. - */ - -template -class TkRotation { -public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; - typedef Basic3DVector BasicVector; - - TkRotation( ){} - TkRotation( Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - - GlobalVector uX = aX.unit(); - GlobalVector uY = aY.unit(); - GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - - } - - TkRotation( const BasicVector & aX, const BasicVector & aY) { - - BasicVector uX = aX.unit(); - BasicVector uY = aY.unit(); - BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - - } - - - /** Construct from global vectors of the x, y and z axes. - * The axes are assumed to be unit vectors forming - * a right-handed orthonormal basis. No checks are performed! - */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - } - - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - } - - - /** rotation around abritrary axis by the amount of phi: - * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) - * the frame is rotated such that the z-asis corresponds to the rotation - * axis desired. THen it's rotated round the "new" z-axis, and then - * the initial transformation is "taken back" again. - * unfortuately I'm too stupid to describe such thing directly by 3 Euler - * angles.. hence I have to construckt it this way...by brute force - */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - - //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); - //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - - // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - - } - /* this is the same thing...derived from the CLHEP ... it gives the - same results MODULO the sign of the rotation.... but I don't want - that... had - TkRotation (const Basic3DVector& axis, float phi) { - T cx = axis.x(); - T cy = axis.y(); - T cz = axis.z(); - - T ll = axis.mag(); - if (ll == 0) { - geometryDetails::TkRotationErr1(); - }else{ - - float cosa = cos(phi), sina = sin(phi); - cx /= ll; cy /= ll; cz /= ll; - - R11 = cosa + (1-cosa)*cx*cx; - R12 = (1-cosa)*cx*cy - sina*cz; - R13 = (1-cosa)*cx*cz + sina*cy; - - R21 = (1-cosa)*cy*cx + sina*cz; - R22 = cosa + (1-cosa)*cy*cy; - R23 = (1-cosa)*cy*cz - sina*cx; - - R31 = (1-cosa)*cz*cx - sina*cy; - R32 = (1-cosa)*cz*cy + sina*cx; - R33 = cosa + (1-cosa)*cz*cz; - - } - - } - */ - - template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; - } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; - } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); - } - - // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { - T del = 0.001; - - if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { - geometryDetails::TkRotationErr2(); - return *this; - } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); - } - } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0][0];} - T xy() const { return rot.axis[0][1];} - T xz() const { return rot.axis[0][2];} - T yx() const { return rot.axis[1][0];} - T yy() const { return rot.axis[1][1];} - T yz() const { return rot.axis[1][2];} - T zx() const { return rot.axis[2][0];} - T zy() const { return rot.axis[2][1];} - T zz() const { return rot.axis[2][2];} - -private: - - Rot3 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - - -template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); -} - -template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); -} - - -template -class TkRotation2D { -public: - - typedef Basic2DVector BasicVector; - - TkRotation2D( ){} - TkRotation2D( Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } - - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} - - - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); - } - - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); - } - - - - private: - - Rot2 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - - -#endif - - - - diff --git a/DataFormats/GeometrySurface/interface/private/newTkRotation.h b/DataFormats/GeometrySurface/interface/private/newTkRotation.h deleted file mode 100644 index f12a7b1ebe118..0000000000000 --- a/DataFormats/GeometrySurface/interface/private/newTkRotation.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef Geom_newTkRotation_H -#define Geom_newTkRotation_H - -#include "DataFormats/GeometryVector/interface/Basic2DVector.h" -#include "DataFormats/GeometryVector/interface/Basic3DVector.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "DataFormats/Math/interface/SSERot.h" - - -#include - -template class TkRotation; -template class TkRotation2D; - -template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); -template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); - -namespace geometryDetails { - void TkRotationErr1(); - void TkRotationErr2(); - -} - - -/** Rotaion matrix used by Surface. - */ - -template -class TkRotation { -public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; - typedef Basic3DVector BasicVector; - - TkRotation( ){} - TkRotation( mathSSE::Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - - GlobalVector uX = aX.unit(); - GlobalVector uY = aY.unit(); - GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - - } - - TkRotation( const BasicVector & aX, const BasicVector & aY) { - - BasicVector uX = aX.unit(); - BasicVector uY = aY.unit(); - BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - - } - - - /** Construct from global vectors of the x, y and z axes. - * The axes are assumed to be unit vectors forming - * a right-handed orthonormal basis. No checks are performed! - */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - } - - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - } - - - /** rotation around abritrary axis by the amount of phi: - * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) - * the frame is rotated such that the z-asis corresponds to the rotation - * axis desired. THen it's rotated round the "new" z-axis, and then - * the initial transformation is "taken back" again. - * unfortuately I'm too stupid to describe such thing directly by 3 Euler - * angles.. hence I have to construckt it this way...by brute force - */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - - //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); - //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - - // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - - } - /* this is the same thing...derived from the CLHEP ... it gives the - same results MODULO the sign of the rotation.... but I don't want - that... had - TkRotation (const Basic3DVector& axis, float phi) { - T cx = axis.x(); - T cy = axis.y(); - T cz = axis.z(); - - T ll = axis.mag(); - if (ll == 0) { - geometryDetails::TkRotationErr1(); - }else{ - - float cosa = cos(phi), sina = sin(phi); - cx /= ll; cy /= ll; cz /= ll; - - R11 = cosa + (1-cosa)*cx*cx; - R12 = (1-cosa)*cx*cy - sina*cz; - R13 = (1-cosa)*cx*cz + sina*cy; - - R21 = (1-cosa)*cy*cx + sina*cz; - R22 = cosa + (1-cosa)*cy*cy; - R23 = (1-cosa)*cy*cz - sina*cx; - - R31 = (1-cosa)*cz*cx - sina*cy; - R32 = (1-cosa)*cz*cy + sina*cx; - R33 = cosa + (1-cosa)*cz*cz; - - } - - } - */ - - template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; - } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; - } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); - } - - // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { - T del = 0.001; - - if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { - geometryDetails::TkRotationErr2(); - return *this; - } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); - } - } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0].arr[0];} - T xy() const { return rot.axis[0].arr[1];} - T xz() const { return rot.axis[0].arr[2];} - T yx() const { return rot.axis[1].arr[0];} - T yy() const { return rot.axis[1].arr[1];} - T yz() const { return rot.axis[1].arr[2];} - T zx() const { return rot.axis[2].arr[0];} - T zy() const { return rot.axis[2].arr[1];} - T zz() const { return rot.axis[2].arr[2];} - -private: - - mathSSE::Rot3 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - - -template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); -} - -template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); -} - - -template -class TkRotation2D { -public: - - typedef Basic2DVector BasicVector; - - TkRotation2D( ){} - TkRotation2D( mathSSE::Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } - - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} - - - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); - } - - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); - } - - - - private: - - mathSSE::Rot2 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - - -#endif - - - - diff --git a/DataFormats/GeometryVector/interface/OnePiRange.h b/DataFormats/GeometryVector/interface/OnePiRange.h deleted file mode 100644 index 1983da64af506..0000000000000 --- a/DataFormats/GeometryVector/interface/OnePiRange.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GeometryVector_Geom_OnePiRange_h -#define GeometryVector_Geom_OnePiRange_h - -#include -#include - -namespace Geom { - -/** \class OnePiRange - * A class for polar angle represantation. - * The use of OnePiRange is tranparant due to the implicit conversion to T - * Constructs like cos(theta) work as with float or double. - * The difference with respect to built-in types is that - * OnePiRange is kept in the range [0, pi], and this is consistently - * implemented in aritmetic operations. In other words, OnePiRange implements - * "modulo(pi)" arithmetics. - */ - - template - class OnePiRange { - public: - - /// Default constructor does not initialise - just as double. - OnePiRange() {} - - /// Constructor from T, does not provide automatic conversion. - explicit OnePiRange( const T& val) : theValue(val) { normalize(); } - - /// conversion operator makes transparent use possible. - operator T() const { return theValue;} - - /// Template argument conversion - template operator OnePiRange() { return OnePiRange(theValue);} - - /// Explicit access to value in case implicit conversion not OK - T value() const { return theValue;} - - // Standard arithmetics - OnePiRange& operator+=(const T& a) {theValue+=a; normalize(); return *this;} - OnePiRange& operator+=(const OnePiRange& a) {return operator+=(a.value());} - - OnePiRange& operator-=(const T& a) {theValue-=a; normalize(); return *this;} - OnePiRange& operator-=(const OnePiRange& a) {return operator-=(a.value());} - - OnePiRange& operator*=(const T& a) {theValue*=a; normalize(); return *this;} - - OnePiRange& operator/=(const T& a) {theValue/=a; normalize(); return *this;} - - T degrees() const { return theValue*180./pi();} - - /// Return the pseudorapidity. - // No need to handle 0 or pi; in this case "inf" is returned. - T eta() const { return -log(tan(theValue/2.)); } - - - private: - - T theValue; - - void normalize() { - if( theValue > (T) pi() || theValue < 0) { - theValue = fmod( theValue, (T) pi()); - } - if (theValue < 0.) theValue += pi(); - } - - }; - - /// - operator - template - inline OnePiRange operator-(const OnePiRange& a) {return OnePiRange(-a.value());} - - - /// Addition - template - inline OnePiRange operator+(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const Scalar& a, const OnePiRange& b) { - return OnePiRange(b) += a; - } - - /// Subtraction - template - inline OnePiRange operator-(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const Scalar& a, const OnePiRange& b) { - return OnePiRange(a - b.value()); // use of unary operators would normalize twice - } - - /// Multiplication with scalar, does not change the precision - template - inline OnePiRange operator*(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) *= b; - } - - /// Multiplication with scalar - template - inline OnePiRange operator*(double a, const OnePiRange& b) { - return OnePiRange(b) *= a; - } - - /// Division - template - inline T operator/(const OnePiRange& a, const OnePiRange& b) { - return a.value() / b.value(); - } - - /// Division by scalar - template - inline OnePiRange operator/(const OnePiRange& a, double b) { - return OnePiRange(a) /= b; - } - -} -#endif diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h deleted file mode 100644 index 7d6a871576de7..0000000000000 --- a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifndef GeometryVector_newBasic2DVector_h -#define GeometryVector_newBasic2DVector_h - -#include "DataFormats/GeometryVector/interface/Phi.h" -#include "DataFormats/GeometryVector/interface/PreciseFloatType.h" -#include "DataFormats/GeometryVector/interface/CoordinateSets.h" -#include "DataFormats/Math/interface/ExtVec.h" - - -#include -#include - - -template < class T> -class Basic2DVector { -public: - - typedef T ScalarType; - typedef Vec2 VectorType; - typedef Vec2 MathVector; - typedef Geom::Polar2Cartesian Polar; - - /** default constructor uses default constructor of T to initialize the - * components. For built-in floating-point types this means initialization - * to zero - */ - Basic2DVector() : v{0,0} {} - - /// Copy constructor from same type. Should not be needed but for gcc bug 12685 - Basic2DVector( const Basic2DVector & p) : v(p.v) {} - - template - Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} - - - /** Explicit constructor from other (possibly unrelated) vector classes - * The only constraint on the argument type is that it has methods - * x() and y(), and that these methods return a type convertible to T. - * Examples of use are - *
construction from a Basic2DVector with different precision - *
construction from a coordinate system converter - */ - template - explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} - - /// construct from cartesian coordinates - Basic2DVector( const T& x, const T& y) : v{x,y} {} - - // constructor from Vec2 or vec4 - Basic2DVector(MathVector const& iv) : v(iv){} - template - Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} - template - Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} - - MathVector const & mathVector() const { return v;} - MathVector & mathVector() { return v;} - - T operator[](int i) const { return v[i];} - T & operator[](int i) { return v[i];} - - - /// Cartesian x coordinate - T x() const { return v[0];} - - /// Cartesian y coordinate - T y() const { return v[1];} - - /// The vector magnitude squared. Equivalent to vec.dot(vec) - T mag2() const { return ::dot(v,v);} - - /// The vector magnitude. Equivalent to sqrt(vec.mag2()) - T mag() const { return std::sqrt( mag2());} - - /// Radius, same as mag() - T r() const { return mag();} - - /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. - * Same precision as the system atan2(x,y) function. - * The return type is Geom::Phi, see it's documentation. - */ - T barePhi() const {return std::atan2(y(),x());} - Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} - - /** Unit vector parallel to this. - * If mag() is zero, a zero vector is returned. - */ - Basic2DVector unit() const { - T my_mag = mag(); - return my_mag == 0 ? *this : *this / my_mag; - } - - /** Operator += with a Basic2DVector of possibly different precision. - */ - template - Basic2DVector& operator+= ( const Basic2DVector& p) { - v = v + p.v; - return *this; - } - - /** Operator -= with a Basic2DVector of possibly different precision. - */ - template - Basic2DVector& operator-= ( const Basic2DVector& p) { - v = v - p.v; - return *this; - } - - /// Unary minus, returns a vector with components (-x(),-y(),-z()) - Basic2DVector operator-() const { return Basic2DVector(-v);} - - /// Scaling by a scalar value (multiplication) - Basic2DVector& operator*= ( T t) { - v = v*t; - return *this; - } - - /// Scaling by a scalar value (division) - Basic2DVector& operator/= ( T t) { - t = T(1)/t; - v = v*t; - return *this; - } - - /// Scalar product, or "dot" product, with a vector of same type. - T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} - - /** Scalar (or dot) product with a vector of different precision. - * The product is computed without loss of precision. The type - * of the returned scalar is the more precise of the scalar types - * of the two vectors. - */ - template - typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .dot(Basic2DVector::Type>(lh)); - } - - /// Vector product, or "cross" product, with a vector of same type. - T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} - - /** Vector (or cross) product with a vector of different precision. - * The product is computed without loss of precision. The type - * of the returned scalar is the more precise of the scalar types - * of the two vectors. - */ - template - typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .cross(Basic2DVector::Type>(lh)); - } - - -public: - - Vec2 v; - -}; - - -namespace geometryDetails { - std::ostream & print2D(std::ostream& s, double x, double y); - -} - -/// simple text output to standard streams -template -inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { - return geometryDetails::print2D(s, v.x(),v.y()); -} - - -/// vector sum and subtraction of vectors of possibly different precision -template -inline Basic2DVector -operator+( const Basic2DVector& a, const Basic2DVector& b) { - return a.v+b.v; -} -template -inline Basic2DVector -operator-( const Basic2DVector& a, const Basic2DVector& b) { - return a.v-b.v; -} - -template -inline Basic2DVector::Type> -operator+( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a) + RT(b); -} - -template -inline Basic2DVector::Type> -operator-( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a)-RT(b); -} - - - - -// scalar product of vectors of same precision -template -inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { - return v1.dot(v2); -} - -/// scalar product of vectors of different precision -template -inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, - const Basic2DVector& v2) { - return v1.dot(v2); -} - - -/** Multiplication by scalar, does not change the precision of the vector. - * The return type is the same as the type of the vector argument. - */ -template -inline Basic2DVector operator*( const Basic2DVector& v, T t) { - return v.v*t; -} - -/// Same as operator*( Vector, Scalar) -template -inline Basic2DVector operator*(T t, const Basic2DVector& v) { - return v.v*t; -} - - - -template -inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { - T t = static_cast(s); - return v*t; -} - -/// Same as operator*( Vector, Scalar) -template -inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { - T t = static_cast(s); - return v*t; -} - -/** Division by scalar, does not change the precision of the vector. - * The return type is the same as the type of the vector argument. - */ -template -inline Basic2DVector operator/(const Basic2DVector& v, T t) { - return v.v/t; -} - -template -inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { - // T t = static_cast(Scalar(1)/s); return v*t; - T t = static_cast(s); - return v/t; -} - -typedef Basic2DVector Basic2DVectorF; -typedef Basic2DVector Basic2DVectorD; - - -#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/METReco/interface/PFClusterMETCollection.h b/DataFormats/METReco/interface/PFClusterMETCollection.h deleted file mode 100644 index 1a02b783450ae..0000000000000 --- a/DataFormats/METReco/interface/PFClusterMETCollection.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef METRECO_PFClusterMETCOLLECTION_H -#define METRECO_PFClusterMETCOLLECTION_H - -/** \class PFClusterMETCollection - * - * \short Collection of PFCluster MET - * - * PFClusterMETCollection is a collection of PFClusterMET objects - * - * \author Salvatore Rappoccio, JHU - * - * \version 1st Version Dec, 2010 - * - ************************************************************/ - -#include -#include "DataFormats/METReco/interface/PFClusterMETFwd.h" - -namespace reco -{ - typedef std::vector PFClusterMETCollection; -} -#endif // METRECO_PFClusterMETCOLLECTION_H diff --git a/DataFormats/Math/interface/SSEArray.h b/DataFormats/Math/interface/SSEArray.h deleted file mode 100644 index 778100e291007..0000000000000 --- a/DataFormats/Math/interface/SSEArray.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef DataFormat_Math_SSEArray_H -#define DataFormat_Math_SSEArray_H - - -#include "DataFormats/Math/interface/SSEVec.h" -#include - -#ifdef CMS_USE_SSE -namespace mathSSE { - -// "vertical array" - template - struct ArrayTraits { - }; - - template - struct ArrayMask { - }; - - //FIXME avoid punning... - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0x0, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0x0); - return v; - } - }; - - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0xffffffffffffffffLL); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0x0LL); - return v; - } - }; - - - template - struct ArrayTraits { - typedef float Scalar; - typedef Vec4 Vec; - static const size_t size = S; - static const size_t ssesize = (S+3)/4; - static const size_t arrsize = 4*ssesize; - static inline Vec maskLast() { return ArrayMask::value(); } - static inline Vec __attribute__((__always_inline__)) mask(Vec v, size_t i) { - return (i==ssesize-1) ? maskLast()&v : v; - } - template - static void loop(F f) { - for (size_t i=0; i!=ssesize-1;++i) - f(i, ArrayMask::value()); - f(ssesize-1,maskLast()); - } - }; - - template - struct ArrayTraits { - typedef double Scalar; - typedef Vec2 Vec; - static const size_t size = S; - static const size_t ssesize = (S+1)/2; - static const size_t arrsize = 2*ssesize; - static inline Vec maskLast() { return ArrayMask::value();} - }; - - template - union Array { - typedef ArrayTraits Traits; - typedef typename Traits::Vec Vec; - typename Vec::nativeType vec[Traits::ssesize]; - T __attribute__ ((aligned(16))) arr[Traits::arrsize]; - - Vec operator[]( size_t i) { return vec[i];} - Vec const & operator[]( size_t i) const{ return reinterpret_cast(vec[i]);} - - }; - - -} - -#endif // CMS_USE_SSE -#endif // DataFormat_Math_SSEArray_H diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h deleted file mode 100644 index 9fe33e8c3d1fd..0000000000000 --- a/DataFormats/Math/interface/private/AVXVec.h +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef DataFormat_Math_AVXVec_H -#define DataFormat_Math_AVXVec_H - -// in principle it should not be used alone -// only as part of SSEVec -namespace mathSSE { - - template<> - union Vec4 { - typedef __m256d nativeType; - __m256d vec; - double __attribute__ ((aligned(32))) arr[4]; - OldVec o; - - Vec4(__m256d ivec) : vec(ivec) {} - - Vec4(OldVec const & ivec) : o(ivec) {} - - Vec4() { - vec = _mm256_setzero_pd(); - } - - - inline Vec4(Vec4 ivec) { - vec = _mm256_cvtps_pd(ivec.vec); - } - - explicit Vec4(double f1) { - set1(f1); - } - - Vec4(double f1, double f2, double f3, double f4=0) { - arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; - } - - - Vec4( Vec2 ivec0, Vec2 ivec1) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - vec = _mm256_insertf128_pd(vec,ivec1.vec,1); - - } - - Vec4( Vec2 ivec0, double f3, double f4=0) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - arr[2] = f3; arr[3] = f4; - } - - Vec4( Vec2 ivec0) { - vec = _mm256_setzero_pd(); - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - } - - - // for masking - void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { - Mask4 mask(m1,m2,m3,m4); vec=mask.vec; - } - - void set(double f1, double f2, double f3, double f4=0) { - vec = _mm256_set_pd(f4, f3, f2, f1); - } - - void set1(double f1) { - vec = _mm256_set1_pd(f1); - } - - template - Vec4 get1() const { - return _mm256_set1_pd(arr[N]); //FIXME - } - /* - Vec4 get1(unsigned int n) const { - return _mm256_set1_pd(arr[n]); //FIXME - } - */ - double & operator[](unsigned int n) { - return arr[n]; - } - - double operator[](unsigned int n) const { - return arr[n]; - } - - Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} - Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} - - }; - - inline Vec4::Vec4(Vec4 ivec) { - vec = _mm256_cvtpd_ps(ivec.vec); - } -} // namespace mathSSE - - - -inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; -} - -inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); -} - -inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); -} - -inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_hadd_pd(a.vec,b.vec); -} - - - -inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { - const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); - return _mm256_xor_pd(a.vec,neg); -} - -inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_and_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_or_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_xor_pd(a.vec,b.vec); -} -inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_andnot_pd(a.vec,b.vec); -} - - -inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_add_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_sub_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_mul_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_div_pd(a.vec,b.vec); -} - -inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); -} - -inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); -} - -inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { - return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); -} - - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) -dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_dot_pd; - mathSSE::Vec4 ret; - ret.vec = _mm256_dot_pd(a.vec,b.vec); - return ret.arr[0]; -} - -inline mathSSE::Vec4 -__attribute__((always_inline)) __attribute__ ((pure)) -cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_cross_pd; - return _mm256_cross_pd(a.vec,b.vec); -} - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) -dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { - mathSSE::Vec4 mul = a*b; - mul = hadd(mul,mul); - return mul.arr[0]; -} - - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h deleted file mode 100644 index 1ec4e68460ee2..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFBlockElementFwd_h -#define DataFormats_ParticleFlowReco_PFBlockElementFwd_h - -/* #include */ - -/* #include "DataFormats/Common/interface/RefProd.h" */ -/* #include "DataFormats/Common/interface/RefVector.h" */ - -namespace reco { - class PFBlockElement; - class PFBlockElementCluster; - class PFBlockElementTrack; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h deleted file mode 100644 index f185ddc2b8f96..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PFBlockElementSuperClusterFwd_H -#define PFBlockElementSuperClusterFwd_H -#include -#include "DataFormats/Common/interface/Ref.h" -namespace reco { - class PFBlockElementSuperCluster; - typedef std::vector PFBlockElementSuperClusterCollection; - typedef edm::Ref PFBlockElementSuperClusterRef; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h b/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h deleted file mode 100644 index d6dccf9c9c476..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ParticleFlowReco_PFClusterShapeAssociation_h_ -#define ParticleFlowReco_PFClusterShapeAssociation_h_ -// \class PFClusterShapeAssociation -// -// \association of ClusterShape to PFCluster -// -// -// -#include "DataFormats/EgammaReco/interface/ClusterShapeFwd.h" -#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/AssociationMap.h" -#include - -namespace reco -{ - typedef - edm::AssociationMap > - PFClusterShapeAssociationCollection; - typedef - PFClusterShapeAssociationCollection::value_type PFClusterShapeAssociation; - typedef - edm::Ref PFClusterShapeAssociationRef; - typedef - edm::RefProd PFClusterShapeAssociationRefProd; - typedef - edm::RefVector PFClusterShapeAssociationRefVector; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h b/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h deleted file mode 100644 index ae63ca1682f2b..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFParticleFwd_h -#define DataFormats_ParticleFlowReco_PFParticleFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFParticle; - - /// collection of PFParticle objects - typedef std::vector PFParticleCollection; - - /// persistent reference to PFParticle objects - typedef edm::Ref PFParticleRef; - - /// reference to PFParticle collection - typedef edm::RefProd PFParticleRefProd; - - /// vector of references to PFParticle objects all in the same collection - typedef edm::RefVector PFParticleRefVector; - - /// iterator over a vector of references to PFParticle objects - typedef PFParticleRefVector::iterator pfParticle_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h deleted file mode 100644 index 4710147743e4e..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef ParticleFlowReco_PFSuperClusterFwd_h -#define ParticleFlowReco_PFSuperClusterFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFSuperCluster; - - /// collection of PFSuperCluster objects - typedef std::vector PFSuperClusterCollection; - - /// persistent reference to PFSuperCluster objects - typedef edm::Ref PFSuperClusterRef; - - /// reference to PFSuperCluster collection - typedef edm::RefProd PFSuperClusterRefProd; - - /// vector of references to PFSuperCluster objects all in the same collection - typedef edm::RefVector PFSuperClusterRefVector; - - /// iterator over a vector of references to PFSuperCluster objects - typedef PFSuperClusterRefVector::iterator PFSuperCluster_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h b/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h deleted file mode 100644 index fa2645f21f5df..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#define DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFTrajectoryPoint; - - /// collection of PFTrajectoryPoint objects - typedef std::vector PFTrajectoryPointCollection; - - /// persistent reference to PFTrajectoryPoint objects - typedef edm::Ref PFTrajectoryPointRef; - - /// reference to PFTrajectoryPoint collection - typedef edm::RefProd PFTrajectoryPointRefProd; - - /// vector of references to PFTrajectoryPoint objects all in the same collection - typedef edm::RefVector PFTrajectoryPointRefVector; - - /// iterator over a vector of references to PFTrajectoryPoint objects - typedef PFTrajectoryPointRefVector::iterator trajectoryPoint_iterator; -} - -#endif diff --git a/DataFormats/Provenance/interface/BranchDescriptionIndex.h b/DataFormats/Provenance/interface/BranchDescriptionIndex.h deleted file mode 100644 index 23a6da64024b2..0000000000000 --- a/DataFormats/Provenance/interface/BranchDescriptionIndex.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DataFormats_Provenance_BranchDescriptionIndex_h -#define DataFormats_Provenance_BranchDescriptionIndex_h -// -*- C++ -*- -// -// Package: Provenance -// Class : BranchDescriptionIndex -// -/**\class BranchDescriptionIndex BranchDescriptionIndex.h DataFormats/Provenance/interface/BranchDescriptionIndex.h - - Description: Index into BranchDescription vector - - Usage: - Internally used by ProductRegistry and by Principal to quickly find data - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:46:09 CDT 2009 -// - -// system include files - -// user include files - -// forward declarations - -namespace edm { - typedef unsigned int BranchDescriptionIndex; -} - -#endif diff --git a/DataFormats/Provenance/interface/TypeInBranchType.h b/DataFormats/Provenance/interface/TypeInBranchType.h deleted file mode 100644 index 8dd5c6a262e52..0000000000000 --- a/DataFormats/Provenance/interface/TypeInBranchType.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef DataFormats_Provenance_TypeInBranchType_h -#define DataFormats_Provenance_TypeInBranchType_h -// -*- C++ -*- -// -// Package: Provenance -// Class : TypeInBranchType -// -/**\class TypeInBranchType TypeInBranchType.h DataFormats/Provenance/interface/TypeInBranchType.h - - Description: Pairs C++ class type and edm::BranchType - - Usage: - Used internally to ProductRegistry and for quickly finding data in Principals - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:50:17 CDT 2009 -// - -// system include files - -// user include files -#include "DataFormats/Provenance/interface/BranchType.h" -#include "FWCore/Utilities/interface/TypeID.h" - -// forward declarations - -namespace edm { - class TypeInBranchType { - - public: - TypeInBranchType(TypeID const& iID, - BranchType const& iBranch) : - id_(iID), - branch_(iBranch) {} - - TypeID const& typeID() const { - return id_; - } - - BranchType const& branchType() const { - return branch_; - } - - bool operator<(TypeInBranchType const& iRHS) const { - if(branch_ < iRHS.branch_) { - return true; - } - if(iRHS.branch_ < branch_) { - return false; - } - return id_ < iRHS.id_; - } - private: - TypeID id_; - BranchType branch_; - }; - -} - -#endif diff --git a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h b/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h deleted file mode 100644 index 429c7ab205921..0000000000000 --- a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef RPCOBJECTS_RPCDIGIL1LINKFWD_H -#define RPCOBJECTS_RPCDIGIL1LINKFWD_H -class RPCDigiL1Link; -#endif // RPCOBJECTS_RPCDIGIL1LINKFWD_H diff --git a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h b/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h deleted file mode 100644 index 9e5062017f007..0000000000000 --- a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -#define TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -class PixelDigiCollection; -#endif // TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H diff --git a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h b/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h deleted file mode 100644 index 7a0bd46627698..0000000000000 --- a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef DataFormats_SiStripCommon_ConstantsForSummaryPlots_H -#define DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - -#include "DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h" -#include "DataFormats/SiStripCommon/interface/ConstantsForPresentation.h" - -#endif // DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - - diff --git a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h b/DataFormats/SiStripDigi/interface/SiStripDigifwd.h deleted file mode 100644 index 5287a400d6d3b..0000000000000 --- a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_SISTRIPDIGIFWD_H -#define TRACKINGOBJECTS_SISTRIPDIGIFWD_H -class SiStripDigi; -#endif // TRACKINGOBJECTS_SISTRIPDIGIFWD_H diff --git a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h b/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h deleted file mode 100644 index 1e5b57c035863..0000000000000 --- a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef DataFormats_SiPixelRecHitFWD_H -#define DataFormats_SiPixelRecHitFWD_H -class SiPixelRecHit; -#endif // diff --git a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h b/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h deleted file mode 100644 index 12c0a9bf9db97..0000000000000 --- a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h -#define DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h - - -#include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" -typedef TrajectorySeed BasicTrajectorySeed; - - -#endif From 8f3fd8b09ee167489d2ef8b6d958d48d80c6f472 Mon Sep 17 00:00:00 2001 From: Congqiao Li Date: Mon, 30 Aug 2021 13:28:37 +0200 Subject: [PATCH 213/923] Fix RelVal workflow 573 --- .../python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py | 4 +--- Configuration/PyReleaseValidation/python/relval_steps.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) 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 index 4c6e0621f529d..06fa6024f2e42 100644 --- 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 @@ -62,8 +62,6 @@ ) from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter -generator = ExternalGeneratorFilter(_generator, - _external_process_waitTime_=cms.untracked.uint32(1200), # increase the max waitTime for Sherpa - ) +generator = ExternalGeneratorFilter(_generator) ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index a6d51b37517b8..612f02d1f6e1f 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -1357,7 +1357,7 @@ def identityFS(wf): 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['sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen']=genvalid('sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff',merge([{'-n':'50'},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) From bf48b21177c15ef3b29b0156a7df543be65e7596 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 14:59:16 +0200 Subject: [PATCH 214/923] comments on LCToCP and LCToSC associators --- .../LCToCPAssociatorByEnergyScoreImpl.cc | 27 ++++++++++++------- .../LCToCPAssociatorByEnergyScoreImpl.h | 25 +++++++++++++++++ .../LCToSCAssociatorByEnergyScoreImpl.h | 9 ++++--- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 965281a03885b..59b26a7477bbe 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -20,19 +20,20 @@ LCToCPAssociatorByEnergyScoreImpl::LCToCPAssociatorByEnergyScoreImpl( hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle& cCCH, const edm::Handle& cPCH) const { - // 1. Extract collections and filter CaloParticles, if required + // Get collections const auto& clusters = *cCCH.product(); const auto& caloParticles = *cPCH.product(); auto nLayerClusters = clusters.size(); - //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. + + //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution and save the indices. std::vector cPIndices; - //Consider CaloParticles coming from the hard scatterer - //excluding the PU contribution and save the indices. removeCPFromPU(caloParticles, cPIndices, hardScatterOnly_); auto nCaloParticles = cPIndices.size(); - // Initialize cPOnLayer. To be returned outside, since it contains the - // information to compute the CaloParticle-To-LayerCluster score. + // Initialize cPOnLayer. It contains the caloParticleOnLayer structure for all CaloParticles in each layer and + // among other the information to compute the CaloParticle-To-LayerCluster score. It is one of the two objects that + // build the output of the makeConnections function. + // cPOnLayer[cpId][layerId] hgcal::caloParticleToLayerCluster cPOnLayer; cPOnLayer.resize(nCaloParticles); for (unsigned int i = 0; i < nCaloParticles; ++i) { @@ -46,6 +47,10 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } // Fill detIdToCaloParticleId_Map and update cPOnLayer + // The detIdToCaloParticleId_Map is used to connect a hit Detid (key) with all the CaloParticles that + // contributed to that hit by storing the CaloParticle id and the fraction of the hit. Observe here + // that all the different contributions of the same CaloParticle to a single hit (coming from their + // internal SimClusters) are merged into a single entry with the fractions properly summed. std::unordered_map> detIdToCaloParticleId_Map; for (const auto& cpId : cPIndices) { const SimClusterRefVector& simClusterRefVector = caloParticles[cpId].simClusters(); @@ -343,6 +348,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } // Compute the correct normalization + // It is the inverse of the denominator of the LCToCP score formula. Observe that this is the sum of the squares. float invLayerClusterEnergyWeight = 0.f; for (auto const& haf : clusters[lcId].hitsAndFractions()) { invLayerClusterEnergyWeight += @@ -370,7 +376,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } cpPair.second += (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invLayerClusterEnergyWeight; - } + } //End of loop over CaloParticles related the this LayerCluster. } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (cpsInLayerCluster[lcId].empty()) @@ -410,7 +416,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( << CPNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInCP << "\t" << std::setw(15) << maxEnergyLCinCP << "\t" << std::setw(20) << CPEnergyFractionInLC << "\n"; #endif - // Compute the correct normalization + // Compute the correct normalization. Observe that this is the sum of the squares. float invCPEnergyWeight = 0.f; for (auto const& haf : cPOnLayer[cpId][layerId].hits_and_fractions) { invCPEnergyWeight += std::pow(haf.second * hitMap_->at(haf.first)->energy(), 2); @@ -464,8 +470,9 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( << (lcPair.second.first / CPenergy) << "\n"; } #endif - } - } + } // End of loop over layers + } // End of loop over CaloParticles + return {cpsInLayerCluster, cPOnLayer}; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index cf2968aff9f56..06debda7f38d9 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -15,6 +15,10 @@ namespace edm { } namespace hgcal { + // This structure is used both for LayerClusters and CaloParticles storing their id and the fraction of a hit + // that belongs to the LayerCluster or CaloParticle. The meaning of the operator is extremely important since + // this struct will be used inside maps and other containers and when searching for one particular occurence + // only the clusterId member will be used in the check, skipping the fraction part. struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -25,6 +29,18 @@ namespace hgcal { } }; + // This introduces a CaloParticle on layer concept. For a CaloParticle it stores: + // 1. Its id: caloParticleId. + // 2. The energy that the CaloParticle deposited in a specific layer and it was reconstructed. + // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed + // and doesn't have any matched rechits are disregarded. Keep in mind that since a CaloParticle + // should most probably have more than one SimCluster, all different contributions from the same CaloParticle + // to a single hit are merged into a single entry, with the fractions properly summed. + // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the CaloParticle under study + // together with the energy that the LayerCluster reconstructed from the CaloParticle and the score. The energy + // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the CaloParticle. + // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's + // cells that the CaloParticle didn't contribute. struct caloParticleOnLayer { unsigned int caloParticleId; float energy = 0; @@ -32,8 +48,17 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; + // This object connects a LayerCluster, identified through its id (lcId), with a vector containing all the CaloParticles + // (via their ids (cpIds)) that share at least one cell with the LayerCluster. For that pair (lcId,cpId) it + // stores the score. Keep in mind that the association is not unique, since there could be several instances + // of the same CaloParticle from several related SimClusters that each contributed to the same LayerCluster. typedef std::vector>> layerClusterToCaloParticle; + // This is used to save the caloParticleOnLayer structure for all CaloParticles in each layer. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector> caloParticleToLayerCluster; + //This is the output of the makeConnections function that contain all the work with CP2LC and LC2CP + //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to + //provide the final product. typedef std::tuple association; } // namespace hgcal diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index 24e3ae6e62298..081c5f34951c6 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -15,10 +15,10 @@ namespace edm { } namespace hgcal { - // This structure is used both for LayerClusters and SimClusters storing the id and the fraction of a hit + // This structure is used both for LayerClusters and SimClusters storing their id and the fraction of a hit // that belongs to the LayerCluster or SimCluster. The meaning of the operator is extremely important since // this struct will be used inside maps and other containers and when searching for one particular occurence - // only the clusterId member will be used in the check skipping the fraction part. + // only the clusterId member will be used in the check, skipping the fraction part. struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -36,8 +36,9 @@ namespace hgcal { // and doesn't have any matched rechits are disregarded. // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the simCluster under study // together with the energy that the Layercluster reconstructed from the SimClusters and the score. The energy - // is not the energy of the LayerCluster, but the energy coming from the SimCluster. So, there will be energy of - // the LayerCluster that is disregarded here, since there may be LayerCluster's cells that the SimCluster didn't contributed. + // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the SimCluster. + // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's + // cells that the SimCluster didn't contribute. struct simClusterOnLayer { unsigned int simClusterId; float energy = 0; From 74d43784d713913aea0ca3a90edea474a43aba7b Mon Sep 17 00:00:00 2001 From: swmukher Date: Mon, 30 Aug 2021 16:13:10 +0200 Subject: [PATCH 215/923] remove redundant brackets --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index f91ffaab113ab..ff7b919f1a9f8 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -12,7 +12,7 @@ calotowers which is expected to be phased out sometime in Run3. The old class can also be used until calotowers stay. After that, one need to switch to this new one. As the old producer code, this one also produces either Hcal isolation or H for H/E depending if doEtSum=true or false. -H for H/E = either a single HCCAL tower behind SC, or towers in a cone, and hcal isolation has these tower(s) excluded. +H for H/E = either a single HCAL tower behind SC, or towers in a cone, and hcal isolation has these tower(s) excluded. A rho correction can be applied */ @@ -116,27 +116,27 @@ EgammaHLTHcalVarProducerFromRecHit::EgammaHLTHcalVarProducerFromRecHit(const edm void EgammaHLTHcalVarProducerFromRecHit::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; - desc.add(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate")); - desc.add(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo")); - desc.add(("hbheRecHitsTag"), edm::InputTag("hltHbhereco")); - desc.add(("doRhoCorrection"), false); - desc.add(("rhoMax"), 999999.); + desc.add("recoEcalCandidateProducer", edm::InputTag("hltRecoEcalCandidate")); + desc.add("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo")); + desc.add("hbheRecHitsTag", edm::InputTag("hltHbhereco")); + desc.add("doRhoCorrection", false); + desc.add("rhoMax", 999999.); desc.add(("rhoScale"), 1.0); //eThresHB/HE are from RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py - desc.add >(("eThresHB"), {0.1, 0.2, 0.3, 0.3}); - desc.add >(("etThresHB"), {0, 0, 0, 0}); - desc.add >(("eThresHE"), {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); - desc.add >(("etThresHE"), {0, 0, 0, 0, 0, 0, 0}); - desc.add(("innerCone"), 0); - desc.add(("outerCone"), 0.14); - desc.add(("depth"), 0); - desc.add(("maxSeverityHB"), 9); - desc.add(("maxSeverityHE"), 9); - desc.add(("doEtSum"), false); - desc.add(("useSingleTower"), false); + desc.add >("eThresHB", {0.1, 0.2, 0.3, 0.3}); + desc.add >("etThresHB", {0, 0, 0, 0}); + desc.add >("eThresHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add >("etThresHE", {0, 0, 0, 0, 0, 0, 0}); + desc.add("innerCone", 0); + desc.add("outerCone", 0.14); + desc.add("depth", 0); + desc.add("maxSeverityHB", 9); + desc.add("maxSeverityHE", 9); + desc.add("doEtSum", false); + desc.add("useSingleTower", false); desc.add >("effectiveAreas", {0.079, 0.25}); // 2016 post-ichep sinEle default desc.add >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap - descriptions.add(("hltEgammaHLTHcalVarProducerFromRecHit"), desc); + descriptions.add("hltEgammaHLTHcalVarProducerFromRecHit", desc); } void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, From 34afd0c67afcdd666db12dd33f9a70adcf952c4d Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 16:26:35 +0200 Subject: [PATCH 216/923] some tweaks in comments in LCToCP and LCToSC --- .../plugins/LCToCPAssociatorByEnergyScoreImpl.h | 6 +++--- .../plugins/LCToSCAssociatorByEnergyScoreImpl.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index 06debda7f38d9..7cdea2eaf79a8 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -48,9 +48,9 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; - // This object connects a LayerCluster, identified through its id (lcId), with a vector containing all the CaloParticles - // (via their ids (cpIds)) that share at least one cell with the LayerCluster. For that pair (lcId,cpId) it - // stores the score. Keep in mind that the association is not unique, since there could be several instances + // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the CaloParticles + // (via their ids (cpIds)) that share at least one cell with the LayerCluster. In that pair it + // stores the score (lcId->(cpId,score)). Keep in mind that the association is not unique, since there could be several instances // of the same CaloParticle from several related SimClusters that each contributed to the same LayerCluster. typedef std::vector>> layerClusterToCaloParticle; // This is used to save the caloParticleOnLayer structure for all CaloParticles in each layer. diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index 081c5f34951c6..f5b4d29b6a014 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -46,9 +46,9 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; - // This object connects a LayerCluster, identified through its id (lcId), with a vector containing all the SimClusters - // (via their ids (scIds)) that share at least one cell with the LayerCluster. For that pair (lcId,scId) it - // stores the score. + // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the SimClusters + // (via their ids (scIds)) that share at least one cell with the LayerCluster. In that pair it + // stores the score (lcId->(scId,score)). typedef std::vector>> layerClusterToSimCluster; // This is used to save the simClusterOnLayer structure for all simClusters in each layer. // It is not exactly what is returned outside, but out of its entries, the output object is build. From 157b28f63b3cb34598efd6256cf2f7e178ae562e Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 16:27:11 +0200 Subject: [PATCH 217/923] some initial comments on TSToSim --- .../TSToSimTSAssociatorByEnergyScoreImpl.cc | 10 +++++-- .../TSToSimTSAssociatorByEnergyScoreImpl.h | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc index 82208b79c09d6..f5a5b7a08aff7 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc @@ -34,9 +34,10 @@ hgcal::association TSToSimTSAssociatorByEnergyScoreImpl::makeConnections( } nSimTracksters = sTIndices.size(); - // Initialize tssInSimTrackster. To be returned outside, since it contains the - // information to compute the SimTrackster-To-Trackster score. - // tssInSimTrackster[stId]: + // Initialize tssInSimTrackster. It contains the simTracksterOnLayer structure for all CaloParticles in each layer and + // among other the information to compute the SimTrackster-To-Trackster score. It is one of the two objects that + // build the output of the makeConnections function. + // tssInSimTrackster[stId] hgcal::simTracksterToTrackster tssInSimTrackster; tssInSimTrackster.resize(nSimTracksters); for (unsigned int i = 0; i < nSimTracksters; ++i) { @@ -46,6 +47,9 @@ hgcal::association TSToSimTSAssociatorByEnergyScoreImpl::makeConnections( } // Fill lcToSimTracksterId_Map and update tssInSimTrackster + // The lcToSimTracksterId_Map is used to connect a LayerCluster, via its id (key), with all the SimTracksters that + // contributed to that LayerCluster by storing the SimTrackster id and the fraction of the LayerCluster's energy + // in which the SimTrackster contributed. std::unordered_map> lcToSimTracksterId_Map; for (const auto& stId : sTIndices) { const auto& lcs = simTracksters[stId].vertices(); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h index bcf019a1bb7ec..05f0652a65106 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h @@ -15,6 +15,12 @@ namespace edm { } namespace hgcal { + // This structure is used for SimTracksters storing its id and the energy fraction of + // a LayerCluster that is related to that SimTrackster. Be careful not to be confused by the fact that + // similar structs are used in other HGCAL associators where the fraction is a hit's fraction. + // The meaning of the operator is extremely important since this struct will be used inside maps and + // other containers and when searching for one particular occurence only the clusterId member will be + // used in the check, skipping the fraction part. struct lcInfoInTrackster { bool operator==(const lcInfoInTrackster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -25,6 +31,20 @@ namespace hgcal { } }; + // In this structure, although it contains LayerClusters and per layer information through them, + // most of the information is 3D information. For a simTrackster it stores: + // 1. Its id: simTracksterId. + // 2. The energy related to the SimTrackster. It is the sum of the LayerClusters energy in which a SimCluster + // contributed. Therefore, there will be energy from each LayerCluster that is disregarded. + // 3. lcs_and_fractions: This is a vector of pairs. The pair is build from the LayerCluster id and the energy + // fraction of that LayerCluster which contributed to SimTrackster under study. So, be careful this is not the + // fraction of the hits. This is the fraction of the LayerCluster's energy in which the SimCluster contributed. + // This quantifies the statement above in 2 about the disregarded energy, by exactly storing the ratio of the + // reconstructed from SimCluster energy over the total LayerCluster energy. + // 4. A map to save the tracksters id (id is the key) that have at least one LayerCluster in common with the + // SimTrackster under study together with the energy and score. Energy in this case is defined as the sum of all + // LayerClusters (shared between the SimTrackster and the trackster) energy (coming from SimCluster of the SimTrackster) + // times the LayerCluster's fraction in trackster. struct simTracksterOnLayer { unsigned int simTracksterId; float energy = 0; @@ -32,7 +52,13 @@ namespace hgcal { std::unordered_map> tracksterIdToEnergyAndScore; }; - typedef std::vector>> tracksterToSimTrackster; + // This object connects a Trackster, identified through its id (tsId), with a vector of pairs containing all + // the SimTracksters (via their ids (stIds)) that share at least one LayerCluster. In that pair + // it stores the score (tsId->(stId,score)). Keep in mind that the association is not unique, since there could be + // several instances of the same SimTrackster from several related SimClusters that each contributed to the same Trackster. + typedef std::vector>> tracksterToSimTrackster; + // This is used to save the simTracksterOnLayer structure for all simTracksters. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector simTracksterToTrackster; typedef std::tuple association; } // namespace hgcal From 32780df49db67b7d6bbbe8486b556810b461379a Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Mon, 30 Aug 2021 16:33:41 +0200 Subject: [PATCH 218/923] a tweak in the TSToSim --- .../plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc index f5a5b7a08aff7..3eecfc5f474cd 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc @@ -108,7 +108,7 @@ hgcal::association TSToSimTSAssociatorByEnergyScoreImpl::makeConnections( // this contains the ids of the simTracksters contributing with at least one // hit to the Trackster. To be returned since this contains the information // to compute the Trackster-To-SimTrackster score. - hgcal::tracksterToSimTrackster stsInTrackster; //[tsId][stId]->(energy,score) + hgcal::tracksterToSimTrackster stsInTrackster; // tsId->(stId,score) stsInTrackster.resize(nTracksters); for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { From 7c85189720b7a314b267fd9b4463746177199f92 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 30 Aug 2021 10:53:32 -0500 Subject: [PATCH 219/923] Have embedded root files send close reports When a file controlled by the RootEmbeddedFileSequence closes, it now informs the StatisticsSenderService. --- IOPool/Input/src/RootEmbeddedFileSequence.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/IOPool/Input/src/RootEmbeddedFileSequence.cc b/IOPool/Input/src/RootEmbeddedFileSequence.cc index 27b57de0c36a5..b0b3d66c41f56 100644 --- a/IOPool/Input/src/RootEmbeddedFileSequence.cc +++ b/IOPool/Input/src/RootEmbeddedFileSequence.cc @@ -16,6 +16,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Utilities/StorageFactory/interface/StatisticsSenderService.h" #include "CLHEP/Random/RandFlat.h" @@ -126,6 +127,10 @@ namespace edm { void RootEmbeddedFileSequence::closeFile_() { // delete the RootFile object. if (rootFile()) { + edm::Service service; + if (service.isAvailable()) { + service->filePreCloseEvent(lfn(), usedFallback()); + } rootFile().reset(); } } From 83fa63ec85842206ed739c4d7b1e7e3159d0b234 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 11:21:06 -0500 Subject: [PATCH 220/923] consolidate JetTagProducer into one file --- .../JetTagComputer/plugins/JetTagProducer.cc | 26 ++++++++++++- .../JetTagComputer/plugins/JetTagProducer.h | 37 ------------------- 2 files changed, 25 insertions(+), 38 deletions(-) delete mode 100644 RecoBTau/JetTagComputer/plugins/JetTagProducer.h diff --git a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc index dafc797188e0c..be48cd596483d 100644 --- a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc +++ b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc @@ -28,22 +28,46 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/makeRefToBaseProdFrom.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/EDMException.h" +#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h" +#include "RecoBTau/JetTagComputer/interface/JetTagComputerRecord.h" +#include "DataFormats/Common/interface/View.h" +#include "DataFormats/BTauReco/interface/BaseTagInfo.h" #include "DataFormats/Common/interface/RefToBase.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/BTauReco/interface/JetTag.h" -#include "JetTagProducer.h" +#include +#include +#include using namespace std; using namespace reco; using namespace edm; +class JetTagProducer : public edm::stream::EDProducer<> { +public: + explicit JetTagProducer(const edm::ParameterSet&); + ~JetTagProducer() override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + std::string m_jetTagComputer; + std::vector > > token_tagInfos; + unsigned int nTagInfos; + edm::ESWatcher recordWatcher_; +}; + // // constructors and destructor // diff --git a/RecoBTau/JetTagComputer/plugins/JetTagProducer.h b/RecoBTau/JetTagComputer/plugins/JetTagProducer.h deleted file mode 100644 index abd9b7520ca9b..0000000000000 --- a/RecoBTau/JetTagComputer/plugins/JetTagProducer.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RecoBTag_JetTagComputer_JetTagProducer_h -#define RecoBTag_JetTagComputer_JetTagProducer_h - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h" -#include "RecoBTau/JetTagComputer/interface/JetTagComputerRecord.h" - -#include "DataFormats/Common/interface/View.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" - -class JetTagProducer : public edm::stream::EDProducer<> { -public: - explicit JetTagProducer(const edm::ParameterSet&); - ~JetTagProducer() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - - std::string m_jetTagComputer; - std::vector > > token_tagInfos; - unsigned int nTagInfos; - edm::ESWatcher recordWatcher_; -}; - -#endif // RecoBTag_JetTagComputer_JetTagProducer_h From 07e2d5fde190612a8fa3ceb90706b8a8b98e509e Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 11:34:57 -0500 Subject: [PATCH 221/923] Use esConsumes in JetTagProducer --- .../JetTagComputer/plugins/JetTagProducer.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc index be48cd596483d..4291d4efcbb24 100644 --- a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc +++ b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc @@ -55,15 +55,15 @@ using namespace edm; class JetTagProducer : public edm::stream::EDProducer<> { public: - explicit JetTagProducer(const edm::ParameterSet&); + explicit JetTagProducer(const edm::ParameterSet &); ~JetTagProducer() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); private: - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::Event &, const edm::EventSetup &) override; - std::string m_jetTagComputer; std::vector > > token_tagInfos; + const edm::ESGetToken computerToken_; unsigned int nTagInfos; edm::ESWatcher recordWatcher_; }; @@ -72,7 +72,7 @@ class JetTagProducer : public edm::stream::EDProducer<> { // constructors and destructor // JetTagProducer::JetTagProducer(const ParameterSet &iConfig) - : m_jetTagComputer(iConfig.getParameter("jetTagComputer")) { + : computerToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetTagComputer")))) { std::vector m_tagInfos = iConfig.getParameter >("tagInfos"); nTagInfos = m_tagInfos.size(); for (unsigned int i = 0; i < nTagInfos; i++) { @@ -99,15 +99,14 @@ namespace { // ------------ method called to produce the data ------------ void JetTagProducer::produce(Event &iEvent, const EventSetup &iSetup) { - edm::ESHandle computer; - iSetup.get().get(m_jetTagComputer, computer); + auto const &computer = iSetup.getData(computerToken_); if (recordWatcher_.check(iSetup)) { - unsigned int nLabels = computer->getInputLabels().size(); + unsigned int nLabels = computer.getInputLabels().size(); if (nLabels == 0) ++nLabels; if (nTagInfos != nLabels) { - vector inputLabels(computer->getInputLabels()); + vector inputLabels(computer.getInputLabels()); // backward compatible case, use default tagInfo if (inputLabels.empty()) inputLabels.push_back("tagInfo"); @@ -158,7 +157,7 @@ void JetTagProducer::produce(Event &iEvent, const EventSetup &iSetup) { const TagInfoPtrs &tagInfoPtrs = iter->second; JetTagComputer::TagInfoHelper helper(tagInfoPtrs); - float discriminator = (*computer)(helper); + float discriminator = computer(helper); (*jetTagCollection)[iter->first] = discriminator; } From 785205b729b412d17d395af1ce49bb4f0b6d7d12 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 12:18:43 -0500 Subject: [PATCH 222/923] Made JetTagProducer a global module Also renamed member data to be consistent. --- .../JetTagComputer/plugins/JetTagProducer.cc | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc index 4291d4efcbb24..6111412097c06 100644 --- a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc +++ b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc @@ -28,8 +28,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/makeRefToBaseProdFrom.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -53,30 +52,31 @@ using namespace std; using namespace reco; using namespace edm; -class JetTagProducer : public edm::stream::EDProducer<> { +class JetTagProducer : public edm::global::EDProducer<> { public: explicit JetTagProducer(const edm::ParameterSet &); ~JetTagProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); private: - void produce(edm::Event &, const edm::EventSetup &) override; + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - std::vector > > token_tagInfos; - const edm::ESGetToken computerToken_; - unsigned int nTagInfos; - edm::ESWatcher recordWatcher_; + std::vector > > token_tagInfos_; + const edm::ESGetToken token_computer_; + mutable std::atomic recordCacheID_{0}; + unsigned int nTagInfos_; }; // // constructors and destructor // JetTagProducer::JetTagProducer(const ParameterSet &iConfig) - : computerToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetTagComputer")))) { - std::vector m_tagInfos = iConfig.getParameter >("tagInfos"); - nTagInfos = m_tagInfos.size(); - for (unsigned int i = 0; i < nTagInfos; i++) { - token_tagInfos.push_back(consumes >(m_tagInfos[i])); + : token_computer_(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetTagComputer")))) { + std::vector tagInfos = iConfig.getParameter >("tagInfos"); + nTagInfos_ = tagInfos.size(); + token_tagInfos_.reserve(nTagInfos_); + for (unsigned int i = 0; i < nTagInfos_; i++) { + token_tagInfos_.push_back(consumes >(tagInfos[i])); } produces(); @@ -98,14 +98,16 @@ namespace { } // namespace // ------------ method called to produce the data ------------ -void JetTagProducer::produce(Event &iEvent, const EventSetup &iSetup) { - auto const &computer = iSetup.getData(computerToken_); +void JetTagProducer::produce(StreamID, Event &iEvent, const EventSetup &iSetup) const { + auto const &computer = iSetup.getData(token_computer_); - if (recordWatcher_.check(iSetup)) { + auto oldID = recordCacheID_.load(); + auto newID = iSetup.get().cacheIdentifier(); + if (oldID != newID) { unsigned int nLabels = computer.getInputLabels().size(); if (nLabels == 0) ++nLabels; - if (nTagInfos != nLabels) { + if (nTagInfos_ != nLabels) { vector inputLabels(computer.getInputLabels()); // backward compatible case, use default tagInfo if (inputLabels.empty()) @@ -117,6 +119,9 @@ void JetTagProducer::produce(Event &iEvent, const EventSetup &iSetup) { message += "\"" + *iter + "\"\n"; throw edm::Exception(errors::Configuration) << message; } + //only if we didn't encounter a problem should we update the cache + // that way other threads will see the same problem + recordCacheID_.compare_exchange_strong(oldID, newID); } // now comes the tricky part: @@ -129,15 +134,15 @@ void JetTagProducer::produce(Event &iEvent, const EventSetup &iSetup) { JetToTagInfoMap jetToTagInfos; // retrieve all requested TagInfos - vector > > tagInfoHandles(nTagInfos); - for (unsigned int i = 0; i < nTagInfos; i++) { + vector > > tagInfoHandles(nTagInfos_); + for (unsigned int i = 0; i < nTagInfos_; i++) { Handle > &tagInfoHandle = tagInfoHandles[i]; - iEvent.getByToken(token_tagInfos[i], tagInfoHandle); + iEvent.getByToken(token_tagInfos_[i], tagInfoHandle); for (View::const_iterator iter = tagInfoHandle->begin(); iter != tagInfoHandle->end(); iter++) { TagInfoPtrs &tagInfos = jetToTagInfos[iter->jet()]; if (tagInfos.empty()) - tagInfos.resize(nTagInfos); + tagInfos.resize(nTagInfos_); tagInfos[i] = &*iter; } From 9b02bf6e1fc7497bda946bd6360a602fb7f1d487 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 12:54:35 -0500 Subject: [PATCH 223/923] Minor code modernizations --- .../JetTagComputer/plugins/JetTagProducer.cc | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc index 6111412097c06..5a8d019d91202 100644 --- a/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc +++ b/RecoBTau/JetTagComputer/plugins/JetTagProducer.cc @@ -55,7 +55,6 @@ using namespace edm; class JetTagProducer : public edm::global::EDProducer<> { public: explicit JetTagProducer(const edm::ParameterSet &); - ~JetTagProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); private: @@ -63,6 +62,7 @@ class JetTagProducer : public edm::global::EDProducer<> { std::vector > > token_tagInfos_; const edm::ESGetToken token_computer_; + const edm::EDPutTokenT token_put_; mutable std::atomic recordCacheID_{0}; unsigned int nTagInfos_; }; @@ -71,19 +71,16 @@ class JetTagProducer : public edm::global::EDProducer<> { // constructors and destructor // JetTagProducer::JetTagProducer(const ParameterSet &iConfig) - : token_computer_(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetTagComputer")))) { - std::vector tagInfos = iConfig.getParameter >("tagInfos"); + : token_computer_(esConsumes(edm::ESInputTag("", iConfig.getParameter("jetTagComputer")))), + token_put_(produces()) { + const std::vector tagInfos = iConfig.getParameter >("tagInfos"); nTagInfos_ = tagInfos.size(); token_tagInfos_.reserve(nTagInfos_); - for (unsigned int i = 0; i < nTagInfos_; i++) { - token_tagInfos_.push_back(consumes >(tagInfos[i])); - } - - produces(); + std::transform(tagInfos.begin(), tagInfos.end(), std::back_inserter(token_tagInfos_), [this](auto const &tagInfo) { + return consumes >(tagInfo); + }); } -JetTagProducer::~JetTagProducer() {} - // // member functions // @@ -134,22 +131,23 @@ void JetTagProducer::produce(StreamID, Event &iEvent, const EventSetup &iSetup) JetToTagInfoMap jetToTagInfos; // retrieve all requested TagInfos - vector > > tagInfoHandles(nTagInfos_); + Handle > tagInfoHandle; for (unsigned int i = 0; i < nTagInfos_; i++) { - Handle > &tagInfoHandle = tagInfoHandles[i]; - iEvent.getByToken(token_tagInfos_[i], tagInfoHandle); + auto tagHandle = iEvent.getHandle(token_tagInfos_[i]); + // take first tagInfo + if (not tagInfoHandle.isValid()) { + tagInfoHandle = tagHandle; + } - for (View::const_iterator iter = tagInfoHandle->begin(); iter != tagInfoHandle->end(); iter++) { - TagInfoPtrs &tagInfos = jetToTagInfos[iter->jet()]; + for (auto const &tagInfo : *tagHandle) { + TagInfoPtrs &tagInfos = jetToTagInfos[tagInfo.jet()]; if (tagInfos.empty()) tagInfos.resize(nTagInfos_); - tagInfos[i] = &*iter; + tagInfos[i] = &tagInfo; } } - // take first tagInfo - Handle > &tagInfoHandle = tagInfoHandles[0]; std::unique_ptr jetTagCollection; if (!tagInfoHandle.product()->empty()) { RefToBase jj = tagInfoHandle->begin()->jet(); @@ -167,7 +165,7 @@ void JetTagProducer::produce(StreamID, Event &iEvent, const EventSetup &iSetup) (*jetTagCollection)[iter->first] = discriminator; } - iEvent.put(std::move(jetTagCollection)); + iEvent.put(token_put_, std::move(jetTagCollection)); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ From 5986927bf33fbe663ef0ae40297646eb38d5278e Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 27 Aug 2021 19:25:30 +0200 Subject: [PATCH 224/923] Add "inverse of nominal value" in GeV to MagneticField, and calculate nominal values in the constructor. This is a preparatory step to migrate PixelRecoUtilities to esConsumes --- .../interface/LocalMagneticField.h | 2 +- .../src/LocalMagneticField.cc | 2 +- .../Engine/interface/MagneticField.h | 23 +++++++------ MagneticField/Engine/src/MagneticField.cc | 32 ++++--------------- .../src/OAEParametrizedMagneticField.cc | 8 +++-- .../src/OAEParametrizedMagneticField.h | 2 +- .../src/ParabolicParametrizedMagneticField.cc | 8 +++-- .../src/ParabolicParametrizedMagneticField.h | 2 +- .../src/PolyFit2DParametrizedMagneticField.cc | 2 ++ .../src/PolyFit2DParametrizedMagneticField.h | 2 +- .../interface/UniformMagneticField.h | 4 +-- .../interface/VolumeBasedMagneticField.h | 2 +- .../src/VolumeBasedMagneticField.cc | 5 ++- .../VolumeGeometry/interface/MagCylinder.h | 2 +- .../interface/MagVolume6Faces.h | 2 +- .../VolumeGeometry/src/MagCylinder.cc | 1 + .../VolumeGeometry/src/MagVolume6Faces.cc | 4 ++- .../test/KinematicState_t.cpp | 6 ++-- .../interface/defaultRKPropagator.h | 4 ++- TrackPropagation/RungeKutta/test/RKTest.cc | 3 +- .../KalmanUpdators/test/KFUpdator_t.cpp | 5 +-- .../test/ClosestApproachInRPhi_t.cpp | 5 +-- .../TrajectoryState/test/testTSOS.cpp | 5 +-- 23 files changed, 67 insertions(+), 64 deletions(-) diff --git a/FastSimulation/TrajectoryManager/interface/LocalMagneticField.h b/FastSimulation/TrajectoryManager/interface/LocalMagneticField.h index ba7966e9e80fe..1b30c0875c17d 100644 --- a/FastSimulation/TrajectoryManager/interface/LocalMagneticField.h +++ b/FastSimulation/TrajectoryManager/interface/LocalMagneticField.h @@ -12,7 +12,7 @@ #include "MagneticField/Engine/interface/MagneticField.h" -class LocalMagneticField : public MagneticField { +class LocalMagneticField final : public MagneticField { public: ///Construct passing the Z field component in Tesla LocalMagneticField(double value); diff --git a/FastSimulation/TrajectoryManager/src/LocalMagneticField.cc b/FastSimulation/TrajectoryManager/src/LocalMagneticField.cc index 7934ab368e800..4824f4987c08c 100644 --- a/FastSimulation/TrajectoryManager/src/LocalMagneticField.cc +++ b/FastSimulation/TrajectoryManager/src/LocalMagneticField.cc @@ -7,6 +7,6 @@ #include "FastSimulation/TrajectoryManager/interface/LocalMagneticField.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" -LocalMagneticField::LocalMagneticField(double value) : theField(0., 0., value) {} +LocalMagneticField::LocalMagneticField(double value) : theField(0., 0., value) { setNominalValue(); } GlobalVector LocalMagneticField::inTesla(const GlobalPoint& gp) const { return theField; } diff --git a/MagneticField/Engine/interface/MagneticField.h b/MagneticField/Engine/interface/MagneticField.h index dae3ca9af17e0..86125fa68f051 100644 --- a/MagneticField/Engine/interface/MagneticField.h +++ b/MagneticField/Engine/interface/MagneticField.h @@ -46,20 +46,19 @@ class MagneticField { } /// The nominal field value for this map in kGauss - int nominalValue() const { - if (kSet == nominalValueCompiuted.load()) - return theNominalValue; - return computeNominalValue(); - } + int nominalValue() const { return theNominalValue; } + + /// The inverse of nominal field value for this map in GeV + float inverseNominalValueInGeV() const { return theInverseNominalValueInGeV; } + +protected: + // need to be called from the constructor of the deriving classes + void setNominalValue(); private: - //nominal field value - virtual int computeNominalValue() const; - mutable std::atomic nominalValueCompiuted; - // CMS_THREAD_GUARD(nominalValueCompiuted) mutable int theNominalValue; - // PG temporary fix for clang 3.4 which is not parsing thread_guard correctly - CMS_THREAD_SAFE mutable int theNominalValue; - enum FooStates { kUnset, kSetting, kSet }; + //nominal field values + int theNominalValue = 0; + float theInverseNominalValueInGeV = 0; }; #endif diff --git a/MagneticField/Engine/src/MagneticField.cc b/MagneticField/Engine/src/MagneticField.cc index cea4ecc0c2b35..3b74895e61802 100644 --- a/MagneticField/Engine/src/MagneticField.cc +++ b/MagneticField/Engine/src/MagneticField.cc @@ -5,32 +5,14 @@ #include "MagneticField/Engine/interface/MagneticField.h" -MagneticField::MagneticField() : nominalValueCompiuted(kUnset), theNominalValue(0) {} +MagneticField::MagneticField() = default; -MagneticField::MagneticField(const MagneticField& orig) : nominalValueCompiuted(kUnset), theNominalValue(0) { - if (orig.nominalValueCompiuted.load() == kSet) { - theNominalValue = orig.theNominalValue; - nominalValueCompiuted.store(kSet); - } -} - -MagneticField::~MagneticField() {} - -int MagneticField::computeNominalValue() const { - int tmp = int((inTesla(GlobalPoint(0.f, 0.f, 0.f))).z() * 10.f + 0.5f); +MagneticField::MagneticField(const MagneticField& orig) = default; - //Try to cache - char expected = kUnset; - if (nominalValueCompiuted.compare_exchange_strong(expected, kSetting)) { - //it is our job to set the value - std::swap(theNominalValue, tmp); +MagneticField::~MagneticField() = default; - //this must be after the swap - nominalValueCompiuted.store(kSet); - return theNominalValue; - } - //another thread beat us to trying to set theNominalValue - // since we don't know when the other thread will finish - // we just return tmp - return tmp; +void MagneticField::setNominalValue() { + auto const at0z = inTesla(GlobalPoint(0.f, 0.f, 0.f)).z(); + theNominalValue = int(at0z * 10.f + 0.5f); + theInverseNominalValueInGeV = 1.f / (at0z * 2.99792458e-3f); } diff --git a/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.cc b/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.cc index be026bfc123b7..6f47946d17c4e 100644 --- a/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.cc +++ b/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.cc @@ -12,12 +12,14 @@ using namespace std; using namespace magfieldparam; -OAEParametrizedMagneticField::OAEParametrizedMagneticField(float B) : theParam(B) {} +OAEParametrizedMagneticField::OAEParametrizedMagneticField(float B) : theParam(B) { setNominalValue(); } -OAEParametrizedMagneticField::OAEParametrizedMagneticField(string T) : theParam(T) {} +OAEParametrizedMagneticField::OAEParametrizedMagneticField(string T) : theParam(T) { setNominalValue(); } OAEParametrizedMagneticField::OAEParametrizedMagneticField(const edm::ParameterSet& parameters) - : theParam(parameters.getParameter("BValue")) {} + : theParam(parameters.getParameter("BValue")) { + setNominalValue(); +} OAEParametrizedMagneticField::~OAEParametrizedMagneticField() {} diff --git a/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.h b/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.h index f25a4b52e28c6..f18bf662e47cc 100644 --- a/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.h +++ b/MagneticField/ParametrizedEngine/src/OAEParametrizedMagneticField.h @@ -22,7 +22,7 @@ namespace magfieldparam { class TkBfield; } -class OAEParametrizedMagneticField : public MagneticField { +class OAEParametrizedMagneticField final : public MagneticField { public: /// Constructor, pass value for nominal field explicit OAEParametrizedMagneticField(float B); diff --git a/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.cc b/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.cc index fa29ed9ce5c86..2dca6d036576d 100644 --- a/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.cc +++ b/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.cc @@ -11,10 +11,14 @@ using namespace std; // Default parameters are the best fit of 3.8T to the OAEParametrizedMagneticField parametrization. ParabolicParametrizedMagneticField::ParabolicParametrizedMagneticField() - : c1(3.8114), b0(-3.94991e-06), b1(7.53701e-06), a(2.43878e-11) {} + : c1(3.8114), b0(-3.94991e-06), b1(7.53701e-06), a(2.43878e-11) { + setNominalValue(); +} ParabolicParametrizedMagneticField::ParabolicParametrizedMagneticField(const vector& parameters) - : c1(parameters[0]), b0(parameters[1]), b1(parameters[2]), a(parameters[3]) {} + : c1(parameters[0]), b0(parameters[1]), b1(parameters[2]), a(parameters[3]) { + setNominalValue(); +} ParabolicParametrizedMagneticField::~ParabolicParametrizedMagneticField() {} diff --git a/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.h b/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.h index b51675d9243ef..4d9c88e7089d2 100644 --- a/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.h +++ b/MagneticField/ParametrizedEngine/src/ParabolicParametrizedMagneticField.h @@ -16,7 +16,7 @@ namespace edm { class ParameterSet; } -class ParabolicParametrizedMagneticField : public MagneticField { +class ParabolicParametrizedMagneticField final : public MagneticField { public: /// Default constructor, use default values for 3.8T map explicit ParabolicParametrizedMagneticField(); diff --git a/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.cc b/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.cc index 5f5beb139641f..652ac6f5c3394 100644 --- a/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.cc +++ b/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.cc @@ -14,11 +14,13 @@ using namespace magfieldparam; PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField(double bVal) : theParam(new BFit()) { theParam->SetField(bVal); + setNominalValue(); } PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField(const edm::ParameterSet& parameters) : theParam(new BFit()) { theParam->SetField(parameters.getParameter("BValue")); + setNominalValue(); } PolyFit2DParametrizedMagneticField::~PolyFit2DParametrizedMagneticField() { delete theParam; } diff --git a/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.h b/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.h index 984edf04c72df..19c321658ffcf 100644 --- a/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.h +++ b/MagneticField/ParametrizedEngine/src/PolyFit2DParametrizedMagneticField.h @@ -18,7 +18,7 @@ namespace magfieldparam { class BFit; } -class PolyFit2DParametrizedMagneticField : public MagneticField { +class PolyFit2DParametrizedMagneticField final : public MagneticField { public: /// Constructor. Fitted bVal for the nominal currents are: /// 2.0216; 3.5162; 3.8114; 4.01242188708911 diff --git a/MagneticField/UniformEngine/interface/UniformMagneticField.h b/MagneticField/UniformEngine/interface/UniformMagneticField.h index 6ede8e07aa036..ee4fefa9c3a92 100644 --- a/MagneticField/UniformEngine/interface/UniformMagneticField.h +++ b/MagneticField/UniformEngine/interface/UniformMagneticField.h @@ -13,9 +13,9 @@ class UniformMagneticField final : public MagneticField { public: ///Construct passing the Z field component in Tesla - UniformMagneticField(float value) : theField(0.f, 0.f, value) {} + UniformMagneticField(float value) : theField(0.f, 0.f, value) { setNominalValue(); } - UniformMagneticField(GlobalVector value) : theField(value) {} + UniformMagneticField(GlobalVector value) : theField(value) { setNominalValue(); } void set(GlobalVector value) { theField = value; } void set(float value) { set(GlobalVector(0.f, 0.f, value)); } diff --git a/MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h b/MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h index e41fd78d5a348..2954651f8b7f8 100644 --- a/MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h +++ b/MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h @@ -15,7 +15,7 @@ class testMagneticField; class testMagGeometryAnalyzer; -class VolumeBasedMagneticField : public MagneticField { +class VolumeBasedMagneticField final : public MagneticField { // For tests friend class testMagneticField; friend class testMagGeometryAnalyzer; diff --git a/MagneticField/VolumeBasedEngine/src/VolumeBasedMagneticField.cc b/MagneticField/VolumeBasedEngine/src/VolumeBasedMagneticField.cc index 7929ccfce952e..b523c06e907a0 100644 --- a/MagneticField/VolumeBasedEngine/src/VolumeBasedMagneticField.cc +++ b/MagneticField/VolumeBasedEngine/src/VolumeBasedMagneticField.cc @@ -15,7 +15,9 @@ VolumeBasedMagneticField::VolumeBasedMagneticField(int geomVersion, maxZ(zMax), paramField(param), magGeomOwned(true), - paramFieldOwned(isParamFieldOwned) {} + paramFieldOwned(isParamFieldOwned) { + setNominalValue(); +} VolumeBasedMagneticField::VolumeBasedMagneticField(const VolumeBasedMagneticField& vbf) : MagneticField::MagneticField(vbf), @@ -26,6 +28,7 @@ VolumeBasedMagneticField::VolumeBasedMagneticField(const VolumeBasedMagneticFiel magGeomOwned(false), paramFieldOwned(false) { // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl; + setNominalValue(); } MagneticField* VolumeBasedMagneticField::clone() const { return new VolumeBasedMagneticField(*this); } diff --git a/MagneticField/VolumeGeometry/interface/MagCylinder.h b/MagneticField/VolumeGeometry/interface/MagCylinder.h index 192c58978d272..e06aa9716167c 100644 --- a/MagneticField/VolumeGeometry/interface/MagCylinder.h +++ b/MagneticField/VolumeGeometry/interface/MagCylinder.h @@ -13,7 +13,7 @@ template class MagneticFieldProvider; -class MagCylinder : public MagVolume { +class MagCylinder final : public MagVolume { public: MagCylinder(const PositionType& pos, const RotationType& rot, diff --git a/MagneticField/VolumeGeometry/interface/MagVolume6Faces.h b/MagneticField/VolumeGeometry/interface/MagVolume6Faces.h index 1bf97ff5292df..b4a5e7259497c 100644 --- a/MagneticField/VolumeGeometry/interface/MagVolume6Faces.h +++ b/MagneticField/VolumeGeometry/interface/MagVolume6Faces.h @@ -20,7 +20,7 @@ template class MagneticFieldProvider; -class MagVolume6Faces : public MagVolume { +class MagVolume6Faces final : public MagVolume { public: MagVolume6Faces(const PositionType& pos, const RotationType& rot, diff --git a/MagneticField/VolumeGeometry/src/MagCylinder.cc b/MagneticField/VolumeGeometry/src/MagCylinder.cc index 68756b294f2ea..094ea973193f0 100644 --- a/MagneticField/VolumeGeometry/src/MagCylinder.cc +++ b/MagneticField/VolumeGeometry/src/MagCylinder.cc @@ -32,6 +32,7 @@ MagCylinder::MagCylinder(const PositionType& pos, if (def != faces.size()) { throw MagGeometryError("MagCylinder constructed with wrong number/type of faces"); } + setNominalValue(); } bool MagCylinder::inside(const GlobalPoint& gp, double tolerance) const { return inside(toLocal(gp), tolerance); } diff --git a/MagneticField/VolumeGeometry/src/MagVolume6Faces.cc b/MagneticField/VolumeGeometry/src/MagVolume6Faces.cc index 2b745405dcfef..d9da431ba47d3 100644 --- a/MagneticField/VolumeGeometry/src/MagVolume6Faces.cc +++ b/MagneticField/VolumeGeometry/src/MagVolume6Faces.cc @@ -5,7 +5,9 @@ MagVolume6Faces::MagVolume6Faces(const PositionType& pos, const std::vector& faces, const MagneticFieldProvider* mfp, double sf) - : MagVolume(pos, rot, mfp, sf), volumeNo(0), copyno(0), theFaces(faces) {} + : MagVolume(pos, rot, mfp, sf), volumeNo(0), copyno(0), theFaces(faces) { + setNominalValue(); +} bool MagVolume6Faces::inside(const GlobalPoint& gp, double tolerance) const { // check if the point is on the correct side of all delimiting surfaces diff --git a/RecoVertex/KinematicFitPrimitives/test/KinematicState_t.cpp b/RecoVertex/KinematicFitPrimitives/test/KinematicState_t.cpp index eca6b5b38d5e0..db74f23f36b79 100644 --- a/RecoVertex/KinematicFitPrimitives/test/KinematicState_t.cpp +++ b/RecoVertex/KinematicFitPrimitives/test/KinematicState_t.cpp @@ -16,9 +16,11 @@ #include -class ConstMagneticField : public MagneticField { +class ConstMagneticField final : public MagneticField { public: - virtual GlobalVector inTesla(const GlobalPoint&) const { return GlobalVector(0, 0, 4); } + ConstMagneticField() { setNominalValue(); } + + GlobalVector inTesla(const GlobalPoint&) const override { return GlobalVector(0, 0, 4); } }; int main() { diff --git a/TrackPropagation/RungeKutta/interface/defaultRKPropagator.h b/TrackPropagation/RungeKutta/interface/defaultRKPropagator.h index 8ce241a14b042..fe6fe563920b5 100644 --- a/TrackPropagation/RungeKutta/interface/defaultRKPropagator.h +++ b/TrackPropagation/RungeKutta/interface/defaultRKPropagator.h @@ -27,7 +27,9 @@ namespace defaultRKPropagator { class RKMagVolume final : public MagVolume { public: RKMagVolume(const PositionType& pos, const RotationType& rot, const MagneticFieldProvider* mfp) - : MagVolume(pos, rot, mfp) {} + : MagVolume(pos, rot, mfp) { + setNominalValue(); + } bool inside(const GlobalPoint& gp, double tolerance = 0.) const override { return true; } diff --git a/TrackPropagation/RungeKutta/test/RKTest.cc b/TrackPropagation/RungeKutta/test/RKTest.cc index a9d6f6b0dd085..53f797a691452 100644 --- a/TrackPropagation/RungeKutta/test/RKTest.cc +++ b/TrackPropagation/RungeKutta/test/RKTest.cc @@ -33,7 +33,8 @@ class RKTestField final : public MagneticField { public: - virtual GlobalVector inTesla(const GlobalPoint&) const { return GlobalVector(0, 0, 4); } + RKTestField() { setNominalValue(); } + GlobalVector inTesla(const GlobalPoint&) const override { return GlobalVector(0, 0, 4); } }; using namespace std; diff --git a/TrackingTools/KalmanUpdators/test/KFUpdator_t.cpp b/TrackingTools/KalmanUpdators/test/KFUpdator_t.cpp index f05520205fcf4..5c8d6f27516dc 100644 --- a/TrackingTools/KalmanUpdators/test/KFUpdator_t.cpp +++ b/TrackingTools/KalmanUpdators/test/KFUpdator_t.cpp @@ -15,9 +15,10 @@ #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" #include -class ConstMagneticField : public MagneticField { +class ConstMagneticField final : public MagneticField { public: - virtual GlobalVector inTesla(const GlobalPoint&) const { return GlobalVector(0, 0, 4); } + ConstMagneticField() { setNominalValue(); } + GlobalVector inTesla(const GlobalPoint&) const override { return GlobalVector(0, 0, 4); } }; #include "TrackingTools/AnalyticalJacobians/interface/JacobianLocalToCartesian.h" diff --git a/TrackingTools/PatternTools/test/ClosestApproachInRPhi_t.cpp b/TrackingTools/PatternTools/test/ClosestApproachInRPhi_t.cpp index 23d8268f0a886..fc7eb55ffbaaf 100644 --- a/TrackingTools/PatternTools/test/ClosestApproachInRPhi_t.cpp +++ b/TrackingTools/PatternTools/test/ClosestApproachInRPhi_t.cpp @@ -11,9 +11,10 @@ #include -class ConstMagneticField : public MagneticField { +class ConstMagneticField final : public MagneticField { public: - virtual GlobalVector inTesla(const GlobalPoint&) const { return GlobalVector(0, 0, 4); } + ConstMagneticField() { setNominalValue(); } + GlobalVector inTesla(const GlobalPoint&) const override { return GlobalVector(0, 0, 4); } }; namespace { diff --git a/TrackingTools/TrajectoryState/test/testTSOS.cpp b/TrackingTools/TrajectoryState/test/testTSOS.cpp index e1dfb8ff7a186..8df6d00eb881d 100644 --- a/TrackingTools/TrajectoryState/test/testTSOS.cpp +++ b/TrackingTools/TrajectoryState/test/testTSOS.cpp @@ -12,9 +12,10 @@ #include -class ConstMagneticField : public MagneticField { +class ConstMagneticField final : public MagneticField { public: - virtual GlobalVector inTesla(const GlobalPoint&) const { return GlobalVector(0, 0, 4); } + ConstMagneticField() { setNominalValue(); } + GlobalVector inTesla(const GlobalPoint&) const override { return GlobalVector(0, 0, 4); } }; int main() { From fc60c0439683417e8c41ba171c68978c9f101d1a Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 30 Aug 2021 16:18:51 +0200 Subject: [PATCH 225/923] Migrate PixelRecoUtilities to use MagneticField::inverseNominalValueInGeV() In order to migrate the code to esConsumes() --- .../Tracking/src/SeedFinderSelector.cc | 4 +- .../src/L1MuonPixelTrackFitter.cc | 5 ++- .../PixelLowPtUtilities/src/TrackFitter.cc | 2 +- .../plugins/PixelNtupletsFitterProducer.cc | 2 +- .../src/KFBasedPixelFitter.cc | 2 +- .../PixelFitterByConformalMappingAndLine.cc | 6 +-- .../src/PixelFitterByHelixProjections.cc | 4 +- .../interface/CAHitQuadrupletGenerator.h | 11 ++++-- .../interface/CAHitTripletGenerator.h | 11 ++++-- .../PixelTriplets/plugins/CAHitNtupletCUDA.cc | 6 ++- .../plugins/CAHitNtupletEDProducerT.cc | 2 +- .../plugins/PixelTripletHLTGenerator.cc | 9 ++++- .../plugins/PixelTripletLargeTipGenerator.cc | 8 +++- .../plugins/PixelTripletNoTipGenerator.cc | 10 ++++- .../plugins/ThirdHitCorrection.cc | 8 +++- .../src/CAHitQuadrupletGenerator.cc | 11 +++--- .../src/CAHitTripletGenerator.cc | 14 +++---- ...neratorFromLayerPairForPhotonConversion.cc | 17 +++++---- ...eneratorFromLayerPairForPhotonConversion.h | 9 +++-- RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc | 5 ++- .../interface/LongitudinalBendingCorrection.h | 8 ++-- .../interface/PixelRecoUtilities.h | 37 +++++-------------- .../src/PixelRecoUtilities.cc | 15 -------- .../plugins/MultiHitGeneratorFromChi2.cc | 2 +- .../RectangularEtaPhiTrackingRegion.h | 2 +- .../src/RectangularEtaPhiTrackingRegion.cc | 18 ++++++--- 26 files changed, 120 insertions(+), 108 deletions(-) delete mode 100644 RecoTracker/TkMSParametrization/src/PixelRecoUtilities.cc diff --git a/FastSimulation/Tracking/src/SeedFinderSelector.cc b/FastSimulation/Tracking/src/SeedFinderSelector.cc index 9983f4e62bc15..53b0a24ef2101 100644 --- a/FastSimulation/Tracking/src/SeedFinderSelector.cc +++ b/FastSimulation/Tracking/src/SeedFinderSelector.cc @@ -224,7 +224,7 @@ bool SeedFinderSelector::pass(const std::vector &hits for (auto &ntuplet : tripletresult) ntuplet.reserve(3); //calling the function from the class, modifies tripletresult - CAHitTriplGenerator_->hitNtuplets(ihd, tripletresult, *eventSetup_, *seedingLayer); + CAHitTriplGenerator_->hitNtuplets(ihd, tripletresult, *seedingLayer); return !tripletresult[0].empty(); } } @@ -311,7 +311,7 @@ bool SeedFinderSelector::pass(const std::vector &hits for (auto &ntuplet : quadrupletresult) ntuplet.reserve(4); //calling the function from the class, modifies quadrupletresult - CAHitQuadGenerator_->hitNtuplets(ihd, quadrupletresult, *eventSetup_, *seedingLayer); + CAHitQuadGenerator_->hitNtuplets(ihd, quadrupletresult, *seedingLayer); return !quadrupletresult[0].empty(); } diff --git a/RecoMuon/TrackerSeedGenerator/src/L1MuonPixelTrackFitter.cc b/RecoMuon/TrackerSeedGenerator/src/L1MuonPixelTrackFitter.cc index 400bbed23e640..15fdf799a62ab 100644 --- a/RecoMuon/TrackerSeedGenerator/src/L1MuonPixelTrackFitter.cc +++ b/RecoMuon/TrackerSeedGenerator/src/L1MuonPixelTrackFitter.cc @@ -41,6 +41,7 @@ reco::Track* L1MuonPixelTrackFitter::run(const edm::EventSetup& es, const TrackingRegion& region) const { edm::ESHandle fieldESH; es.get().get(fieldESH); + const auto& field = *fieldESH; double phi_vtx_fromHits = (theHit2 - theHit1).phi(); @@ -48,7 +49,7 @@ reco::Track* L1MuonPixelTrackFitter::run(const edm::EventSetup& es, double invPtErr = errInversePt(invPt, theEtaL1); int charge = (invPt > 0.) ? 1 : -1; - double curvature = PixelRecoUtilities::curvature(invPt, es); + double curvature = PixelRecoUtilities::curvature(invPt, field); Circle circle(theHit1, theHit2, curvature); @@ -88,7 +89,7 @@ reco::Track* L1MuonPixelTrackFitter::run(const edm::EventSetup& es, std::cout < TrackFitter::run(const std::vector 1.e-4) ? 1. / invPt : 1.e4; float errPt = 0.055 * valPt + 0.017 * valPt * valPt; diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc index f49d2f01f48c6..c39468f669b35 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc @@ -35,7 +35,7 @@ class PixelNtupletsFitterProducer : public edm::global::EDProducer<> { void PixelNtupletsFitterProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { auto const& idealField = iSetup.getData(idealMagneticFieldToken_); - float bField = 1 / PixelRecoUtilities::fieldInInvGev(iSetup); + float bField = 1 / idealField.inverseNominalValueInGeV(); auto impl = std::make_unique(bField, &idealField, useRiemannFit_); auto prod = std::make_unique(std::move(impl)); iEvent.put(std::move(prod)); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc index c712be79c669c..c3f7a9885b7e7 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc @@ -92,7 +92,7 @@ std::unique_ptr KFBasedPixelFitter::run(const std::vector 1.e-4) { - float invPt = PixelRecoUtilities::inversePt(circle.curvature(), setup); + float invPt = PixelRecoUtilities::inversePt(circle.curvature(), *theField); float valPt = 1.f / invPt; float chargeTmp = (points[1].x() - points[0].x()) * (points[2].y() - points[1].y()) - (points[1].y() - points[0].y()) * (points[2].x() - points[1].x()); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc index f2c83d8755ba9..b25bfd7ae8ff4 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc @@ -85,9 +85,9 @@ std::unique_ptr PixelFitterByConformalMappingAndLine::run(const std parabola.fixImpactParmaeter(0.); Measurement1D curv = parabola.curvature(); - float invPt = PixelRecoUtilities::inversePt(curv.value(), setup); + float invPt = PixelRecoUtilities::inversePt(curv.value(), *theField); float valPt = (invPt > 1.e-4) ? 1. / invPt : 1.e4; - float errPt = PixelRecoUtilities::inversePt(curv.error(), setup) * sqr(valPt); + float errPt = PixelRecoUtilities::inversePt(curv.error(), *theField) * sqr(valPt); Measurement1D pt(valPt, errPt); Measurement1D phi = parabola.directionPhi(); Measurement1D tip = parabola.impactParameter(); @@ -101,7 +101,7 @@ std::unique_ptr PixelFitterByConformalMappingAndLine::run(const std const GlobalPoint &point = points[i]; const GlobalError &error = errors[i]; r[i] = sqrt(sqr(point.x() - region.origin().x()) + sqr(point.y() - region.origin().y())); - r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt.value(), setup)(r[i]); + r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt.value(), *theField)(r[i]); z[i] = point.z() - region.origin().z(); errZ[i] = (isBarrel[i]) ? sqrt(error.czz()) : sqrt(error.rerr(point)) * simpleCot; } diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc index 42ffdfc3abb09..d19ca5ddef391 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc @@ -127,8 +127,8 @@ std::unique_ptr PixelFitterByHelixProjections::run(const std::vecto int iCharge = charge(points); float curvature = circle.curvature(); - if ((curvature > 1.e-4) && (LIKELY(PixelRecoUtilities::fieldInInvGev(setup) > 0.01))) { - float invPt = PixelRecoUtilities::inversePt(circle.curvature(), setup); + if ((curvature > 1.e-4) && (LIKELY(theField->inverseNominalValueInGeV()) > 0.01)) { + float invPt = PixelRecoUtilities::inversePt(circle.curvature(), *theField); valPt = (invPt > 1.e-4f) ? 1.f / invPt : 1.e4f; CircleFromThreePoints::Vector2D center = circle.center(); valTip = iCharge * (center.mag() - 1.f / curvature); diff --git a/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h b/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h index 7e93f30a186fb..f2cff74430da8 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CAHitQuadrupletGenerator.h @@ -8,6 +8,7 @@ #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" @@ -48,7 +49,6 @@ class CAHitQuadrupletGenerator { void hitNtuplets(const IntermediateHitDoublets& regionDoublets, std::vector& result, - const edm::EventSetup& es, const SeedingLayerSetsHits& layers); private: @@ -56,6 +56,9 @@ class CAHitQuadrupletGenerator { std::unique_ptr theComparitor; + const edm::ESGetToken theFieldToken; + const MagneticField* theField = nullptr; + class QuantityDependsPtEval { public: QuantityDependsPtEval(float v1, float v2, float c1, float c2) @@ -103,12 +106,12 @@ class CAHitQuadrupletGenerator { << "PixelQuadrupletGenerator::QuantityDependsPt: pt2 needs to be > 0; is " << pt2_; } - QuantityDependsPtEval evaluator(const edm::EventSetup& es) const { + QuantityDependsPtEval evaluator(const MagneticField& field) const { if (enabled_) { return QuantityDependsPtEval(value1_, value2_, - PixelRecoUtilities::curvature(1.f / pt1_, es), - PixelRecoUtilities::curvature(1.f / pt2_, es)); + PixelRecoUtilities::curvature(1.f / pt1_, field), + PixelRecoUtilities::curvature(1.f / pt2_, field)); } return QuantityDependsPtEval(value2_, value2_, 0.f, 0.f); } diff --git a/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h b/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h index 7ac7a77927209..3896e94c30579 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h @@ -8,6 +8,7 @@ #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "RecoTracker/TkHitPairs/interface/LayerHitMapCache.h" @@ -47,7 +48,6 @@ class CAHitTripletGenerator { void hitNtuplets(const IntermediateHitDoublets& regionDoublets, std::vector& result, - const edm::EventSetup& es, const SeedingLayerSetsHits& layers); private: @@ -55,6 +55,9 @@ class CAHitTripletGenerator { std::unique_ptr theComparitor; + const edm::ESGetToken theFieldToken; + const MagneticField* theField = nullptr; + class QuantityDependsPtEval { public: QuantityDependsPtEval(float v1, float v2, float c1, float c2) @@ -102,12 +105,12 @@ class CAHitTripletGenerator { << "CAHitTripletGenerator::QuantityDependsPt: pt2 needs to be > 0; is " << pt2_; } - QuantityDependsPtEval evaluator(const edm::EventSetup& es) const { + QuantityDependsPtEval evaluator(const MagneticField& field) const { if (enabled_) { return QuantityDependsPtEval(value1_, value2_, - PixelRecoUtilities::curvature(1.f / pt1_, es), - PixelRecoUtilities::curvature(1.f / pt2_, es)); + PixelRecoUtilities::curvature(1.f / pt1_, field), + PixelRecoUtilities::curvature(1.f / pt2_, field)); } return QuantityDependsPtEval(value2_, value2_, 0.f, 0.f); } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc index ee295d8f5253c..083a03ad2459b 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc @@ -16,6 +16,7 @@ #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/RunningAverage.h" #include "HeterogeneousCore/CUDACore/interface/ScopedContext.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" #include "CAHitNtupletGeneratorOnGPU.h" @@ -34,6 +35,7 @@ class CAHitNtupletCUDA : public edm::global::EDProducer<> { bool onGPU_; + edm::ESGetToken tokenField_; edm::EDGetTokenT> tokenHitGPU_; edm::EDPutTokenT> tokenTrackGPU_; edm::EDGetTokenT tokenHitCPU_; @@ -43,7 +45,7 @@ class CAHitNtupletCUDA : public edm::global::EDProducer<> { }; CAHitNtupletCUDA::CAHitNtupletCUDA(const edm::ParameterSet& iConfig) - : onGPU_(iConfig.getParameter("onGPU")), gpuAlgo_(iConfig, consumesCollector()) { + : onGPU_(iConfig.getParameter("onGPU")), tokenField_(esConsumes()), gpuAlgo_(iConfig, consumesCollector()) { if (onGPU_) { tokenHitGPU_ = consumes>(iConfig.getParameter("pixelRecHitSrc")); @@ -65,7 +67,7 @@ void CAHitNtupletCUDA::fillDescriptions(edm::ConfigurationDescriptions& descript } void CAHitNtupletCUDA::produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& es) const { - auto bf = 1. / PixelRecoUtilities::fieldInInvGev(es); + auto bf = 1. / es.getData(tokenField_).inverseNominalValueInGeV(); if (onGPU_) { auto hHits = iEvent.getHandle(tokenHitGPU_); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc index 685a249454cb0..660c6779b94ef 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletEDProducerT.cc @@ -86,7 +86,7 @@ void CAHitNtupletEDProducerT::produce(edm::Event& iEvent, const edm for (auto& ntuplet : ntuplets) ntuplet.reserve(localRA_.upper()); - generator_.hitNtuplets(regionDoublets, ntuplets, iSetup, seedingLayerHits); + generator_.hitNtuplets(regionDoublets, ntuplets, seedingLayerHits); int index = 0; for (const auto& regionLayerPairs : regionDoublets) { const TrackingRegion& region = regionLayerPairs.region(); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc index 36b4bce0850ae..73f8a806c5182 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletHLTGenerator.cc @@ -12,7 +12,6 @@ #include "ThirdHitCorrection.h" #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include #include "RecoTracker/TkSeedingLayers/interface/SeedComparitorFactory.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" @@ -24,6 +23,8 @@ #include "DataFormats/Math/interface/normalizedPhi.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + #include #include @@ -138,6 +139,10 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, const float maxphi = M_PI + maxDelphi, minphi = -maxphi; // increase to cater for any range const float safePhi = M_PI - maxDelphi; // sideband + edm::ESHandle hfield; + es.get().get(hfield); + const auto& field = *hfield; + // fill the prediction vector for (int il = 0; il < nThirdLayers; ++il) { auto const& hits = *thirdHitMap[il]; @@ -180,7 +185,7 @@ void PixelTripletHLTGenerator::hitTriplets(const TrackingRegion& region, float imppar = region.originRBound(); float imppartmp = region.originRBound() + region.origin().perp(); - float curv = PixelRecoUtilities::curvature(1.f / region.ptMin(), es); + float curv = PixelRecoUtilities::curvature(1.f / region.ptMin(), field); for (std::size_t ip = 0; ip != doublets.size(); ip++) { auto xi = doublets.x(ip, HitDoublets::inner); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc index 608dc5a7e3c7a..49c3f808ae7c9 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc @@ -16,6 +16,8 @@ #include "MatchedHitRZCorrectionFromBending.h" #include "CommonTools/RecoAlgos/interface/KDTreeLinkerAlgo.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + #include #include #include @@ -138,6 +140,10 @@ void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, es.get().get(tTopoHand); const TrackerTopology* tTopo = tTopoHand.product(); + edm::ESHandle hfield; + es.get().get(hfield); + const auto& field = *hfield; + auto outSeq = doublets.detLayer(HitDoublets::outer)->seqNum(); using NodeInfo = KDTreeNodeInfo; @@ -199,7 +205,7 @@ void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, rzError[il] = maxErr; //save error } - double curv = PixelRecoUtilities::curvature(1. / region.ptMin(), es); + double curv = PixelRecoUtilities::curvature(1. / region.ptMin(), field); for (std::size_t ip = 0; ip != doublets.size(); ip++) { auto xi = doublets.x(ip, HitDoublets::inner); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletNoTipGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletNoTipGenerator.cc index 4ad44d9cde294..269f92c42dced 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletNoTipGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletNoTipGenerator.cc @@ -16,6 +16,8 @@ #include "TrackingTools/DetLayers/interface/DetLayer.h" #include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + typedef PixelRecoRange Range; template T sqr(T t) { @@ -72,6 +74,10 @@ void PixelTripletNoTipGenerator::hitTriplets(const TrackingRegion& region, thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il], region, es); } + edm::ESHandle hfield; + es.get().get(hfield); + const auto& field = *hfield; + MultipleScatteringParametrisation sigma1RPhi(firstLayer, es); MultipleScatteringParametrisation sigma2RPhi(secondLayer, es); @@ -81,7 +87,7 @@ void PixelTripletNoTipGenerator::hitTriplets(const TrackingRegion& region, GlobalPoint p2((*ip).outer()->globalPosition() - shift); ThirdHitPredictionFromInvLine predictionRPhiTMP(p1, p2); - double pt_p1p2 = 1. / PixelRecoUtilities::inversePt(predictionRPhiTMP.curvature(), es); + double pt_p1p2 = 1. / PixelRecoUtilities::inversePt(predictionRPhiTMP.curvature(), field); PixelRecoPointRZ point1(p1.perp(), p1.z()); PixelRecoPointRZ point2(p2.perp(), p2.z()); @@ -165,7 +171,7 @@ void PixelTripletNoTipGenerator::hitTriplets(const TrackingRegion& region, Range hitZRange(z3Hit - z3HitError, z3Hit + z3HitError); bool inside = hitZRange.hasIntersection(zRange); - double curvatureMS = PixelRecoUtilities::curvature(1. / region.ptMin(), es); + double curvatureMS = PixelRecoUtilities::curvature(1. / region.ptMin(), field); bool ptCut = (predictionRPhi.curvature() - theNSigma * predictionRPhi.errorCurvature() < curvatureMS); bool chi2Cut = (predictionRPhi.chi2() < theChi2Cut); if (inside && ptCut && chi2Cut) { diff --git a/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.cc b/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.cc index e1e8c294c9ad9..d217a3f13ec46 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.cc @@ -2,6 +2,7 @@ #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" using namespace pixelrecoutilities; @@ -21,8 +22,11 @@ void ThirdHitCorrection::init(const edm::EventSetup &es, bool useBendingCorrection) { theUseMultipleScattering = useMultipleScattering; theUseBendingCorrection = useBendingCorrection; - if (useBendingCorrection) - theBendingCorrection.init(pt, es); + if (useBendingCorrection) { + edm::ESHandle hfield; + es.get().get(hfield); + theBendingCorrection.init(pt, *hfield); + } theMultScattCorrRPhi = 0; theMScoeff = 0; diff --git a/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc b/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc index 8676b48c4a253..74ae6df89d754 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CAHitQuadrupletGenerator.cc @@ -25,7 +25,8 @@ using namespace std; constexpr unsigned int CAHitQuadrupletGenerator::minLayers; CAHitQuadrupletGenerator::CAHitQuadrupletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) - : extraHitRPhitolerance(cfg.getParameter( + : theFieldToken(iC.esConsumes()), + extraHitRPhitolerance(cfg.getParameter( "extraHitRPhitolerance")), //extra window in ThirdHitPredictionFromCircle range (divide by R to get phi) maxChi2(cfg.getParameter("maxChi2")), fitFastCircle(cfg.getParameter("fitFastCircle")), @@ -84,6 +85,7 @@ void CAHitQuadrupletGenerator::fillDescriptions(edm::ParameterSetDescription& de void CAHitQuadrupletGenerator::initEvent(const edm::Event& ev, const edm::EventSetup& es) { if (theComparitor) theComparitor->init(ev, es); + theField = &es.getData(theFieldToken); } namespace { void createGraphStructure(const SeedingLayerSetsHits& layers, CAGraph& g) { @@ -159,7 +161,6 @@ namespace { void CAHitQuadrupletGenerator::hitNtuplets(const IntermediateHitDoublets& regionDoublets, std::vector& result, - const edm::EventSetup& es, const SeedingLayerSetsHits& layers) { CAGraph g; @@ -193,7 +194,7 @@ void CAHitQuadrupletGenerator::hitNtuplets(const IntermediateHitDoublets& region auto& allCells = ca.getAllCells(); - const QuantityDependsPtEval maxChi2Eval = maxChi2.evaluator(es); + const QuantityDependsPtEval maxChi2Eval = maxChi2.evaluator(*theField); // re-used thoughout std::array bc_r; @@ -242,12 +243,12 @@ void CAHitQuadrupletGenerator::hitNtuplets(const IntermediateHitDoublets& region if (useBendingCorrection) { // Following PixelFitterByConformalMappingAndLine const float simpleCot = (gps.back().z() - gps.front().z()) / (gps.back().perp() - gps.front().perp()); - const float pt = 1.f / PixelRecoUtilities::inversePt(abscurv, es); + const float pt = 1.f / PixelRecoUtilities::inversePt(abscurv, *theField); for (int i = 0; i < 4; ++i) { const GlobalPoint& point = gps[i]; const GlobalError& error = ges[i]; bc_r[i] = sqrt(sqr(point.x() - region.origin().x()) + sqr(point.y() - region.origin().y())); - bc_r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt, es)(bc_r[i]); + bc_r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt, *theField)(bc_r[i]); bc_z[i] = point.z() - region.origin().z(); bc_errZ2[i] = (barrels[i]) ? error.czz() : error.rerr(point) * sqr(simpleCot); } diff --git a/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc b/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc index be604fd60d631..8b33b5005e78b 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CAHitTripletGenerator.cc @@ -25,9 +25,9 @@ using namespace std; constexpr unsigned int CAHitTripletGenerator::minLayers; -CAHitTripletGenerator::CAHitTripletGenerator(const edm::ParameterSet& cfg, - edm::ConsumesCollector& iC) - : extraHitRPhitolerance(cfg.getParameter( +CAHitTripletGenerator::CAHitTripletGenerator(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) + : theFieldToken(iC.esConsumes()), + extraHitRPhitolerance(cfg.getParameter( "extraHitRPhitolerance")), //extra window in ThirdHitPredictionFromCircle range (divide by R to get phi) maxChi2(cfg.getParameter("maxChi2")), useBendingCorrection(cfg.getParameter("useBendingCorrection")), @@ -79,6 +79,7 @@ void CAHitTripletGenerator::fillDescriptions(edm::ParameterSetDescription& desc) void CAHitTripletGenerator::initEvent(const edm::Event& ev, const edm::EventSetup& es) { if (theComparitor) theComparitor->init(ev, es); + theField = &es.getData(theFieldToken); } namespace { @@ -158,7 +159,6 @@ namespace { void CAHitTripletGenerator::hitNtuplets(const IntermediateHitDoublets& regionDoublets, std::vector& result, - const edm::EventSetup& es, const SeedingLayerSetsHits& layers) { CAGraph g; @@ -185,7 +185,7 @@ void CAHitTripletGenerator::hitNtuplets(const IntermediateHitDoublets& regionDou auto& allCells = ca.getAllCells(); - const QuantityDependsPtEval maxChi2Eval = maxChi2.evaluator(es); + const QuantityDependsPtEval maxChi2Eval = maxChi2.evaluator(*theField); // re-used thoughout, need to be vectors because of RZLine interface std::array bc_r; @@ -225,12 +225,12 @@ void CAHitTripletGenerator::hitNtuplets(const IntermediateHitDoublets& regionDou if (useBendingCorrection) { // Following PixelFitterByConformalMappingAndLine const float simpleCot = (gps.back().z() - gps.front().z()) / (gps.back().perp() - gps.front().perp()); - const float pt = 1.f / PixelRecoUtilities::inversePt(abscurv, es); + const float pt = 1.f / PixelRecoUtilities::inversePt(abscurv, *theField); for (int i = 0; i < 3; ++i) { const GlobalPoint& point = gps[i]; const GlobalError& error = ges[i]; bc_r[i] = sqrt(sqr(point.x() - region.origin().x()) + sqr(point.y() - region.origin().y())); - bc_r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt, es)(bc_r[i]); + bc_r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt, *theField)(bc_r[i]); bc_z[i] = point.z() - region.origin().z(); bc_errZ2[i] = (barrels[i]) ? error.czz() : error.rerr(point) * sqr(simpleCot); } diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc index 963e4d69e7b23..1c583299faa29 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.cc @@ -88,7 +88,10 @@ void HitPairGeneratorFromLayerPairForPhotonConversion::hitPairs(const Conversion float innerPhimin, innerPhimax; /*Getting only the Hits in the outer layer that are compatible with the conversion region*/ - if (!getPhiRange(outerPhimin, outerPhimax, *outerLayerObj.detLayer(), convRegion, es)) + edm::ESHandle hfield; + es.get().get(hfield); + const auto& field = *hfield; + if (!getPhiRange(outerPhimin, outerPhimax, *outerLayerObj.detLayer(), convRegion, field)) return; outerHitsMap.hits(outerPhimin, outerPhimax, outerHits); @@ -128,7 +131,7 @@ void HitPairGeneratorFromLayerPairForPhotonConversion::hitPairs(const Conversion /*Get only the inner hits compatible with the conversion region*/ innerHits.clear(); - if (!getPhiRange(innerPhimin, innerPhimax, *innerLayerObj.detLayer(), convRegion, es)) + if (!getPhiRange(innerPhimin, innerPhimax, *innerLayerObj.detLayer(), convRegion, field)) continue; innerHitsMap.hits(innerPhimin, innerPhimax, innerHits); @@ -280,19 +283,19 @@ bool HitPairGeneratorFromLayerPairForPhotonConversion::getPhiRange(float& Phimin float& Phimax, const DetLayer& layer, const ConversionRegion& convRegion, - const edm::EventSetup& es) { + const MagneticField& field) { if (layer.location() == GeomDetEnumerators::barrel) { - return getPhiRange(Phimin, Phimax, getLayerRadius(layer), convRegion, es); + return getPhiRange(Phimin, Phimax, getLayerRadius(layer), convRegion, field); } else if (layer.location() == GeomDetEnumerators::endcap) { float Z = getLayerZ(layer); float R = Z / convRegion.cotTheta(); - return getPhiRange(Phimin, Phimax, R, convRegion, es); //FIXME + return getPhiRange(Phimin, Phimax, R, convRegion, field); //FIXME } return false; } bool HitPairGeneratorFromLayerPairForPhotonConversion::getPhiRange( - float& Phimin, float& Phimax, const float& layerR, const ConversionRegion& convRegion, const edm::EventSetup& es) { + float& Phimin, float& Phimax, const float& layerR, const ConversionRegion& convRegion, const MagneticField& field) { Phimin = reco::deltaPhi(convRegion.convPoint().phi(), 0.); float dphi; @@ -305,7 +308,7 @@ bool HitPairGeneratorFromLayerPairForPhotonConversion::getPhiRange( return false; } - float theRCurvatureMin = PixelRecoUtilities::bendingRadius(ptmin, es); + float theRCurvatureMin = PixelRecoUtilities::bendingRadius(ptmin, field); if (theRCurvatureMin < DeltaL) dphi = atan(DeltaL / layerR); diff --git a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.h b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.h index 98f85423af903..1aca05b95039a 100644 --- a/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.h +++ b/RecoTracker/ConversionSeedGenerators/plugins/HitPairGeneratorFromLayerPairForPhotonConversion.h @@ -41,9 +41,12 @@ class dso_hidden HitPairGeneratorFromLayerPairForPhotonConversion { // : public float& Phimax, const DetLayer& layer, const ConversionRegion& convRegion, - const edm::EventSetup& es); - bool getPhiRange( - float& Phimin, float& Phimax, const float& layerR, const ConversionRegion& convRegion, const edm::EventSetup& es); + const MagneticField& field); + bool getPhiRange(float& Phimin, + float& Phimax, + const float& layerR, + const ConversionRegion& convRegion, + const MagneticField& field); bool checkRZCompatibilityWithSeedTrack(const RecHitsSortedInPhi::Hit& hit, const DetLayer& layer, const ConversionRegion& convRegion); diff --git a/RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc b/RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc index 3594d26ae18cc..265bfb1047736 100644 --- a/RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc +++ b/RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc @@ -7,6 +7,7 @@ #include "RecoTracker/TkMSParametrization/interface/PixelRecoRange.h" #include "DataFormats/GeometryVector/interface/Basic2DVector.h" #include "DataFormats/Math/interface/ExtVec.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #if !defined(__INTEL_COMPILER) #define USE_VECTORS_HERE @@ -104,7 +105,9 @@ InnerDeltaPhi::InnerDeltaPhi(const DetLayer& outlayer, { float zMinOrigin = theVtxZ - region.originZBound(); float zMaxOrigin = theVtxZ + region.originZBound(); - theRCurvature = PixelRecoUtilities::bendingRadius(thePtMin, iSetup); + edm::ESHandle hfield; + iSetup.get().get(hfield); + theRCurvature = PixelRecoUtilities::bendingRadius(thePtMin, *hfield); if (innerIsBarrel) initBarrelLayer(layer); diff --git a/RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h b/RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h index 8f5d9a2df495f..5e3152f37ad27 100644 --- a/RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h +++ b/RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h @@ -1,14 +1,14 @@ #ifndef PixelRecoUtilities_LongitudinalBendingCorrection_H #define PixelRecoUtilities_LongitudinalBendingCorrection_H -#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" +#include "MagneticField/Engine/interface/MagneticField.h" namespace pixelrecoutilities { class LongitudinalBendingCorrection { public: LongitudinalBendingCorrection() : coeff(0) {} - LongitudinalBendingCorrection(float pt, const edm::EventSetup& es) { init(pt, es); } - void init(float pt, const edm::EventSetup& es) { - auto theInvCurv = pt * PixelRecoUtilities::fieldInInvGev(es); + LongitudinalBendingCorrection(float pt, const MagneticField& field) { init(pt, field); } + void init(float pt, const MagneticField& field) { + auto theInvCurv = pt * field.inverseNominalValueInGeV(); coeff = 1.f / (4.f * 6.f * theInvCurv * theInvCurv); } diff --git a/RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h b/RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h index ff3084caa7805..a9c08e3775a3a 100644 --- a/RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h +++ b/RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h @@ -1,59 +1,40 @@ #ifndef PixelRecoUtilities_H #define PixelRecoUtilities_H #include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include +#include "MagneticField/Engine/interface/MagneticField.h" /** \namespace PixelRecoUtilities * Small utility funcions used during seed generation */ namespace PixelRecoUtilities { - - /** The magnetic field at 0,0,0 - */ - struct FieldAt0 { - FieldAt0(const edm::EventSetup& es); - float fieldInInvGev; - }; - - /** Magnetic field intensity in units of cm/GeV. - * The value is cached in a static variable, so the actual - * MagneticField is accessed only once. - */ - inline float fieldInInvGev(const edm::EventSetup& iSetup) { - static const FieldAt0 fieldAt0(iSetup); - return fieldAt0.fieldInInvGev; - } - // void MaginTesla(const edm::EventSetup& c); /** gives bending radius in magnetic field, * pT in GeV, magnetic field taken at (0,0,0) */ template - T bendingRadius(T pt, const edm::EventSetup& iSetup) { - return pt * fieldInInvGev(iSetup); + T bendingRadius(T pt, const MagneticField& field) { + return pt * field.inverseNominalValueInGeV(); } /** gives transverse curvature (=1/radius of curvature) in magnetic field, * pT in GeV, magnetic field taken at (0,0,0) */ template - T curvature(T InversePt, const edm::EventSetup& iSetup) { - return InversePt / fieldInInvGev(iSetup); + T curvature(T InversePt, const MagneticField& field) { + return InversePt / field.inverseNominalValueInGeV(); } /** inverse pt from curvature **/ template - T inversePt(T curvature, const edm::EventSetup& iSetup) { - return curvature * fieldInInvGev(iSetup); + T inversePt(T curvature, const MagneticField& field) { + return curvature * field.inverseNominalValueInGeV(); } /** distance between stright line propagation and helix * r_stright_line = radius+longitudinalBendingCorrection(radius,pt) */ - inline double longitudinalBendingCorrection(double radius, double pt, const edm::EventSetup& iSetup) { - double invCurv = bendingRadius(pt, iSetup); + inline double longitudinalBendingCorrection(double radius, double pt, const MagneticField& field) { + double invCurv = bendingRadius(pt, field); if (invCurv == 0.) return 0.; return radius / 6. * radius * radius / (2. * invCurv * 2. * invCurv); diff --git a/RecoTracker/TkMSParametrization/src/PixelRecoUtilities.cc b/RecoTracker/TkMSParametrization/src/PixelRecoUtilities.cc deleted file mode 100644 index 68db7fd4e528d..0000000000000 --- a/RecoTracker/TkMSParametrization/src/PixelRecoUtilities.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -namespace PixelRecoUtilities { - FieldAt0::FieldAt0(const edm::EventSetup& es) { - edm::ESHandle pSetup; - es.get().get(pSetup); - fieldInInvGev = 1.f / std::abs(pSetup->inTesla(GlobalPoint(0, 0, 0)).z() * 2.99792458e-3f); - } - -} // namespace PixelRecoUtilities diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc index 94198728f1eb7..7043bd77329ef 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc @@ -305,7 +305,7 @@ void MultiHitGeneratorFromChi2::hitSets(const TrackingRegion& region, //gc: now we have initialized the KDTrees and we are out of the layer loop //gc: this sets the minPt of the triplet - auto curv = PixelRecoUtilities::curvature(1. / region.ptMin(), es); + auto curv = PixelRecoUtilities::curvature(1. / region.ptMin(), *bfield); LogTrace("MultiHitGeneratorFromChi2") << "doublet size=" << doublets.size() << std::endl; diff --git a/RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h b/RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h index b021740ba03e8..fdebb7f2f5bcd 100644 --- a/RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h +++ b/RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h @@ -208,7 +208,7 @@ class RectangularEtaPhiTrackingRegion final : public TrackingRegion { std::unique_ptr estimator(const ForwardDetLayer* layer, const edm::EventSetup& iSetup) const dso_internal; - OuterHitPhiPrediction phiWindow(const edm::EventSetup& iSetup) const dso_internal; + OuterHitPhiPrediction phiWindow(const MagneticField& field) const dso_internal; HitRZConstraint rzConstraint() const dso_internal; void initEtaRange(const GlobalVector& dir, const Margin& margin); diff --git a/RecoTracker/TkTrackingRegions/src/RectangularEtaPhiTrackingRegion.cc b/RecoTracker/TkTrackingRegions/src/RectangularEtaPhiTrackingRegion.cc index 3e2710fcaed93..bdc4257cbfd6f 100644 --- a/RecoTracker/TkTrackingRegions/src/RectangularEtaPhiTrackingRegion.cc +++ b/RecoTracker/TkTrackingRegions/src/RectangularEtaPhiTrackingRegion.cc @@ -190,7 +190,10 @@ std::unique_ptr RectangularEtaPhiTrackingRegion::estimator return nullptr; // phi prediction - OuterHitPhiPrediction phiPrediction = phiWindow(iSetup); + edm::ESHandle hfield; + iSetup.get().get(hfield); + const auto& field = *hfield; + OuterHitPhiPrediction phiPrediction = phiWindow(field); // // optional corrections for tolerance (mult.scatt, error, bending) @@ -202,7 +205,7 @@ std::unique_ptr RectangularEtaPhiTrackingRegion::estimator auto sinThetaInv = std::sqrt(1.f + sqr(cotTheta)); MultipleScatteringParametrisation msSigma(layer, iSetup); auto scatt = 3.f * msSigma(ptMin(), cotTheta); - auto bendR = longitudinalBendingCorrection(radius, ptMin(), iSetup); + auto bendR = longitudinalBendingCorrection(radius, ptMin(), field); float hitErrRPhi = 0.; float hitErrZ = 0.; @@ -246,7 +249,10 @@ std::unique_ptr RectangularEtaPhiTrackingRegion::estimator return nullptr; // phi prediction - OuterHitPhiPrediction phiPrediction = phiWindow(iSetup); + edm::ESHandle hfield; + iSetup.get().get(hfield); + const auto& field = *hfield; + OuterHitPhiPrediction phiPrediction = phiWindow(field); OuterHitPhiPrediction::Range phiRange = phiPrediction(detRWindow.max()); // @@ -257,7 +263,7 @@ std::unique_ptr RectangularEtaPhiTrackingRegion::estimator float cosThetaInv = std::sqrt(1 + sqr(cotTheta)) / cotTheta; MultipleScatteringParametrisation msSigma(layer, iSetup); float scatt = 3.f * msSigma(ptMin(), cotTheta); - float bendR = longitudinalBendingCorrection(hitRWindow.max(), ptMin(), iSetup); + float bendR = longitudinalBendingCorrection(hitRWindow.max(), ptMin(), field); float hitErrRPhi = 0.; float hitErrR = 0.; float corrPhi = (scatt + hitErrRPhi) / detRWindow.min(); @@ -285,11 +291,11 @@ std::unique_ptr RectangularEtaPhiTrackingRegion::estimator iSetup); } -OuterHitPhiPrediction RectangularEtaPhiTrackingRegion::phiWindow(const edm::EventSetup& iSetup) const { +OuterHitPhiPrediction RectangularEtaPhiTrackingRegion::phiWindow(const MagneticField& field) const { auto phi0 = phiDirection(); return OuterHitPhiPrediction( OuterHitPhiPrediction::Range(phi0 - thePhiMargin.left(), phi0 + thePhiMargin.right()), - OuterHitPhiPrediction::Range(curvature(invPtRange().min(), iSetup), curvature(invPtRange().max(), iSetup)), + OuterHitPhiPrediction::Range(curvature(invPtRange().min(), field), curvature(invPtRange().max(), field)), originRBound()); } From 73b8af6adb01948858d4ab3a15b6f67e5f4306ce Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 31 Aug 2021 04:51:58 +0200 Subject: [PATCH 226/923] Clean the code - removed the usage of cout and updated the cfg's --- .../plugins/PrintGeomInfoAction.cc | 54 +++++++-------- .../plugins/PrintMaterialBudgetInfo.cc | 66 +++++++++---------- .../PrintGeomInfo/plugins/PrintSensitive.cc | 10 +-- ...nfo_cfg.py => runMaterialBudgeInfo_cfg.py} | 18 +++-- .../PrintGeomInfo/test/python/runSens_cfg.py | 20 +++--- .../test/python/runSummary_cfg.py | 11 ++-- 6 files changed, 94 insertions(+), 85 deletions(-) rename SimG4Core/PrintGeomInfo/test/python/{run_MaterialBudgeInfo_cfg.py => runMaterialBudgeInfo_cfg.py} (77%) diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc index 19f42c1bc4536..7234c140e16a8 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc @@ -54,19 +54,19 @@ class PrintGeomInfoAction : public SimWatcher, private: void update(const BeginOfJob *job) override; void update(const BeginOfRun *run) override; - void dumpSummary(std::ostream &out = std::cout); - void dumpG4LVList(std::ostream &out = std::cout); - void dumpG4LVTree(std::ostream &out = std::cout); - void dumpMaterialList(std::ostream &out = std::cout); - void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out = std::cout); + void dumpSummary(std::ostream &out = G4cout); + void dumpG4LVList(std::ostream &out = G4cout); + void dumpG4LVTree(std::ostream &out = G4cout); + void dumpMaterialList(std::ostream &out = G4cout); + void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out = G4cout); int countNoTouchables(); void add1touchable(G4LogicalVolume *lv, int &nTouch); - void dumpHierarchyTreePVLV(std::ostream &out = std::cout); - void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout); - void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout); - void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout); - void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out = std::cout); - void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout); + void dumpHierarchyTreePVLV(std::ostream &out = G4cout); + void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = G4cout); + void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = G4cout); + void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = G4cout); + void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out = G4cout); + void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = G4cout); void dumpInFile(); void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector &touches); std::string spacesFromLeafDepth(unsigned int leafDepth); @@ -113,16 +113,16 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { fileDetail_ = p.getUntrackedParameter("FileDetail", false); G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:" << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material " - << dumpMaterial_ << "\n " + << dumpMaterial_ << G4endl << " " << " LV " << dumpLV_ << " Solid " << dumpSolid_ << " Attribs " << dumpAtts_ - << "\n " + << G4endl << " " << " PV " << dumpPV_ << " Rotation " << dumpRotation_ << " Replica " << dumpReplica_ - << "\n " + << G4endl << " " << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ - << "\n " + << G4endl << " " << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":" << filePV_ << ":" << fileTouch_ << " FileDetail " << fileDetail_ - << "\n for " << names_.size() << " names:"; + << G4endl << " for " << names_.size() << " names:"; for (unsigned int i = 0; i < names_.size(); i++) G4cout << " " << names_[i]; G4cout << G4endl; @@ -483,10 +483,10 @@ void PrintGeomInfoAction::dumpInFile() { std::ofstream fout(fileMat_.c_str()); for (std::vector::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) { if (!fileDetail_) - fout << (*matite)->GetName() << "\n"; + fout << (*matite)->GetName() << G4endl; else fout << (*matite)->GetName() << " " << (*matite)->GetRadlen() << " " << (*matite)->GetNuclearInterLength() - << "\n"; + << G4endl; } fout.close(); } @@ -495,18 +495,18 @@ void PrintGeomInfoAction::dumpInFile() { std::ofstream fout(fileSolid_.c_str()); for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) if (!fileDetail_) - fout << (*lvcite)->GetSolid()->GetName() << "\n"; + fout << (*lvcite)->GetSolid()->GetName() << G4endl; else - fout << (*lvcite)->GetSolid()->GetName() << " " << (*lvcite)->GetSolid()->GetCubicVolume() << "\n"; + fout << (*lvcite)->GetSolid()->GetName() << " " << (*lvcite)->GetSolid()->GetCubicVolume() << G4endl; fout.close(); } if (!fileLV_.empty()) { std::ofstream fout(fileLV_.c_str()); for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) if (!fileDetail_) - fout << (*lvcite)->GetName() << "\n"; + fout << (*lvcite)->GetName() << G4endl; else - fout << (*lvcite)->GetName() << " " << (*lvcite)->GetMass(false, false) << "\n"; + fout << (*lvcite)->GetName() << " " << (*lvcite)->GetMass(false, false) << G4endl; fout.close(); } if (!filePV_.empty()) { @@ -516,15 +516,15 @@ void PrintGeomInfoAction::dumpInFile() { if (fileDetail_) { if (dd4hep_) fout << (*pvcite)->GetName() << " " << (*pvcite)->GetTranslation().x() << " " - << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << "\n"; + << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << G4endl; else fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << " " << (*pvcite)->GetTranslation().x() - << " " << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << "\n"; + << " " << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << G4endl; } else { if (dd4hep_) - fout << (*pvcite)->GetName() << "\n"; + fout << (*pvcite)->GetName() << G4endl; else - fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n"; + fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << G4endl; } } fout.close(); @@ -535,7 +535,7 @@ void PrintGeomInfoAction::dumpInFile() { getTouch(theTopPV_, 0, 1, touches); std::sort(touches.begin(), touches.end()); for (const auto &touch : touches) - fout << touch << "\n"; + fout << touch << G4endl; fout.close(); } } diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc index 56e02d6de72b2..47937b349b9b0 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc @@ -48,20 +48,20 @@ class PrintMaterialBudgetInfo : public SimWatcher, private: void update(const BeginOfJob* job) override{}; void update(const BeginOfRun* run) override; - void dumpHeader(std::ostream& out = std::cout); - void dumpLaTeXHeader(std::ostream& out = std::cout); + void dumpHeader(std::ostream& out = G4cout); + void dumpLaTeXHeader(std::ostream& out = G4cout); void dumpHierarchyLeaf(G4VPhysicalVolume* pv, G4LogicalVolume* lv, unsigned int leafDepth, - std::ostream& weightOut = std::cout, - std::ostream& texOut = std::cout); + std::ostream& weightOut = G4cout, + std::ostream& texOut = G4cout); void printInfo(G4VPhysicalVolume* pv, G4LogicalVolume* lv, unsigned int leafDepth, - std::ostream& weightOut = std::cout, - std::ostream& texOut = std::cout); - void dumpElementMassFraction(std::ostream& elementOut = std::cout); - void dumpLaTeXFooter(std::ostream& out = std::cout); + std::ostream& weightOut = G4cout, + std::ostream& texOut = G4cout); + void dumpElementMassFraction(std::ostream& elementOut = G4cout); + void dumpLaTeXFooter(std::ostream& out = G4cout); private: std::string name; @@ -86,7 +86,7 @@ PrintMaterialBudgetInfo::PrintMaterialBudgetInfo(const edm::ParameterSet& p) { name = p.getUntrackedParameter("Name", "*"); nchar = name.find('*'); name.assign(name, 0, nchar); - std::cout << "PrintMaterialBudget selected volume " << name << std::endl; + G4cout << "PrintMaterialBudget selected volume " << name << G4endl; volumeFound = false; std::string weightFileName = name + ".weight"; weightOutputFile.open(weightFileName.c_str()); @@ -94,9 +94,9 @@ PrintMaterialBudgetInfo::PrintMaterialBudgetInfo(const edm::ParameterSet& p) { elementOutputFile.open(elementFileName.c_str()); std::string texFileName = name + "_table.tex"; texOutputFile.open(texFileName.c_str()); - std::cout << "PrintMaterialBudget output file " << weightFileName << std::endl; - std::cout << "PrintMaterialBudget output file " << elementFileName << std::endl; - std::cout << "PrintMaterialBudget output file " << texFileName << std::endl; + G4cout << "PrintMaterialBudget output file " << weightFileName << G4endl; + G4cout << "PrintMaterialBudget output file " << elementFileName << G4endl; + G4cout << "PrintMaterialBudget output file " << texFileName << G4endl; elementNames.clear(); elementTotalWeight.clear(); elementWeightFraction.clear(); @@ -147,7 +147,7 @@ void PrintMaterialBudgetInfo::dumpHeader(std::ostream& out) { << "\t" << "Mass" << "\t" - << "\t" << std::endl; + << "\t" << G4endl; out << "Level" << "\t" << "Name" @@ -166,16 +166,16 @@ void PrintMaterialBudgetInfo::dumpHeader(std::ostream& out) { << "\t" << "[g] " << "\t" - << "\t" << std::endl; + << "\t" << G4endl; } void PrintMaterialBudgetInfo::dumpLaTeXHeader(std::ostream& out) { - out << "\\begin{table}[h!]" << std::endl - << " \\caption{\\textsf {" << name << "} volume list.}" << std::endl - << " \\label{tab: " << name << "}" << std::endl - << " \\begin{center}" << std::endl - << " \\begin{tabular}{ccccccc}" << std::endl - << " \\hline" << std::endl; + out << "\\begin{table}[h!]" << G4endl + << " \\caption{\\textsf {" << name << "} volume list.}" << G4endl + << " \\label{tab: " << name << "}" << G4endl + << " \\begin{center}" << G4endl + << " \\begin{tabular}{ccccccc}" << G4endl + << " \\hline" << G4endl; out << " Geom." << "\t & " << " Volume" @@ -189,7 +189,7 @@ void PrintMaterialBudgetInfo::dumpLaTeXHeader(std::ostream& out) { << " Density" << "\t & " << " Mass" - << "\t \\\\ " << std::endl; + << "\t \\\\ " << G4endl; out << " Level" << "\t & " << " Name" @@ -203,15 +203,15 @@ void PrintMaterialBudgetInfo::dumpLaTeXHeader(std::ostream& out) { << " " << "\t & " << " " - << "\t \\\\ " << std::endl - << " \\hline\\hline" << std::endl; + << "\t \\\\ " << G4endl + << " \\hline\\hline" << G4endl; } void PrintMaterialBudgetInfo::dumpLaTeXFooter(std::ostream& out) { - out << " \\hline" << std::endl - << " \\end{tabular}" << std::endl - << " \\end{center}" << std::endl - << "\\end{table}" << std::endl; + out << " \\hline" << G4endl + << " \\end{tabular}" << G4endl + << " \\end{center}" << G4endl + << "\\end{table}" << G4endl; } void PrintMaterialBudgetInfo::dumpHierarchyLeaf( @@ -228,7 +228,7 @@ void PrintMaterialBudgetInfo::dumpHierarchyLeaf( volumeFound = true; levelFound = leafDepth; printInfo(pv, lv, leafDepth, weightOut, texOut); - texOut << " \\hline" << std::endl; + texOut << " \\hline" << G4endl; } //----- Get LV daughters from list of PV daughters @@ -272,12 +272,12 @@ void PrintMaterialBudgetInfo::printInfo( //----- dump info weightOut << leafDepth << "\t" << volumeName << "\t" << pv->GetCopyNo() << "\t" << solidName << "\t" << materialName - << "\t" << G4BestUnit(density, "Volumic Mass") << "\t" << G4BestUnit(weight, "Mass") << "\t" << std::endl; + << "\t" << G4BestUnit(density, "Volumic Mass") << "\t" << G4BestUnit(weight, "Mass") << "\t" << G4endl; // texOut << "\t" << leafDepth << "\t & " << stringLaTeXUnderscore(volumeName) << "\t & " << pv->GetCopyNo() << "\t & " << stringLaTeXUnderscore(solidName) << "\t & " << stringLaTeXUnderscore(materialName) << "\t & " << stringLaTeXSuperscript(G4BestUnit(density, "Volumic Mass")) << "\t & " - << stringLaTeXSuperscript(G4BestUnit(weight, "Mass")) << "\t \\\\ " << std::endl; + << stringLaTeXSuperscript(G4BestUnit(weight, "Mass")) << "\t \\\\ " << G4endl; // for (unsigned int iElement = 0; iElement < (unsigned int)lv->GetMaterial()->GetNumberOfElements(); iElement++) { // exclude Air in element weight fraction computation @@ -312,7 +312,7 @@ void PrintMaterialBudgetInfo::dumpElementMassFraction(std::ostream& elementOut) << "Total Mass" << "\t" << "Mass Fraction " - << "\t" << std::endl; + << "\t" << G4endl; // dump for (unsigned int iElement = 0; iElement < (unsigned int)elementTotalWeight.size(); iElement++) { if (elementNames[iElement] != "rr") { @@ -320,11 +320,11 @@ void PrintMaterialBudgetInfo::dumpElementMassFraction(std::ostream& elementOut) elementNames[iElement].append("\t"); elementOut << elementNames[iElement] << "\t" << iElement << "\t" << G4BestUnit(elementTotalWeight[iElement], "Mass") << "\t" << elementWeightFraction[iElement] - << std::endl; + << G4endl; } } elementOut << "\n\t\tTotal Weight without Air " << G4BestUnit(totalWeight, "Mass") << "\tTotal Fraction " - << totalFraction << std::endl; + << totalFraction << G4endl; } std::string PrintMaterialBudgetInfo::stringLaTeXUnderscore(std::string stringname) { diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc index 5a0d74bd5454b..7ae6871c76cfa 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc @@ -21,7 +21,7 @@ class PrintSensitive : public SimWatcher, public Observer { private: void update(const BeginOfRun *run) override; - int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out = std::cout); + int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out = G4cout); G4VPhysicalVolume *getTopPV(); private: @@ -34,16 +34,16 @@ PrintSensitive::PrintSensitive(const edm::ParameterSet &p) { name_ = p.getUntrackedParameter("Name", "*"); nchar_ = name_.find('*'); name_.assign(name_, 0, nchar_); - std::cout << "PrintSensitive:: Print position of all Sensitive Touchables: " - << " for names (0-" << nchar_ << ") = " << name_ << "\n"; + G4cout << "PrintSensitive:: Print position of all Sensitive Touchables: " + << " for names (0-" << nchar_ << ") = " << name_ << G4endl; } PrintSensitive::~PrintSensitive() {} void PrintSensitive::update(const BeginOfRun *run) { G4VPhysicalVolume *theTopPV = getTopPV(); - int nsens = dumpTouch(theTopPV, 0, false, 0, std::cout); - std::cout << "\nTotal number of sensitive detector volumes for " << name_ << " is " << nsens << std::endl; + int nsens = dumpTouch(theTopPV, 0, false, 0, G4cout); + G4cout << "\nTotal number of sensitive detector volumes for " << name_ << " is " << nsens << G4endl; } int PrintSensitive::dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out) { diff --git a/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfo_cfg.py similarity index 77% rename from SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py rename to SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfo_cfg.py index 82239fa27a13d..bb51c83453fc0 100644 --- a/SimG4Core/PrintGeomInfo/test/python/run_MaterialBudgeInfo_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runMaterialBudgeInfo_cfg.py @@ -1,16 +1,22 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("PrintMaterialBudget") +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process("PrintMaterialBudget",Run3) +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') + +#from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +#process = cms.Process('PrintMaterialBudget',Run3_dd4hep) +#process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') + +#from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +#process = cms.Process('PrintMaterialBudget',Phase2C11) +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Geometry.CMSCommonData.cmsExtendedGeometry2015XML_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.MatBudget = dict(extension = "txt") +process.MessageLogger.G4cout=dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) diff --git a/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py index 32b836f89fca3..9b29754b4e39b 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSens_cfg.py @@ -1,18 +1,22 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("PrintGeom") +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PrintGeometry',Run3) +process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') + +#from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep +#process = cms.Process('PrintGeometry',Run3_dd4hep) +#process.load('Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff') + +#from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +#process = cms.Process('PrintGeometry',Phase2C11) +#process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('FWCore.MessageService.MessageLogger_cfi') -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") +process.MessageLogger.G4cout=dict() process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) diff --git a/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py index f83807b3815bd..d29709419a4ad 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runSummary_cfg.py @@ -1,12 +1,11 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("G4PrintGeometry") - -#process.load('Configuration.Geometry.GeometryIdeal_cff') -#process.load('Configuration.Geometry.GeometryExtendedReco_cff') -#process.load('Configuration.Geometry.GeometryExtended2015Reco_cff') -#process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PrintGeometry',Run3) process.load('Configuration.Geometry.GeometryExtended2021Reco_cff') + +#from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 +#process = cms.Process('PrintGeometry',Phase2C11) #process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') #process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') From b5aed4d16935f1ce6fd2ed072f668000d020c9a2 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 31 Aug 2021 05:00:46 +0200 Subject: [PATCH 227/923] Code check --- .../plugins/PrintGeomInfoAction.cc | 16 ++++++++-------- .../plugins/PrintMaterialBudgetInfo.cc | 18 ++++++------------ .../PrintGeomInfo/plugins/PrintSensitive.cc | 2 +- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc index 7234c140e16a8..5dcec80fef5c9 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintGeomInfoAction.cc @@ -114,15 +114,15 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:" << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material " << dumpMaterial_ << G4endl << " " - << " LV " << dumpLV_ << " Solid " << dumpSolid_ << " Attribs " << dumpAtts_ - << G4endl << " " - << " PV " << dumpPV_ << " Rotation " << dumpRotation_ << " Replica " << dumpReplica_ - << G4endl << " " - << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ - << G4endl << " " + << " LV " << dumpLV_ << " Solid " << dumpSolid_ << " Attribs " << dumpAtts_ << G4endl + << " " + << " PV " << dumpPV_ << " Rotation " << dumpRotation_ << " Replica " << dumpReplica_ << G4endl + << " " + << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ << G4endl + << " " << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":" - << filePV_ << ":" << fileTouch_ << " FileDetail " << fileDetail_ - << G4endl << " for " << names_.size() << " names:"; + << filePV_ << ":" << fileTouch_ << " FileDetail " << fileDetail_ << G4endl + << " for " << names_.size() << " names:"; for (unsigned int i = 0; i < names_.size(); i++) G4cout << " " << names_[i]; G4cout << G4endl; diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc index 47937b349b9b0..53696227a1697 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintMaterialBudgetInfo.cc @@ -170,12 +170,9 @@ void PrintMaterialBudgetInfo::dumpHeader(std::ostream& out) { } void PrintMaterialBudgetInfo::dumpLaTeXHeader(std::ostream& out) { - out << "\\begin{table}[h!]" << G4endl - << " \\caption{\\textsf {" << name << "} volume list.}" << G4endl - << " \\label{tab: " << name << "}" << G4endl - << " \\begin{center}" << G4endl - << " \\begin{tabular}{ccccccc}" << G4endl - << " \\hline" << G4endl; + out << "\\begin{table}[h!]" << G4endl << " \\caption{\\textsf {" << name << "} volume list.}" << G4endl + << " \\label{tab: " << name << "}" << G4endl << " \\begin{center}" << G4endl << " \\begin{tabular}{ccccccc}" + << G4endl << " \\hline" << G4endl; out << " Geom." << "\t & " << " Volume" @@ -203,15 +200,12 @@ void PrintMaterialBudgetInfo::dumpLaTeXHeader(std::ostream& out) { << " " << "\t & " << " " - << "\t \\\\ " << G4endl - << " \\hline\\hline" << G4endl; + << "\t \\\\ " << G4endl << " \\hline\\hline" << G4endl; } void PrintMaterialBudgetInfo::dumpLaTeXFooter(std::ostream& out) { - out << " \\hline" << G4endl - << " \\end{tabular}" << G4endl - << " \\end{center}" << G4endl - << "\\end{table}" << G4endl; + out << " \\hline" << G4endl << " \\end{tabular}" << G4endl << " \\end{center}" << G4endl << "\\end{table}" + << G4endl; } void PrintMaterialBudgetInfo::dumpHierarchyLeaf( diff --git a/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc index 7ae6871c76cfa..f6ed109fefef3 100644 --- a/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc +++ b/SimG4Core/PrintGeomInfo/plugins/PrintSensitive.cc @@ -35,7 +35,7 @@ PrintSensitive::PrintSensitive(const edm::ParameterSet &p) { nchar_ = name_.find('*'); name_.assign(name_, 0, nchar_); G4cout << "PrintSensitive:: Print position of all Sensitive Touchables: " - << " for names (0-" << nchar_ << ") = " << name_ << G4endl; + << " for names (0-" << nchar_ << ") = " << name_ << G4endl; } PrintSensitive::~PrintSensitive() {} From e10f0bf39dc5f91381095a896922cd258718fd0f Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 19 May 2021 15:50:58 +0200 Subject: [PATCH 228/923] merge conflict with master --- CommonTools/ParticleFlow/plugins/PFPileUp.cc | 32 ++++- CommonTools/ParticleFlow/plugins/PFPileUp.h | 9 +- .../ParticleFlow/plugins/PFnoPileUp.cc | 45 +++++++ CommonTools/ParticleFlow/plugins/PFnoPileUp.h | 48 ++++++++ CommonTools/ParticleFlow/python/pfCHS_cff.py | 16 +++ .../ParticleFlow/python/pfNoPileUpJME_cff.py | 28 ++++- .../ParticleFlow/python/pfPileUp_cfi.py | 5 +- .../PileupAlgos/plugins/PuppiProducer.cc | 43 ++++++- .../PileupAlgos/plugins/PuppiProducer.h | 5 + CommonTools/PileupAlgos/python/Puppi_cff.py | 3 + .../test/recomputePuppiOnMiniAOD.py | 115 ++++++++++++++++++ .../interface/PrimaryVertexAssignment.h | 45 ++++++- .../RecoAlgos/plugins/PrimaryVertexSorter.cc | 2 + .../RecoAlgos/plugins/PrimaryVertexSorter.h | 20 +++ .../python}/primaryVertexAssociation_cfi.py | 0 .../python/sortedPFPrimaryVertices_cfi.py | 10 +- .../python/sortedPackedPrimaryVertices_cfi.py | 15 +++ .../python/sortedPrimaryVertices_cfi.py | 7 ++ .../RecoAlgos/src/PrimaryVertexAssignment.cc | 33 ++++- .../PatAlgos/python/slimming/miniAOD_tools.py | 10 +- .../python/slimming/puppiForMET_cff.py | 6 +- .../PatAlgos/python/slimming/slimming_cff.py | 2 +- .../python/tools/jetCollectionTools.py | 8 +- .../PatAlgos/test/miniAOD/example_addJet.py | 4 +- .../PatAlgos/test/miniAOD/example_ei.py | 2 +- .../test/miniAOD/example_jet_and_met.py | 6 +- .../runMETCorrectionsAndUncertainties.py | 33 ++--- .../python/pfDeepBoostedJet_cff.py | 2 +- .../ONNXRuntime/python/pfDeepFlavour_cff.py | 2 +- .../JetProducers/python/hepTopTaggerV2_cff.py | 3 +- 30 files changed, 501 insertions(+), 58 deletions(-) create mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUp.cc create mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUp.h create mode 100644 CommonTools/ParticleFlow/python/pfCHS_cff.py create mode 100644 CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py rename {PhysicsTools/PatAlgos/python/slimming => CommonTools/RecoAlgos/python}/primaryVertexAssociation_cfi.py (100%) create mode 100644 CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index e3681db53e9c4..b8b599fbbd9f1 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -20,6 +20,14 @@ PFPileUp::PFPileUp(const edm::ParameterSet& iConfig) { tokenVertices_ = consumes(iConfig.getParameter("Vertices")); + fUseVertexAssociation = iConfig.getParameter("useVertexAssociation"); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + if (fUseVertexAssociation) { + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + } + enable_ = iConfig.getParameter("Enable"); verbose_ = iConfig.getUntrackedParameter("verbose", false); @@ -93,10 +101,26 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { "error."); } - pileUpAlgo_.process(*pfCandidatesRef, *vertices); - pOutput->insert( - pOutput->end(), pileUpAlgo_.getPFCandidatesFromPU().begin(), pileUpAlgo_.getPFCandidatesFromPU().end()); - + if (fUseVertexAssociation) { + edm::Handle> assoHandle; + iEvent.getByToken(tokenVertexAssociation_, assoHandle); + const edm::Association* associatedPV = assoHandle.product(); + edm::Handle> assoQualityHandle; + iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); + const edm::ValueMap* associationQuality = assoQualityHandle.product(); + PFCollection pfCandidatesFromPU; + for (unsigned i = 0; i < (*pfCandidatesRef).size(); i++) { + const reco::VertexRef& PVOrig = (*associatedPV)[(*pfCandidatesRef)[i]]; + int quality = (*associationQuality)[(*pfCandidatesRef)[i]]; + if (PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_)) + pfCandidatesFromPU.push_back((*pfCandidatesRef)[i]); + } + pOutput->insert(pOutput->end(), pfCandidatesFromPU.begin(), pfCandidatesFromPU.end()); + } else { + pileUpAlgo_.process(*pfCandidatesRef, *vertices); + pOutput->insert( + pOutput->end(), pileUpAlgo_.getPFCandidatesFromPU().begin(), pileUpAlgo_.getPFCandidatesFromPU().end()); + } // for ( PFCollection::const_iterator byValueBegin = pileUpAlgo_.getPFCandidatesFromPU().begin(), // byValueEnd = pileUpAlgo_.getPFCandidatesFromPU().end(), ibyValue = byValueBegin; // ibyValue != byValueEnd; ++ibyValue ) { diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.h b/CommonTools/ParticleFlow/plugins/PFPileUp.h index 6016386986150..07e114c1d8f9e 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.h +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.h @@ -15,6 +15,7 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" #include "CommonTools/ParticleFlow/interface/PFPileUpAlgo.h" @@ -30,9 +31,10 @@ produces the corresponding collection of PileUpCandidates. class PFPileUp : public edm::stream::EDProducer<> { public: - typedef std::vector > PFCollection; + typedef std::vector> PFCollection; typedef edm::View PFView; typedef std::vector PFCollectionByValue; + typedef edm::Association CandToVertex; explicit PFPileUp(const edm::ParameterSet&); @@ -59,6 +61,11 @@ class PFPileUp : public edm::stream::EDProducer<> { /// use the closest z vertex if a track is not in a vertex bool checkClosestZVertex_; + + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + bool fUseVertexAssociation; + int vertexAssociationQuality_; }; #endif diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc new file mode 100644 index 0000000000000..0bd240110be12 --- /dev/null +++ b/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc @@ -0,0 +1,45 @@ +#include "CommonTools/ParticleFlow/plugins/PFnoPileUp.h" + +#include "DataFormats/VertexReco/interface/Vertex.h" + +#include "FWCore/Framework/interface/ESHandle.h" + +// #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/EventSetup.h" + +using namespace std; +using namespace edm; +using namespace reco; + +PFnoPileUp::PFnoPileUp(const edm::ParameterSet& iConfig) { + tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + produces>(); +} + +PFnoPileUp::~PFnoPileUp() {} + +void PFnoPileUp::produce(Event& iEvent, const EventSetup& iSetup) { + unique_ptr> pOutput(new edm::PtrVector); + Handle candidateView; + iEvent.getByToken(tokenCandidatesView_, candidateView); + edm::Handle> assoHandle; + iEvent.getByToken(tokenVertexAssociation_, assoHandle); + const edm::Association* associatedPV = assoHandle.product(); + edm::Handle> assoQualityHandle; + iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); + const edm::ValueMap* associationQuality = assoQualityHandle.product(); + for (unsigned i = 0; i < candidateView->size(); i++) { + const reco::VertexRef& PVOrig = (*associatedPV)[candidateView->ptrAt(i)]; + int quality = (*associationQuality)[candidateView->ptrAt(i)]; + if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) + pOutput->push_back(candidateView->ptrAt(i)); + } + iEvent.put(std::move(pOutput)); +} + +DEFINE_FWK_MODULE(PFnoPileUp); \ No newline at end of file diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUp.h b/CommonTools/ParticleFlow/plugins/PFnoPileUp.h new file mode 100644 index 0000000000000..412dd326252c7 --- /dev/null +++ b/CommonTools/ParticleFlow/plugins/PFnoPileUp.h @@ -0,0 +1,48 @@ +#ifndef CommonTools_ParticleFlow_PFnoPileUp_ +#define CommonTools_ParticleFlow_PFnoPileUp_ + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +/**\class PFnoPileUp +\brief Identifies pile-up candidates from a collection of Candidates, and +produces the corresponding collection of NoPileUpCandidates. + +\author Andreas Hinzmann +\date May 2021 + +*/ + +class PFnoPileUp : public edm::stream::EDProducer<> { +public: + typedef edm::View CandidateView; + typedef edm::Association CandToVertex; + + explicit PFnoPileUp(const edm::ParameterSet&); + + ~PFnoPileUp() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + edm::EDGetTokenT tokenCandidatesView_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + int vertexAssociationQuality_; +}; + +#endif diff --git a/CommonTools/ParticleFlow/python/pfCHS_cff.py b/CommonTools/ParticleFlow/python/pfCHS_cff.py new file mode 100644 index 0000000000000..c1912df9720de --- /dev/null +++ b/CommonTools/ParticleFlow/python/pfCHS_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms +from CommonTools.ParticleFlow.pfNoPileUpJME_cff import adapt, pfPileUpJME +from PhysicsTools.PatAlgos.sortedPackedPrimaryVertices_cfi import sortedPackedPrimaryVertices + +packedPrimaryVertexAssociationJME = sortedPackedPrimaryVertices.clone( + produceSortedVertices = False, + producePileUpCollection = False, + produceNoPileUpCollection = False +) +adapt(packedPrimaryVertexAssociationJME) + +pfCHS = cms.EDProducer("PFnoPileUp", + candidates = cms.InputTag("packedPFCandidates"), + vertexAssociationQuality = pfPileUpJME.vertexAssociationQuality, + vertexAssociation = cms.InputTag("packedPrimaryVertexAssociationJME","original") + ) diff --git a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py index 0907848fe1db6..445e08283b952 100644 --- a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py +++ b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py @@ -2,16 +2,38 @@ from CommonTools.ParticleFlow.pfPileUp_cfi import pfPileUp as _pfPileUp from CommonTools.ParticleFlow.TopProjectors.pfNoPileUp_cfi import pfNoPileUp as _pfNoPileUp -from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import * +from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import goodOfflinePrimaryVertices +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation + +def adapt(primaryVertexAssociationJME): + # options for quality PrimaryDz = 6 (used in PUPPI) + primaryVertexAssociationJME.assignment.maxDzSigForPrimaryAssignment = 1e10 + primaryVertexAssociationJME.assignment.maxDzForPrimaryAssignment = 0.3 + primaryVertexAssociationJME.assignment.maxDzErrorForPrimaryAssignment = 1e10 + primaryVertexAssociationJME.assignment.NumOfPUVtxsForCharged = 2 + primaryVertexAssociationJME.assignment.PtMaxCharged = 20. + primaryVertexAssociationJME.assignment.EtaMinUseDz = 2.4 + primaryVertexAssociationJME.assignment.OnlyUseFirstDz = True + from Configuration.Eras.Modifier_phase2_common_cff import phase2_common + phase2_common.toModify( + primaryVertexAssociationJME.assignment, + maxDzForPrimaryAssignment=0.1, + EtaMinUseDz = 4.0 + ) +primaryVertexAssociationJME = primaryVertexAssociation.clone(vertices = 'goodOfflinePrimaryVertices') +adapt(primaryVertexAssociationJME) pfPileUpJME = _pfPileUp.clone(PFCandidates='particleFlowPtrs', - Vertices = 'goodOfflinePrimaryVertices', - checkClosestZVertex = False ) + useVertexAssociation = True, + vertexAssociationQuality = 7, + vertexAssociation = cms.InputTag('primaryVertexAssociationJME','original'), + ) pfNoPileUpJME = _pfNoPileUp.clone(topCollection = 'pfPileUpJME', bottomCollection = 'particleFlowPtrs' ) pfNoPileUpJMETask = cms.Task( goodOfflinePrimaryVertices, + primaryVertexAssociationJME, pfPileUpJME, pfNoPileUpJME ) diff --git a/CommonTools/ParticleFlow/python/pfPileUp_cfi.py b/CommonTools/ParticleFlow/python/pfPileUp_cfi.py index 4696123d18f91..025d6479ad2eb 100644 --- a/CommonTools/ParticleFlow/python/pfPileUp_cfi.py +++ b/CommonTools/ParticleFlow/python/pfPileUp_cfi.py @@ -8,5 +8,8 @@ # pile-up identification now enabled by default. To be studied for jets Enable = cms.bool(True), verbose = cms.untracked.bool(False), - checkClosestZVertex = cms.bool(True) + checkClosestZVertex = cms.bool(True), + useVertexAssociation = cms.bool(False), + vertexAssociationQuality = cms.int32(0), + vertexAssociation = cms.InputTag(''), ) diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index cfbeb0cc02ff9..4543064dbb12a 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -41,6 +41,13 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { tokenPFCandidates_ = consumes(iConfig.getParameter("candName")); tokenVertices_ = consumes(iConfig.getParameter("vertexName")); + fUseVertexAssociation = iConfig.getParameter("useVertexAssociation"); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + if (fUseVertexAssociation) { + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + } fUsePUProxyValue = iConfig.getParameter("usePUProxyValue"); @@ -80,6 +87,17 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { iEvent.getByToken(tokenVertices_, hVertexProduct); const reco::VertexCollection* pvCol = hVertexProduct.product(); + edm::Handle> assoHandle; + const edm::Association* associatedPV = nullptr; + edm::Handle> assoQualityHandle; + const edm::ValueMap* associationQuality = nullptr; + if ((fUseVertexAssociation) && (!fUseExistingWeights)) { + iEvent.getByToken(tokenVertexAssociation_, assoHandle); + associatedPV = assoHandle.product(); + iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); + associationQuality = assoQualityHandle.product(); + } + double puProxyValue = 0.; if (fUsePUProxyValue) { puProxyValue = iEvent.get(puProxyValueToken_); @@ -95,6 +113,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Fill the reco objects fRecoObjCollection.clear(); fRecoObjCollection.reserve(pfCol->size()); + size_t ic = 0; for (auto const& aPF : *pfCol) { RecoObj pReco; pReco.pt = aPF.pt(); @@ -110,7 +129,25 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { uint pVtxId = 0; bool isLepton = ((std::abs(pReco.pdgId) == 11) || (std::abs(pReco.pdgId) == 13)); const pat::PackedCandidate* lPack = dynamic_cast(&aPF); - if (lPack == nullptr) { + + if (fUseVertexAssociation) { + const reco::VertexRef& PVOrig = (*associatedPV)[reco::CandidatePtr(hPFProduct, ic)]; + int quality = (*associationQuality)[reco::CandidatePtr(hPFProduct, ic)]; + if (PVOrig.isNonnull() && (quality >= vertexAssociationQuality_)) { + closestVtx = PVOrig.get(); + pVtxId = PVOrig.key(); + } + if (std::abs(pReco.charge) == 0) + pReco.id = 0; + else if (fPuppiNoLep && isLepton) + pReco.id = 3; + else if (closestVtx != nullptr && pVtxId == 0) + pReco.id = 1; // Associated to main vertex + else if (closestVtx != nullptr && pVtxId > 0) + pReco.id = 2; // Associated to PU + else + pReco.id = 0; // Unassociated + } else if (lPack == nullptr) { const reco::PFCandidate* pPF = dynamic_cast(&aPF); double curdz = 9999; int closestVtxForUnassociateds = -9999; @@ -230,6 +267,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { } fRecoObjCollection.push_back(pReco); + ic++; } fPuppiContainer->initialize(fRecoObjCollection); @@ -401,6 +439,9 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description desc.add("vtxZCut", 24); desc.add("candName", edm::InputTag("particleFlow")); desc.add("vertexName", edm::InputTag("offlinePrimaryVertices")); + desc.add("useVertexAssociation", false); + desc.add("vertexAssociationQuality", 0); + desc.add("vertexAssociation", edm::InputTag("")); desc.add("applyCHS", true); desc.add("invertPuppi", false); desc.add("useExp", false); diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.h b/CommonTools/PileupAlgos/plugins/PuppiProducer.h index befcf4c6a7f0a..bef5c7d797646 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.h +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.h @@ -34,6 +34,7 @@ class PuppiProducer : public edm::stream::EDProducer<> { typedef std::vector PFOutputCollection; typedef std::vector PackedOutputCollection; typedef edm::View PFView; + typedef edm::Association CandToVertex; private: virtual void beginJob(); @@ -42,6 +43,8 @@ class PuppiProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT tokenPFCandidates_; edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; edm::EDGetTokenT tokenPuppiContainer_; edm::EDGetTokenT tokenPuppiCandidates_; edm::EDGetTokenT tokenPackedPuppiCandidates_; @@ -59,6 +62,8 @@ class PuppiProducer : public edm::stream::EDProducer<> { std::string fPuppiName; std::string fPFName; std::string fPVName; + bool fUseVertexAssociation; + int vertexAssociationQuality_; bool fPuppiDiagnostics; bool fPuppiNoLep; bool fUseFromPVLooseTight; diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index 107aea9a49cab..b3dfc16923d9c 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -31,6 +31,9 @@ NumOfPUVtxsForCharged = 2, PtMaxCharged = 20., PtMaxNeutralsStartSlope = 20., + useVertexAssociation = True, + vertexAssociationQuality = cms.int32(6), + vertexAssociation = cms.InputTag('primaryVertexAssociationJME','original'), #candName = cms.string('packedPFCandidates'), #vertexName = cms.string('offlineSlimmedPrimaryVertices'), clonePackedCands = False, # should only be set to True for MiniAOD diff --git a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py new file mode 100644 index 0000000000000..5a799908344e1 --- /dev/null +++ b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py @@ -0,0 +1,115 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: step5 --conditions auto:run2_mc --nThreads 2 -n 10 --era Run2_2016 --eventcontent MINIAODSIM --filein file:step3_inMINIAODSIM.root -s NANO --datatier NANOAODSIM --mc --fileout file:step5.root +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 + +process = cms.Process('NANO',Run2_2016) + +# 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.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('PhysicsTools.NanoAOD.nano_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +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:/afs/cern.ch/user/h/hinzmann/stable_13TeV/jetmet/mtd/CMSSW_11_1_8/src/25202.0_TTbar_13+TTbar_13+DIGIUP15_PU25+RECOUP15_PU25+HARVESTUP15_PU25+NANOUP15_PU25/step3_inMINIAODSIM.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( + + ), + 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('step5 nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.MINIAODSIMoutput = cms.OutputModule("PoolOutputModule", + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(9), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('MINIAODSIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:updatedMINIAODSIM.root'), + outputCommands = process.MINIAODSIMEventContent.outputCommands +) + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + +from CommonTools.PileupAlgos.customizePuppiTune_cff import UpdatePuppiTune_MC +UpdatePuppiTune_MC(process) + +# Path and EndPath definitions +process.puppi_step = cms.Path(process.puppiSequence) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.MINIAODSIMoutput_step = cms.EndPath(process.MINIAODSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.puppi_step,process.endjob_step,process.MINIAODSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +#Setup FWK for multithreaded +process.options.numberOfThreads=cms.untracked.uint32(2) +process.options.numberOfStreams=cms.untracked.uint32(0) +process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) + +# customisation of the process. + +# End of customisation functions + +# Customisation from command line + +# 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/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h index da7626850313e..ac62013cc66c0 100644 --- a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h +++ b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h @@ -12,6 +12,7 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" @@ -41,7 +42,12 @@ class PrimaryVertexAssignment { maxDxySigForNotReconstructedPrimary_(iConfig.getParameter("maxDxySigForNotReconstructedPrimary")), maxDxyForNotReconstructedPrimary_(iConfig.getParameter("maxDxyForNotReconstructedPrimary")), useTiming_(iConfig.getParameter("useTiming")), - preferHighRanked_(iConfig.getParameter("preferHighRanked")) {} + preferHighRanked_(iConfig.getParameter("preferHighRanked")), + fNumOfPUVtxsForCharged_(iConfig.getParameter("NumOfPUVtxsForCharged")), + fDzCutForChargedFromPUVtxs_(iConfig.getParameter("DzCutForChargedFromPUVtxs")), + fPtMaxCharged_(iConfig.getParameter("PtMaxCharged")), + fEtaMinUseDz_(iConfig.getParameter("EtaMinUseDz")), + fOnlyUseFirstDz_(iConfig.getParameter("OnlyUseFirstDz")) {} ~PrimaryVertexAssignment() {} @@ -54,6 +60,15 @@ class PrimaryVertexAssignment { const edm::View& jets, const TransientTrackBuilder& builder) const; + std::pair chargedHadronVertex( + const reco::VertexCollection& vertices, + int iVertex, + const reco::Track* track, + float trackTime, + float trackTimeResolution, // <0 if timing not available for this object + const edm::View& jets, + const TransientTrackBuilder& builder) const; + std::pair chargedHadronVertex( const reco::VertexCollection& vertices, const reco::TrackRef& trackRef, @@ -82,6 +97,29 @@ class PrimaryVertexAssignment { return chargedHadronVertex( vertices, reco::TrackRef(), &(*pfcand.gsfTrackRef()), time, timeResolution, jets, builder); } + + std::pair chargedHadronVertex(const reco::VertexCollection& vertices, + const pat::PackedCandidate& pfcand, + const edm::View& jets, + const TransientTrackBuilder& builder) const { + float time = 0, timeResolution = -1; + if (useTiming_ && pfcand.timeError() > 0) { + time = pfcand.time(); + timeResolution = pfcand.timeError(); + } + if (!pfcand.hasTrackDetails()) + return std::pair(-1, PrimaryVertexAssignment::Unassigned); + else + return chargedHadronVertex( + vertices, + (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose) ? pfcand.vertexRef().key() : -1, + &pfcand.pseudoTrack(), + time, + timeResolution, + jets, + builder); + } + std::pair chargedHadronVertex(const reco::VertexCollection& vertices, const reco::RecoChargedRefCandidate& chcand, const edm::ValueMap* trackTimeTag, @@ -112,6 +150,11 @@ class PrimaryVertexAssignment { double maxDxyForNotReconstructedPrimary_; bool useTiming_; bool preferHighRanked_; + int fNumOfPUVtxsForCharged_; + double fDzCutForChargedFromPUVtxs_; + double fPtMaxCharged_; + double fEtaMinUseDz_; + bool fOnlyUseFirstDz_; }; #endif diff --git a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc index c9dad79418207..b019100fa3e3b 100644 --- a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc +++ b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc @@ -6,3 +6,5 @@ typedef PrimaryVertexSorter > RecoCha DEFINE_FWK_MODULE(RecoChargedRefCandidatePrimaryVertexSorter); typedef PrimaryVertexSorter > PFCandidatePrimaryVertexSorter; DEFINE_FWK_MODULE(PFCandidatePrimaryVertexSorter); +typedef PrimaryVertexSorter > PackedCandidatePrimaryVertexSorter; +DEFINE_FWK_MODULE(PackedCandidatePrimaryVertexSorter); diff --git a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h index 300ce6cb2c14b..fa78ebf5de8d6 100644 --- a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h +++ b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h @@ -20,6 +20,7 @@ #include "CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h" #include "CommonTools/RecoAlgos/interface/PrimaryVertexSorting.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" /**\class PrimaryVertexSorter * \author Andrea Rizzi @@ -311,6 +312,9 @@ template <> inline void PrimaryVertexSorter>::doConsumesForTiming(const edm::ParameterSet& iConfig) { } +template <> +inline void PrimaryVertexSorter>::doConsumesForTiming(const edm::ParameterSet& iConfig) {} + template <> inline bool PrimaryVertexSorter>::needsProductsForTiming() { return true; @@ -321,6 +325,11 @@ inline bool PrimaryVertexSorter>::needsProductsFo return false; } +template <> +inline bool PrimaryVertexSorter>::needsProductsForTiming() { + return false; +} + template <> inline std::pair PrimaryVertexSorter>::runAlgo(const reco::VertexCollection& vertices, @@ -343,4 +352,15 @@ inline std::pair PrimaryVertexSorter +std::pair PrimaryVertexSorter>::runAlgo( + const reco::VertexCollection& vertices, + const pat::PackedCandidate& pf, + const edm::ValueMap* trackTimeTag, + const edm::ValueMap* trackTimeResoTag, + const edm::View& jets, + const TransientTrackBuilder& builder) { + return assignmentAlgo_.chargedHadronVertex(vertices, pf, jets, builder); +} + #endif diff --git a/PhysicsTools/PatAlgos/python/slimming/primaryVertexAssociation_cfi.py b/CommonTools/RecoAlgos/python/primaryVertexAssociation_cfi.py similarity index 100% rename from PhysicsTools/PatAlgos/python/slimming/primaryVertexAssociation_cfi.py rename to CommonTools/RecoAlgos/python/primaryVertexAssociation_cfi.py diff --git a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py index ef8876b177ebf..2b67ed5dc0ae6 100644 --- a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py @@ -18,7 +18,14 @@ maxDxySigForNotReconstructedPrimary = cms.double(2), #in AND with next maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), - preferHighRanked = cms.bool(False) + preferHighRanked = cms.bool(False), + + #options used in PUPPI + NumOfPUVtxsForCharged = cms.int32(-1), + DzCutForChargedFromPUVtxs = cms.double(0.2), + PtMaxCharged = cms.double(-1), + EtaMinUseDz = cms.double(-1), + OnlyUseFirstDz = cms.bool(False), ), particles = cms.InputTag("particleFlow"), vertices= cms.InputTag("offlinePrimaryVertices"), @@ -31,4 +38,3 @@ produceNoPileUpCollection = cms.bool(True), ) - diff --git a/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py new file mode 100644 index 0000000000000..7b4bf97166295 --- /dev/null +++ b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms +from CommonTools.RecoAlgos.sortedPFPrimaryVertices_cfi import sortedPFPrimaryVertices +sortedPackedPrimaryVertices = cms.EDProducer("PackedCandidatePrimaryVertexSorter", + sorting = cms.PSet(), + assignment = sortedPFPrimaryVertices.assignment, + particles = cms.InputTag("packedPFCandidates"), + vertices= cms.InputTag("offlineSlimmedPrimaryVertices"), + jets= cms.InputTag("slimmedJets"), + qualityForPrimary = cms.int32(3), + usePVMET = cms.bool(True), + produceAssociationToOriginalVertices = cms.bool(True), + produceSortedVertices = cms.bool(True), + producePileUpCollection = cms.bool(True), + produceNoPileUpCollection = cms.bool(True), +) diff --git a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py index e2d877bf93292..901c85e9d1760 100644 --- a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py @@ -19,6 +19,13 @@ maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), preferHighRanked = cms.bool(False), + + #options used in PUPPI + NumOfPUVtxsForCharged = cms.int32(-1), + DzCutForChargedFromPUVtxs = cms.double(0.2), + PtMaxCharged = cms.double(-1), + EtaMinUseDz = cms.double(-1), + OnlyUseFirstDz = cms.bool(False), ), particles = cms.InputTag("trackRefsForJets"), trackTimeTag = cms.InputTag(""), diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 83ca81b2679fe..6ef1d658a8973 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -28,6 +28,19 @@ std::pair PrimaryVertexAssignment::charge } index++; } + return chargedHadronVertex(vertices, iVertex, track, time, timeReso, jets, builder); +} + +std::pair PrimaryVertexAssignment::chargedHadronVertex( + const reco::VertexCollection& vertices, + int iVertex, + const reco::Track* track, + float time, + float timeReso, // <0 if timing not available for this object + const edm::View& jets, + const TransientTrackBuilder& builder) const { + typedef reco::VertexCollection::const_iterator IV; + typedef reco::Vertex::trackRef_iterator IT; bool useTime = useTiming_; if (edm::isNotFinite(time) || timeReso < 1e-6) { @@ -54,6 +67,11 @@ std::pair PrimaryVertexAssignment::charge } } + // recover cases where the primary vertex is split + if ((iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && + (std::abs(track->dz(vertices.at(0).position())) < fDzCutForChargedFromPUVtxs_)) + return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); + if (iVertex >= 0) return std::pair(iVertex, PrimaryVertexAssignment::UsedInFit); @@ -89,13 +107,26 @@ std::pair PrimaryVertexAssignment::charge // first use "closest in Z" with tight cuts (targetting primary particles) const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2, 2) : 0.f; const float dzE = sqrt(track->dzError() * track->dzError() + add_cov); - if (vtxIdMinSignif >= 0 and + if (!fOnlyUseFirstDz_ and vtxIdMinSignif >= 0 and (dzmin < maxDzForPrimaryAssignment_ and dzmin / dzE < maxDzSigForPrimaryAssignment_ and track->dzError() < maxDzErrorForPrimaryAssignment_) and (!useTime or dtmin / timeReso < maxDtSigForPrimaryAssignment_)) { iVertex = vtxIdMinSignif; } + // consider only distances to first vertex for association of pileup vertices (originally used in PUPPI) + if ((fOnlyUseFirstDz_) && (vtxIdMinSignif >= 0) && (std::abs(track->eta()) > fEtaMinUseDz_)) + iVertex = ((std::abs(track->dz(vertices.at(0).position())) < maxDzForPrimaryAssignment_ and + std::abs(track->dz(vertices.at(0).position())) / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) + ? 0 + : vtxIdMinSignif; + + // protect high pT particles from association to pileup vertices and assign them to the first vertex + if ((fPtMaxCharged_ > 0) && (vtxIdMinSignif >= 0) && (track->pt() > fPtMaxCharged_)) + iVertex = 0; + if (iVertex >= 0) return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 7130afe2c1ad6..f4ee51a85d229 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -198,14 +198,12 @@ def _add_slimmedMETsNoHF(process): # ================== NoHF pfMET # ================== CHSMET - process.CHSCands = cms.EDFilter("CandPtrSelector", - src=cms.InputTag("packedPFCandidates"), - cut=cms.string("fromPV(0) > 0") - ) - task.add(process.CHSCands) + process.load("CommonTools.ParticleFlow.pfCHS_cff") + task.add(process.packedPrimaryVertexAssociationJME) + task.add(process.pfCHS) from RecoMET.METProducers.pfMet_cfi import pfMet - process.pfMetCHS = pfMet.clone(src = 'CHSCands') + process.pfMetCHS = pfMet.clone(src = 'pfCHS') task.add(process.pfMetCHS) addMETCollection(process, diff --git a/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py b/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py index 3d45ca91911fa..27a1bea045697 100644 --- a/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py @@ -12,19 +12,23 @@ def makePuppies( process ): def makePuppiesFromMiniAOD( process, createScheduledSequence=False ): task = getPatAlgosToolsTask(process) + process.load('CommonTools.ParticleFlow.pfCHS_cff') + task.add(process.packedPrimaryVertexAssociationJME) process.load('CommonTools.PileupAlgos.Puppi_cff') task.add(process.puppi) process.puppi.candName = 'packedPFCandidates' process.puppi.clonePackedCands = True process.puppi.vertexName = 'offlineSlimmedPrimaryVertices' process.puppi.useExistingWeights = True + process.puppi.vertexAssociation = 'packedPrimaryVertexAssociationJME:original' task.add(process.puppiNoLep) process.puppiNoLep.candName = 'packedPFCandidates' process.puppiNoLep.clonePackedCands = True process.puppiNoLep.vertexName = 'offlineSlimmedPrimaryVertices' process.puppiNoLep.useExistingWeights = True + process.puppiNoLep.vertexAssociation = 'packedPrimaryVertexAssociationJME:original' #making a sequence for people running the MET tool in scheduled mode if createScheduledSequence: - puppiMETSequence = cms.Sequence(process.puppi*process.puppiNoLep) + puppiMETSequence = cms.Sequence(process.packedPrimaryVertexAssociationJME*process.puppi*process.puppiNoLep) setattr(process, "puppiMETSequence", puppiMETSequence) diff --git a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py index b8963bd0e0f96..306efa71e690e 100644 --- a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py @@ -6,7 +6,7 @@ from PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVertices_cfi import * from PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVertices4D_cfi import * from PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVerticesWithBS_cfi import * -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import * +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import * from PhysicsTools.PatAlgos.slimming.genParticles_cff import * from PhysicsTools.PatAlgos.slimming.genParticleAssociation_cff import * from PhysicsTools.PatAlgos.slimming.selectedPatTrigger_cfi import * diff --git a/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py b/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py index e327f3d46fb0d..f39e4b0a90c16 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py @@ -282,11 +282,9 @@ def addRecoJetCollection(self, # CHS # elif recoJetInfo.jetPUMethod == "chs": - self.addProcessAndTask(proc, pfCand, cms.EDFilter("CandPtrSelector", - src = cms.InputTag(self.pfLabel), - cut = cms.string("fromPV"), - ) - ) + from CommonTools.ParticleFlow.pfCHS_cff import pfCHS, packedPrimaryVertexAssociationJME + self.addProcessAndTask(proc, pfCand, pfCHS.clone()) + self.prerequisites.append(process.packedPrimaryVertexAssociationJME) self.prerequisites.append(pfCand) # # PUPPI diff --git a/PhysicsTools/PatAlgos/test/miniAOD/example_addJet.py b/PhysicsTools/PatAlgos/test/miniAOD/example_addJet.py index df1a5b96f7877..8e574b1ea1391 100644 --- a/PhysicsTools/PatAlgos/test/miniAOD/example_addJet.py +++ b/PhysicsTools/PatAlgos/test/miniAOD/example_addJet.py @@ -20,10 +20,10 @@ from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets -process.chs = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) +process.load("CommonTools.ParticleFlow.pfCHS_cff") process.ak4PFJets = ak4PFJets.clone(src = 'packedPFCandidates', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it -process.ak4PFJetsCHS = ak4PFJets.clone(src = 'chs', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it +process.ak4PFJetsCHS = ak4PFJets.clone(src = 'pfCHS', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it process.ak4GenJets = ak4GenJets.clone(src = 'packedGenParticles') process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") diff --git a/PhysicsTools/PatAlgos/test/miniAOD/example_ei.py b/PhysicsTools/PatAlgos/test/miniAOD/example_ei.py index 6ca1deea96755..57b0f2d420e98 100644 --- a/PhysicsTools/PatAlgos/test/miniAOD/example_ei.py +++ b/PhysicsTools/PatAlgos/test/miniAOD/example_ei.py @@ -36,7 +36,7 @@ 0.5*pfIsolationVariables().sumPUPt))/pt < 0.15''')) #do projections -process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) +process.load("CommonTools.ParticleFlow.pfCHS_cff") process.pfNoMuonCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfCHS"), veto = cms.InputTag("selectedMuons")) process.pfNoElectronsCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuonCHS"), veto = cms.InputTag("selectedElectrons")) diff --git a/PhysicsTools/PatAlgos/test/miniAOD/example_jet_and_met.py b/PhysicsTools/PatAlgos/test/miniAOD/example_jet_and_met.py index a91458a60a1fb..7aa247e8cf60b 100644 --- a/PhysicsTools/PatAlgos/test/miniAOD/example_jet_and_met.py +++ b/PhysicsTools/PatAlgos/test/miniAOD/example_jet_and_met.py @@ -19,10 +19,12 @@ from RecoJets.JetProducers.ak5GenJets_cfi import ak5GenJets from RecoMET.METProducers.pfMet_cfi import pfMet -process.chs = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) +process.load("CommonTools.ParticleFlow.pfCHS_cff") +task.add(process.packedPrimaryVertexAssociationJME) +task.add(process.pfCHS) process.ak5PFJets = ak5PFJets.clone(src = 'packedPFCandidates', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it -process.ak5PFJetsCHS = ak5PFJets.clone(src = 'chs', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it +process.ak5PFJetsCHS = ak5PFJets.clone(src = 'pfCHS', doAreaFastjet = True) # no idea while doArea is false by default, but it's True in RECO so we have to set it process.ak5GenJets = ak5GenJets.clone(src = 'packedGenParticles') process.pfMet = pfMet.clone(src = "packedPFCandidates") process.pfMet.calculateSignificance = False # this can't be easily implemented on packed PF candidates at the moment diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index 804dbff34d274..a0505f5ad0886 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -914,20 +914,8 @@ def getMETUncertainties(self, process, metType, metModName, electronCollection, #--------------------------------------------------------------------- # PFPhotons : #------------ - if self._parameters["Puppi"].value or not self._parameters["onMiniAOD"].value: - cutforpfNoPileUp = cms.string("") - else: - cutforpfNoPileUp = cms.string("fromPV > 1") - - pfNoPileUp = cms.EDFilter("CandPtrSelector", - src = pfCandCollection, - cut = cutforpfNoPileUp - ) - addToProcessAndTask("pfNoPileUp"+postfix, pfNoPileUp, process, task) - metUncSequence += getattr(process, "pfNoPileUp"+postfix) - pfPhotons = cms.EDFilter("CandPtrSelector", - src = cms.InputTag("pfNoPileUp"+postfix), + src = pfCandCollection, cut = cms.string("abs(pdgId) = 22") ) addToProcessAndTask("pfPhotons"+postfix, pfPhotons, process, task) @@ -1605,13 +1593,8 @@ def ak4JetReclustering(self,process, pfCandCollection, patMetModuleSequence, pos if chs: CHSname="chs" jetColName="ak4PFJetsCHS" - - pfCHS=None - if self._parameters["onMiniAOD"].value: - pfCHS = cms.EDFilter("CandPtrSelector", src = pfCandCollection, cut = cms.string("fromPV")) - pfCandColl = cms.InputTag("pfNoPileUpJME"+postfix) - addToProcessAndTask("pfNoPileUpJME"+postfix, pfCHS, process, task) - patMetModuleSequence += getattr(process, "pfNoPileUpJME"+postfix) + if self._parameters["onMiniAOD"].value: + pfCandColl = cms.InputTag("pfCHS") else: addToProcessAndTask("tmpPFCandCollPtr"+postfix, cms.EDProducer("PFCandidateFwdPtrProducer", @@ -1620,8 +1603,10 @@ def ak4JetReclustering(self,process, pfCandCollection, patMetModuleSequence, pos process.load("CommonTools.ParticleFlow.pfNoPileUpJME_cff") task.add(process.pfNoPileUpJMETask) configtools.cloneProcessingSnippet(process, getattr(process,"pfNoPileUpJMESequence"), postfix, addToTask = True ) + getattr(process, "primaryVertexAssociationJME"+postfix).particles = pfCandCollection getattr(process, "pfPileUpJME"+postfix).PFCandidates = "tmpPFCandCollPtr"+postfix getattr(process, "pfNoPileUpJME"+postfix).bottomCollection = "tmpPFCandCollPtr"+postfix + getattr(process, "pfNoPileUpJME"+postfix).vertexAssociation = 'primaryVertexAssociationJME'+postfix+':original' pfCandColl = "pfNoPileUpJME"+postfix patMetModuleSequence += getattr(process, "tmpPFCandCollPtr"+postfix) patMetModuleSequence += getattr(process, "pfNoPileUpJME"+postfix) @@ -1711,10 +1696,12 @@ def miniAODConfigurationPre(self, process, patMetModuleSequence, pfCandCollectio ##adding the necessary chs and track met configuration task = getPatAlgosToolsTask(process) - pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV(0)>0")) - addToProcessAndTask("pfCHS", pfCHS, process, task) + from CommonTools.ParticleFlow.pfCHS_cff import pfCHS, packedPrimaryVertexAssociationJME + addToProcessAndTask("packedPrimaryVertexAssociationJME",packedPrimaryVertexAssociationJME.clone(), process, task) + patMetModuleSequence += getattr(process, "packedPrimaryVertexAssociationJME") + addToProcessAndTask("pfCHS", pfCHS.clone(), process, task) from RecoMET.METProducers.pfMet_cfi import pfMet - pfMetCHS = pfMet.clone(src = 'pfCHS') + pfMetCHS = pfMet.clone(src = "pfCHS") addToProcessAndTask("pfMetCHS", pfMetCHS, process, task) addMETCollection(process, diff --git a/RecoBTag/ONNXRuntime/python/pfDeepBoostedJet_cff.py b/RecoBTag/ONNXRuntime/python/pfDeepBoostedJet_cff.py index 8233fbd8c9288..cd07ad7088339 100644 --- a/RecoBTag/ONNXRuntime/python/pfDeepBoostedJet_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfDeepBoostedJet_cff.py @@ -20,7 +20,7 @@ ) from CommonTools.PileupAlgos.Puppi_cff import puppi -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation # This task is not used, useful only if we run DeepFlavour from RECO # jets (RECO/AOD) diff --git a/RecoBTag/ONNXRuntime/python/pfDeepFlavour_cff.py b/RecoBTag/ONNXRuntime/python/pfDeepFlavour_cff.py index e4c446a178028..6786543ecfa9c 100644 --- a/RecoBTag/ONNXRuntime/python/pfDeepFlavour_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfDeepFlavour_cff.py @@ -9,7 +9,7 @@ from RecoBTag.ONNXRuntime.pfDeepCombinedJetTags_cfi import pfDeepCombinedJetTags from RecoBTag.ONNXRuntime.pfNegativeDeepFlavourJetTags_cfi import pfNegativeDeepFlavourJetTags from CommonTools.PileupAlgos.Puppi_cff import puppi -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation # This task is not used, useful only if we run DeepFlavour from RECO # jets (RECO/AOD) diff --git a/RecoJets/JetProducers/python/hepTopTaggerV2_cff.py b/RecoJets/JetProducers/python/hepTopTaggerV2_cff.py index cbdaeec689b27..7f62bf9ddc676 100644 --- a/RecoJets/JetProducers/python/hepTopTaggerV2_cff.py +++ b/RecoJets/JetProducers/python/hepTopTaggerV2_cff.py @@ -5,7 +5,8 @@ from RecoJets.JetProducers.PFJetParameters_cfi import * # CHS -chsForHTT = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) +from CommonTools.ParticleFlow.pfCHS_cff import pfCHS +chsForHTT = pfCHS.clone() # Schedule HEPTopTagger hepTopTaggerV2 = cms.EDProducer( From c2dbd7ad64d2d9aae162ba6f5f16e5e53b2594dc Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 28 May 2021 17:10:28 +0200 Subject: [PATCH 229/923] fix CHS config --- CommonTools/ParticleFlow/python/pfCHS_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonTools/ParticleFlow/python/pfCHS_cff.py b/CommonTools/ParticleFlow/python/pfCHS_cff.py index c1912df9720de..10cafabe7570b 100644 --- a/CommonTools/ParticleFlow/python/pfCHS_cff.py +++ b/CommonTools/ParticleFlow/python/pfCHS_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from CommonTools.ParticleFlow.pfNoPileUpJME_cff import adapt, pfPileUpJME -from PhysicsTools.PatAlgos.sortedPackedPrimaryVertices_cfi import sortedPackedPrimaryVertices +from CommonTools.RecoAlgos.sortedPackedPrimaryVertices_cfi import sortedPackedPrimaryVertices packedPrimaryVertexAssociationJME = sortedPackedPrimaryVertices.clone( produceSortedVertices = False, From 7b70199c3bcd1bf710855d60e6244fb011496dfc Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 28 May 2021 17:10:40 +0200 Subject: [PATCH 230/923] merge with CMSSW_12 --- PhysicsTools/PatAlgos/python/slimming/lostTracks_cfi.py | 2 +- RecoBTag/ONNXRuntime/python/pfParticleNetAK4_cff.py | 2 +- RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/lostTracks_cfi.py b/PhysicsTools/PatAlgos/python/slimming/lostTracks_cfi.py index 93f75eb1cc3f8..2da39f09701e7 100644 --- a/PhysicsTools/PatAlgos/python/slimming/lostTracks_cfi.py +++ b/PhysicsTools/PatAlgos/python/slimming/lostTracks_cfi.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation from PhysicsTools.PatAlgos.slimming.packedPFCandidates_cfi import packedPFCandidates lostTracks = cms.EDProducer("PATLostTracks", diff --git a/RecoBTag/ONNXRuntime/python/pfParticleNetAK4_cff.py b/RecoBTag/ONNXRuntime/python/pfParticleNetAK4_cff.py index 8392793825a27..03c789b10f5eb 100644 --- a/RecoBTag/ONNXRuntime/python/pfParticleNetAK4_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfParticleNetAK4_cff.py @@ -19,7 +19,7 @@ ) from CommonTools.PileupAlgos.Puppi_cff import puppi -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation # This task is not used, useful only if we run it from RECO jets (RECO/AOD) pfParticleNetAK4Task = cms.Task(puppi, primaryVertexAssociation, pfParticleNetAK4TagInfos, diff --git a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py index d60b42b44c057..cad96af9c5a7c 100644 --- a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py @@ -34,7 +34,7 @@ ) from CommonTools.PileupAlgos.Puppi_cff import puppi -from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation # This task is not used, useful only if we run it from RECO jets (RECO/AOD) pfParticleNetTask = cms.Task(puppi, primaryVertexAssociation, pfParticleNetTagInfos, From c46498e5d7841308ebde9c19611b12cc7da217b4 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 2 Jun 2021 18:51:56 +0200 Subject: [PATCH 231/923] fix reminiaod workflows --- .../PatUtils/python/tools/runMETCorrectionsAndUncertainties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index a0505f5ad0886..efdaa35135190 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -1606,7 +1606,7 @@ def ak4JetReclustering(self,process, pfCandCollection, patMetModuleSequence, pos getattr(process, "primaryVertexAssociationJME"+postfix).particles = pfCandCollection getattr(process, "pfPileUpJME"+postfix).PFCandidates = "tmpPFCandCollPtr"+postfix getattr(process, "pfNoPileUpJME"+postfix).bottomCollection = "tmpPFCandCollPtr"+postfix - getattr(process, "pfNoPileUpJME"+postfix).vertexAssociation = 'primaryVertexAssociationJME'+postfix+':original' + getattr(process, "pfPileUpJME"+postfix).vertexAssociation = 'primaryVertexAssociationJME'+postfix+':original' pfCandColl = "pfNoPileUpJME"+postfix patMetModuleSequence += getattr(process, "tmpPFCandCollPtr"+postfix) patMetModuleSequence += getattr(process, "pfNoPileUpJME"+postfix) From 38a9510652eac31c3fd74eba1c8bab192bb93b3d Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Thu, 3 Jun 2021 00:11:25 +0200 Subject: [PATCH 232/923] fix heavy ion workflow --- CommonTools/PileupAlgos/python/Puppi_cff.py | 8 +++++--- RecoMET/Configuration/python/RecoPFMET_cff.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index b3dfc16923d9c..f1749609bcea3 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -99,10 +99,12 @@ ) ) +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +pp_on_AA.toModify(puppi, algos = []) +from Configuration.ProcessModifiers.run2_miniAOD_pp_on_AA_103X_cff import run2_miniAOD_pp_on_AA_103X +run2_miniAOD_pp_on_AA_103X.toModify(puppi,useVertexAssociation = False) # because the association is only run on cleandParticleFlow + puppiNoLep = puppi.clone( puppiNoLep = True, PtMaxPhotons = 20. ) - -from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA -pp_on_AA.toModify(puppi, algos = []) diff --git a/RecoMET/Configuration/python/RecoPFMET_cff.py b/RecoMET/Configuration/python/RecoPFMET_cff.py index 89b4afad19d63..22d0e7d178747 100644 --- a/RecoMET/Configuration/python/RecoPFMET_cff.py +++ b/RecoMET/Configuration/python/RecoPFMET_cff.py @@ -3,11 +3,12 @@ ##____________________________________________________________________________|| from RecoMET.METProducers.pfMet_cfi import * from RecoMET.METProducers.pfChMet_cfi import * +from CommonTools.ParticleFlow.pfNoPileUpJME_cff import goodOfflinePrimaryVertices, primaryVertexAssociationJME from CommonTools.PileupAlgos.Puppi_cff import puppiNoLep from RecoMET.METProducers.pfMetPuppi_cfi import * ##____________________________________________________________________________|| -recoPFMETTask = cms.Task(pfMet , particleFlowForChargedMET , pfChMet, puppiNoLep, pfMetPuppi) +recoPFMETTask = cms.Task(pfMet , particleFlowForChargedMET , goodOfflinePrimaryVertices, primaryVertexAssociationJME, pfChMet, puppiNoLep, pfMetPuppi) recoPFMET = cms.Sequence(recoPFMETTask) ##____________________________________________________________________________|| From 393614368a0527dd81f92ba944906821b3b38e7a Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Tue, 22 Jun 2021 17:26:04 +0200 Subject: [PATCH 233/923] allow to disable use of vertex fit --- .../test/recomputePuppiOnMiniAOD.py | 33 +++++++++++++++++-- .../interface/PrimaryVertexAssignment.h | 4 ++- .../python/sortedPFPrimaryVertices_cfi.py | 1 + .../python/sortedPrimaryVertices_cfi.py | 1 + .../RecoAlgos/src/PrimaryVertexAssignment.cc | 6 ++-- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py index 5a799908344e1..5628b60de9425 100644 --- a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py +++ b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py @@ -28,7 +28,7 @@ # Input source process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('file:/afs/cern.ch/user/h/hinzmann/stable_13TeV/jetmet/mtd/CMSSW_11_1_8/src/25202.0_TTbar_13+TTbar_13+DIGIUP15_PU25+RECOUP15_PU25+HARVESTUP15_PU25+NANOUP15_PU25/step3_inMINIAODSIM.root'), + fileNames = cms.untracked.vstring('file:/afs/cern.ch/user/h/hinzmann/stable_13TeV/jetmet/mtd/CMSSW_12_0_0_pre3/src/25202.0_TTbar_13+TTbar_13+DIGIUP15_PU25+RECOUP15_PU25+HARVESTUP15_PU25+NANOUP15_PU25/step3_inMINIAODSIM.root'), secondaryFileNames = cms.untracked.vstring() ) @@ -85,8 +85,35 @@ from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') -from CommonTools.PileupAlgos.customizePuppiTune_cff import UpdatePuppiTune_MC -UpdatePuppiTune_MC(process) +# Rerun PUPPI MET and ak4 jets (but not ak8) +from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask +task = getPatAlgosToolsTask(process) +from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD +makePuppiesFromMiniAOD(process,True) +process.puppi.useExistingWeights = False +process.puppiNoLep.useExistingWeights = False +from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD +runMetCorAndUncFromMiniAOD(process,isData=False,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi",recoMetFromPFCs=True) +from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer +addToProcessAndTask('patPuppiJetSpecificProducer', patPuppiJetSpecificProducer.clone(src=cms.InputTag("patJetsPuppi")), process, task) +from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection +updateJetCollection( + process, + labelName = 'PuppiJetSpecific', + jetSource = cms.InputTag('patJetsPuppi'), +) +process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ] +addToProcessAndTask('slimmedJetsPuppi', process.updatedPatJetsPuppiJetSpecific.clone(), process, task) +del process.updatedPatJetsPuppiJetSpecific +process.puppiSequence = cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi+process.patPuppiJetSpecificProducer+process.slimmedJetsPuppi) + +# Example how to not use vertex fit for track-vertex-association, but only dz +#process.packedPrimaryVertexAssociationJME.assignment.useVertexFit = False +#process.packedPrimaryVertexAssociationJME.assignment.maxDzSigForPrimaryAssignment = 5.0 +#process.packedPrimaryVertexAssociationJME.assignment.maxDzForPrimaryAssignment = 0.1 +#process.packedPrimaryVertexAssociationJME.assignment.maxDzErrorForPrimaryAssignment = 0.05 +#process.packedPrimaryVertexAssociationJME.assignment.OnlyUseFirstDz = False +#process.pfCHS.vertexAssociationQuality = 6 # Path and EndPath definitions process.puppi_step = cms.Path(process.puppiSequence) diff --git a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h index ac62013cc66c0..d84c7356d2bbc 100644 --- a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h +++ b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h @@ -42,6 +42,7 @@ class PrimaryVertexAssignment { maxDxySigForNotReconstructedPrimary_(iConfig.getParameter("maxDxySigForNotReconstructedPrimary")), maxDxyForNotReconstructedPrimary_(iConfig.getParameter("maxDxyForNotReconstructedPrimary")), useTiming_(iConfig.getParameter("useTiming")), + useVertexFit_(iConfig.getParameter("useVertexFit")), preferHighRanked_(iConfig.getParameter("preferHighRanked")), fNumOfPUVtxsForCharged_(iConfig.getParameter("NumOfPUVtxsForCharged")), fDzCutForChargedFromPUVtxs_(iConfig.getParameter("DzCutForChargedFromPUVtxs")), @@ -112,7 +113,7 @@ class PrimaryVertexAssignment { else return chargedHadronVertex( vertices, - (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose) ? pfcand.vertexRef().key() : -1, + (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose)) ? pfcand.vertexRef().key() : -1, &pfcand.pseudoTrack(), time, timeResolution, @@ -149,6 +150,7 @@ class PrimaryVertexAssignment { double maxDxySigForNotReconstructedPrimary_; double maxDxyForNotReconstructedPrimary_; bool useTiming_; + bool useVertexFit_; bool preferHighRanked_; int fNumOfPUVtxsForCharged_; double fDzCutForChargedFromPUVtxs_; diff --git a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py index 2b67ed5dc0ae6..1e446422fb1e1 100644 --- a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py @@ -18,6 +18,7 @@ maxDxySigForNotReconstructedPrimary = cms.double(2), #in AND with next maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), + useVertexFit = cms.bool(True), preferHighRanked = cms.bool(False), #options used in PUPPI diff --git a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py index 901c85e9d1760..57be0713ca862 100644 --- a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py @@ -18,6 +18,7 @@ maxDxySigForNotReconstructedPrimary = cms.double(2), #in AND with next maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), + useVertexFit = cms.bool(True), preferHighRanked = cms.bool(False), #options used in PUPPI diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 6ef1d658a8973..11d2785c8e159 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -52,7 +52,7 @@ std::pair PrimaryVertexAssignment::charge if (preferHighRanked_) { for (IV iv = vertices.begin(); iv != vertices.end(); ++iv) { int ivtx = iv - vertices.begin(); - if (iVertex == ivtx) + if (useVertexFit_ && (iVertex == ivtx)) return std::pair(ivtx, PrimaryVertexAssignment::UsedInFit); double dz = std::abs(track->dz(iv->position())); @@ -68,11 +68,11 @@ std::pair PrimaryVertexAssignment::charge } // recover cases where the primary vertex is split - if ((iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && + if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && (std::abs(track->dz(vertices.at(0).position())) < fDzCutForChargedFromPUVtxs_)) return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); - if (iVertex >= 0) + if (useVertexFit_ && (iVertex >= 0)) return std::pair(iVertex, PrimaryVertexAssignment::UsedInFit); double distmin = std::numeric_limits::max(); From 556d75de24d83d454f1129043e3286cd3963e184 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 11 Aug 2021 14:10:53 +0200 Subject: [PATCH 234/923] comments from Andrea --- CommonTools/ParticleFlow/plugins/PFPileUp.cc | 88 ++++++++++++++++--- CommonTools/ParticleFlow/plugins/PFPileUp.h | 71 --------------- .../ParticleFlow/plugins/PFnoPileUp.cc | 45 ---------- CommonTools/ParticleFlow/plugins/PFnoPileUp.h | 48 ---------- CommonTools/ParticleFlow/python/pfCHS_cff.py | 2 +- .../ParticleFlow/python/pfNoPileUpJME_cff.py | 2 +- .../PileupAlgos/plugins/PuppiProducer.cc | 18 ++-- CommonTools/PileupAlgos/python/Puppi_cff.py | 10 +-- .../interface/PrimaryVertexAssignment.h | 4 +- .../python/sortedPackedPrimaryVertices_cfi.py | 18 ++-- .../RecoAlgos/src/PrimaryVertexAssignment.cc | 50 ++++++----- 11 files changed, 128 insertions(+), 228 deletions(-) delete mode 100644 CommonTools/ParticleFlow/plugins/PFPileUp.h delete mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUp.cc delete mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUp.h diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index b8b599fbbd9f1..bfc6720dff437 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -1,4 +1,23 @@ -#include "CommonTools/ParticleFlow/plugins/PFPileUp.h" +#ifndef PhysicsTools_PFCandProducer_PFPileUp_ +#define PhysicsTools_PFCandProducer_PFPileUp_ + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +#include "CommonTools/ParticleFlow/interface/PFPileUpAlgo.h" #include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" @@ -6,7 +25,6 @@ #include "FWCore/Framework/interface/ESHandle.h" -// #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -14,6 +32,55 @@ using namespace std; using namespace edm; using namespace reco; +/**\class PFPileUp +\brief Identifies pile-up candidates from a collection of PFCandidates, and +produces the corresponding collection of PileUpCandidates. + +\author Colin Bernet +\date february 2008 +\updated Florian Beaudette 30/03/2012 + +*/ + +class PFPileUp : public edm::stream::EDProducer<> { +public: + typedef std::vector> PFCollection; + typedef edm::View PFView; + typedef std::vector PFCollectionByValue; + typedef edm::Association CandToVertex; + + explicit PFPileUp(const edm::ParameterSet&); + + ~PFPileUp() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + PFPileUpAlgo pileUpAlgo_; + + /// PFCandidates to be analyzed + edm::EDGetTokenT tokenPFCandidates_; + /// fall-back token + edm::EDGetTokenT tokenPFCandidatesView_; + + /// vertices + edm::EDGetTokenT tokenVertices_; + + /// enable PFPileUp selection + bool enable_; + + /// verbose ? + bool verbose_; + + /// use the closest z vertex if a track is not in a vertex + bool checkClosestZVertex_; + + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + bool fUseVertexAssociation; + int vertexAssociationQuality_; +}; + PFPileUp::PFPileUp(const edm::ParameterSet& iConfig) { tokenPFCandidates_ = consumes(iConfig.getParameter("PFCandidates")); tokenPFCandidatesView_ = mayConsume(iConfig.getParameter("PFCandidates")); @@ -102,18 +169,14 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { } if (fUseVertexAssociation) { - edm::Handle> assoHandle; - iEvent.getByToken(tokenVertexAssociation_, assoHandle); - const edm::Association* associatedPV = assoHandle.product(); - edm::Handle> assoQualityHandle; - iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); - const edm::ValueMap* associationQuality = assoQualityHandle.product(); + const edm::Association associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap associationQuality = iEvent.get(tokenVertexAssociationQuality_); PFCollection pfCandidatesFromPU; - for (unsigned i = 0; i < (*pfCandidatesRef).size(); i++) { - const reco::VertexRef& PVOrig = (*associatedPV)[(*pfCandidatesRef)[i]]; - int quality = (*associationQuality)[(*pfCandidatesRef)[i]]; + for (auto& p : (*pfCandidatesRef)) { + const reco::VertexRef& PVOrig = associatedPV[p]; + int quality = associationQuality[p]; if (PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_)) - pfCandidatesFromPU.push_back((*pfCandidatesRef)[i]); + pfCandidatesFromPU.push_back(p); } pOutput->insert(pOutput->end(), pfCandidatesFromPU.begin(), pfCandidatesFromPU.end()); } else { @@ -132,3 +195,4 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { iEvent.put(std::move(pOutput)); // iEvent.put(std::move(pOutputByValue)); } +#endif diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.h b/CommonTools/ParticleFlow/plugins/PFPileUp.h deleted file mode 100644 index 07e114c1d8f9e..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef PhysicsTools_PFCandProducer_PFPileUp_ -#define PhysicsTools_PFCandProducer_PFPileUp_ - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Common/interface/Association.h" - -#include "CommonTools/ParticleFlow/interface/PFPileUpAlgo.h" - -/**\class PFPileUp -\brief Identifies pile-up candidates from a collection of PFCandidates, and -produces the corresponding collection of PileUpCandidates. - -\author Colin Bernet -\date february 2008 -\updated Florian Beaudette 30/03/2012 - -*/ - -class PFPileUp : public edm::stream::EDProducer<> { -public: - typedef std::vector> PFCollection; - typedef edm::View PFView; - typedef std::vector PFCollectionByValue; - typedef edm::Association CandToVertex; - - explicit PFPileUp(const edm::ParameterSet&); - - ~PFPileUp() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - PFPileUpAlgo pileUpAlgo_; - - /// PFCandidates to be analyzed - edm::EDGetTokenT tokenPFCandidates_; - /// fall-back token - edm::EDGetTokenT tokenPFCandidatesView_; - - /// vertices - edm::EDGetTokenT tokenVertices_; - - /// enable PFPileUp selection - bool enable_; - - /// verbose ? - bool verbose_; - - /// use the closest z vertex if a track is not in a vertex - bool checkClosestZVertex_; - - edm::EDGetTokenT tokenVertexAssociation_; - edm::EDGetTokenT> tokenVertexAssociationQuality_; - bool fUseVertexAssociation; - int vertexAssociationQuality_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc deleted file mode 100644 index 0bd240110be12..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFnoPileUp.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include "CommonTools/ParticleFlow/plugins/PFnoPileUp.h" - -#include "DataFormats/VertexReco/interface/Vertex.h" - -#include "FWCore/Framework/interface/ESHandle.h" - -// #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EventSetup.h" - -using namespace std; -using namespace edm; -using namespace reco; - -PFnoPileUp::PFnoPileUp(const edm::ParameterSet& iConfig) { - tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); - vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); - tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); - tokenVertexAssociationQuality_ = - consumes>(iConfig.getParameter("vertexAssociation")); - produces>(); -} - -PFnoPileUp::~PFnoPileUp() {} - -void PFnoPileUp::produce(Event& iEvent, const EventSetup& iSetup) { - unique_ptr> pOutput(new edm::PtrVector); - Handle candidateView; - iEvent.getByToken(tokenCandidatesView_, candidateView); - edm::Handle> assoHandle; - iEvent.getByToken(tokenVertexAssociation_, assoHandle); - const edm::Association* associatedPV = assoHandle.product(); - edm::Handle> assoQualityHandle; - iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); - const edm::ValueMap* associationQuality = assoQualityHandle.product(); - for (unsigned i = 0; i < candidateView->size(); i++) { - const reco::VertexRef& PVOrig = (*associatedPV)[candidateView->ptrAt(i)]; - int quality = (*associationQuality)[candidateView->ptrAt(i)]; - if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) - pOutput->push_back(candidateView->ptrAt(i)); - } - iEvent.put(std::move(pOutput)); -} - -DEFINE_FWK_MODULE(PFnoPileUp); \ No newline at end of file diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUp.h b/CommonTools/ParticleFlow/plugins/PFnoPileUp.h deleted file mode 100644 index 412dd326252c7..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFnoPileUp.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef CommonTools_ParticleFlow_PFnoPileUp_ -#define CommonTools_ParticleFlow_PFnoPileUp_ - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Common/interface/Association.h" - -/**\class PFnoPileUp -\brief Identifies pile-up candidates from a collection of Candidates, and -produces the corresponding collection of NoPileUpCandidates. - -\author Andreas Hinzmann -\date May 2021 - -*/ - -class PFnoPileUp : public edm::stream::EDProducer<> { -public: - typedef edm::View CandidateView; - typedef edm::Association CandToVertex; - - explicit PFnoPileUp(const edm::ParameterSet&); - - ~PFnoPileUp() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - edm::EDGetTokenT tokenCandidatesView_; - edm::EDGetTokenT tokenVertices_; - edm::EDGetTokenT tokenVertexAssociation_; - edm::EDGetTokenT> tokenVertexAssociationQuality_; - int vertexAssociationQuality_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/python/pfCHS_cff.py b/CommonTools/ParticleFlow/python/pfCHS_cff.py index 10cafabe7570b..b455aec07ef9f 100644 --- a/CommonTools/ParticleFlow/python/pfCHS_cff.py +++ b/CommonTools/ParticleFlow/python/pfCHS_cff.py @@ -9,7 +9,7 @@ ) adapt(packedPrimaryVertexAssociationJME) -pfCHS = cms.EDProducer("PFnoPileUp", +pfCHS = cms.EDProducer("PFnoPileUpPacked", candidates = cms.InputTag("packedPFCandidates"), vertexAssociationQuality = pfPileUpJME.vertexAssociationQuality, vertexAssociation = cms.InputTag("packedPrimaryVertexAssociationJME","original") diff --git a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py index 445e08283b952..caad529298bd3 100644 --- a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py +++ b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py @@ -26,7 +26,7 @@ def adapt(primaryVertexAssociationJME): pfPileUpJME = _pfPileUp.clone(PFCandidates='particleFlowPtrs', useVertexAssociation = True, vertexAssociationQuality = 7, - vertexAssociation = cms.InputTag('primaryVertexAssociationJME','original'), + vertexAssociation = ('primaryVertexAssociationJME','original'), ) pfNoPileUpJME = _pfNoPileUp.clone(topCollection = 'pfPileUpJME', bottomCollection = 'particleFlowPtrs' ) diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index 4543064dbb12a..3490a006578ee 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -87,15 +87,11 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { iEvent.getByToken(tokenVertices_, hVertexProduct); const reco::VertexCollection* pvCol = hVertexProduct.product(); - edm::Handle> assoHandle; - const edm::Association* associatedPV = nullptr; - edm::Handle> assoQualityHandle; - const edm::ValueMap* associationQuality = nullptr; + edm::Association associatedPV; + edm::ValueMap associationQuality; if ((fUseVertexAssociation) && (!fUseExistingWeights)) { - iEvent.getByToken(tokenVertexAssociation_, assoHandle); - associatedPV = assoHandle.product(); - iEvent.getByToken(tokenVertexAssociationQuality_, assoQualityHandle); - associationQuality = assoQualityHandle.product(); + associatedPV = iEvent.get(tokenVertexAssociation_); + associationQuality = iEvent.get(tokenVertexAssociationQuality_); } double puProxyValue = 0.; @@ -113,7 +109,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Fill the reco objects fRecoObjCollection.clear(); fRecoObjCollection.reserve(pfCol->size()); - size_t ic = 0; + int ic = 0; for (auto const& aPF : *pfCol) { RecoObj pReco; pReco.pt = aPF.pt(); @@ -131,8 +127,8 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { const pat::PackedCandidate* lPack = dynamic_cast(&aPF); if (fUseVertexAssociation) { - const reco::VertexRef& PVOrig = (*associatedPV)[reco::CandidatePtr(hPFProduct, ic)]; - int quality = (*associationQuality)[reco::CandidatePtr(hPFProduct, ic)]; + const reco::VertexRef& PVOrig = associatedPV[reco::CandidatePtr(hPFProduct, ic)]; + int quality = associationQuality[reco::CandidatePtr(hPFProduct, ic)]; if (PVOrig.isNonnull() && (quality >= vertexAssociationQuality_)) { closestVtx = PVOrig.get(); pVtxId = PVOrig.key(); diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index f1749609bcea3..b2e6b5f015ac1 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -32,10 +32,10 @@ PtMaxCharged = 20., PtMaxNeutralsStartSlope = 20., useVertexAssociation = True, - vertexAssociationQuality = cms.int32(6), - vertexAssociation = cms.InputTag('primaryVertexAssociationJME','original'), - #candName = cms.string('packedPFCandidates'), - #vertexName = cms.string('offlineSlimmedPrimaryVertices'), + vertexAssociationQuality = 6, + vertexAssociation = ('primaryVertexAssociationJME','original'), + #candName = 'packedPFCandidates', + #vertexName = 'offlineSlimmedPrimaryVertices', clonePackedCands = False, # should only be set to True for MiniAOD algos = { 0: dict( @@ -102,7 +102,7 @@ from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA pp_on_AA.toModify(puppi, algos = []) from Configuration.ProcessModifiers.run2_miniAOD_pp_on_AA_103X_cff import run2_miniAOD_pp_on_AA_103X -run2_miniAOD_pp_on_AA_103X.toModify(puppi,useVertexAssociation = False) # because the association is only run on cleandParticleFlow +run2_miniAOD_pp_on_AA_103X.toModify(puppi,useVertexAssociation = False) # because the association is only run on cleanedParticleFlow puppiNoLep = puppi.clone( puppiNoLep = True, diff --git a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h index d84c7356d2bbc..388fd1567a977 100644 --- a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h +++ b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h @@ -113,7 +113,9 @@ class PrimaryVertexAssignment { else return chargedHadronVertex( vertices, - (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose)) ? pfcand.vertexRef().key() : -1, + (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose)) + ? pfcand.vertexRef().key() + : -1, &pfcand.pseudoTrack(), time, timeResolution, diff --git a/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py index 7b4bf97166295..9a9b171db5bf4 100644 --- a/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py @@ -3,13 +3,13 @@ sortedPackedPrimaryVertices = cms.EDProducer("PackedCandidatePrimaryVertexSorter", sorting = cms.PSet(), assignment = sortedPFPrimaryVertices.assignment, - particles = cms.InputTag("packedPFCandidates"), - vertices= cms.InputTag("offlineSlimmedPrimaryVertices"), - jets= cms.InputTag("slimmedJets"), - qualityForPrimary = cms.int32(3), - usePVMET = cms.bool(True), - produceAssociationToOriginalVertices = cms.bool(True), - produceSortedVertices = cms.bool(True), - producePileUpCollection = cms.bool(True), - produceNoPileUpCollection = cms.bool(True), + particles = cms.InputTag("packedPFCandidates"), + vertices= cms.InputTag("offlineSlimmedPrimaryVertices"), + jets= cms.InputTag("slimmedJets"), + qualityForPrimary = cms.int32(3), + usePVMET = cms.bool(True), + produceAssociationToOriginalVertices = cms.bool(True), + produceSortedVertices = cms.bool(True), + producePileUpCollection = cms.bool(True), + produceNoPileUpCollection = cms.bool(True), ) diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 11d2785c8e159..7515cb6f42583 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -104,28 +104,30 @@ std::pair PrimaryVertexAssignment::charge } } - // first use "closest in Z" with tight cuts (targetting primary particles) - const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2, 2) : 0.f; - const float dzE = sqrt(track->dzError() * track->dzError() + add_cov); - if (!fOnlyUseFirstDz_ and vtxIdMinSignif >= 0 and - (dzmin < maxDzForPrimaryAssignment_ and dzmin / dzE < maxDzSigForPrimaryAssignment_ and - track->dzError() < maxDzErrorForPrimaryAssignment_) and - (!useTime or dtmin / timeReso < maxDtSigForPrimaryAssignment_)) { - iVertex = vtxIdMinSignif; - } - - // consider only distances to first vertex for association of pileup vertices (originally used in PUPPI) - if ((fOnlyUseFirstDz_) && (vtxIdMinSignif >= 0) && (std::abs(track->eta()) > fEtaMinUseDz_)) - iVertex = ((std::abs(track->dz(vertices.at(0).position())) < maxDzForPrimaryAssignment_ and - std::abs(track->dz(vertices.at(0).position())) / dzE < maxDzSigForPrimaryAssignment_ and - track->dzError() < maxDzErrorForPrimaryAssignment_) and - (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) - ? 0 - : vtxIdMinSignif; - // protect high pT particles from association to pileup vertices and assign them to the first vertex - if ((fPtMaxCharged_ > 0) && (vtxIdMinSignif >= 0) && (track->pt() > fPtMaxCharged_)) + if ((fPtMaxCharged_ > 0) && (vtxIdMinSignif >= 0) && (track->pt() > fPtMaxCharged_)) { iVertex = 0; + } else { + // first use "closest in Z" with tight cuts (targetting primary particles) + const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2, 2) : 0.f; + const float dzE = sqrt(track->dzError() * track->dzError() + add_cov); + if (!fOnlyUseFirstDz_) { + if (vtxIdMinSignif >= 0 and + (dzmin < maxDzForPrimaryAssignment_ and dzmin / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or dtmin / timeReso < maxDtSigForPrimaryAssignment_)) + iVertex = vtxIdMinSignif; + } else { + // consider only distances to first vertex for association of pileup vertices (originally used in PUPPI) + if ((vtxIdMinSignif >= 0) && (std::abs(track->eta()) > fEtaMinUseDz_)) + iVertex = ((std::abs(track->dz(vertices.at(0).position())) < maxDzForPrimaryAssignment_ and + std::abs(track->dz(vertices.at(0).position())) / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) + ? 0 + : vtxIdMinSignif; + } + } if (iVertex >= 0) return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); @@ -133,14 +135,14 @@ std::pair PrimaryVertexAssignment::charge // if track not assigned yet, it could be a b-decay secondary , use jet axis dist criterion // first find the closest jet within maxJetDeltaR_ int jetIdx = -1; - double minDeltaR = maxJetDeltaR_; + double minDeltaR2 = maxJetDeltaR_ * maxJetDeltaR_; for (edm::View::const_iterator ij = jets.begin(); ij != jets.end(); ++ij) { if (ij->pt() < minJetPt_) continue; // skip jets below the jet Pt threshold - double deltaR = reco::deltaR(*ij, *track); - if (deltaR < minDeltaR and track->dzError() < maxDzErrorForPrimaryAssignment_) { - minDeltaR = deltaR; + double deltaR2 = reco::deltaR2(*ij, *track); + if (deltaR2 < minDeltaR2 and track->dzError() < maxDzErrorForPrimaryAssignment_) { + minDeltaR2 = deltaR2; jetIdx = std::distance(jets.begin(), ij); } } From 6c855891394252c4e4bbb370c23bbef137a9be23 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 11 Aug 2021 17:16:28 +0200 Subject: [PATCH 235/923] add back lost file --- .../ParticleFlow/plugins/PFnoPileUpPacked.cc | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc new file mode 100644 index 0000000000000..45c402185b37c --- /dev/null +++ b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc @@ -0,0 +1,97 @@ +#ifndef CommonTools_ParticleFlow_PFnoPileUpPacked_ +#define CommonTools_ParticleFlow_PFnoPileUpPacked_ + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +#include "DataFormats/VertexReco/interface/Vertex.h" + +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +using namespace std; +using namespace edm; +using namespace reco; + + +/**\class PFnoPileUpPacked +\brief Identifies pile-up candidates from a collection of Candidates, and +produces the corresponding collection of NoPileUpCandidates. + +\author Andreas Hinzmann +\date May 2021 + +*/ + +class PFnoPileUpPacked : public edm::stream::EDProducer<> { +public: + typedef edm::View CandidateView; + typedef edm::Association CandToVertex; + + explicit PFnoPileUpPacked(const edm::ParameterSet&); + + ~PFnoPileUpPacked() override = default; + + void produce(edm::Event&, const edm::EventSetup&) override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + +private: + edm::EDGetTokenT tokenCandidatesView_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + int vertexAssociationQuality_; +}; + + +PFnoPileUpPacked::PFnoPileUpPacked(const edm::ParameterSet& iConfig) { + tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + produces>(); +} + +void PFnoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { + unique_ptr> pOutput(new edm::PtrVector); + Handle candidateView; + iEvent.getByToken(tokenCandidatesView_, candidateView); + const edm::Association associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap associationQuality = iEvent.get(tokenVertexAssociationQuality_); + for (auto p : candidateView->ptrs()) { + const reco::VertexRef& PVOrig = associatedPV[p]; + int quality = associationQuality[p]; + if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) + pOutput->push_back(p); + } + iEvent.put(std::move(pOutput)); +} + +void PFnoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + desc.add("candidates", edm::InputTag("packedPFCandidates")); + desc.add("vertexAssociationQuality", 7); + desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME","original")); + descriptions.add("produceMuons", desc); +} + +DEFINE_FWK_MODULE(PFnoPileUpPacked); +#endif \ No newline at end of file From 5e94e09adaec3a06021041d662841164dbb3c1bf Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 11 Aug 2021 17:33:46 +0200 Subject: [PATCH 236/923] code format and code checks --- CommonTools/ParticleFlow/plugins/PFPileUp.cc | 4 ++-- .../ParticleFlow/plugins/PFnoPileUpPacked.cc | 22 +++++++++---------- .../RecoAlgos/plugins/PrimaryVertexSorter.h | 5 +++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index bfc6720dff437..cdd1e11e1d930 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -169,8 +169,8 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { } if (fUseVertexAssociation) { - const edm::Association associatedPV = iEvent.get(tokenVertexAssociation_); - const edm::ValueMap associationQuality = iEvent.get(tokenVertexAssociationQuality_); + const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); PFCollection pfCandidatesFromPU; for (auto& p : (*pfCandidatesRef)) { const reco::VertexRef& PVOrig = associatedPV[p]; diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc index 45c402185b37c..b035017b953e0 100644 --- a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc +++ b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc @@ -29,7 +29,6 @@ using namespace std; using namespace edm; using namespace reco; - /**\class PFnoPileUpPacked \brief Identifies pile-up candidates from a collection of Candidates, and produces the corresponding collection of NoPileUpCandidates. @@ -50,7 +49,7 @@ class PFnoPileUpPacked : public edm::stream::EDProducer<> { void produce(edm::Event&, const edm::EventSetup&) override; - static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: edm::EDGetTokenT tokenCandidatesView_; @@ -60,7 +59,6 @@ class PFnoPileUpPacked : public edm::stream::EDProducer<> { int vertexAssociationQuality_; }; - PFnoPileUpPacked::PFnoPileUpPacked(const edm::ParameterSet& iConfig) { tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); @@ -74,9 +72,9 @@ void PFnoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { unique_ptr> pOutput(new edm::PtrVector); Handle candidateView; iEvent.getByToken(tokenCandidatesView_, candidateView); - const edm::Association associatedPV = iEvent.get(tokenVertexAssociation_); - const edm::ValueMap associationQuality = iEvent.get(tokenVertexAssociationQuality_); - for (auto p : candidateView->ptrs()) { + const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); + for (const auto& p : candidateView->ptrs()) { const reco::VertexRef& PVOrig = associatedPV[p]; int quality = associationQuality[p]; if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) @@ -85,12 +83,12 @@ void PFnoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { iEvent.put(std::move(pOutput)); } -void PFnoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { - edm::ParameterSetDescription desc; - desc.add("candidates", edm::InputTag("packedPFCandidates")); - desc.add("vertexAssociationQuality", 7); - desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME","original")); - descriptions.add("produceMuons", desc); +void PFnoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("candidates", edm::InputTag("packedPFCandidates")); + desc.add("vertexAssociationQuality", 7); + desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME", "original")); + descriptions.add("produceMuons", desc); } DEFINE_FWK_MODULE(PFnoPileUpPacked); diff --git a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h index fa78ebf5de8d6..e4e8e5b98cc4e 100644 --- a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h +++ b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h @@ -313,7 +313,8 @@ inline void PrimaryVertexSorter>::doConsumesForTi } template <> -inline void PrimaryVertexSorter>::doConsumesForTiming(const edm::ParameterSet& iConfig) {} +inline void PrimaryVertexSorter>::doConsumesForTiming( + const edm::ParameterSet& iConfig) {} template <> inline bool PrimaryVertexSorter>::needsProductsForTiming() { @@ -353,7 +354,7 @@ inline std::pair PrimaryVertexSorter -std::pair PrimaryVertexSorter>::runAlgo( +inline std::pair PrimaryVertexSorter>::runAlgo( const reco::VertexCollection& vertices, const pat::PackedCandidate& pf, const edm::ValueMap* trackTimeTag, From 8ef33596911b5d97ba05a99820a1a8faebe6652c Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 11 Aug 2021 17:36:39 +0200 Subject: [PATCH 237/923] remove nano import --- CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py | 1 - 1 file changed, 1 deletion(-) diff --git a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py index 5628b60de9425..8825604bf18c1 100644 --- a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py +++ b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py @@ -17,7 +17,6 @@ process.load('SimGeneral.MixingModule.mixNoPU_cfi') process.load('Configuration.StandardSequences.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('PhysicsTools.NanoAOD.nano_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') From ff72b04c3280cb4a3283a6880394724715cb529c Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Thu, 12 Aug 2021 14:44:31 +0200 Subject: [PATCH 238/923] remove ifdefs --- CommonTools/ParticleFlow/plugins/PFPileUp.cc | 4 ---- CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index cdd1e11e1d930..c144c18e9bd24 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -1,6 +1,3 @@ -#ifndef PhysicsTools_PFCandProducer_PFPileUp_ -#define PhysicsTools_PFCandProducer_PFPileUp_ - // system include files #include #include @@ -195,4 +192,3 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { iEvent.put(std::move(pOutput)); // iEvent.put(std::move(pOutputByValue)); } -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc index b035017b953e0..649e17e49d58c 100644 --- a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc +++ b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc @@ -1,6 +1,3 @@ -#ifndef CommonTools_ParticleFlow_PFnoPileUpPacked_ -#define CommonTools_ParticleFlow_PFnoPileUpPacked_ - // system include files #include #include @@ -91,5 +88,4 @@ void PFnoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descript descriptions.add("produceMuons", desc); } -DEFINE_FWK_MODULE(PFnoPileUpPacked); -#endif \ No newline at end of file +DEFINE_FWK_MODULE(PFnoPileUpPacked); \ No newline at end of file From 4f83c43fef2cfd0ba9655b8fdd3a84f4d54db33a Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Mon, 16 Aug 2021 11:40:17 +0200 Subject: [PATCH 239/923] remove PFPileUp from SealModule --- CommonTools/ParticleFlow/plugins/PFPileUp.cc | 1 + CommonTools/ParticleFlow/plugins/SealModule.cc | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index c144c18e9bd24..35b328035eda6 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -192,3 +192,4 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { iEvent.put(std::move(pOutput)); // iEvent.put(std::move(pOutputByValue)); } +DEFINE_FWK_MODULE(PFPileUp); diff --git a/CommonTools/ParticleFlow/plugins/SealModule.cc b/CommonTools/ParticleFlow/plugins/SealModule.cc index eb561b1381c31..134fee6951bf8 100644 --- a/CommonTools/ParticleFlow/plugins/SealModule.cc +++ b/CommonTools/ParticleFlow/plugins/SealModule.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "CommonTools/ParticleFlow/plugins/PFMET.h" -#include "CommonTools/ParticleFlow/plugins/PFPileUp.h" #include "CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h" #include "CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h" #include "CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h" @@ -9,7 +8,6 @@ #include "CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h" DEFINE_FWK_MODULE(PFMET); -DEFINE_FWK_MODULE(PFPileUp); DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionStringFilter); DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionPdgIdFilter); From 67c5d8e730e45e34cfd96059b884e58835f74a66 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 20 Aug 2021 12:33:32 +0200 Subject: [PATCH 240/923] comments from Jacobo --- .../ParticleFlow/plugins/PFnoPileUpPacked.cc | 91 ------------------- CommonTools/ParticleFlow/python/pfCHS_cff.py | 9 +- .../PileupAlgos/plugins/PuppiProducer.cc | 8 +- CommonTools/PileupAlgos/python/Puppi_cff.py | 2 - .../interface/PrimaryVertexAssignment.h | 6 +- .../RecoAlgos/src/PrimaryVertexAssignment.cc | 34 +++---- .../runMETCorrectionsAndUncertainties.py | 2 +- 7 files changed, 29 insertions(+), 123 deletions(-) delete mode 100644 CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc diff --git a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc deleted file mode 100644 index 649e17e49d58c..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFnoPileUpPacked.cc +++ /dev/null @@ -1,91 +0,0 @@ -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Common/interface/Association.h" - -#include "DataFormats/VertexReco/interface/Vertex.h" - -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -using namespace std; -using namespace edm; -using namespace reco; - -/**\class PFnoPileUpPacked -\brief Identifies pile-up candidates from a collection of Candidates, and -produces the corresponding collection of NoPileUpCandidates. - -\author Andreas Hinzmann -\date May 2021 - -*/ - -class PFnoPileUpPacked : public edm::stream::EDProducer<> { -public: - typedef edm::View CandidateView; - typedef edm::Association CandToVertex; - - explicit PFnoPileUpPacked(const edm::ParameterSet&); - - ~PFnoPileUpPacked() override = default; - - void produce(edm::Event&, const edm::EventSetup&) override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - edm::EDGetTokenT tokenCandidatesView_; - edm::EDGetTokenT tokenVertices_; - edm::EDGetTokenT tokenVertexAssociation_; - edm::EDGetTokenT> tokenVertexAssociationQuality_; - int vertexAssociationQuality_; -}; - -PFnoPileUpPacked::PFnoPileUpPacked(const edm::ParameterSet& iConfig) { - tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); - vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); - tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); - tokenVertexAssociationQuality_ = - consumes>(iConfig.getParameter("vertexAssociation")); - produces>(); -} - -void PFnoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { - unique_ptr> pOutput(new edm::PtrVector); - Handle candidateView; - iEvent.getByToken(tokenCandidatesView_, candidateView); - const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); - const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); - for (const auto& p : candidateView->ptrs()) { - const reco::VertexRef& PVOrig = associatedPV[p]; - int quality = associationQuality[p]; - if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) - pOutput->push_back(p); - } - iEvent.put(std::move(pOutput)); -} - -void PFnoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("candidates", edm::InputTag("packedPFCandidates")); - desc.add("vertexAssociationQuality", 7); - desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME", "original")); - descriptions.add("produceMuons", desc); -} - -DEFINE_FWK_MODULE(PFnoPileUpPacked); \ No newline at end of file diff --git a/CommonTools/ParticleFlow/python/pfCHS_cff.py b/CommonTools/ParticleFlow/python/pfCHS_cff.py index b455aec07ef9f..23dba83b7fa79 100644 --- a/CommonTools/ParticleFlow/python/pfCHS_cff.py +++ b/CommonTools/ParticleFlow/python/pfCHS_cff.py @@ -9,8 +9,7 @@ ) adapt(packedPrimaryVertexAssociationJME) -pfCHS = cms.EDProducer("PFnoPileUpPacked", - candidates = cms.InputTag("packedPFCandidates"), - vertexAssociationQuality = pfPileUpJME.vertexAssociationQuality, - vertexAssociation = cms.InputTag("packedPrimaryVertexAssociationJME","original") - ) +from CommonTools.ParticleFlow.pfNoPileUpPacked_cfi import pfNoPileUpPacked as _pfNoPileUpPacked +pfCHS = _pfNoPileUpPacked.clone( + vertexAssociationQuality=pfPileUpJME.vertexAssociationQuality +) diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index 3490a006578ee..a04967339319e 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -109,7 +109,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Fill the reco objects fRecoObjCollection.clear(); fRecoObjCollection.reserve(pfCol->size()); - int ic = 0; + int iCand = 0; for (auto const& aPF : *pfCol) { RecoObj pReco; pReco.pt = aPF.pt(); @@ -127,8 +127,8 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { const pat::PackedCandidate* lPack = dynamic_cast(&aPF); if (fUseVertexAssociation) { - const reco::VertexRef& PVOrig = associatedPV[reco::CandidatePtr(hPFProduct, ic)]; - int quality = associationQuality[reco::CandidatePtr(hPFProduct, ic)]; + const reco::VertexRef& PVOrig = associatedPV[reco::CandidatePtr(hPFProduct, iCand)]; + int quality = associationQuality[reco::CandidatePtr(hPFProduct, iCand)]; if (PVOrig.isNonnull() && (quality >= vertexAssociationQuality_)) { closestVtx = PVOrig.get(); pVtxId = PVOrig.key(); @@ -263,7 +263,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { } fRecoObjCollection.push_back(pReco); - ic++; + iCand++; } fPuppiContainer->initialize(fRecoObjCollection); diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index b2e6b5f015ac1..9943d59afe49b 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -34,8 +34,6 @@ useVertexAssociation = True, vertexAssociationQuality = 6, vertexAssociation = ('primaryVertexAssociationJME','original'), - #candName = 'packedPFCandidates', - #vertexName = 'offlineSlimmedPrimaryVertices', clonePackedCands = False, # should only be set to True for MiniAOD algos = { 0: dict( diff --git a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h index 388fd1567a977..011ee2ecee2d2 100644 --- a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h +++ b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h @@ -91,7 +91,7 @@ class PrimaryVertexAssignment { } if (pfcand.gsfTrackRef().isNull()) { if (pfcand.trackRef().isNull()) - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; else return chargedHadronVertex(vertices, pfcand.trackRef(), time, timeResolution, jets, builder); } @@ -109,7 +109,7 @@ class PrimaryVertexAssignment { timeResolution = pfcand.timeError(); } if (!pfcand.hasTrackDetails()) - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; else return chargedHadronVertex( vertices, @@ -135,7 +135,7 @@ class PrimaryVertexAssignment { timeResolution = (*trackTimeResoTag)[chcand.track()]; } if (chcand.track().isNull()) - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; return chargedHadronVertex(vertices, chcand.track(), time, timeResolution, jets, builder); } diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 7515cb6f42583..c6b56788acd8f 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -53,7 +53,7 @@ std::pair PrimaryVertexAssignment::charge for (IV iv = vertices.begin(); iv != vertices.end(); ++iv) { int ivtx = iv - vertices.begin(); if (useVertexFit_ && (iVertex == ivtx)) - return std::pair(ivtx, PrimaryVertexAssignment::UsedInFit); + return {ivtx, PrimaryVertexAssignment::UsedInFit}; double dz = std::abs(track->dz(iv->position())); double dt = std::abs(time - iv->t()); @@ -62,18 +62,19 @@ std::pair PrimaryVertexAssignment::charge if ((dz < maxDzForPrimaryAssignment_ or dz / track->dzError() < maxDzSigForPrimaryAssignment_) and (!useTimeVtx or dt / timeReso < maxDtSigForPrimaryAssignment_)) { - return std::pair(ivtx, PrimaryVertexAssignment::PrimaryDz); + return {ivtx, PrimaryVertexAssignment::PrimaryDz}; } } } + auto firstVertexDz = std::abs(track->dz(vertices.at(0).position())); // recover cases where the primary vertex is split if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && - (std::abs(track->dz(vertices.at(0).position())) < fDzCutForChargedFromPUVtxs_)) - return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); + firstVertexDz < fDzCutForChargedFromPUVtxs_) + return {iVertex, PrimaryVertexAssignment::PrimaryDz}; if (useVertexFit_ && (iVertex >= 0)) - return std::pair(iVertex, PrimaryVertexAssignment::UsedInFit); + return {iVertex, PrimaryVertexAssignment::UsedInFit}; double distmin = std::numeric_limits::max(); double dzmin = std::numeric_limits::max(); @@ -120,17 +121,17 @@ std::pair PrimaryVertexAssignment::charge } else { // consider only distances to first vertex for association of pileup vertices (originally used in PUPPI) if ((vtxIdMinSignif >= 0) && (std::abs(track->eta()) > fEtaMinUseDz_)) - iVertex = ((std::abs(track->dz(vertices.at(0).position())) < maxDzForPrimaryAssignment_ and - std::abs(track->dz(vertices.at(0).position())) / dzE < maxDzSigForPrimaryAssignment_ and - track->dzError() < maxDzErrorForPrimaryAssignment_) and - (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) - ? 0 - : vtxIdMinSignif; + iVertex = + ((firstVertexDz < maxDzForPrimaryAssignment_ and firstVertexDz / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) + ? 0 + : vtxIdMinSignif; } } if (iVertex >= 0) - return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); + return {iVertex, PrimaryVertexAssignment::PrimaryDz}; // if track not assigned yet, it could be a b-decay secondary , use jet axis dist criterion // first find the closest jet within maxJetDeltaR_ @@ -170,20 +171,19 @@ std::pair PrimaryVertexAssignment::charge } } if (iVertex >= 0) - return std::pair(iVertex, PrimaryVertexAssignment::BTrack); + return {iVertex, PrimaryVertexAssignment::BTrack}; // if the track is not compatible with other PVs but is compatible with the BeamSpot, we may simply have not reco'ed the PV! // we still point it to the closest in Z, but flag it as possible orphan-primary if (!vertices.empty() && std::abs(track->dxy(vertices[0].position())) < maxDxyForNotReconstructedPrimary_ && std::abs(track->dxy(vertices[0].position()) / track->dxyError()) < maxDxySigForNotReconstructedPrimary_) - return std::pair(vtxIdMinSignif, - PrimaryVertexAssignment::NotReconstructedPrimary); + return {vtxIdMinSignif, PrimaryVertexAssignment::NotReconstructedPrimary}; //FIXME: here we could better handle V0s and NucInt // all other tracks could be non-B secondaries and we just attach them with closest Z if (vtxIdMinSignif >= 0) - return std::pair(vtxIdMinSignif, PrimaryVertexAssignment::OtherDz); + return {vtxIdMinSignif, PrimaryVertexAssignment::OtherDz}; //If for some reason even the dz failed (when?) we consider the track not assigned - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; } diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index efdaa35135190..739cc55562a12 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -1696,7 +1696,7 @@ def miniAODConfigurationPre(self, process, patMetModuleSequence, pfCandCollectio ##adding the necessary chs and track met configuration task = getPatAlgosToolsTask(process) - from CommonTools.ParticleFlow.pfCHS_cff import pfCHS, packedPrimaryVertexAssociationJME + from CommonTools.ParticleFlow.pfCHS_cff import pfCHS, packedPrimaryVertexAssociationJME addToProcessAndTask("packedPrimaryVertexAssociationJME",packedPrimaryVertexAssociationJME.clone(), process, task) patMetModuleSequence += getattr(process, "packedPrimaryVertexAssociationJME") addToProcessAndTask("pfCHS", pfCHS.clone(), process, task) From 763b616c290a810a981b7c8ab8dd03afc95f9826 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 20 Aug 2021 16:10:31 +0200 Subject: [PATCH 241/923] fix implementation of vertex split recovery --- CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index c6b56788acd8f..12e3d601c2faf 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -71,7 +71,7 @@ std::pair PrimaryVertexAssignment::charge // recover cases where the primary vertex is split if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && firstVertexDz < fDzCutForChargedFromPUVtxs_) - return {iVertex, PrimaryVertexAssignment::PrimaryDz}; + return {0, PrimaryVertexAssignment::PrimaryDz}; if (useVertexFit_ && (iVertex >= 0)) return {iVertex, PrimaryVertexAssignment::UsedInFit}; From ceac155982d17753da5b9788da0a0e432b8c88c2 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 20 Aug 2021 16:17:01 +0200 Subject: [PATCH 242/923] add renamed file --- .../ParticleFlow/plugins/PFNoPileUpPacked.cc | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc diff --git a/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc new file mode 100644 index 0000000000000..d6ef1ad458c61 --- /dev/null +++ b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc @@ -0,0 +1,91 @@ +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +#include "DataFormats/VertexReco/interface/Vertex.h" + +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +using namespace std; +using namespace edm; +using namespace reco; + +/**\class PFNoPileUpPacked +\brief Identifies pile-up candidates from a collection of Candidates, and +produces the corresponding collection of NoPileUpCandidates. + +\author Andreas Hinzmann +\date May 2021 + +*/ + +class PFNoPileUpPacked : public edm::stream::EDProducer<> { +public: + typedef edm::View CandidateView; + typedef edm::Association CandToVertex; + + explicit PFNoPileUpPacked(const edm::ParameterSet&); + + ~PFNoPileUpPacked() override = default; + + void produce(edm::Event&, const edm::EventSetup&) override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + edm::EDGetTokenT tokenCandidatesView_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + int vertexAssociationQuality_; +}; + +PFNoPileUpPacked::PFNoPileUpPacked(const edm::ParameterSet& iConfig) { + tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + produces>(); +} + +void PFNoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { + unique_ptr> pOutput(new edm::PtrVector); + Handle candidateView; + iEvent.getByToken(tokenCandidatesView_, candidateView); + const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); + for (const auto& p : candidateView->ptrs()) { + const reco::VertexRef& PVOrig = associatedPV[p]; + int quality = associationQuality[p]; + if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) + pOutput->push_back(p); + } + iEvent.put(std::move(pOutput)); +} + +void PFNoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("candidates", edm::InputTag("packedPFCandidates")); + desc.add("vertexAssociationQuality", 7); + desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME", "original")); + descriptions.add("produceMuons", desc); +} + +DEFINE_FWK_MODULE(PFNoPileUpPacked); \ No newline at end of file From 818d5316aaee219c0ba0c30f38908b2096ada86c Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Mon, 23 Aug 2021 10:37:16 +0200 Subject: [PATCH 243/923] fix crash --- CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 12e3d601c2faf..f5e983ef0857c 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -67,7 +67,9 @@ std::pair PrimaryVertexAssignment::charge } } - auto firstVertexDz = std::abs(track->dz(vertices.at(0).position())); + double firstVertexDz = std::numeric_limits::max(); + if (vertices.size() > 0) + firstVertexDz = std::abs(track->dz(vertices.at(0).position())); // recover cases where the primary vertex is split if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && firstVertexDz < fDzCutForChargedFromPUVtxs_) From 5ba3a3962d0860eb8588db7d5c889058aa7bc725 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Mon, 23 Aug 2021 10:39:42 +0200 Subject: [PATCH 244/923] code check --- CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index f5e983ef0857c..230a336d4d4e3 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -68,7 +68,7 @@ std::pair PrimaryVertexAssignment::charge } double firstVertexDz = std::numeric_limits::max(); - if (vertices.size() > 0) + if (!vertices.empty()) firstVertexDz = std::abs(track->dz(vertices.at(0).position())); // recover cases where the primary vertex is split if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && From 74a797538c36dcce682351262de3f240b409499b Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Wed, 25 Aug 2021 12:17:32 +0200 Subject: [PATCH 245/923] fix filldescriptions label --- CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc index d6ef1ad458c61..5a94c6cd3bb0b 100644 --- a/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc +++ b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc @@ -85,7 +85,7 @@ void PFNoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("candidates", edm::InputTag("packedPFCandidates")); desc.add("vertexAssociationQuality", 7); desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME", "original")); - descriptions.add("produceMuons", desc); + descriptions.addWithDefaultLabel(desc); } DEFINE_FWK_MODULE(PFNoPileUpPacked); \ No newline at end of file From f4b7e6e6170f69c32b6ad0a141c944fef42f1380 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 31 Aug 2021 13:04:59 +0200 Subject: [PATCH 246/923] add 2022 scenario for direct simulation --- Validation/CTPPS/alignment/2022.xml | 13 ++++ .../simu_config/profile_2022_default_cff.py | 24 +++++++ .../CTPPS/python/simu_config/year_2022_cff.py | 66 +++++++++++++++++++ Validation/CTPPS/test/simu/run_multiple | 2 + 4 files changed, 105 insertions(+) create mode 100644 Validation/CTPPS/alignment/2022.xml create mode 100644 Validation/CTPPS/python/simu_config/profile_2022_default_cff.py create mode 100644 Validation/CTPPS/python/simu_config/year_2022_cff.py diff --git a/Validation/CTPPS/alignment/2022.xml b/Validation/CTPPS/alignment/2022.xml new file mode 100644 index 0000000000000..a715768fe083b --- /dev/null +++ b/Validation/CTPPS/alignment/2022.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py b/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py new file mode 100644 index 0000000000000..803fcf0e286dd --- /dev/null +++ b/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py @@ -0,0 +1,24 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.CTPPS.simu_config.year_2022_cff import * + +alignmentFile = "Validation/CTPPS/alignment/2022.xml" + +profile_2022_default = profile_base_2022.clone( + L_int = 1, + + ctppsLHCInfo = dict( + # NB: until a dedicated 2022 distributions are issued, it is OK to use 2021 ones here + xangleBetaStarHistogramObject = "2021/h2_betaStar_vs_xangle" + ), + + ctppsRPAlignmentCorrectionsDataXML = dict( + MisalignedFiles = [alignmentFile], + RealFiles = [alignmentFile] + ), + + ctppsDirectSimuData = dict( + timeResolutionDiamonds45 = "0.200", + timeResolutionDiamonds56 = "0.200" + ) +) diff --git a/Validation/CTPPS/python/simu_config/year_2022_cff.py b/Validation/CTPPS/python/simu_config/year_2022_cff.py new file mode 100644 index 0000000000000..ba1c6d46ae719 --- /dev/null +++ b/Validation/CTPPS/python/simu_config/year_2022_cff.py @@ -0,0 +1,66 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.CTPPS.simu_config.base_cff import * + +# base profile settings for 2022 +profile_base_2022 = profile_base.clone( + ctppsLHCInfo = dict( + beamEnergy = 7000 + ), + + ctppsOpticalFunctions = dict( + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(144.974), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/144.974urad.root") ), + cms.PSet( xangle = cms.double(160.000), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/160.000urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) + ), + + ctppsDirectSimuData = dict( + empiricalAperture45 = cms.string("1E3*([xi] - 0.20)"), + empiricalAperture56 = cms.string("1E3*([xi] - 0.20)") + ) +) + +# adjust basic settings +generator.energy = profile_base_2022.ctppsLHCInfo.beamEnergy + +# geometry (NB: until a dedicated 2022 geometry is issued, it is OK to use 2021 one here) +from Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi import * +ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag +del ctppsGeometryESModule # this functionality is replaced by the composite ES source + +# local reconstruction +ctppsLocalTrackLiteProducer.includeStrips = False +ctppsLocalTrackLiteProducer.includePixels = True +ctppsLocalTrackLiteProducer.includeDiamonds = True + +reco_local = cms.Sequence( + ctppsPixelLocalTracks + * ctppsDiamondLocalReconstruction + * ctppsLocalTrackLiteProducer +) + +# RP ids +rpIds = cms.PSet( + rp_45_F = cms.uint32(23), + rp_45_N = cms.uint32(3), + rp_56_N = cms.uint32(103), + rp_56_F = cms.uint32(123) +) + +# default list of profiles +from Validation.CTPPS.simu_config.profile_2022_default_cff import profile_2022_default +ctppsCompositeESSource.periods = [profile_2022_default] diff --git a/Validation/CTPPS/test/simu/run_multiple b/Validation/CTPPS/test/simu/run_multiple index 9b42add2fe789..24f0c47648254 100755 --- a/Validation/CTPPS/test/simu/run_multiple +++ b/Validation/CTPPS/test/simu/run_multiple @@ -51,6 +51,8 @@ RunOne "2018" "Run2_2018" RunOne "2021" "Run3" +RunOne "2022" "Run3" + rc=0 for pid in $pids do From 745a5673aa31662cb56a85af79b6f639ae7cbefc Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 31 Aug 2021 14:20:16 +0200 Subject: [PATCH 247/923] optics config moved to a single cff file --- .../ctppsOpticalFunctions_non_DB_cff.py | 142 ++++++++++++++++++ .../simu_config/profile_2016_postTS2_cff.py | 16 +- .../simu_config/profile_2016_preTS2_cff.py | 16 +- .../CTPPS/python/simu_config/year_2017_cff.py | 20 +-- .../CTPPS/python/simu_config/year_2018_cff.py | 20 +-- .../CTPPS/python/simu_config/year_2021_cff.py | 21 +-- .../CTPPS/python/simu_config/year_2022_cff.py | 21 +-- 7 files changed, 166 insertions(+), 90 deletions(-) create mode 100644 CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py diff --git a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py new file mode 100644 index 0000000000000..b8683b5675ea4 --- /dev/null +++ b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py @@ -0,0 +1,142 @@ +import FWCore.ParameterSet.Config as cms + +from CalibPPS.ESProducers.ctppsLHCInfo_cff import * + +# (source) optical functions sampled at few xangles +from CalibPPS.ESProducers.ctppsOpticalFunctionsESSource_cfi import * + +optics_2016_preTS2 = cms.PSet( + validityRange = cms.EventRange("273725:min - 280385:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(185), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_preTS2/version2/185urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2016_preTS2) + +optics_2016_postTS2 = cms.PSet( + validityRange = cms.EventRange("282730:min - 284044:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_postTS2/version2/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2016_postTS2) + +optics_2017 = cms.PSet( + validityRange = cms.EventRange("297046:min - 307082:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/120urad.root") ), + cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/130urad.root") ), + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2017) + +optics_2018 = cms.PSet( + validityRange = cms.EventRange("314747:min - 325175:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/120urad.root") ), + cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/130urad.root") ), + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2018) + +optics_2021 = cms.PSet( + validityRange = cms.EventRange("1234:1 - 1234:max"), # NB: a fake IOV, this optics was never used for LHC + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(110.444), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/110.444urad.root") ), + cms.PSet( xangle = cms.double(184.017), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/184.017urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +# NB: do not append the 2021 config - not used for any LHC data + +optics_2022 = cms.PSet( + validityRange = cms.EventRange("343890:min - 999999:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(144.974), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/144.974urad.root") ), + cms.PSet( xangle = cms.double(160.000), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/160.000urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2022) + +# optics interpolation between crossing angles +from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * +ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel diff --git a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py index 1542db2032c8f..82235542eb261 100644 --- a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.year_2016_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2016_postTS2 as selected_optics + alignmentFile = "Validation/CTPPS/alignment/2016_postTS2.xml" profile_2016_postTS2 = profile_base_2016.clone( @@ -12,18 +14,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_postTS2/version2/140urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip - - cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ), ctppsRPAlignmentCorrectionsDataXML = dict( diff --git a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py index f68e365b2597a..faaf385087753 100644 --- a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py +++ b/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.year_2016_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2016_preTS2 as selected_optics + alignmentFile = "Validation/CTPPS/alignment/2016_preTS2.xml" profile_2016_preTS2 = profile_base_2016.clone( @@ -12,18 +14,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(185), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_preTS2/version2/185urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip - - cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ), ctppsRPAlignmentCorrectionsDataXML = dict( diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py index 8a39857850966..b881521ecf694 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.base_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2017 as selected_optics + # base profile settings for 2017 profile_base_2017 = profile_base.clone( ctppsLHCInfo = dict( @@ -9,22 +11,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/120urad.root") ), - cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/130urad.root") ), - cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/140urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip - cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond - cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - - cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip - cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond - cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ) ) diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index 37915a804049a..c0ab9834b9b8a 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.base_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2018 as selected_optics + # base profile settings for 2018 profile_base_2018 = profile_base.clone( ctppsLHCInfo = dict( @@ -9,22 +11,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/120urad.root") ), - cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/130urad.root") ), - cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/140urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel - cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond - cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - - cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel - cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond - cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ), ctppsDirectSimuData = dict( diff --git a/Validation/CTPPS/python/simu_config/year_2021_cff.py b/Validation/CTPPS/python/simu_config/year_2021_cff.py index d50bc0ba42b4b..05d22056e5cfe 100644 --- a/Validation/CTPPS/python/simu_config/year_2021_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2021_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.base_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2021 as selected_optics + # base profile settings for 2021 profile_base_2021 = profile_base.clone( ctppsLHCInfo = dict( @@ -9,23 +11,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(110.444), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/110.444urad.root") ), - cms.PSet( xangle = cms.double(184.017), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2021/version_pre3/184.017urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel - cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond - cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond - cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - - cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel - cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond - cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond - cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ), ctppsDirectSimuData = dict( diff --git a/Validation/CTPPS/python/simu_config/year_2022_cff.py b/Validation/CTPPS/python/simu_config/year_2022_cff.py index ba1c6d46ae719..bb986cb1b3b91 100644 --- a/Validation/CTPPS/python/simu_config/year_2022_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2022_cff.py @@ -2,6 +2,8 @@ from Validation.CTPPS.simu_config.base_cff import * +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2022 as selected_optics + # base profile settings for 2022 profile_base_2022 = profile_base.clone( ctppsLHCInfo = dict( @@ -9,23 +11,8 @@ ), ctppsOpticalFunctions = dict( - opticalFunctions = cms.VPSet( - cms.PSet( xangle = cms.double(144.974), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/144.974urad.root") ), - cms.PSet( xangle = cms.double(160.000), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/160.000urad.root") ) - ), - - scoringPlanes = cms.VPSet( - # z in cm - cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel - cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond - cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond - cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel - - cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel - cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond - cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond - cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel - ) + opticalFunctions = selected_optics.opticalFunctions, + scoringPlanes = selected_optics.scoringPlanes, ), ctppsDirectSimuData = dict( From 1bfee1b5945da8c890464656408fa8581264f3f1 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 31 Aug 2021 15:16:22 +0200 Subject: [PATCH 248/923] logic fix --- CondFormats/PPSObjects/src/PPSPixelTopology.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CondFormats/PPSObjects/src/PPSPixelTopology.cc b/CondFormats/PPSObjects/src/PPSPixelTopology.cc index 13d20b8a0547c..fdc337abd62ef 100644 --- a/CondFormats/PPSObjects/src/PPSPixelTopology.cc +++ b/CondFormats/PPSObjects/src/PPSPixelTopology.cc @@ -28,16 +28,17 @@ unsigned short PPSPixelTopology::pixelIndex(PixelInfo pI) const { bool PPSPixelTopology::isPixelHit(float xLocalCoordinate, float yLocalCoordinate, bool is3x2 = true) const { // check hit fiducial boundaries - double xModuleSize = 2 * ((no_of_pixels_simX_ / 2. + 1) * pitch_simX_ + dead_edge_width_); + const double xModuleSize = 2 * ((no_of_pixels_simX_ / 2. + 1) * pitch_simX_ + dead_edge_width_); if (xLocalCoordinate < -xModuleSize / 2. || xLocalCoordinate > xModuleSize / 2.) return false; - double yModuleSize = (no_of_pixels_simY_ + 4.) * pitch_simY_ + 2. * dead_edge_width_; - double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_; + const double yModuleSize = (no_of_pixels_simY_ + 4.) * pitch_simY_ + 2. * dead_edge_width_; + const double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_; if (is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; - - if (!is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) + if (!is3x2 && (runType_=="Run2") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) + return false; + if (!is3x2 && (runType_=="Run3") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; return true; From 213cbdc725cae0ca19eeb8b326c99895e9ff2eac Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 31 Aug 2021 16:05:14 +0200 Subject: [PATCH 249/923] Fully resolve the issue of usinng dd4hep in CherenkovAnalysis --- .../data/SingleDREAMDD4Hep.xml | 1 + SimG4CMS/CherenkovAnalysis/data/cms.xml | 35 +++++++++++++++++++ .../CherenkovAnalysis/data/singleDREAM.xml | 30 ---------------- .../python/SingleDREAMXML_cfi.py | 3 +- SimG4CMS/CherenkovAnalysis/src/DreamSD.cc | 23 ++++-------- .../test/runSingleDREAMDD4Hep_cfg.py | 1 - 6 files changed, 44 insertions(+), 49 deletions(-) create mode 100644 SimG4CMS/CherenkovAnalysis/data/cms.xml diff --git a/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml b/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml index f645f19e9ae33..432001d44fed6 100644 --- a/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml +++ b/SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml @@ -21,6 +21,7 @@ + diff --git a/SimG4CMS/CherenkovAnalysis/data/cms.xml b/SimG4CMS/CherenkovAnalysis/data/cms.xml new file mode 100644 index 0000000000000..7d59d00a2d97e --- /dev/null +++ b/SimG4CMS/CherenkovAnalysis/data/cms.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimG4CMS/CherenkovAnalysis/data/singleDREAM.xml b/SimG4CMS/CherenkovAnalysis/data/singleDREAM.xml index 239e87c842921..4186a87f8602f 100644 --- a/SimG4CMS/CherenkovAnalysis/data/singleDREAM.xml +++ b/SimG4CMS/CherenkovAnalysis/data/singleDREAM.xml @@ -1,36 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SimG4CMS/CherenkovAnalysis/python/SingleDREAMXML_cfi.py b/SimG4CMS/CherenkovAnalysis/python/SingleDREAMXML_cfi.py index f61ed78b83ef9..2e27a6f0581a8 100644 --- a/SimG4CMS/CherenkovAnalysis/python/SingleDREAMXML_cfi.py +++ b/SimG4CMS/CherenkovAnalysis/python/SingleDREAMXML_cfi.py @@ -3,8 +3,9 @@ XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials/2021/v2/materials.xml', + 'SimG4CMS/CherenkovAnalysis/data/cms.xml', 'SimG4CMS/CherenkovAnalysis/data/singleDREAM.xml'), - rootNodeName = cms.string('singleDREAM:DREAM') + rootNodeName = cms.string('cms:OCMS') ) diff --git a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc index 574a98da415c2..9ed4579eed6f3 100644 --- a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc +++ b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc @@ -1,6 +1,3 @@ - -#include - #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDFilter.h" #include "DetectorDescription/Core/interface/DDFilteredView.h" @@ -142,11 +139,10 @@ void DreamSD::initMap(const std::string &sd) { DDFilteredView fv((*cpvDDD_), filter); fv.firstChild(); bool dodet = true; - const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); while (dodet) { const DDSolid &sol = fv.logicalPart().solid(); std::vector paras(sol.parameters()); - G4String name = sol.name().name(); + std::string name = static_cast(sol.name().name()); #ifdef EDM_ML_DEBUG edm::LogVerbatim("EcalSim") << "DreamSD::initMap (for " << sd << "): Solid " << name << " Shape " << sol.shape() << " Parameter 0 = " << paras[0]; @@ -155,16 +151,7 @@ void DreamSD::initMap(const std::string &sd) { std::sort(paras.begin(), paras.end()); double length = 2.0 * k_ScaleFromDDDToG4 * paras.back(); double width = 2.0 * k_ScaleFromDDDToG4 * paras.front(); - G4LogicalVolume *lv = nullptr; - for (auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) - if ((*lvcite)->GetName() == name) { - lv = (*lvcite); - break; - } - xtalLMap_.insert(std::pair(lv, Doubles(length, width))); -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalSim") << "DreamSD " << name << ":" << lv << ":" << length << ":" << width; -#endif + fillMap(name, length, width); dodet = fv.next(); } } @@ -191,7 +178,8 @@ void DreamSD::fillMap(const std::string &name, double length, double width) { G4LogicalVolume *lv = nullptr; for (auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { edm::LogVerbatim("EcalSim") << name << " vs " << (*lvcite)->GetName(); - if ((*lvcite)->GetName() == static_cast(name)) { + std::string namex = static_cast((*lvcite)->GetName()); + if (name == static_cast(dd4hep::dd::noNamespace(namex))) { lv = (*lvcite); break; } @@ -432,7 +420,8 @@ double DreamSD::getAverageNumberOfPhotons_(const double charge, // Values from Ts42 detector construction bool DreamSD::setPbWO2MaterialProperties_(G4Material *aMaterial) { std::string pbWO2Name("E_PbWO4"); - if (pbWO2Name != aMaterial->GetName()) { // Wrong material! + std::string name = static_cast(aMaterial->GetName()); + if (static_cast(dd4hep::dd::noNamespace(name)) != pbWO2Name) { // Wrong material! edm::LogWarning("EcalSim") << "This is not the right material: " << "expecting " << pbWO2Name << ", got " << aMaterial->GetName(); return false; diff --git a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py index 4dee50fee0ade..e4069a5951fbe 100644 --- a/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py +++ b/SimG4CMS/CherenkovAnalysis/test/runSingleDREAMDD4Hep_cfg.py @@ -39,7 +39,6 @@ process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits*process.cherenkovAnalysis) process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/CherenkovAnalysis/data/SingleDREAMDD4Hep.xml") -process.DDDetectorESProducer.rootDDName = 'singleDREAM:DREAM' process.generator.PGunParameters.MinE = 10.0 process.generator.PGunParameters.MaxE = 10.0 process.g4SimHits.UseMagneticField = False From e1ea31c83998e43b1a364c3279b94c27eadf9c4b Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 31 Aug 2021 16:33:48 +0200 Subject: [PATCH 250/923] Code check --- SimG4CMS/CherenkovAnalysis/src/DreamSD.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc index 9ed4579eed6f3..57f355729dc12 100644 --- a/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc +++ b/SimG4CMS/CherenkovAnalysis/src/DreamSD.cc @@ -179,7 +179,7 @@ void DreamSD::fillMap(const std::string &name, double length, double width) { for (auto lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { edm::LogVerbatim("EcalSim") << name << " vs " << (*lvcite)->GetName(); std::string namex = static_cast((*lvcite)->GetName()); - if (name == static_cast(dd4hep::dd::noNamespace(namex))) { + if (name == static_cast(dd4hep::dd::noNamespace(namex))) { lv = (*lvcite); break; } From 2f308d48ef9f04f23af734108fb02d1f30d9458c Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 31 Aug 2021 17:03:52 +0200 Subject: [PATCH 251/923] apply code format --- CondFormats/PPSObjects/src/PPSPixelTopology.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CondFormats/PPSObjects/src/PPSPixelTopology.cc b/CondFormats/PPSObjects/src/PPSPixelTopology.cc index fdc337abd62ef..55f78046d9938 100644 --- a/CondFormats/PPSObjects/src/PPSPixelTopology.cc +++ b/CondFormats/PPSObjects/src/PPSPixelTopology.cc @@ -36,9 +36,9 @@ bool PPSPixelTopology::isPixelHit(float xLocalCoordinate, float yLocalCoordinate const double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_; if (is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; - if (!is3x2 && (runType_=="Run2") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) + if (!is3x2 && (runType_ == "Run2") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) return false; - if (!is3x2 && (runType_=="Run3") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) + if (!is3x2 && (runType_ == "Run3") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; return true; From 5eb962981d2ea15e41715e32527afee5bca75f10 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 31 Aug 2021 17:06:44 +0200 Subject: [PATCH 252/923] detach DQM module from PCL --- ...ALCARECOPPSDiamondSampicTimingCalib_cff.py | 23 +++---------- .../DiamondSampicCalibrationWorker_cfg.py | 15 --------- .../python/AlCaHarvesting_cff.py | 8 ++--- .../python/AlCaRecoStreams_cff.py | 2 +- DQM/CTPPS/plugins/BuildFile.xml | 1 + .../DiamondSampicCalibrationDQMSource.cc | 32 ++++++++++++++++--- 6 files changed, 38 insertions(+), 43 deletions(-) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py index 8e669abb63642..7d5ac38529738 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py @@ -1,21 +1,9 @@ import FWCore.ParameterSet.Config as cms -from RecoPPS.Configuration.recoCTPPS_cff import diamondSampicLocalReconstruction +from RecoPPS.Configuration.recoCTPPS_cff import diamondSampicLocalReconstructionTask from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLWorker_cfi import PPSDiamondSampicTimingCalibrationPCLWorker from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -diamondSampicCalibrationDQM = DQMEDAnalyzer('DiamondSampicCalibrationDQMSource', - tagRecHits = cms.InputTag("totemTimingRecHits"), - verbosity = cms.untracked.uint32(0) -) - -# load DQM framework -from DQM.Integration.config.environment_cfi import * -dqmEnv.subSystemFolder = "CTPPS" -dqmEnv.eventInfoFolder = "EventInfo" -dqmSaver.path = "" -dqmSaver.tag = "CTPPS" - MEtoEDMConvertPPSDiamondSampicTimingCalib = cms.EDProducer('MEtoEDMConverter', Name = cms.untracked.string('MEtoEDMConverter'), Verbosity = cms.untracked.int32(0), @@ -24,11 +12,8 @@ deleteAfterCopy = cms.untracked.bool(True), ) -seqALCARECOPPSDiamondSampicTimingCalib = cms.Sequence( - diamondSampicLocalReconstruction* - PPSDiamondSampicTimingCalibrationPCLWorker* - diamondSampicCalibrationDQM* - dqmEnv* - dqmSaver* +taskALCARECOPPSDiamondSampicTimingCalib = cms.Task( + diamondSampicLocalReconstructionTask, + PPSDiamondSampicTimingCalibrationPCLWorker, MEtoEDMConvertPPSDiamondSampicTimingCalib ) diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py index 87ee1c7071f82..ad08ed411bea4 100644 --- a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py @@ -66,29 +66,14 @@ fileName = cms.untracked.string("worker_output.root") ) -# load DQM framework -process.load("DQM.Integration.config.environment_cfi") -process.dqmEnv.subSystemFolder = "CTPPS" -process.dqmEnv.eventInfoFolder = "EventInfo" -process.dqmSaver.path = "" -process.dqmSaver.tag = "CTPPS" - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -process.diamondSampicDQMSource = DQMEDAnalyzer('DiamondSampicCalibrationDQMSource', - tagRecHits = cms.InputTag("totemTimingRecHits"), - verbosity = cms.untracked.uint32(0) -) process.path = cms.Path( process.totemTimingRawToDigi* process.diamondSampicLocalReconstruction* - process.diamondSampicDQMSource* process.PPSDiamondSampicTimingCalibrationPCLWorker ) process.end_path = cms.EndPath( - process.dqmEnv + - process.dqmSaver+ process.dqmOutput ) diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 65840d8687250..b2c0e72c6a143 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -221,14 +221,14 @@ ALCAHARVESTPPSTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) ALCAHARVESTPPSTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), tag = cms.string('PPSDiamondTimingCalibration_pcl'), - timetype = cms.untracked.string('lumiid') + timetype = cms.untracked.string('runnumber') ) ALCAHARVESTPPSDiamondSampicTimingCalibration = PPSDiamondSampicTimingCalibrationPCLHarvester.clone() -ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd')) -ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), +ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_Sampic')) +ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd_Sampic'), tag = cms.string('DiamondSampicCalibration'), - timetype = cms.untracked.string('lumiid')) + timetype = cms.untracked.string('runnumber')) # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index 85188c2823841..3f1bfea6f0a3d 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -227,7 +227,7 @@ pathALCARECOMuAlOverlapsGeneralTracks = cms.Path(seqALCARECOMuAlOverlapsGeneralTracks) pathALCARECORpcCalHLT = cms.Path(seqALCARECORpcCalHLT) pathALCARECOPPSTimingCalib = cms.Path(taskALCARECOPPSTimingCalib) -pathALCARECOPPSDiamondSampicTimingCalib = cms.Path(seqALCARECOPPSDiamondSampicTimingCalib) +pathALCARECOPPSDiamondSampicTimingCalib = cms.Path(taskALCARECOPPSDiamondSampicTimingCalib) pathALCARECOTkAlBeamHalo = cms.Path(seqALCARECOTkAlBeamHalo*ALCARECOTkAlBeamHaloDQM) pathALCARECOMuAlBeamHaloOverlaps = cms.Path(seqALCARECOMuAlBeamHaloOverlaps) pathALCARECOMuAlBeamHalo = cms.Path(seqALCARECOMuAlBeamHalo) diff --git a/DQM/CTPPS/plugins/BuildFile.xml b/DQM/CTPPS/plugins/BuildFile.xml index f82346cffcbd3..6e804109707e8 100644 --- a/DQM/CTPPS/plugins/BuildFile.xml +++ b/DQM/CTPPS/plugins/BuildFile.xml @@ -13,4 +13,5 @@ + diff --git a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc index ea2c0aace6127..81a5cf0e4ba71 100644 --- a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc +++ b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc @@ -42,6 +42,8 @@ #include "DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h" #include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" #include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h" #include @@ -64,7 +66,9 @@ class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { // (in mm) static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + edm::EDGetTokenT> totemTimingDigiToken_; edm::EDGetTokenT> tokenRecHit_; + edm::ESGetToken timingCalibrationToken_; edm::ESGetToken geomEsToken_; unsigned int verbosity_; edm::TimeValue_t timeOfPreviousEvent_; @@ -109,6 +113,7 @@ class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id); }; + edm::ESHandle hTimingCalib_; std::unordered_map channelPlots_; }; @@ -168,7 +173,10 @@ DiamondSampicCalibrationDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker //---------------------------------------------------------------------------------------------------- DiamondSampicCalibrationDQMSource::DiamondSampicCalibrationDQMSource(const edm::ParameterSet &ps) - : tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + : totemTimingDigiToken_( + consumes>(ps.getParameter("totemTimingDigiTag"))), + tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + timingCalibrationToken_(esConsumes()), geomEsToken_(esConsumes()), verbosity_(ps.getUntrackedParameter("verbosity", 0)), timeOfPreviousEvent_(0) {} @@ -219,15 +227,28 @@ void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooke const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel()); channelPlots_[chId] = ChannelPlots(ibooker, chId); } + hTimingCalib_ = iSetup.getHandle(timingCalibrationToken_); } //---------------------------------------------------------------------------------------------------- void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { + PPSTimingCalibration calib = *hTimingCalib_; // get event setup data edm::Handle> timingRecHits; event.getByToken(tokenRecHit_, timingRecHits); + edm::Handle> timingDigi; + event.getByToken(totemTimingDigiToken_, timingDigi); + + std::unordered_map detIdToHw; + + for (const auto &digis : *timingDigi) { + const CTPPSDiamondDetId detId(digis.detId()); + for (const auto &digi : digis) + detIdToHw[detId] = digi.hardwareId(); + } + // Using TotemTimingDigi std::set boardSet; std::unordered_map channelsPerPlane; @@ -260,10 +281,13 @@ void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const e //All plots with Time if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) { - potPlots_[detId_pot].recHitTime->Fill(rechit.time()); - + int db = (detIdToHw[detId] & 0xE0) >> 5; + int sampic = (detIdToHw[detId] & 0x10) >> 4; + int channel = (detIdToHw[detId] & 0x0F); + double offset = calib.timeOffset(db, sampic, channel); + potPlots_[detId_pot].recHitTime->Fill(rechit.time() + offset); if (channelPlots_.find(detId) != channelPlots_.end()) - channelPlots_[detId].recHitTime->Fill(rechit.time()); + channelPlots_[detId].recHitTime->Fill(rechit.time() + offset); } } } From 23e672941de04a872dc61cf90a4a87f9f6784425 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 31 Aug 2021 10:34:56 -0500 Subject: [PATCH 253/923] Addes esConsumes to L1MuBMEtaProcessor --- .../L1TMuonBarrel/src/L1MuBMEtaProcessor.cc | 27 ++++++------------- .../L1TMuonBarrel/src/L1MuBMEtaProcessor.h | 20 +++++++------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.cc index 3ebb1ba904c17..95f57c4a58899 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.cc @@ -66,6 +66,7 @@ L1MuBMEtaProcessor::L1MuBMEtaProcessor(const L1MuBMTrackFinder& tf, int id, edm: m_epid(id), m_foundPattern(0), m_tseta(15), + m_bmtfParamsToken(iC.esConsumes()), m_DTDigiToken(iC.consumes(L1MuBMTFConfig::getBMThetaDigiInputTag())) { m_tseta.reserve(15); } @@ -84,13 +85,14 @@ L1MuBMEtaProcessor::~L1MuBMEtaProcessor() {} // run Eta Processor // void L1MuBMEtaProcessor::run(int bx, const edm::Event& e, const edm::EventSetup& c) { + auto const& params = c.getData(m_bmtfParamsToken); if (L1MuBMTFConfig::getEtaTF()) { - receiveData(bx, e, c); - runEtaTrackFinder(c); + receiveData(bx, e, params); + runEtaTrackFinder(params); } receiveAddresses(); - runEtaMatchingUnit(c); + runEtaMatchingUnit(params); assign(); } @@ -208,17 +210,12 @@ void L1MuBMEtaProcessor::print() const { // // receive data ( 15*3 BBMX eta trigger primitives ) // -void L1MuBMEtaProcessor::receiveData(int bx, const edm::Event& e, const edm::EventSetup& c) { - //c.get< L1MuDTTFMasksRcd >().get( msks ); - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); +void L1MuBMEtaProcessor::receiveData(int bx, const edm::Event& e, const L1TMuonBarrelParams& bmtfParams) { msks = bmtfParams.l1mudttfmasks; theEtaPatternLUT.m_lut = bmtfParams.lutparams_.eta_lut_; //l1mudttfetaplut; // ETF look-up table theQualPatternLUT.m_lut = bmtfParams.lutparams_.qp_lut_; //l1mudttfqualplut; // EMU look-up tables edm::Handle dttrig; - // e.getByLabel(L1MuBMTFConfig::getBMThetaDigiInputTag(),dttrig); e.getByToken(m_DTDigiToken, dttrig); // const int bx_offset = dttrig->correctBX(); @@ -308,11 +305,7 @@ void L1MuBMEtaProcessor::receiveAddresses() { // // run Eta Track Finder (ETF) // -void L1MuBMEtaProcessor::runEtaTrackFinder(const edm::EventSetup& c) { - //c.get< L1MuDTEtaPatternLutRcd >().get( theEtaPatternLUT ); - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); +void L1MuBMEtaProcessor::runEtaTrackFinder(const L1TMuonBarrelParams& bmtfParams) { theEtaPatternLUT.m_lut = bmtfParams.lutparams_.eta_lut_; //l1mudttfetaplut; // ETF look-up table // check if there are any data @@ -358,11 +351,7 @@ void L1MuBMEtaProcessor::runEtaTrackFinder(const edm::EventSetup& c) { // // run Eta Matching Unit (EMU) // -void L1MuBMEtaProcessor::runEtaMatchingUnit(const edm::EventSetup& c) { - //c.get< L1MuDTQualPatternLutRcd >().get( theQualPatternLUT ); - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); +void L1MuBMEtaProcessor::runEtaMatchingUnit(const L1TMuonBarrelParams& bmtfParams) { theQualPatternLUT.m_lut = bmtfParams.lutparams_.qp_lut_; //l1mudttfqualplut; // EMU look-up tables // loop over all addresses diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.h index d6012c48cc49c..8b5c63ec69fcf 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMEtaProcessor.h @@ -33,10 +33,10 @@ // Collaborating Class Declarations -- //------------------------------------ -#include -#include -#include -#include +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMAddressArray.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h" @@ -54,6 +54,7 @@ class L1MuBMTrack; class L1MuBMTEtaPatternLut; class L1MuBMTQualPatternLut; class L1MuDTTFMasks; +class L1TMuonBarrelParamsRcd; // --------------------- // -- Class Interface -- @@ -90,16 +91,16 @@ class L1MuBMEtaProcessor { private: /// receive data (eta trigger primitives) - void receiveData(int bx, const edm::Event& e, const edm::EventSetup& c); + void receiveData(int bx, const edm::Event& e, const L1TMuonBarrelParams& params); /// receive addresses (from 6 Sector Processors) void receiveAddresses(); /// run Eta Track Finder (ETF) - void runEtaTrackFinder(const edm::EventSetup& c); + void runEtaTrackFinder(const L1TMuonBarrelParams& params); /// run Eta Matching Unit (EMU) - void runEtaMatchingUnit(const edm::EventSetup& c); + void runEtaMatchingUnit(const L1TMuonBarrelParams& params); /// assign eta and etaFineBit void assign(); @@ -124,10 +125,7 @@ class L1MuBMEtaProcessor { L1MuBMTrack* m_TracKCand[12]; std::vector m_tseta; - //edm::ESHandle< L1MuDTEtaPatternLut > theEtaPatternLUT; // ETF look-up table - //edm::ESHandle< L1MuDTQualPatternLut > theQualPatternLUT; // EMU look-up tables - //edm::ESHandle< L1MuDTTFMasks > msks; - edm::ESHandle bmtfParamsHandle; + edm::ESGetToken m_bmtfParamsToken; L1MuDTTFMasks msks; L1MuBMTEtaPatternLut theEtaPatternLUT; // ETF look-up table L1MuBMTQualPatternLut theQualPatternLUT; // EMU look-up tables From 60d5c894faec0e4540e25c806dcbabff6fd998e5 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Tue, 31 Aug 2021 17:38:24 +0200 Subject: [PATCH 254/923] Removed lexical_cast boost dependency in CondFormats --- CondFormats/MFObjects/src/MagFieldConfig.cc | 5 ++--- .../interface/eos/portable_archive_exception.hpp | 3 +-- CondFormats/SiStripObjects/src/SiStripDetSummary.cc | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CondFormats/MFObjects/src/MagFieldConfig.cc b/CondFormats/MFObjects/src/MagFieldConfig.cc index 4b3853e9a0752..f1ef5440064d8 100644 --- a/CondFormats/MFObjects/src/MagFieldConfig.cc +++ b/CondFormats/MFObjects/src/MagFieldConfig.cc @@ -12,7 +12,6 @@ #include #include -#include using namespace std; using namespace magneticfield; @@ -81,8 +80,8 @@ vector MagFieldConfig::expandList(const string& list) { for (vstring::const_iterator i = v1.begin(); i != v1.end(); ++i) { vstring v2; boost::split(v2, *i, boost::is_any_of("-")); - unsigned start = boost::lexical_cast(v2.front()); - unsigned end = boost::lexical_cast(v2.back()); + unsigned start = std::stoul(v2.front()); + unsigned end = std::stoul(v2.back()); if ((v2.size() > 2) || (start > end)) { throw cms::Exception("ConfigurationError") << "VolumeBasedMagneticFieldESProducerFromDB: malformed configuration" << list << endl; diff --git a/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp b/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp index 0aa18a83c752f..0f0628a93f6d8 100644 --- a/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp +++ b/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp @@ -14,7 +14,6 @@ #pragma once -#include #include #include @@ -75,7 +74,7 @@ namespace eos { template portable_archive_exception(const T& abnormal) : boost::archive::archive_exception(other_exception), msg("serialization of illegal floating point value: ") { - msg += boost::lexical_cast(abnormal); + msg += std::to_string(abnormal); } //! override the base class function with our message diff --git a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc index 7ade22ed47d7e..f5510cb3be52f 100644 --- a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc +++ b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc @@ -34,7 +34,7 @@ void SiStripDetSummary::add(DetId detid, float value) { break; } detNum += layer * 10 + stereo; - // string name( detector + boost::lexical_cast(layer) + boost::lexical_cast(stereo) ); + // string name( detector + std::to_string(layer) + std::to_string(stereo) ); valueMap_[detNum].mean += value; valueMap_[detNum].rms += value * value; valueMap_[detNum].count += 1; From 7834317b55e1fbdfd9f8f7cfedb154fe1433c2d6 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 31 Aug 2021 18:11:05 +0200 Subject: [PATCH 255/923] Fix 2021 XML Reco config --- ...eometryDD4hepExtended2021FlatMinus05PercentReco_cff.py | 1 - ...eometryDD4hepExtended2021FlatMinus10PercentReco_cff.py | 1 - ...GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py | 1 - ...GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py | 1 - .../Geometry/python/GeometryDD4hepExtended2021Reco_cff.py | 1 - .../GeometryDD4hepExtended2021ZeroMaterialReco_cff.py | 1 - .../GeometryExtended2021FlatMinus05PercentReco_cff.py | 1 - .../GeometryExtended2021FlatMinus10PercentReco_cff.py | 1 - .../GeometryExtended2021FlatPlus05PercentReco_cff.py | 1 - .../GeometryExtended2021FlatPlus10PercentReco_cff.py | 1 - .../Geometry/python/GeometryExtended2021Reco_cff.py | 1 - .../python/GeometryExtended2021ZeroMaterialReco_cff.py | 1 - Configuration/Geometry/python/dict2021Geometry.py | 8 -------- 13 files changed, 20 deletions(-) diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py index 0e921c0acea74..3cc9ae3004e21 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py index 469e47feb7236..53fdfe55fdf7f 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py index 19aac45a7d9e7..898420b813bc8 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py index 6ca4b2f0b6b6c..ac606c5857577 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py index 8b94a6b3d9f79..bb0eed90f8e97 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py index b9ae26ff64194..2b687c4b806f1 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py index 2457ac1b060ba..c98b17ff1dce4 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py index 83ada461b0a85..0d20e27f047ab 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py index 82b4c2cf5f218..ca96a5b16ec9b 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py index 52faf9264acfd..14a33b3afc6f8 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py b/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py index 792748585f995..f573869340ef1 100644 --- a/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py index d80bc32f051fb..31be348f0238c 100644 --- a/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py @@ -12,7 +12,6 @@ from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * -trackerGeometry.applyAlignment = cms.bool(False) # calo from Geometry.CaloEventSetup.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 6461b92b41d59..0f42449d314ba 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -378,7 +378,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T2" : { @@ -581,7 +580,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T3" : { @@ -785,7 +783,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T4" : { @@ -989,7 +986,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T5" : { @@ -1194,7 +1190,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T6" : { @@ -1399,7 +1394,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T7" : { @@ -1604,7 +1598,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T8" : { @@ -1809,7 +1802,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, } From 5a89c95236d3100e98ff0ae1a94c603119fcb3fd Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 31 Aug 2021 11:11:36 -0500 Subject: [PATCH 256/923] Removed unused L1AbstractProcessor base class --- .../interface/L1AbstractProcessor.h | 48 ------------------- .../L1TMuonBarrel/src/L1MuBMAssignmentUnit.h | 13 +++-- L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h | 10 ++-- L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h | 9 ++-- .../src/L1MuBMExtrapolationUnit.h | 10 ++-- .../L1TMuonBarrel/src/L1MuBMMuonSorter.h | 10 ++-- L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h | 11 ++--- .../L1TMuonBarrel/src/L1MuBMTrackAssembler.h | 10 ++-- .../L1TMuonBarrel/src/L1MuBMWedgeSorter.h | 10 ++-- 9 files changed, 35 insertions(+), 96 deletions(-) delete mode 100644 L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h diff --git a/L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h b/L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h deleted file mode 100644 index 82727583b8e49..0000000000000 --- a/L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------- -// -/** \class L1AbstractProcessor - * - * Abstract Base Class for L1 Trigger Devices with EventSetup -*/ -// -// -// Author : -// N. Neumeister CERN EP -// -//-------------------------------------------------- -#ifndef L1_ABSTRACT_PROCESSOR_H -#define L1_ABSTRACT_PROCESSOR_H - -//--------------- -// C++ Headers -- -//--------------- - -//---------------------- -// Base Class Headers -- -//---------------------- - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ - -#include - -// --------------------- -// -- Class Interface -- -// --------------------- - -class L1AbstractProcessor { -public: - /// destructor - virtual ~L1AbstractProcessor() {} - - /// run processor logic - virtual void run(){}; - - virtual void run(const edm::EventSetup& c){}; - - /// clear event memory of processor - virtual void reset() = 0; -}; - -#endif diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h index 81678fc308901..eef6078495c4d 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h @@ -29,8 +29,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -39,7 +37,8 @@ #include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" #include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h" -#include +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMAddressArray.h" class L1MuBMTrackSegPhi; @@ -49,19 +48,19 @@ class L1MuBMLUTHandler; // -- Class Interface -- // --------------------- -class L1MuBMAssignmentUnit : public L1AbstractProcessor { +class L1MuBMAssignmentUnit { public: /// constructor L1MuBMAssignmentUnit(L1MuBMSectorProcessor& sp, int id); /// destructor - ~L1MuBMAssignmentUnit() override; + ~L1MuBMAssignmentUnit(); /// run Assignment Unit - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Assignment Unit - void reset() override; + void reset(); /// assign phi void PhiAU(const edm::EventSetup& c); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h index cf1e1bdff3304..256e236a7a7e6 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h @@ -27,8 +27,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -40,19 +38,19 @@ class L1MuBMSEU; // -- Class Interface -- // --------------------- -class L1MuBMERS : public L1AbstractProcessor { +class L1MuBMERS { public: /// constructor L1MuBMERS(const L1MuBMSEU&); /// destructor - ~L1MuBMERS() override; + ~L1MuBMERS(); /// run L1MuBMERS - void run() override; + void run(); /// reset ERS - void reset() override; + void reset(); /// return extrapolation quality inline unsigned int quality(int id) const { return m_quality[id]; } diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h index bb5a378ab465b..17a7f525dfefa 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h @@ -28,7 +28,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" #include "L1Trigger/L1TMuonBarrel/interface/L1MuBMLUTHandler.h" //------------------------------------ @@ -49,22 +48,22 @@ class L1MuDTTFParameters; // -- Class Interface -- // --------------------- -class L1MuBMEUX : public L1AbstractProcessor { +class L1MuBMEUX { public: /// constructor L1MuBMEUX(const L1MuBMSectorProcessor& sp, const L1MuBMSEU& seu, int id); /// destructor - ~L1MuBMEUX() override; + ~L1MuBMEUX(); /// equal operator bool operator==(const L1MuBMEUX&) const; /// run Extrapolator - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Extrapolator - void reset() override; + void reset(); /// load data into EUX void load(const L1MuBMTrackSegPhi* start_ts, const L1MuBMTrackSegPhi* target_ts); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h index 86cbf4927bfd6..666d1e6003a80 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h @@ -33,8 +33,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -51,7 +49,7 @@ class L1MuDTTFParameters; // -- Class Interface -- // --------------------- -class L1MuBMExtrapolationUnit : public L1AbstractProcessor { +class L1MuBMExtrapolationUnit { public: typedef std::pair SEUId; typedef std::map > SEUmap; @@ -60,13 +58,13 @@ class L1MuBMExtrapolationUnit : public L1AbstractProcessor { L1MuBMExtrapolationUnit(const L1MuBMSectorProcessor&); /// destructor - ~L1MuBMExtrapolationUnit() override; + ~L1MuBMExtrapolationUnit(); /// run Extrapolation Unit - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Extrapolation Unit - void reset() override; + void reset(); /// reset a single extrapolation void reset(Extrapolation ext, unsigned int startAdr, unsigned int relAdr); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMMuonSorter.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMMuonSorter.h index dd16cfd533ec1..6f5c66c9e4e5b 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMMuonSorter.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMMuonSorter.h @@ -28,8 +28,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -42,19 +40,19 @@ class L1MuBMSecProcId; // -- Class Interface -- // --------------------- -class L1MuBMMuonSorter : public L1AbstractProcessor { +class L1MuBMMuonSorter { public: /// constructor L1MuBMMuonSorter(const L1MuBMTrackFinder&); /// destructor - ~L1MuBMMuonSorter() override; + ~L1MuBMMuonSorter(); /// run Muon Sorter - void run() override; + void run(); /// reset Muon Sorter - void reset() override; + void reset(); /// print results after sorting void print() const; diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h index 63c37e57f0916..27319513d9ba2 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h @@ -29,12 +29,11 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ +#include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" class L1MuBMSectorProcessor; class L1MuBMTrackSegPhi; @@ -45,19 +44,19 @@ class L1MuBMERS; // -- Class Interface -- // --------------------- -class L1MuBMSEU : public L1AbstractProcessor { +class L1MuBMSEU { public: /// constructor L1MuBMSEU(const L1MuBMSectorProcessor& sp, Extrapolation ext, unsigned int tsId); /// destructor - ~L1MuBMSEU() override; + ~L1MuBMSEU(); /// run SEU - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset SEU - void reset() override; + void reset(); /// reset single extrapolation void reset(unsigned int relAdr); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h index 5872dfa46fb62..f26b9d36f3515 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h @@ -32,8 +32,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -46,19 +44,19 @@ class L1MuBMSectorProcessor; // -- Class Interface -- // --------------------- -class L1MuBMTrackAssembler : public L1AbstractProcessor { +class L1MuBMTrackAssembler { public: /// constructor L1MuBMTrackAssembler(const L1MuBMSectorProcessor&); /// destructor - ~L1MuBMTrackAssembler() override; + ~L1MuBMTrackAssembler(); /// run Track Assembler - void run() override; + void run(); /// reset Track Assembler - void reset() override; + void reset(); /// print result of Track Assembler void print() const; diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMWedgeSorter.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMWedgeSorter.h index a3376f98da89a..ff3ff4db42931 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMWedgeSorter.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMWedgeSorter.h @@ -28,8 +28,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -42,22 +40,22 @@ class L1MuBMSecProcId; // -- Class Interface -- // --------------------- -class L1MuBMWedgeSorter : public L1AbstractProcessor { +class L1MuBMWedgeSorter { public: /// constructor L1MuBMWedgeSorter(const L1MuBMTrackFinder&, int id); /// destructor - ~L1MuBMWedgeSorter() override; + ~L1MuBMWedgeSorter(); /// return Wedge Sorter identifier (0-11) inline int id() const { return m_wsid; } /// run Wedge Sorter - void run() override; + void run(); /// reset Wedge Sorter - void reset() override; + void reset(); /// print results after sorting void print() const; From 3d12a09adb96b4c84ae480f56b297d9071c96367 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 31 Aug 2021 18:19:41 +0200 Subject: [PATCH 257/923] Reorganize the files in SimCalorimetry/CastorTechTrigProducer and merge .h files --- .../{ => plugins}/BuildFile.xml | 5 +- .../{src => plugins}/CastorTTRecord.cc | 49 ++++++++++++++++++- .../src/CastorTTRecord.h | 47 ------------------ .../CastorTechTrigProducer/src/SealModule.cc | 5 -- 4 files changed, 51 insertions(+), 55 deletions(-) rename SimCalorimetry/CastorTechTrigProducer/{ => plugins}/BuildFile.xml (72%) rename SimCalorimetry/CastorTechTrigProducer/{src => plugins}/CastorTTRecord.cc (83%) delete mode 100644 SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h delete mode 100644 SimCalorimetry/CastorTechTrigProducer/src/SealModule.cc diff --git a/SimCalorimetry/CastorTechTrigProducer/BuildFile.xml b/SimCalorimetry/CastorTechTrigProducer/plugins/BuildFile.xml similarity index 72% rename from SimCalorimetry/CastorTechTrigProducer/BuildFile.xml rename to SimCalorimetry/CastorTechTrigProducer/plugins/BuildFile.xml index 20c6355823a6b..23ec1218f9162 100644 --- a/SimCalorimetry/CastorTechTrigProducer/BuildFile.xml +++ b/SimCalorimetry/CastorTechTrigProducer/plugins/BuildFile.xml @@ -6,4 +6,7 @@ - + + + + diff --git a/SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.cc b/SimCalorimetry/CastorTechTrigProducer/plugins/CastorTTRecord.cc similarity index 83% rename from SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.cc rename to SimCalorimetry/CastorTechTrigProducer/plugins/CastorTTRecord.cc index 6d05064ec4c27..28536a6389ecd 100644 --- a/SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.cc +++ b/SimCalorimetry/CastorTechTrigProducer/plugins/CastorTTRecord.cc @@ -1,13 +1,53 @@ -#include "SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h" - #include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" #include "CalibFormats/CastorObjects/interface/CastorCoderDb.h" +#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" +#include "CalibFormats/CastorObjects/interface/CastorDbService.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalDigi/interface/HcalTTPDigi.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtTechnicalTriggerRecord.h" +#include "FWCore/Framework/interface/one/EDProducer.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/ESGetToken.h" + +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" + +class CastorTTRecord : public edm::one::EDProducer<> { +public: + explicit CastorTTRecord(const edm::ParameterSet &ps); + ~CastorTTRecord() override; + + void produce(edm::Event &e, const edm::EventSetup &c) override; + + // get fC from digis and save it to array double energy[16 sectors][14 + // modules] + void getEnergy_fC(double energy[16][14], + edm::Handle &CastorDigiColl, + edm::Event &e, + const edm::EventSetup &c); + + // get Trigger decisions | vector needs same SIZE and ORDER as in 'ttpBits_' + void getTriggerDecisions(std::vector &decision, double energy[16][14]) const; + + // get Trigger decisions for every octant | vector has size of 6 -> 6 HTR card + // bits + void getTriggerDecisionsPerOctant(std::vector tdps[16], double energy[16][14]) const; + +private: + edm::EDGetTokenT CastorDigiColl_; + unsigned int CastorSignalTS_; + + std::vector ttpBits_; + std::vector TrigNames_; + std::vector TrigThresholds_; + edm::ESGetToken conditionsToken_; + + double reweighted_gain; +}; CastorTTRecord::CastorTTRecord(const edm::ParameterSet &ps) { CastorDigiColl_ = consumes(ps.getParameter("CastorDigiCollection")); @@ -261,3 +301,8 @@ void CastorTTRecord::getTriggerDecisionsPerOctant(std::vector tdpo[8], dou } } } + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" + +DEFINE_FWK_MODULE(CastorTTRecord); diff --git a/SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h b/SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h deleted file mode 100644 index 9cb911515242d..0000000000000 --- a/SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef CastorTechTrigProducer_CastorTTRecord_h -#define CastorTechTrigProducer_CastorTTRecord_h - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/one/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" -#include "CalibFormats/CastorObjects/interface/CastorDbService.h" - -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" - -class CastorTTRecord : public edm::one::EDProducer<> { -public: - explicit CastorTTRecord(const edm::ParameterSet &ps); - ~CastorTTRecord() override; - - void produce(edm::Event &e, const edm::EventSetup &c) override; - - // get fC from digis and save it to array double energy[16 sectors][14 - // modules] - void getEnergy_fC(double energy[16][14], - edm::Handle &CastorDigiColl, - edm::Event &e, - const edm::EventSetup &c); - - // get Trigger decisions | vector needs same SIZE and ORDER as in 'ttpBits_' - void getTriggerDecisions(std::vector &decision, double energy[16][14]) const; - - // get Trigger decisions for every octant | vector has size of 6 -> 6 HTR card - // bits - void getTriggerDecisionsPerOctant(std::vector tdps[16], double energy[16][14]) const; - -private: - edm::EDGetTokenT CastorDigiColl_; - unsigned int CastorSignalTS_; - - std::vector ttpBits_; - std::vector TrigNames_; - std::vector TrigThresholds_; - edm::ESGetToken conditionsToken_; - - double reweighted_gain; -}; - -#endif diff --git a/SimCalorimetry/CastorTechTrigProducer/src/SealModule.cc b/SimCalorimetry/CastorTechTrigProducer/src/SealModule.cc deleted file mode 100644 index 265d15106a35e..0000000000000 --- a/SimCalorimetry/CastorTechTrigProducer/src/SealModule.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h" - -DEFINE_FWK_MODULE(CastorTTRecord); From 258a2cf61196796296309986400dbb20e3f95fca Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari <48947123+Purva-Chaudhari@users.noreply.github.com> Date: Tue, 31 Aug 2021 22:43:47 +0530 Subject: [PATCH 258/923] cleared unneeded comments --- CondFormats/SiStripObjects/src/SiStripDetSummary.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc index f5510cb3be52f..495ef24a2dff3 100644 --- a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc +++ b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc @@ -34,7 +34,6 @@ void SiStripDetSummary::add(DetId detid, float value) { break; } detNum += layer * 10 + stereo; - // string name( detector + std::to_string(layer) + std::to_string(stereo) ); valueMap_[detNum].mean += value; valueMap_[detNum].rms += value * value; valueMap_[detNum].count += 1; From d363c3b37d28dbf5e59d43012b7e1827af301576 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 11 Jul 2021 11:19:01 +0200 Subject: [PATCH 259/923] Merge .h and .cc files of some more PhysicsTools plugins --- .../plugins/CandIsoDepositProducer.cc | 49 ++++++--- .../plugins/CandIsoDepositProducer.h | 42 -------- .../plugins/CandIsolatorFromDeposits.cc | 67 +++++++++--- .../plugins/CandIsolatorFromDeposits.h | 62 ----------- .../plugins/CandViewExtractor.cc | 101 ++++++++++++++++-- .../plugins/CandViewExtractor.h | 67 ------------ .../plugins/CandViewExtractor.icc | 34 ------ .../IsolationAlgos/plugins/PFTauExtractor.cc | 51 +++++++-- .../IsolationAlgos/plugins/PFTauExtractor.h | 53 --------- .../ElectronMatchedCandidateProducer.h | 34 ------ .../ElectronMatchedCandidateProducer.cc | 30 ++++-- 11 files changed, 248 insertions(+), 342 deletions(-) delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.icc delete mode 100644 PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h delete mode 100644 PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h diff --git a/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc b/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc index 191b7cd1f51c3..2bd006abcdf2c 100644 --- a/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc @@ -1,26 +1,44 @@ -#include "PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.h" - -// Framework +#include "DataFormats/Common/interface/AssociationVector.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/RefToBaseProd.h" +#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" +#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" +#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.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 "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractorFactory.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/MuonReco/interface/Muon.h" +class CandIsoDepositProducer : public edm::stream::EDProducer<> { +public: + CandIsoDepositProducer(const edm::ParameterSet &); -#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" -#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" + ~CandIsoDepositProducer() override; -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractorFactory.h" + void produce(edm::Event &, const edm::EventSetup &) override; -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include +private: + inline const reco::Track *extractTrack(const reco::Candidate &cand, reco::Track *dummyStorage) const; + enum TrackType { FakeT, BestT, StandAloneMuonT, CombinedMuonT, TrackT, GsfT, CandidateT }; + edm::ParameterSet theConfig; + edm::EDGetTokenT > theCandCollectionToken; + TrackType theTrackType; + std::vector theDepositNames; + bool theMultipleDepositsFlag; + std::unique_ptr theExtractor; +}; using namespace edm; using namespace reco; @@ -177,4 +195,5 @@ void CandIsoDepositProducer::produce(Event &event, const EventSetup &eventSetup) } //! for(iDep - -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" - -#include - -namespace edm { - class Event; -} -namespace edm { - class EventSetup; -} - -class CandIsoDepositProducer : public edm::stream::EDProducer<> { -public: - CandIsoDepositProducer(const edm::ParameterSet &); - - ~CandIsoDepositProducer() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - inline const reco::Track *extractTrack(const reco::Candidate &cand, reco::Track *dummyStorage) const; - enum TrackType { FakeT, BestT, StandAloneMuonT, CombinedMuonT, TrackT, GsfT, CandidateT }; - edm::ParameterSet theConfig; - edm::EDGetTokenT > theCandCollectionToken; - TrackType theTrackType; - std::vector theDepositNames; - bool theMultipleDepositsFlag; - std::unique_ptr theExtractor; -}; -#endif diff --git a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc b/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc index 651dbca49fd3f..58d39d1427464 100644 --- a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc @@ -1,27 +1,63 @@ -#include "PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h" - -// Framework -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "CommonTools/Utils/interface/StringObjectFunction.h" +#include "DataFormats/Candidate/interface/CandAssociation.h" +#include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" - -#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" #include "DataFormats/RecoCandidate/interface/IsoDeposit.h" +#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h" - -#include "DataFormats/Candidate/interface/CandAssociation.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDProducer.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" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" + #include #include -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" +class CandIsolatorFromDeposits : public edm::stream::EDProducer<> { +public: + typedef edm::ValueMap CandDoubleMap; + + enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR, MeanDR, SumDR }; + CandIsolatorFromDeposits(const edm::ParameterSet &); + + ~CandIsolatorFromDeposits() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + +private: + class SingleDeposit { + public: + SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); + void cleanup(); + void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); + double compute(const reco::CandidateBaseRef &cand); + const reco::IsoDepositMap &map() { return *hDeps_; } + + private: + Mode mode_; + edm::EDGetTokenT srcToken_; + double deltaR_; + bool usesFunction_; + double weight_; + StringObjectFunction weightExpr_; + reco::isodeposit::AbsVetos vetos_; + reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! + bool skipDefaultVeto_; + edm::Handle hDeps_; // transient + }; + // datamembers + std::vector sources_; +}; using namespace edm; using namespace reco; @@ -193,4 +229,5 @@ void CandIsolatorFromDeposits::produce(Event &event, const EventSetup &eventSetu event.put(std::move(ret)); } +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(CandIsolatorFromDeposits); diff --git a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h b/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h deleted file mode 100644 index 7b4ec440489d2..0000000000000 --- a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef MuonIsolationProducers_CandIsolatorFromDeposits_H -#define MuonIsolationProducers_CandIsolatorFromDeposits_H - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" - -#include "DataFormats/Candidate/interface/Candidate.h" -#include "CommonTools/Utils/interface/StringObjectFunction.h" -#include "DataFormats/Common/interface/OwnVector.h" - -#include - -namespace edm { - class Event; -} -namespace edm { - class EventSetup; -} - -class CandIsolatorFromDeposits : public edm::stream::EDProducer<> { -public: - typedef edm::ValueMap CandDoubleMap; - - enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR, MeanDR, SumDR }; - CandIsolatorFromDeposits(const edm::ParameterSet &); - - ~CandIsolatorFromDeposits() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - class SingleDeposit { - public: - SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); - void cleanup(); - void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); - double compute(const reco::CandidateBaseRef &cand); - const reco::IsoDepositMap &map() { return *hDeps_; } - - private: - Mode mode_; - edm::EDGetTokenT srcToken_; - double deltaR_; - bool usesFunction_; - double weight_; - StringObjectFunction weightExpr_; - reco::isodeposit::AbsVetos vetos_; - reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! - bool skipDefaultVeto_; - edm::Handle hDeps_; // transient - }; - // datamembers - std::vector sources_; -}; -#endif diff --git a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.cc b/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.cc index 22ffc2cc39964..c9160daa4a864 100644 --- a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.cc @@ -1,17 +1,105 @@ -#include "CandViewExtractor.h" - -#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" +#include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" +#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" #include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/Math/interface/deltaR.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" + +#include +#include + +namespace muonisolation { + + class CandViewExtractor : public reco::isodeposit::IsoDepositExtractor { + public: + CandViewExtractor(){}; + CandViewExtractor(const edm::ParameterSet& par, edm::ConsumesCollector&& iC); + + ~CandViewExtractor() override {} + + void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& cand) override {} + + /* virtual reco::IsoDeposit::Vetos vetos(const edm::Event & ev, + const edm::EventSetup & evSetup, const reco::Candidate & cand) const; + + virtual reco::IsoDeposit::Vetos vetos(const edm::Event & ev, + const edm::EventSetup & evSetup, const reco::Track & cand) const; +*/ + + void initEvent(const edm::Event& ev, const edm::EventSetup& evSetup) override; + + reco::IsoDeposit deposit(const edm::Event& ev, + const edm::EventSetup& evSetup, + const reco::Track& muon) const override { + return depositFromObject(ev, evSetup, muon); + } + + reco::IsoDeposit deposit(const edm::Event& ev, + const edm::EventSetup& evSetup, + const reco::Candidate& muon) const override { + return depositFromObject(ev, evSetup, muon); + } + + private: + reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction& dir) const; + + template + reco::IsoDeposit depositFromObject(const edm::Event& ev, const edm::EventSetup& evSetup, const T& cand) const; + + // Parameter set + edm::EDGetTokenT > theCandViewToken; // Track Collection Label + std::string theDepositLabel; // name for deposit + edm::Handle > theCandViewH; //cached handle + edm::Event::CacheIdentifier_t theCacheID; //event cacheID + double theDiff_r; // transverse distance to vertex + double theDiff_z; // z distance to vertex + double theDR_Max; // Maximum cone angle for deposits + double theDR_Veto; // Veto cone angle + }; + +} // namespace muonisolation using namespace edm; using namespace reco; using namespace muonisolation; -#include "CandViewExtractor.icc" +template +IsoDeposit CandViewExtractor::depositFromObject(const Event& event, const EventSetup& eventSetup, const T& cand) const { + static const std::string metname = "MuonIsolation|CandViewExtractor"; + + reco::isodeposit::Direction candDir(cand.eta(), cand.phi()); + IsoDeposit deposit(candDir); + deposit.setVeto(veto(candDir)); + deposit.addCandEnergy(cand.pt()); + + Handle > candViewH; + if (theCacheID != event.cacheIdentifier()) { + event.getByToken(theCandViewToken, candViewH); + } else { + candViewH = theCandViewH; + } + + double eta = cand.eta(), phi = cand.phi(); + const reco::Particle::Point& vtx = cand.vertex(); + LogDebug(metname) << "cand eta=" << eta << " phi=" << phi << " vtx=" << vtx; + for (View::const_iterator it = candViewH->begin(), ed = candViewH->end(); it != ed; ++it) { + double dR = deltaR(it->eta(), it->phi(), eta, phi); + LogDebug(metname) << "pdgid=" << it->pdgId() << " vtx=" << it->vertex() << " dR=" << dR + << " dvz=" << it->vz() - cand.vz() << " drho=" << (it->vertex() - vtx).Rho(); + if ((dR < theDR_Max) && (dR > theDR_Veto) && (std::abs(it->vz() - cand.vz()) < theDiff_z) && + ((it->vertex() - vtx).Rho() < theDiff_r)) { + // ok + reco::isodeposit::Direction dirTrk(it->eta(), it->phi()); + deposit.addDeposit(dirTrk, it->pt()); + LogDebug(metname) << "pt=" << it->pt(); + } + } + + return deposit; +} CandViewExtractor::CandViewExtractor(const ParameterSet& par, edm::ConsumesCollector&& iC) : theCandViewToken(iC.consumes >(par.getParameter("inputCandView"))), @@ -46,5 +134,4 @@ void CandViewExtractor::initEvent(const edm::Event& ev, const edm::EventSetup& e #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractorFactory.h" -#include "CandViewExtractor.h" DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::CandViewExtractor, "CandViewExtractor"); diff --git a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.h b/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.h deleted file mode 100644 index cc96c62cb3500..0000000000000 --- a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef MuonIsolation_CandViewExtractor_H -#define MuonIsolation_CandViewExtractor_H - -#include -#include - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" - -namespace muonisolation { - - class CandViewExtractor : public reco::isodeposit::IsoDepositExtractor { - public: - CandViewExtractor(){}; - CandViewExtractor(const edm::ParameterSet& par, edm::ConsumesCollector&& iC); - - ~CandViewExtractor() override {} - - void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& cand) override {} - - /* virtual reco::IsoDeposit::Vetos vetos(const edm::Event & ev, - const edm::EventSetup & evSetup, const reco::Candidate & cand) const; - - virtual reco::IsoDeposit::Vetos vetos(const edm::Event & ev, - const edm::EventSetup & evSetup, const reco::Track & cand) const; -*/ - - void initEvent(const edm::Event& ev, const edm::EventSetup& evSetup) override; - - reco::IsoDeposit deposit(const edm::Event& ev, - const edm::EventSetup& evSetup, - const reco::Track& muon) const override { - return depositFromObject(ev, evSetup, muon); - } - - reco::IsoDeposit deposit(const edm::Event& ev, - const edm::EventSetup& evSetup, - const reco::Candidate& muon) const override { - return depositFromObject(ev, evSetup, muon); - } - - private: - reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction& dir) const; - - template - reco::IsoDeposit depositFromObject(const edm::Event& ev, const edm::EventSetup& evSetup, const T& cand) const; - - // Parameter set - edm::EDGetTokenT > theCandViewToken; // Track Collection Label - std::string theDepositLabel; // name for deposit - edm::Handle > theCandViewH; //cached handle - edm::Event::CacheIdentifier_t theCacheID; //event cacheID - double theDiff_r; // transverse distance to vertex - double theDiff_z; // z distance to vertex - double theDR_Max; // Maximum cone angle for deposits - double theDR_Veto; // Veto cone angle - }; - -} // namespace muonisolation - -#endif diff --git a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.icc b/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.icc deleted file mode 100644 index 681e3f8a10118..0000000000000 --- a/PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.icc +++ /dev/null @@ -1,34 +0,0 @@ -template -IsoDeposit CandViewExtractor::depositFromObject(const Event& event, const EventSetup& eventSetup, const T& cand) const { - static const std::string metname = "MuonIsolation|CandViewExtractor"; - - reco::isodeposit::Direction candDir(cand.eta(), cand.phi()); - IsoDeposit deposit(candDir); - deposit.setVeto(veto(candDir)); - deposit.addCandEnergy(cand.pt()); - - Handle > candViewH; - if (theCacheID != event.cacheIdentifier()) { - event.getByToken(theCandViewToken, candViewH); - } else { - candViewH = theCandViewH; - } - - double eta = cand.eta(), phi = cand.phi(); - const reco::Particle::Point& vtx = cand.vertex(); - LogDebug(metname) << "cand eta=" << eta << " phi=" << phi << " vtx=" << vtx; - for (View::const_iterator it = candViewH->begin(), ed = candViewH->end(); it != ed; ++it) { - double dR = deltaR(it->eta(), it->phi(), eta, phi); - LogDebug(metname) << "pdgid=" << it->pdgId() << " vtx=" << it->vertex() << " dR=" << dR - << " dvz=" << it->vz() - cand.vz() << " drho=" << (it->vertex() - vtx).Rho(); - if ((dR < theDR_Max) && (dR > theDR_Veto) && (std::abs(it->vz() - cand.vz()) < theDiff_z) && - ((it->vertex() - vtx).Rho() < theDiff_r)) { - // ok - reco::isodeposit::Direction dirTrk(it->eta(), it->phi()); - deposit.addDeposit(dirTrk, it->pt()); - LogDebug(metname) << "pt=" << it->pt(); - } - } - - return deposit; -} diff --git a/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.cc b/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.cc index 7e5c38c43df95..57b31fc5b72aa 100644 --- a/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.cc +++ b/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.cc @@ -1,13 +1,50 @@ -#include "PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/TauReco/interface/PFTau.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "FWCore/Framework/interface/ConsumesCollector.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/Utilities/interface/InputTag.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" + +class PFTauExtractor : public reco::isodeposit::IsoDepositExtractor { +public: + explicit PFTauExtractor(const edm::ParameterSet&, edm::ConsumesCollector&& iC); + ~PFTauExtractor() override {} + + /// definition of pure virtual functions inherited from IsoDepositExtractor base-class + void fillVetos(const edm::Event&, const edm::EventSetup&, const reco::TrackCollection&) override {} + reco::IsoDeposit deposit(const edm::Event& evt, const edm::EventSetup& es, const reco::Track& track) const override { + return depositFromObject(evt, es, track); + } + reco::IsoDeposit deposit(const edm::Event& evt, + const edm::EventSetup& es, + const reco::Candidate& candidate) const override { + return depositFromObject(evt, es, candidate); + } -#include "DataFormats/Math/interface/deltaR.h" +private: + /// configuration parameters + edm::EDGetTokenT tauSourceToken_; + edm::EDGetTokenT > candidateSourceToken_; + double maxDxyTrack_; + double maxDzTrack_; + double dRmatchPFTau_; + double dRVetoCone_; + double dRIsoCone_; + double dRvetoPFTauSignalConeConstituents_; + + /// private member function for computing the IsoDeposits + /// in case of reco::Track as well as in case of reco::Canididate input + template + reco::IsoDeposit depositFromObject(const edm::Event&, const edm::EventSetup&, const T&) const; +}; PFTauExtractor::PFTauExtractor(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) { tauSourceToken_ = iC.consumes(cfg.getParameter("tauSource")); diff --git a/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h b/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h deleted file mode 100644 index 6bac332e3dca7..0000000000000 --- a/PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef PhysicsTools_IsolationAlgos_PFTauExtractor_H -#define PhysicsTools_IsolationAlgos_PFTauExtractor_H - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "DataFormats/TauReco/interface/PFTau.h" -#include "DataFormats/TauReco/interface/PFTauFwd.h" - -class PFTauExtractor : public reco::isodeposit::IsoDepositExtractor { -public: - explicit PFTauExtractor(const edm::ParameterSet&, edm::ConsumesCollector&& iC); - ~PFTauExtractor() override {} - - /// definition of pure virtual functions inherited from IsoDepositExtractor base-class - void fillVetos(const edm::Event&, const edm::EventSetup&, const reco::TrackCollection&) override {} - reco::IsoDeposit deposit(const edm::Event& evt, const edm::EventSetup& es, const reco::Track& track) const override { - return depositFromObject(evt, es, track); - } - reco::IsoDeposit deposit(const edm::Event& evt, - const edm::EventSetup& es, - const reco::Candidate& candidate) const override { - return depositFromObject(evt, es, candidate); - } - -private: - /// configuration parameters - edm::EDGetTokenT tauSourceToken_; - edm::EDGetTokenT > candidateSourceToken_; - double maxDxyTrack_; - double maxDzTrack_; - double dRmatchPFTau_; - double dRVetoCone_; - double dRIsoCone_; - double dRvetoPFTauSignalConeConstituents_; - - /// private member function for computing the IsoDeposits - /// in case of reco::Track as well as in case of reco::Canididate input - template - reco::IsoDeposit depositFromObject(const edm::Event&, const edm::EventSetup&, const T&) const; -}; - -#endif diff --git a/PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h b/PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h deleted file mode 100644 index a80246bbd5f2c..0000000000000 --- a/PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef PhysicsTools_TagAndProbe_ElectronMatchedCandidateProducer_h -#define PhysicsTools_TagAndProbe_ElectronMatchedCandidateProducer_h - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" - -// forward declarations - -class ElectronMatchedCandidateProducer : public edm::EDProducer { -public: - explicit ElectronMatchedCandidateProducer(const edm::ParameterSet&); - ~ElectronMatchedCandidateProducer() override; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - // ----------member data --------------------------- - - edm::EDGetTokenT > electronCollectionToken_; - edm::EDGetTokenT > scCollectionToken_; - double delRMatchingCut_; -}; - -#endif diff --git a/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc b/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc index 96c066e995afb..51c9f20a12ac1 100644 --- a/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc +++ b/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc @@ -1,8 +1,27 @@ -#include "PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include + +class ElectronMatchedCandidateProducer : public edm::EDProducer { +public: + explicit ElectronMatchedCandidateProducer(const edm::ParameterSet &); + +private: + void beginJob() override; + void produce(edm::Event &, const edm::EventSetup &) override; + void endJob() override; -#include "DataFormats/Math/interface/deltaR.h" // reco::deltaR + // ----------member data --------------------------- + + edm::EDGetTokenT> electronCollectionToken_; + edm::EDGetTokenT> scCollectionToken_; + double delRMatchingCut_; +}; ElectronMatchedCandidateProducer::ElectronMatchedCandidateProducer(const edm::ParameterSet ¶ms) { const edm::InputTag allelectrons("gsfElectrons"); @@ -16,15 +35,13 @@ ElectronMatchedCandidateProducer::ElectronMatchedCandidateProducer(const edm::Pa produces>(); } -ElectronMatchedCandidateProducer::~ElectronMatchedCandidateProducer() {} - // // member functions // // ------------ method called to produce the data ------------ -void ElectronMatchedCandidateProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { +void ElectronMatchedCandidateProducer::produce(edm::Event &event, const edm::EventSetup &) { // Create the output collection auto outColRef = std::make_unique>(); auto outColPtr = std::make_unique>(); @@ -68,4 +85,5 @@ void ElectronMatchedCandidateProducer::beginJob() {} void ElectronMatchedCandidateProducer::endJob() {} //define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(ElectronMatchedCandidateProducer); From 7bfe8d873bbc14526c497e05dd3beb36d69490b5 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 31 Aug 2021 12:26:41 -0500 Subject: [PATCH 260/923] Added esConsumes to helper classes in L1TMuonBarrel --- L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc | 9 +-------- L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h | 7 +------ .../L1TMuonBarrel/src/L1MuBMExtrapolationUnit.cc | 10 ++++------ .../L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h | 8 ++++---- L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc | 4 ++-- L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h | 3 ++- .../L1TMuonBarrel/src/L1MuBMSectorProcessor.cc | 2 +- .../L1TMuonBarrel/src/L1MuBMSectorReceiver.cc | 15 ++++++--------- .../L1TMuonBarrel/src/L1MuBMSectorReceiver.h | 7 ++----- 9 files changed, 23 insertions(+), 42 deletions(-) diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc index ddf939f2226e5..4d08d18cee84d 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc @@ -88,14 +88,7 @@ bool L1MuBMEUX::operator==(const L1MuBMEUX& eux) const { // // run EUX // -void L1MuBMEUX::run(const edm::EventSetup& c) { - //c.get< L1MuDTExtLutRcd >().get( theExtLUTs ); - // c.get< L1MuDTTFParametersRcd >().get( pars ); - - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); - +void L1MuBMEUX::run(const L1TMuonBarrelParams& bmtfParams) { pars = bmtfParams.l1mudttfparams; theExtLUTs = new L1MuBMLUTHandler(bmtfParams); ///< ext look-up tables diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h index 17a7f525dfefa..05b002ade0d69 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h @@ -34,7 +34,6 @@ // Collaborating Class Declarations -- //------------------------------------ -#include #include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" #include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h" @@ -60,7 +59,7 @@ class L1MuBMEUX { bool operator==(const L1MuBMEUX&) const; /// run Extrapolator - void run(const edm::EventSetup& c); + void run(const L1TMuonBarrelParams& c); /// reset Extrapolator void reset(); @@ -117,15 +116,11 @@ class L1MuBMEUX { const L1MuBMTrackSegPhi* m_start; // start track segment const L1MuBMTrackSegPhi* m_target; // target track segment - edm::ESHandle bmtfParamsHandle; - - //edm::ESHandle< L1MuDTExtLut > theExtLUTs; // extrapolation look-up tables L1MuBMLUTHandler* theExtLUTs; int const theExtFilter = 1; // extrapolation quality filter unsigned short const nbit_phi = 12; // number of bits used for phi unsigned short const nbit_phib = 10; // number of bits used for phib - //edm::ESHandle< L1MuDTTFParameters > pars; L1MuDTTFParameters pars; }; diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.cc index 5851873983715..18cf1af464592 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.cc @@ -52,7 +52,8 @@ using namespace std; // Constructors -- //---------------- -L1MuBMExtrapolationUnit::L1MuBMExtrapolationUnit(const L1MuBMSectorProcessor& sp) : m_sp(sp), m_SEUs() { +L1MuBMExtrapolationUnit::L1MuBMExtrapolationUnit(const L1MuBMSectorProcessor& sp, edm::ConsumesCollector cc) + : m_sp(sp), m_SEUs(), m_paramsToken(cc.esConsumes()) { for (int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++) { Extrapolation ext = static_cast(ext_idx); @@ -92,10 +93,7 @@ L1MuBMExtrapolationUnit::~L1MuBMExtrapolationUnit() { // run Extrapolation Unit // void L1MuBMExtrapolationUnit::run(const edm::EventSetup& c) { - //c.get< L1MuDTTFParametersRcd >().get( pars ); - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); + const L1TMuonBarrelParams& bmtfParams = c.getData(m_paramsToken); pars = bmtfParams.l1mudttfparams; SEUmap::const_iterator iter; @@ -110,7 +108,7 @@ void L1MuBMExtrapolationUnit::run(const edm::EventSetup& c) { if (ts != nullptr && !ts->empty()) { ((*iter).second)->load(ts); - ((*iter).second)->run(c); + ((*iter).second)->run(bmtfParams); } } diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h index 666d1e6003a80..8fd99b93e74a6 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h @@ -40,7 +40,8 @@ #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" #include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" #include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h" -#include +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EventSetup.h" class L1MuBMSectorProcessor; class L1MuBMSEU; class L1MuDTTFParameters; @@ -55,7 +56,7 @@ class L1MuBMExtrapolationUnit { typedef std::map > SEUmap; /// constructor - L1MuBMExtrapolationUnit(const L1MuBMSectorProcessor&); + L1MuBMExtrapolationUnit(const L1MuBMSectorProcessor&, edm::ConsumesCollector iC); /// destructor ~L1MuBMExtrapolationUnit(); @@ -95,8 +96,7 @@ class L1MuBMExtrapolationUnit { mutable SEUmap m_SEUs; // Single Extrapolation Units - //edm::ESHandle< L1MuDTTFParameters > pars; - edm::ESHandle bmtfParamsHandle; + edm::ESGetToken m_paramsToken; L1MuDTTFParameters pars; }; diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc index 6742b07fca49f..489d805099464 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc @@ -82,7 +82,7 @@ L1MuBMSEU::~L1MuBMSEU() { // // run SEU // -void L1MuBMSEU::run(const edm::EventSetup& c) { +void L1MuBMSEU::run(const L1TMuonBarrelParams& params) { if (L1MuBMTFConfig::Debug(3)) cout << "Run SEU " << m_ext << " " << m_startTS_Id << endl; @@ -121,7 +121,7 @@ void L1MuBMSEU::run(const edm::EventSetup& c) { const L1MuBMTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr); if (target_ts && !target_ts->empty()) { m_EUXs[reladr]->load(m_startTS, target_ts); - m_EUXs[reladr]->run(c); + m_EUXs[reladr]->run(params); if (m_EUXs[reladr]->result()) m_EXtable.set(reladr); } diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h index 27319513d9ba2..249b1a2282ce9 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h @@ -36,6 +36,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" class L1MuBMSectorProcessor; +class L1TMuonBarrelParams; class L1MuBMTrackSegPhi; class L1MuBMEUX; class L1MuBMERS; @@ -53,7 +54,7 @@ class L1MuBMSEU { ~L1MuBMSEU(); /// run SEU - void run(const edm::EventSetup& c); + void run(const L1TMuonBarrelParams& params); /// reset SEU void reset(); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc index 69aa07c060b00..6af6a9ff3a6a2 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc @@ -60,7 +60,7 @@ L1MuBMSectorProcessor::L1MuBMSectorProcessor(const L1MuBMTrackFinder& tf, m_spid(id), m_SectorReceiver(new L1MuBMSectorReceiver(*this, std::move(iC))), m_DataBuffer(new L1MuBMDataBuffer(*this)), - m_EU(new L1MuBMExtrapolationUnit(*this)), + m_EU(new L1MuBMExtrapolationUnit(*this, iC)), m_TA(new L1MuBMTrackAssembler(*this)), m_AUs(), m_TrackCands(), diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.cc index 87b3aa7d3fbfc..74fd1bc5fd954 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.cc @@ -50,7 +50,9 @@ using namespace std; // Constructors -- //---------------- L1MuBMSectorReceiver::L1MuBMSectorReceiver(L1MuBMSectorProcessor& sp, edm::ConsumesCollector&& iC) - : m_sp(sp), m_DTDigiToken(iC.consumes(L1MuBMTFConfig::getBMDigiInputTag())) {} + : m_sp(sp), + m_bmtfParamsToken(iC.esConsumes()), + m_DTDigiToken(iC.consumes(L1MuBMTFConfig::getBMDigiInputTag())) {} //-------------- // Destructor -- @@ -67,19 +69,14 @@ L1MuBMSectorReceiver::~L1MuBMSectorReceiver() { // receive track segment data from the BBMX chamber triggers // void L1MuBMSectorReceiver::run(int bx, const edm::Event& e, const edm::EventSetup& c) { - //c.get< L1MuDTTFParametersRcd >().get( pars ); - //c.get< L1MuDTTFMasksRcd >().get( msks ); - - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); + const L1TMuonBarrelParams& bmtfParams = c.getData(m_bmtfParamsToken); msks = bmtfParams.l1mudttfmasks; pars = bmtfParams.l1mudttfparams; //pars.print(); //msks.print(); // get track segments from BBMX chamber trigger - receiveBBMXData(bx, e, c); + receiveBBMXData(bx, e); } // @@ -90,7 +87,7 @@ void L1MuBMSectorReceiver::reset() {} // // receive track segment data from the BBMX chamber trigger // -void L1MuBMSectorReceiver::receiveBBMXData(int bx, const edm::Event& e, const edm::EventSetup& c) { +void L1MuBMSectorReceiver::receiveBBMXData(int bx, const edm::Event& e) { edm::Handle dttrig; //e.getByLabel(L1MuBMTFConfig::getBMDigiInputTag(),dttrig); e.getByToken(m_DTDigiToken, dttrig); diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.h index 60428cfd24f9b..98da237130e69 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.h @@ -66,10 +66,7 @@ class L1MuBMSectorReceiver { private: /// receive track segment data from BBMX chamber trigger - void receiveBBMXData(int bx, const edm::Event& e, const edm::EventSetup& c); - - /// receive track segment data from CSC chamber trigger - void receiveCSCData(int bx, const edm::Event& e, const edm::EventSetup& c); + void receiveBBMXData(int bx, const edm::Event& e); /// find the right sector for a given address int address2sector(int adr) const; @@ -80,7 +77,7 @@ class L1MuBMSectorReceiver { private: L1MuBMSectorProcessor& m_sp; - edm::ESHandle bmtfParamsHandle; + edm::ESGetToken m_bmtfParamsToken; L1MuDTTFMasks msks; L1MuDTTFParameters pars; From 130b6fb76efd646fb82f2290f1deb7148a221e46 Mon Sep 17 00:00:00 2001 From: swmukher Date: Tue, 31 Aug 2021 19:27:34 +0200 Subject: [PATCH 261/923] addressed review comments --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index ff7b919f1a9f8..fcf3ddedf53ed 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -163,20 +163,18 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, EgammaHcalIsolation::InclusionRule external; EgammaHcalIsolation::InclusionRule internal; - if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based - external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - } - - if (useSingleTower_ && !doEtSum_) { //this is single tower based H/E - external = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; - internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - } - - if (useSingleTower_ && doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal - external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; - } + if (useSingleTower_) { + if (!doEtSum_) { //this is single tower based H/E + external = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + } else { //this is cone-based HCAL isolation with single tower based footprint removal + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + } + } else { //useSingleTower_=False means H/E is cone-based + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + } EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation(external, outerCone_, @@ -195,19 +193,17 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, iSetup.getData(hcalSevLvlComputerToken_), iSetup.getData(caloTowerConstituentsMapToken_)); - if (!useSingleTower_) { //useSingleTower_=False means H/E is cone-based. - if (doEtSum_) { //hcal iso - isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(), depth_); //depth=0 means all depths - } else if (!doEtSum_) { // doEtSum_=False means sum up energy, this is for H/E - isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(), depth_); //depth=0 means all depths - } - } - if (useSingleTower_) { if (doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths - } else if (!doEtSum_) { //this is single tower based H/E - isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } else { //this is single tower based H/E + isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } + } else { //useSingleTower_=False means H/E is cone-based. + if (doEtSum_) { //hcal iso + isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } else { // doEtSum_=False means sum up energy, this is for H/E + isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(), depth_); //depth=0 means all depths } } From b09e1211306bdca8b7ed82cc690fbc748a957ee5 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Wed, 1 Sep 2021 01:32:57 +0800 Subject: [PATCH 262/923] Remove unused headers in misc package. --- .../DTRawToDigi/interface/DTROS25Data.h | 61 ---- .../ESRawToDigi/interface/ESCrcKchipFast.h | 50 --- .../interface/ECALUnpackerException.h | 32 -- .../EcalRawToDigi/interface/MyWatcher.h | 43 --- .../RPCRawToDigi/interface/RPCRawSynchro.h | 1 - EventFilter/Utilities/interface/ModuleWeb.h | 51 ---- EventFilter/Utilities/interface/config_json.h | 43 --- .../interface/TypeInfoHolder.h | 45 --- .../TauolaInterface/interface/TauolaWrapper.h | 105 ------- .../interface/BPHMuonChargeSelect.h | 54 ---- .../interface/BPHParticleChargeSelect.h | 73 ----- IOPool/Common/interface/CustomStreamer.h | 58 ---- .../interface/BoxNDScanner.h | 172 ----------- .../interface/MultivariateFunctorScanner.h | 77 ----- .../interface/rescanArray.h | 122 -------- .../interface/CorrectedMETProducerT.h | 110 ------- .../DTSectorCollector/interface/DTSCCand.h | 123 -------- .../interface/L1GctSimpleJetFinder.h | 54 ---- L1Trigger/L1TCalorimeter/interface/classes.h | 19 -- .../interface/OMTFConfigurator.h | 25 -- .../interface/OMTFPatternMaker.h | 32 -- .../interface/L1AnalysisRecoTrackBase.h | 17 -- .../L1Analyzer/interface/L1PromptAnalysis.h | 288 ------------------ .../Engine/interface/MagneticFieldHelpers.h | 42 --- .../interface/RectangularVolumeBounds.h | 8 - Mixing/Base/interface/FixedPUGenerator.h | 25 -- Mixing/Base/interface/PUGenerator.h | 22 -- 27 files changed, 1752 deletions(-) delete mode 100644 EventFilter/DTRawToDigi/interface/DTROS25Data.h delete mode 100644 EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h delete mode 100644 EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h delete mode 100644 EventFilter/EcalRawToDigi/interface/MyWatcher.h delete mode 100644 EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h delete mode 100644 EventFilter/Utilities/interface/ModuleWeb.h delete mode 100644 EventFilter/Utilities/interface/config_json.h delete mode 100644 FWCore/ServiceRegistry/interface/TypeInfoHolder.h delete mode 100644 GeneratorInterface/TauolaInterface/interface/TauolaWrapper.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h delete mode 100644 IOPool/Common/interface/CustomStreamer.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/rescanArray.h delete mode 100644 JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h delete mode 100644 L1Trigger/DTSectorCollector/interface/DTSCCand.h delete mode 100644 L1Trigger/GlobalCaloTrigger/interface/L1GctSimpleJetFinder.h delete mode 100644 L1Trigger/L1TCalorimeter/interface/classes.h delete mode 100644 L1Trigger/L1TMuonOverlap/interface/OMTFConfigurator.h delete mode 100644 L1Trigger/L1TMuonOverlap/interface/OMTFPatternMaker.h delete mode 100644 L1Trigger/L1TNtuples/interface/L1AnalysisRecoTrackBase.h delete mode 100644 L1TriggerOffline/L1Analyzer/interface/L1PromptAnalysis.h delete mode 100644 MagneticField/Engine/interface/MagneticFieldHelpers.h delete mode 100644 MagneticField/VolumeGeometry/interface/RectangularVolumeBounds.h delete mode 100644 Mixing/Base/interface/FixedPUGenerator.h delete mode 100644 Mixing/Base/interface/PUGenerator.h diff --git a/EventFilter/DTRawToDigi/interface/DTROS25Data.h b/EventFilter/DTRawToDigi/interface/DTROS25Data.h deleted file mode 100644 index 57ea5ecaa1df0..0000000000000 --- a/EventFilter/DTRawToDigi/interface/DTROS25Data.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef DTRawToDigi_DTROS25Data_h -#define DTRawToDigi_DTROS25Data_h - -/** \class DTROS25Data - * The collection containing DT ROS25 status data. - * - * \author M. Zanetti - INFN Padova - */ - -#include - -#include - - -typedef std::pair DTTDCData; - -class DTROS25Data { - -public: - - /// Constructors - DTROS25Data(int ROSId = 0): theROSId(ROSId) {} - - - /// Destructor - virtual ~DTROS25Data() {} - - /// Setters - inline void setROSId(const int & ID) { theROSId = ID; } - - inline void addROSTrailer( const DTROSTrailerWord & word) { theROSTrailers.push_back(word); } - inline void addROSError( const DTROSErrorWord & word) { theROSErrors.push_back(word); } - inline void addROSDebug( const DTROSDebugWord & word) { theROSDebugs.push_back(word); } - inline void addROBTrailer( const DTROBTrailerWord & word) { theROBTrailers.push_back(word); } - inline void addTDCMeasurement( const DTTDCMeasurementWord & word) { theTDCMeasurements.push_back(word); } - inline void addTDCData( const DTTDCData & tdcData) { theTDCData.push_back(tdcData); } - - /// Getters - inline int getROSID() const { return theROSId; } - - inline const std::vector& getROSTrailers() const {return theROSTrailers;} - inline const std::vector& getROSErrors() const {return theROSErrors;} - inline const std::vector& getROSDebugs() const {return theROSDebugs;} - inline const std::vector& getROBTrailers() const {return theROBTrailers;} - inline const std::vector& getTDCMeasurements() const {return theTDCMeasurements;} - inline const std::vector& getTDCData() const {return theTDCData;} - -private: - - int theROSId; - - std::vector theROSTrailers; - std::vector theROSErrors; - std::vector theROSDebugs; - std::vector theROBTrailers; - std::vector theTDCMeasurements; - std::vector theTDCData; - -}; - -#endif diff --git a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h b/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h deleted file mode 100644 index 206cbc5c734dc..0000000000000 --- a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef ESCrcKchipFast_H -#define ESCrcKchipFast_H - -#include - -class ESCrcKchipFast { - - private : - - uint32_t crc; - - public: - - ESCrcKchipFast() { - init(); - reset() ; - }; - - void init() { - crc = 0x0ffff ; - } - - void reset() { - crc = 0x0ffff ; - } ; - - void add(unsigned int data) { - for (int i=0;i<16;i++) - { - if ((crc&0x0001) == (data&0x0001)) - crc=crc>>1; - else - crc=(crc>>1)^0x8408; // flipped 0x1021; - data=(data>>1); - } - }; - - uint32_t get_crc() { - return crc ; - }; - - bool isCrcOk(unsigned int crcin=0x0000) { - return ((get_crc()==crcin) ? true : false ); - }; - - ~ESCrcKchipFast() { } ; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h b/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h deleted file mode 100644 index a9f1e57d0cdb2..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h +++ /dev/null @@ -1,32 +0,0 @@ -// Date : 30/05/2005 -// Author : N.Almeida (LIP) - -#ifndef ECALUNPACKEREXCEPTION_H -#define ECALUNPACKEREXCEPTION_H - -#include -#include -#include - - -class ECALUnpackerException { - public : - - /** - * Constructor - */ - ECALUnpackerException(std::ostringstream a){ info_=a.str(); } - - ECALUnpackerException(std::string a){info_=a;} - /** - * Exception's discription - */ - std::string what() const throw() { return info_;} - - protected : - - std::string info_; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/MyWatcher.h b/EventFilter/EcalRawToDigi/interface/MyWatcher.h deleted file mode 100644 index 5d26a0df24808..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/MyWatcher.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MyWATCHER_H -#define MyWATCHER_H - -#include "TStopwatch.h" -#include -#include - -#ifdef EDM_ML_DEBUG -class MyWatcher : public TStopwatch { - public: - MyWatcher(const std::string n=""):name(n),total(0) {} - ~MyWatcher(){} - - std::string start(bool r=true){Start(r); return " [Start]";} - std::string continu(){Continue(); return " [Continue]";} - std::string reset(){Reset(); return " [Reset]";} - std::string stop() {Stop(); return " [Stop]";} - std::string lap() { - std::stringstream o; - double r=RealTime(); - total+=r; - o<<"\n "< -#include -#include - - - - namespace evf - { - - - namespace moduleweb { - class ForkParams { - public: - ForkParams():slotId(-1),restart(0),isMaster(-1){} - int slotId; - bool restart; - int isMaster; - }; - class ForkInfoObj { - public: - ForkInfoObj() - { - control_sem_ = new sem_t; - sem_init(control_sem_,0,0); - stopCondition=0; - receivedStop_=false; - } - ~ForkInfoObj() - { - sem_destroy(control_sem_); - delete control_sem_; - } - void lock() {if (mst_lock_) pthread_mutex_lock(mst_lock_);} - void unlock() {if (mst_lock_) pthread_mutex_unlock(mst_lock_);} - void (*forkHandler) (void *); - ForkParams forkParams; - unsigned int stopCondition; - bool receivedStop_; - sem_t *control_sem_; - pthread_mutex_t * mst_lock_; - void * fuAddr; - }; - } - -} -#endif diff --git a/EventFilter/Utilities/interface/config_json.h b/EventFilter/Utilities/interface/config_json.h deleted file mode 100644 index 5d334cbc5e6b9..0000000000000 --- a/EventFilter/Utilities/interface/config_json.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef JSON_CONFIG_H_INCLUDED -# define JSON_CONFIG_H_INCLUDED - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 -/// If defined, indicates that Json specific container should be used -/// (hash table & simple deque container with customizable allocator). -/// THIS FEATURE IS STILL EXPERIMENTAL! -//# define JSON_VALUE_USE_INTERNAL_MAP 1 -/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. -/// The memory pools allocator used optimization (initializing Value and ValueInternalLink -/// as if it was a POD) that may cause some validation tool to report errors. -/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. -//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 - -/// If defined, indicates that Json use exception to report invalid type manipulation -/// instead of C assert macro. -# define JSON_USE_EXCEPTION 1 - -# ifdef JSON_IN_CPPTL -# include -# ifndef JSON_USE_CPPTL -# define JSON_USE_CPPTL 1 -# endif -# endif - -# ifdef JSON_IN_CPPTL -# define JSON_API CPPTL_API -# elif defined(JSON_DLL_BUILD) -# define JSON_API __declspec(dllexport) -# elif defined(JSON_DLL) -# define JSON_API __declspec(dllimport) -# else -# define JSON_API -# endif - -#endif // JSON_CONFIG_H_INCLUDED diff --git a/FWCore/ServiceRegistry/interface/TypeInfoHolder.h b/FWCore/ServiceRegistry/interface/TypeInfoHolder.h deleted file mode 100644 index f09e6d65b49fb..0000000000000 --- a/FWCore/ServiceRegistry/interface/TypeInfoHolder.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef ServiceRegistry_TypeInfoHolder_h -#define ServiceRegistry_TypeInfoHolder_h - -#include -// -*- C++ -*- -// -// Package: ServiceRegistry -// Class : TypeInfoHolder -// -/**\class TypeInfoHolder TypeInfoHolder.h FWCore/ServiceRegistry/interface/TypeInfoHolder.h - - Description: wrapper to allow std::type_info to be used as a key to a std::map - - Usage: - - -*/ -// -// Original Author: Chris Jones -// Created: Mon Sep 5 14:38:42 EDT 2005 -// - -// system include files - -// user include files - -// forward declarations -namespace edm { - namespace serviceregistry { - - class TypeInfoHolder { - public: - TypeInfoHolder(const std::type_info& iInfo) : m_info(iInfo) {} - const std::type_info& info() const { return m_info;} - - bool operator<(const TypeInfoHolder& iRHS) const { - return m_info.before(iRHS.m_info) ; - } - private: - const std::type_info& m_info; - }; - } -} - -#endif diff --git a/GeneratorInterface/TauolaInterface/interface/TauolaWrapper.h b/GeneratorInterface/TauolaInterface/interface/TauolaWrapper.h deleted file mode 100644 index 9a998a1a68c58..0000000000000 --- a/GeneratorInterface/TauolaInterface/interface/TauolaWrapper.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef gen_ExternalDecays_TauolaWrapper_h -#define gen_ExternalDecays_TauolaWrapper_h - -/********** TauolaWrapper - * - * Wrapper to Fortran functions in TAUOLA tau decay library - * - * Christian Veelken - * 04/17/07 - * - * Modified to contain access to individual decays (COMMON TAUBRA), and - * force polarization like in case of particle gun taus (SUBROUTINE DEXAY - * and COMMON MOMDEC) - * 23.2.2009/S.Lehti - * - * Modified to remove everything related to pythia6 or pretauola; - * all pythia6-related functionalities and/or ties are moving back - * to Pythia6Interface; - * the concept will ensure transparent use of Tauola with ANY - * multi-purpose generator - * J.V.Yarba, Feb.26, 2009 - * - ***************************************/ - -// -//------------------------------------------------------------------------------- -// - -// main function(s) of TAUOLA/pretauola tau decay library - -extern "C" { - void tauola_(int*, int*); - void tauola_srs_(int*,int*); - void taurep_(int*); - void ranmar_(float*,int*); - void rmarin_(int*, int*, int*); -} -#define tauola tauola_ - -void inline call_tauola (int mode, int polarization) { tauola(&mode, &polarization); } - -extern "C" { - extern void dexay_(int*, float[4]); -} -#define dexay dexay_ - -void inline call_dexay (int mode, float polarization[4]) { dexay(&mode, polarization); } - -// -//------------------------------------------------------------------------------- -// - -// common block with steering parameters for CMS specific Fortran interface to TAUOLA - -extern "C" { - extern struct { - int pjak1; - int pjak2; - int mdtau; - } ki_taumod_; -} -#define ki_taumod ki_taumod_ - -extern "C" { - extern struct { - int jak1; - int jak2; - int itdkrc; - int ifphot; - int ifhadm; - int ifhadp; - } libra_ ; -} -#define libra libra_ - -extern "C" { - extern struct { - float gamprt[30]; - int jlist[30]; - int nchan; - } taubra_; -} -#define taubra taubra_ - -extern "C" { - extern struct { - double q1[4]; - double q2[4]; - double p1[4]; - double p2[4]; - double p3[4]; - double p4[4]; - } momdec_; -} -#define momdec momdec_ - -extern "C" { - extern struct { - int np1; - int np2; - } taupos_; -} -#define taupos taupos_ - -#endif diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h deleted file mode 100644 index 3f7d574ed79fc..0000000000000 --- a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h -#define HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h -/** \class BPHMuonChargeSelect - * - * Description: - * Class for muon selection by charge - * - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "DataFormats/PatCandidates/interface/Muon.h" - -//--------------- -// C++ Headers -- -//--------------- - -// --------------------- -// -- Class Interface -- -// --------------------- - -class BPHMuonChargeSelect : public BPHParticleChargeSelect { -public: - /** Constructor - */ - BPHMuonChargeSelect(int c) : BPHParticleChargeSelect(c) {} - - // deleted copy constructor and assignment operator - BPHMuonChargeSelect(const BPHMuonChargeSelect& x) = delete; - BPHMuonChargeSelect& operator=(const BPHMuonChargeSelect& x) = delete; - - /** Destructor - */ - ~BPHMuonChargeSelect() override {} - - /** Operations - */ - /// select muon - bool accept(const reco::Candidate& cand) const override { - if (dynamic_cast(&cand) == nullptr) - return false; - return BPHParticleChargeSelect::accept(cand); - }; -}; - -#endif diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h deleted file mode 100644 index e85f05677bad2..0000000000000 --- a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h -#define HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h -/** \class BPHParticleChargeSelect - * - * Description: - * Class for particle selection by charge - * - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoSelect.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" - -//--------------- -// C++ Headers -- -//--------------- - -// --------------------- -// -- Class Interface -- -// --------------------- - -class BPHParticleChargeSelect : public BPHRecoSelect { -public: - /** Constructor - */ - BPHParticleChargeSelect(int c) : charge(c ? (c > 0 ? 1 : -1) : 0) {} - - // deleted copy constructor and assignment operator - BPHParticleChargeSelect(const BPHParticleChargeSelect& x) = delete; - BPHParticleChargeSelect& operator=(const BPHParticleChargeSelect& x) = delete; - - /** Destructor - */ - ~BPHParticleChargeSelect() override {} - - /** Operations - */ - /// select particle - bool accept(const reco::Candidate& cand) const override { - switch (charge) { - default: - case 0: - return (cand.charge() != 0); - case 1: - return (cand.charge() > 0); - case -1: - return (cand.charge() < 0); - } - return true; - }; - - /// set selection charge - void setCharge(int c) { - charge = (c ? (c > 0 ? 1 : -1) : 0); - return; - } - - /// get selection charge - double getCharge() const { return charge; } - -private: - int charge; -}; - -#endif diff --git a/IOPool/Common/interface/CustomStreamer.h b/IOPool/Common/interface/CustomStreamer.h deleted file mode 100644 index 5f07f3e7fd904..0000000000000 --- a/IOPool/Common/interface/CustomStreamer.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef IOPool_Common_CustomStreamer_h -#define IOPool_Common_CustomStreamer_h - -#include -#include "TClass.h" -#include "TClassStreamer.h" -#include "TClassRef.h" -#include "FWCore/Utilities/interface/TypeID.h" -#include "TBuffer.h" - -namespace edm { - template - class CustomStreamer : public TClassStreamer { - public: - typedef T element_type; - CustomStreamer(); - void operator() (TBuffer &R__b, void *objp); - private: - std::string className_; - TClassRef cl_; - }; - - template - CustomStreamer::CustomStreamer() : - className_(TypeID(typeid(T)).className()), - cl_(className_.c_str()) - {} - - template - void - CustomStreamer::operator()(TBuffer &R__b, void *objp) { - if (R__b.IsReading()) { - cl_->ReadBuffer(R__b, objp); - } else { - cl_->WriteBuffer(R__b, objp); - } - } - - template - void - SetCustomStreamer() { - TClass *cl = TClass::GetClass(typeid(T)); - if (cl->GetStreamer() == 0) { - cl->AdoptStreamer(new CustomStreamer()); - } - } - - template - void - SetCustomStreamer(T const&) { - TClass *cl = TClass::GetClass(typeid(T)); - if (cl->GetStreamer() == 0) { - cl->AdoptStreamer(new CustomStreamer()); - } - } -} - -#endif diff --git a/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h b/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h deleted file mode 100644 index 44d32c6b037da..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef NPSTAT_BOXNDSCANNER_HH_ -#define NPSTAT_BOXNDSCANNER_HH_ - -/*! -// \file BoxNDScanner.h -// -// \brief Iteration over uniformly spaced coordinates inside -// a multidimensional box -// -// Author: I. Volobouev -// -// March 2010 -*/ - -#include "JetMETCorrections/InterpolationTables/interface/BoxND.h" - -namespace npstat { - /** - * A class for iterating over all coordinates in a multidimensional box - * (but not a full-fledeged iterator). The expected usage pattern is as - * follows: - * - * @code - * double* coords = ... (the buffer size should be at least box.dim()) - * for (BoxNDScanner scan(box,shape); scan.isValid(); ++scan) - * { - * scan.getCoords(coords, coordsBufferSize); - * .... Do what is necessary with coordinates .... - * .... Extract linear bin number: .............. - * scan.state(); - * } - * @endcode - * - * The coordinates will be in the middle of the bins (imagine - * a multivariate histogram with boundaries defined by the given box). - */ - template - class BoxNDScanner - { - public: - //@{ - /** - // Constructor from a bounding box and a multidimensional - // array shape - */ - inline BoxNDScanner(const BoxND& box, - const std::vector& shape) - : box_(box), state_(0UL) - {initialize(shape.empty() ? static_cast(0) : - &shape[0], shape.size());} - - inline BoxNDScanner(const BoxND& box, - const unsigned* shape, const unsigned lenShape) - : box_(box), state_(0UL) {initialize(shape, lenShape);} - //@} - - /** Dimensionality of the scan */ - inline unsigned dim() const {return box_.dim();} - - /** Retrieve current state (i.e., linear index of the scan) */ - inline unsigned long state() const {return state_;} - - /** Maximum possible state (i.e., linear index of the scan) */ - inline unsigned long maxState() const {return maxState_;} - - /** Returns false when iteration is complete */ - inline bool isValid() const {return state_ < maxState_;} - - /** Retrieve current coordinates inside the box */ - void getCoords(Numeric* x, unsigned nx) const; - - /** Retrieve current multidimensional index */ - void getIndex(unsigned* index, unsigned indexBufferLen) const; - - /** Reset the state (as if the object has just been constructed) */ - inline void reset() {state_ = 0UL;} - - /** Prefix increment */ - inline BoxNDScanner& operator++() - {if (state_ < maxState_) ++state_; return *this;} - - /** Postfix increment (distinguished by the dummy "int" parameter) */ - inline void operator++(int) {if (state_ < maxState_) ++state_;} - - /** Set the state directly */ - inline void setState(const unsigned long state) - {state_ = state <= maxState_ ? state : maxState_;} - - private: - BoxNDScanner(); - - void initialize(const unsigned* shape, unsigned lenShape); - - BoxND box_; - std::vector strides_; - std::vector bw_; - unsigned long state_; - unsigned long maxState_; - }; -} - -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -namespace npstat { - template - void BoxNDScanner::initialize(const unsigned* shape, - const unsigned dim) - { - if (!(dim && box_.dim() == dim)) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::initialize: incompatible scan shape"); - assert(shape); - for (unsigned j=0; j0; --j) - strides_[j - 1] = strides_[j]*shape[j]; - maxState_ = strides_[0]*shape[0]; - - bw_.reserve(dim); - for (unsigned j=0; j - void BoxNDScanner::getCoords(Numeric* x, const unsigned nx) const - { - const unsigned dim = strides_.size(); - if (nx < dim) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::getCoords: " - "insufficient length of the output buffer"); - if (state_ >= maxState_) throw npstat::NpstatRuntimeError( - "In npstat::BoxNDScanner::getCoords: invalid scanner state"); - assert(x); - - unsigned long l = state_; - for (unsigned i=0; i - void BoxNDScanner::getIndex(unsigned* ix, const unsigned nx) const - { - const unsigned dim = strides_.size(); - if (nx < dim) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::getIndex: " - "insufficient length of the output buffer"); - if (state_ >= maxState_) throw npstat::NpstatRuntimeError( - "In npstat::BoxNDScanner::getIndex: invalid scanner state"); - assert(ix); - - unsigned long l = state_; - for (unsigned i=0; i(idx); - l -= (idx * strides_[i]); - } - } -} - - -#endif // NPSTAT_BOXNDSCANNER_HH_ - diff --git a/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h b/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h deleted file mode 100644 index c34494d45b63e..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ -#define NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ - -/*! -// \file MultivariateFunctorScanner.h -// -// \brief Adapts any AbsMultivariateFunctor for use with ArrayND method -// "functorFill" -// -// Author: I. Volobouev -// -// July 2012 -*/ - -#include -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -#include "JetMETCorrections/InterpolationTables/interface/AbsMultivariateFunctor.h" - -namespace npstat { - /** - // This class adapts an object derived from AbsMultivariateFunctor - // so that it can be used with ArrayND method "functorFill" and such - */ - template - class MultivariateFunctorScanner - { - public: - /** - // A mapper for each coordinate in the "maps" argument will - // convert the array index into a proper argument for the scanned - // density. - // - // This functor will NOT make copies of either "fcn" or "maps" - // parameters. These parameters will be used by reference only - // (aliased). It is up to the user of this class to ensure proper - // lifetime of these objects. - */ - inline MultivariateFunctorScanner(const AbsMultivariateFunctor& fcn, - const std::vector& maps) - : fcn_(fcn), mapping_(maps), buf_(fcn.minDim()), dim_(fcn.minDim()) - { - if (!(dim_ && dim_ == maps.size())) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner constructor: " - "incompatible arguments"); - if (dim_ != fcn.maxDim()) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner constructor: " - "functors of variable dimensionality are not supported"); - } - - /** Calculate the functor value for the given array indices */ - inline double operator()(const unsigned* index, - const unsigned indexLen) const - { - if (dim_ != indexLen) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner::operator(): " - "incompatible input point dimensionality"); - assert(index); - double* x = &buf_[0]; - for (unsigned i=0; i& mapping_; - mutable std::vector buf_; - unsigned dim_; - }; -} - -#endif // NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ - diff --git a/JetMETCorrections/InterpolationTables/interface/rescanArray.h b/JetMETCorrections/InterpolationTables/interface/rescanArray.h deleted file mode 100644 index 08742b7113908..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/rescanArray.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef NPSTAT_RESCANARRAY_HH_ -#define NPSTAT_RESCANARRAY_HH_ - -/*! -// \file rescanArray.h -// -// \brief Fill a multidimensional array using values from another array -// with a different shape -// -// Author: I. Volobouev -// -// October 2010 -*/ - -#include "JetMETCorrections/InterpolationTables/interface/ArrayND.h" - -namespace npstat { - /** - // A utility for filling one array using values of another. The - // array shapes do not have to be the same but the ranks have to be. - // Roughly, the arrays are treated as values of histogram bins inside - // the unit box. The array "to" is filled either with the closest bin - // value of the array "from" or with an interpolated value (if - // "interpolationDegree" parameter is not 0). - // - // interpolationDegree parameter must be one of 0, 1, or 3. - */ - template - void rescanArray(const ArrayND& from, - ArrayND* to, - unsigned interpolationDegree=0); -} - -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -#include "JetMETCorrections/InterpolationTables/interface/LinearMapper1d.h" - -namespace npstat { - namespace Private { - template - class ArrayMapper - { - public: - ArrayMapper(const ArrayND& from, - const ArrayND& to, - const unsigned interpolationDegree) - : mapped_(from.rank()), - from_(from), - dim_(from.rank()), - ideg_(interpolationDegree) - { - assert(dim_ == to.rank()); - if (dim_) - { - mappers_.reserve(dim_); - for (unsigned i=0; i mappers_; - mutable std::vector mapped_; - const ArrayND& from_; - unsigned dim_; - unsigned ideg_; - }; - } - - template - void rescanArray(const ArrayND& from, - ArrayND* to, - const unsigned interpolationDegree) - { - assert(to); - if (from.rank() != to->rank()) throw npstat::NpstatInvalidArgument( - "In npstat::rescanArray: incompatible dimensionalities " - "of input and output arrays"); - if (!(interpolationDegree == 0U || - interpolationDegree == 1U || - interpolationDegree == 3U)) throw npstat::NpstatInvalidArgument( - "In npstat::rescanArray: unsupported interpolation degree"); - to->functorFill(Private::ArrayMapper( - from, *to, interpolationDegree)); - } -} - - -#endif // NPSTAT_RESCANARRAY_HH_ - diff --git a/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h b/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h deleted file mode 100644 index 298d28b228224..0000000000000 --- a/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef JetMETCorrections_Type1MET_CorrectedMETProducer_h -#define JetMETCorrections_Type1MET_CorrectedMETProducer_h - -/** \class CorrectedMETProducerT - * - * Produce MET collections with Type 1 / Type 1 + 2 corrections applied - * - * NOTE: This file defines the generic template. - * Concrete instances for CaloMET and PFMET are defined in - * JetMETCorrections/Type1MET/plugins/CorrectedCaloMETProducer.cc - * JetMETCorrections/Type1MET/plugins/CorrectedPFMETProducer.cc - * - * \authors Michael Schmitt, Richard Cavanaugh, The University of Florida - * Florent Lacroix, University of Illinois at Chicago - * Christian Veelken, LLR - * - * - * - */ - -#include "FWCore/Framework/interface/stream/EDProducer.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 "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "JetMETCorrections/Type1MET/interface/METCorrectionAlgorithm.h" -#include "DataFormats/METReco/interface/CorrMETData.h" -#include "DataFormats/Candidate/interface/Candidate.h" - -#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" - -#include - -namespace CorrectedMETProducer_namespace { - template - reco::Candidate::LorentzVector correctedP4(const T& rawMEt, const CorrMETData& correction) { - double correctedMEtPx = rawMEt.px() + correction.mex; - double correctedMEtPy = rawMEt.py() + correction.mey; - double correctedMEtPt = sqrt(correctedMEtPx * correctedMEtPx + correctedMEtPy * correctedMEtPy); - return reco::Candidate::LorentzVector(correctedMEtPx, correctedMEtPy, 0., correctedMEtPt); - } - - template - double correctedSumEt(const T& rawMEt, const CorrMETData& correction) { - return rawMEt.sumEt() + correction.sumet; - } - - template - class CorrectedMETFactoryT { - public: - T operator()(const T&, const CorrMETData&) const { - assert(0); // "place-holder" for template instantiations for concrete T types only, **not** to be called - } - }; -} // namespace CorrectedMETProducer_namespace - -template -class CorrectedMETProducerT : public edm::stream::EDProducer<> { - typedef std::vector METCollection; - -public: - explicit CorrectedMETProducerT(const edm::ParameterSet& cfg) - : moduleLabel_(cfg.getParameter("@module_label")), algorithm_(0) { - token_ = consumes(cfg.getParameter("src")); - - algorithm_ = new METCorrectionAlgorithm(cfg, consumesCollector()); - - produces(""); - } - ~CorrectedMETProducerT() { delete algorithm_; } - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("corrPfMetType1", "type1")); - descriptions.add(defaultModuleLabel >(), desc); - } - -private: - void produce(edm::Event& evt, const edm::EventSetup& es) { - std::unique_ptr correctedMEtCollection(new METCollection); - - edm::Handle rawMEtCollection; - evt.getByToken(token_, rawMEtCollection); - - for (typename METCollection::const_iterator rawMEt = rawMEtCollection->begin(); rawMEt != rawMEtCollection->end(); - ++rawMEt) { - CorrMETData correction = algorithm_->compMETCorrection(evt); - - static const CorrectedMETProducer_namespace::CorrectedMETFactoryT correctedMET_factory{}; - T correctedMEt = correctedMET_factory(*rawMEt, correction); - - correctedMEtCollection->push_back(correctedMEt); - } - - //--- add collection of MET objects with Type 1 / Type 1 + 2 corrections applied to the event - evt.put(std::move(correctedMEtCollection)); - } - - std::string moduleLabel_; - - edm::EDGetTokenT token_; - - METCorrectionAlgorithm* algorithm_; // algorithm for computing Type 1 / Type 1 + 2 MET corrections -}; - -#endif diff --git a/L1Trigger/DTSectorCollector/interface/DTSCCand.h b/L1Trigger/DTSectorCollector/interface/DTSCCand.h deleted file mode 100644 index 3f7a616799466..0000000000000 --- a/L1Trigger/DTSectorCollector/interface/DTSCCand.h +++ /dev/null @@ -1,123 +0,0 @@ -//------------------------------------------------- -// -// \class: DTSC.h -/** - * Implementation of Sector Collector trigger algorithm - * - * - * - * \author D. Bonacorsi, S. Marcellini - */ -// -//-------------------------------------------------- -#ifndef DT_SC_H -#define DT_SC_H - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -class DTTracoTrigData; -class DTTSCand; -class DTConfigSectColl; -// added DBSM -class DTTrigGeom; - -//---------------------- -// Base Class Headers -- -//---------------------- -// added DBSM -#include "L1Trigger/DTUtilities/interface/DTGeomSupplier.h" - -//--------------- -// C++ Headers -- -//--------------- -#include - -// --------------------- -// -- Class Interface -- -// --------------------- - - -class DTSC{ - - public: - - //! Constructor - DTSC(DTConfigSectColl*); - - //! Destructor - ~DTSC(); - - // non-const methods - - //! Add a TSM candidate to the Sect Coll, ifs is first/second track flag - void addCand(DTTSCand* cand); - - //! Set a flag to skip sort2 - void ignoreSecondTrack() { _ignoreSecondTrack=1; } - - //! Run the Sector Collector algorithm - void run(); - - //! Sort 1 - DTTSCand* DTSectCollsort1(); - - //! Sort 2 - DTTSCand* DTSectCollsort2(); - - //! Clear - void clear(); - - // const methods - - //! Configuration set - inline DTConfigSectColl* config() const { return _config; } - - //! Return the number of input tracks (first/second) - unsigned nCand(int ifs) const; - - //! Return the number of input first tracks - inline int nFirstT() const { return _incand[0].size(); } - - //! Return the number of input second tracks - inline int nSecondT() const { return _incand[1].size(); } - - //! Return requested TSS candidate - DTTSCand* getDTTSCand(int ifs, unsigned n) const; - - //! Return requested TRACO trigger - const DTTracoTrigData* getTracoT(int ifs, unsigned n) const; - - //! Return the number of sorted tracks - inline int nTracks() const { return _outcand.size(); } - - //! Return the requested track - DTTSCand* getTrack(int n) const ; - - - private: - - // Configuration - DTConfigSectColl* _config; - - // input data - std::vector _incand[2]; - - // output data - std::vector _outcand; - - // internal use variables - int _ignoreSecondTrack; - - -}; -#endif - - - - - - - - - diff --git a/L1Trigger/GlobalCaloTrigger/interface/L1GctSimpleJetFinder.h b/L1Trigger/GlobalCaloTrigger/interface/L1GctSimpleJetFinder.h deleted file mode 100644 index 35fa1897822ac..0000000000000 --- a/L1Trigger/GlobalCaloTrigger/interface/L1GctSimpleJetFinder.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef L1GCTSIMPLEJETFINDER_H_ -#define L1GCTSIMPLEJETFINDER_H_ - -#include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h" - -#include - -/*! \class L1GctSimpleJetFinder - * \brief simple jet finder for test purposes. - * - * Currently returns no jets - * The intention is to return local maxima (without clustering) - * - */ -/* - * \author Greg Heath - * \date June 2006 - */ - -class L1GctSimpleJetFinder : public L1GctJetFinderBase { -public: - /// id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi. - L1GctSimpleJetFinder(int id); - - ~L1GctSimpleJetFinder(); - - /// Overload << operator - friend std::ostream& operator<<(std::ostream& os, const L1GctSimpleJetFinder& algo); - - /// get input data from sources - virtual void fetchInput(); - - /// process the data, fill output buffers - virtual void process(); - -protected: - // Each jetFinder must define the constants as private and copy the - // function definitions below. - virtual unsigned maxRegionsIn() const { return MAX_REGIONS_IN; } - virtual unsigned centralCol0() const { return CENTRAL_COL0; } - virtual unsigned nCols() const { return N_COLS; } - -private: - /// The real jetFinders must define these constants - static const unsigned int MAX_REGIONS_IN; ///< Dependent on number of rows and columns. - static const unsigned int N_COLS; - static const unsigned int CENTRAL_COL0; - - void findJets(); -}; - -std::ostream& operator<<(std::ostream& os, const L1GctSimpleJetFinder& algo); - -#endif /*L1GCTSIMPLEJETFINDER_H_*/ diff --git a/L1Trigger/L1TCalorimeter/interface/classes.h b/L1Trigger/L1TCalorimeter/interface/classes.h deleted file mode 100644 index 5c23744bb10d3..0000000000000 --- a/L1Trigger/L1TCalorimeter/interface/classes.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * ======================================================================== - * - * Description: Define dataformats for L1RecoMatch, L1 Global object. - * - * ======================================================================== - */ - -#include "L1Trigger/L1TCalorimeter/interface/L1RecoMatch.h" -#include "L1Trigger/L1TCalorimeter/interface/L1GObject.h" - -namespace { - - L1RecoMatch dummyMatch; - L1GObject dummyL1G; - std::vector dummyL1GCollection; - edm::Wrapper > dummyL1GWrapper; - -} diff --git a/L1Trigger/L1TMuonOverlap/interface/OMTFConfigurator.h b/L1Trigger/L1TMuonOverlap/interface/OMTFConfigurator.h deleted file mode 100644 index 82bd4a5d7c64f..0000000000000 --- a/L1Trigger/L1TMuonOverlap/interface/OMTFConfigurator.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef OMTF_OMTFConfigurator_H -#define OMTF_OMTFConfigurator_H - -#include "xercesc/dom/DOM.hpp" - - -////////////////////////////////// -// OMTFConfigurator -////////////////////////////////// -class OMTFConfigurator{ - - public: - - - private: - -}; - - -////////////////////////////////// -////////////////////////////////// - - - -#endif diff --git a/L1Trigger/L1TMuonOverlap/interface/OMTFPatternMaker.h b/L1Trigger/L1TMuonOverlap/interface/OMTFPatternMaker.h deleted file mode 100644 index 60898ad2a730e..0000000000000 --- a/L1Trigger/L1TMuonOverlap/interface/OMTFPatternMaker.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef OMTF_OMTFPaternMaker_H -#define OMTF_OMTFPaternMaker_H - -#include - -#include "L1Trigger/L1TMuonOverlap/interface/GoldenPattern.h" - -class OMTFConfiguration; -class XMLConfigReader; -class OMTFinput; - -namespace edm{ -class ParameterSet; -} - -class OMTFPaternMaker{ - - public: - - OMTFPaternMaker(const edm::ParameterSet & cfg); - - ~OMTFPaternMaker(); - - private: - - ///Map holding Golden Patterns - std::map theGPs; - -}; - - -#endif diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisRecoTrackBase.h b/L1Trigger/L1TNtuples/interface/L1AnalysisRecoTrackBase.h deleted file mode 100644 index 2f19f4a6b092c..0000000000000 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisRecoTrackBase.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __L1Analysis_L1AnalysisRecoTrackBase_H__ -#define __L1Analysis_L1AnalysisRecoTrackBase_H__ - - -namespace L1Analysis -{ - class L1AnalysisRecoTrackBase - { - public : - unsigned nTrk; - unsigned nHighPurity; - double fHighPurity; - }; -} -#endif - - diff --git a/L1TriggerOffline/L1Analyzer/interface/L1PromptAnalysis.h b/L1TriggerOffline/L1Analyzer/interface/L1PromptAnalysis.h deleted file mode 100644 index d6d29a3eef1a6..0000000000000 --- a/L1TriggerOffline/L1Analyzer/interface/L1PromptAnalysis.h +++ /dev/null @@ -1,288 +0,0 @@ - -//------------------------------------------------- -// -// \class L1PromptAnalysis -/** - * Description: This code is designed for l1 prompt analysis -// starting point is a GMTTreeMaker By Ivan Mikulec. -*/ -// -// I. Mikulec HEPHY Vienna -// -//-------------------------------------------------- -#ifndef L1_PROMPT_ANALYSIS_H -#define L1_PROMPT_ANALYSIS_H - -//--------------- -// C++ Headers -- -//--------------- - -#include -#include - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ - -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" -#include "FWCore/Utilities/interface/InputTag.h" - -class TFile; -class TTree; - -// --------------------- -// -- Class Interface -- -// --------------------- - -const int MAXGEN = 20; -const int MAXRPC = 12; -const int MAXDTBX = 12; -const int MAXCSC = 12; -const int MAXGMT = 12; -const int MAXGT = 12; -const int MAXRCTREG = 400; -const int MAXDTPH = 50; -const int MAXDTTH = 50; -const int MAXDTTR = 50; - -class L1PromptAnalysis : public edm::EDAnalyzer { -public: - // constructor - explicit L1PromptAnalysis(const edm::ParameterSet&); - virtual ~L1PromptAnalysis(); - - // fill tree - virtual void analyze(const edm::Event&, const edm::EventSetup&); - void book(); - - virtual void beginJob(); - virtual void endJob(); - -private: - //GENERAL block - int runn; - int eventn; - int lumi; - int bx; - uint64_t orbitn; - uint64_t timest; - - // Generator info - float weight; - float pthat; - - // simulation block - int ngen; - float pxgen[MAXGEN]; - float pygen[MAXGEN]; - float pzgen[MAXGEN]; - float ptgen[MAXGEN]; - float etagen[MAXGEN]; - float phigen[MAXGEN]; - int chagen[MAXGEN]; - float vxgen[MAXGEN]; - float vygen[MAXGEN]; - float vzgen[MAXGEN]; - int pargen[MAXGEN]; - - // GMT data - int bxgmt; - - //DTBX Trigger block - int ndt; - int bxd[MAXDTBX]; - float ptd[MAXDTBX]; - int chad[MAXDTBX]; - float etad[MAXDTBX]; - int etafined[MAXDTBX]; - float phid[MAXDTBX]; - int quald[MAXDTBX]; - int dwd[MAXDTBX]; - int chd[MAXDTBX]; - - //CSC Trigger block - int ncsc; - int bxc[MAXCSC]; - float ptc[MAXCSC]; - int chac[MAXCSC]; - float etac[MAXCSC]; - float phic[MAXCSC]; - int qualc[MAXCSC]; - int dwc[MAXCSC]; - - //RPCb Trigger - int nrpcb; - int bxrb[MAXRPC]; - float ptrb[MAXRPC]; - int charb[MAXRPC]; - float etarb[MAXRPC]; - float phirb[MAXRPC]; - int qualrb[MAXRPC]; - int dwrb[MAXRPC]; - - //RPCf Trigger - int nrpcf; - int bxrf[MAXRPC]; - float ptrf[MAXRPC]; - int charf[MAXRPC]; - float etarf[MAXRPC]; - float phirf[MAXRPC]; - int qualrf[MAXRPC]; - int dwrf[MAXRPC]; - - //Global Muon Trigger - int ngmt; - int bxg[MAXGMT]; - float ptg[MAXGMT]; - int chag[MAXGMT]; - float etag[MAXGMT]; - float phig[MAXGMT]; - int qualg[MAXGMT]; - int detg[MAXGMT]; - int rankg[MAXGMT]; - int isolg[MAXGMT]; - int mipg[MAXGMT]; - int dwg[MAXGMT]; - int idxRPCb[MAXGMT]; - int idxRPCf[MAXGMT]; - int idxDTBX[MAXGMT]; - int idxCSC[MAXGMT]; - - // GT info - uint64_t gttw1[3]; - uint64_t gttw2[3]; - uint64_t gttt[3]; - - //PSB info - int nele; - int bxel[MAXGT]; - float rankel[MAXGT]; - float phiel[MAXGT]; - float etael[MAXGT]; - - int njet; - int bxjet[MAXGT]; - float rankjet[MAXGT]; - float phijet[MAXGT]; - float etajet[MAXGT]; - - //GCT - edm::InputTag gctCenJetsSource_; - edm::InputTag gctForJetsSource_; - edm::InputTag gctTauJetsSource_; - edm::InputTag gctEnergySumsSource_; - edm::InputTag gctIsoEmSource_; - edm::InputTag gctNonIsoEmSource_; - - int gctIsoEmSize; - float gctIsoEmEta[4]; - float gctIsoEmPhi[4]; - float gctIsoEmRnk[4]; - int gctNonIsoEmSize; - float gctNonIsoEmEta[4]; - float gctNonIsoEmPhi[4]; - float gctNonIsoEmRnk[4]; - int gctCJetSize; - float gctCJetEta[4]; - float gctCJetPhi[4]; - float gctCJetRnk[4]; - int gctFJetSize; - float gctFJetEta[4]; - float gctFJetPhi[4]; - float gctFJetRnk[4]; - int gctTJetSize; - float gctTJetEta[4]; - float gctTJetPhi[4]; - float gctTJetRnk[4]; - float gctEtMiss; - float gctEtMissPhi; - float gctEtHad; - float gctEtTot; - int gctHFRingEtSumSize; - float gctHFRingEtSumEta[4]; - float gctHFBitCountsSize; - float gctHFBitCountsEta[4]; - // RCT - - edm::InputTag rctSource_; - int rctRegSize; - float rctRegEta[MAXRCTREG]; - float rctRegPhi[MAXRCTREG]; - float rctRegRnk[MAXRCTREG]; - int rctRegVeto[MAXRCTREG]; - int rctRegBx[MAXRCTREG]; - int rctRegOverFlow[MAXRCTREG]; - int rctRegMip[MAXRCTREG]; - int rctRegFGrain[MAXRCTREG]; - int rctEmSize; - int rctIsIsoEm[MAXRCTREG]; - float rctEmEta[MAXRCTREG]; - float rctEmPhi[MAXRCTREG]; - float rctEmRnk[MAXRCTREG]; - int rctEmBx[MAXRCTREG]; - - // DTTF - edm::InputTag dttfSource_; - - int dttf_phSize; - int dttf_phBx[MAXDTPH]; - int dttf_phWh[MAXDTPH]; - int dttf_phSe[MAXDTPH]; - int dttf_phSt[MAXDTPH]; - float dttf_phAng[MAXDTPH]; - float dttf_phBandAng[MAXDTPH]; - int dttf_phCode[MAXDTPH]; - float dttf_phX[MAXDTPH]; - float dttf_phY[MAXDTPH]; - - int dttf_thSize; - int dttf_thBx[MAXDTTH]; - int dttf_thWh[MAXDTTH]; - int dttf_thSe[MAXDTTH]; - int dttf_thSt[MAXDTTH]; - float dttf_thX[MAXDTTH]; - float dttf_thY[MAXDTTH]; - float dttf_thTheta[MAXDTTH][7]; - int dttf_thCode[MAXDTTH][7]; - - int dttf_trSize; - int dttf_trBx[MAXDTTR]; - int dttf_trTag[MAXDTTR]; - int dttf_trQual[MAXDTTR]; - int dttf_trPtPck[MAXDTTR]; - float dttf_trPtVal[MAXDTTR]; - int dttf_trPhiPck[MAXDTTR]; - float dttf_trPhiVal[MAXDTTR]; - int dttf_trPhiGlob[MAXDTTR]; - int dttf_trChPck[MAXDTTR]; - int dttf_trWh[MAXDTTR]; - int dttf_trSc[MAXDTTR]; - /// - - TFile* m_file; - TTree* m_tree; - - edm::InputTag m_GMTInputTag; - edm::InputTag m_GTEvmInputTag; - edm::InputTag m_GTInputTag; - edm::InputTag m_GeneratorInputTag; - edm::InputTag m_SimulationInputTag; - - bool m_PhysVal; - bool verbose_; - std::string m_outfilename; -}; - -#endif diff --git a/MagneticField/Engine/interface/MagneticFieldHelpers.h b/MagneticField/Engine/interface/MagneticFieldHelpers.h deleted file mode 100644 index 06beec5d40985..0000000000000 --- a/MagneticField/Engine/interface/MagneticFieldHelpers.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef MagneticFieldHelpers_h -#define MagneticFieldHelpers_h - -// #include "CondFormats/RunInfo/interface/RunInfo.h" -// #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" - -namespace magneticFieldHelpers { - - /// Return the closer nominal field value (kGauss) to a given magnet current (A) - int closerNominalField(float current) { - int zeroFieldThreshold = 1000; //fixme - float nominalCurrents[5] = {9558,14416,16819,18268,19262} ; //FIXME: replace with correct values... - int nominalFields[5] = {20,30,35,38,40} ; //in kGauss - if(current < zeroFieldThreshold) return 0; - int i=0; - for(;i<4;i++) - { - if(2*current < nominalCurrents[i]+nominalCurrents[i+1] ) - return nominalFields[i]; - } - return nominalFields[i]; - } - -// /// Return the closer nominal field value (kGauss) to the average current stored in the DB. -// int closerNominalField(const RunInfo & runInfo) { -// return closerNominalField(runInfo.m_avg_current); -// } - -// /// Return the closer nominal field value (kGauss) to the average current stored in the DB. -// int closerNominalField(const edm::EventSetup& es) -// { -// edm::ESHandle sum; -// es.get().get(sum); -// return closerNominalField( *sum.product() ); -// } - - -} - -#endif // MagneticFieldHelpers_h diff --git a/MagneticField/VolumeGeometry/interface/RectangularVolumeBounds.h b/MagneticField/VolumeGeometry/interface/RectangularVolumeBounds.h deleted file mode 100644 index 5ef800e81b2bd..0000000000000 --- a/MagneticField/VolumeGeometry/interface/RectangularVolumeBounds.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef RectangularVolumeBounds_H -#define RectangularVolumeBounds_H - -#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" - -typedef RectangularPlaneBounds RectangularVolumeBounds; - -#endif diff --git a/Mixing/Base/interface/FixedPUGenerator.h b/Mixing/Base/interface/FixedPUGenerator.h deleted file mode 100644 index 3a0ce92928a71..0000000000000 --- a/Mixing/Base/interface/FixedPUGenerator.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef FIXED_PU_GENERATOR_H -#define FIXED_PU_GENERATOR_H - -/*---------------------------------------------------------------------- - -----------------------------------------------------------------------*/ -#include "Mixing/Base/interface/PUGenerator.h" - -namespace edm -{ - - class FixedPUGenerator: public PUGenerator - { - public: - explicit FixedPUGenerator(int average): nrEvtsPerBunch(average) { } - ~FixedPUGenerator() { } - - private: - virtual unsigned int numberOfEventsPerBunch() const { return nrEvtsPerBunch;} - - unsigned int nrEvtsPerBunch; - }; -}//edm - -#endif diff --git a/Mixing/Base/interface/PUGenerator.h b/Mixing/Base/interface/PUGenerator.h deleted file mode 100644 index dbe7ff5e68425..0000000000000 --- a/Mixing/Base/interface/PUGenerator.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef PU_GENERATOR_H -#define PU_GENERATOR_H - -/*---------------------------------------------------------------------- - -----------------------------------------------------------------------*/ - -namespace edm -{ - - class PUGenerator - { - public: - explicit PUGenerator() { } - virtual ~PUGenerator() { } - virtual unsigned int numberOfEventsPerBunch() const=0; - - private: - }; - -}//edm -#endif From f79825018b666450833f1cc5955950130ba96fbe Mon Sep 17 00:00:00 2001 From: swmukher Date: Tue, 31 Aug 2021 19:40:52 +0200 Subject: [PATCH 263/923] code checks --- .../EgammaHLTHcalVarProducerFromRecHit.cc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc index fcf3ddedf53ed..e950fde814006 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc @@ -165,16 +165,16 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, if (useSingleTower_) { if (!doEtSum_) { //this is single tower based H/E - external = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; - internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + external = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; } else { //this is cone-based HCAL isolation with single tower based footprint removal - external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::isBehindClusterSeed; } } else { //useSingleTower_=False means H/E is cone-based - external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; - } + external = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + internal = EgammaHcalIsolation::InclusionRule::withinConeAroundCluster; + } EgammaHcalIsolation thisHcalVar_ = EgammaHcalIsolation(external, outerCone_, @@ -196,11 +196,11 @@ void EgammaHLTHcalVarProducerFromRecHit::produce(edm::StreamID, if (useSingleTower_) { if (doEtSum_) { //this is cone-based HCAL isolation with single tower based footprint removal isol = thisHcalVar_.getHcalEtSumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths - } else { //this is single tower based H/E - isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths + } else { //this is single tower based H/E + isol = thisHcalVar_.getHcalESumBc(recoEcalCandRef.get(), depth_); //depth=0 means all depths } - } else { //useSingleTower_=False means H/E is cone-based. - if (doEtSum_) { //hcal iso + } else { //useSingleTower_=False means H/E is cone-based. + if (doEtSum_) { //hcal iso isol = thisHcalVar_.getHcalEtSum(recoEcalCandRef.get(), depth_); //depth=0 means all depths } else { // doEtSum_=False means sum up energy, this is for H/E isol = thisHcalVar_.getHcalESum(recoEcalCandRef.get(), depth_); //depth=0 means all depths From 39b324e04cec1a36ead416dc76b70a9aee23fe17 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Thu, 19 Aug 2021 23:01:29 +0200 Subject: [PATCH 264/923] Added, registered and tested PPSAlignmentConfigRun3v1. --- .../PPSAlignmentConfigRun3v1ESSource.cc | 693 ++++++++++++++++++ CondCore/CTPPSPlugins/src/plugin.cc | 3 + CondCore/Utilities/plugins/Module_2XML.cc | 1 + CondCore/Utilities/src/CondDBFetch.cc | 1 + CondCore/Utilities/src/CondDBImport.cc | 1 + CondCore/Utilities/src/CondFormats.h | 1 + .../interface/PPSAlignmentConfigRun3v1Rcd.h | 14 + .../src/PPSAlignmentConfigRun3v1Rcd.cc | 10 + .../interface/PPSAlignmentConfigRun3v1.h | 193 +++++ .../src/PPSAlignmentConfigRun3v1.cc | 244 ++++++ .../T_EventSetup_PPSAlignmentConfigRun3v1.cc | 4 + CondFormats/PPSObjects/src/classes_def.xml | 14 +- CondFormats/PPSObjects/src/headers.h | 1 + CondFormats/PPSObjects/test/BuildFile.xml | 4 + ...stSerializationPPSAlignmentConfigRun3v1.cc | 17 + .../RetrievePPSAlignmentConfigRun3v1.cc | 42 ++ .../plugins/WritePPSAlignmentConfigRun3v1.cc | 51 ++ .../retrieve_PPSAlignmentConfigRun3v1_cfg.py | 52 ++ .../write_PPSAlignmentConfigRun3v1_cfg.py | 89 +++ 19 files changed, 1434 insertions(+), 1 deletion(-) create mode 100644 CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc create mode 100644 CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h create mode 100644 CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc create mode 100644 CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h create mode 100644 CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc create mode 100644 CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc create mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc create mode 100644 CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc create mode 100644 CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc create mode 100644 CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py create mode 100644 CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc new file mode 100644 index 0000000000000..f6466ae9300d3 --- /dev/null +++ b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc @@ -0,0 +1,693 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/SourceFactory.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESProducts.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/ESInputTag.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" + +#include +#include +#include +#include +#include + +#include "TF1.h" +#include "TProfile.h" +#include "TFile.h" +#include "TKey.h" +#include "TSystemFile.h" + +//--------------------------------------------------------------------------------------------- + +class PPSAlignmentConfigRun3v1ESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + PPSAlignmentConfigRun3v1ESSource(const edm::ParameterSet &iConfig); + + std::unique_ptr produce(const PPSAlignmentConfigRun3v1Rcd &); + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc); + TDirectory *findDirectoryWithName(TDirectory *dir, std::string searchName); + std::vector buildVectorFromDirectory(TDirectory *dir, + const PPSAlignmentConfigRun3v1::RPConfig &rpd); + + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, + const edm::IOVSyncValue &iosv, + edm::ValidityInterval &oValidity) override; + + bool debug; + + PPSAlignmentConfigRun3v1::SectorConfig sectorConfig45, sectorConfig56; + + double x_ali_sh_step; + + double y_mode_sys_unc; + double chiSqThreshold; + double y_mode_unc_max_valid; + double y_mode_max_valid; + + unsigned int minRPTracksSize; + unsigned int maxRPTracksSize; + double n_si; + + std::map> matchingReferencePoints; + std::map matchingShiftRanges; + + std::map alignment_x_meth_o_ranges; + unsigned int fitProfileMinBinEntries; + unsigned int fitProfileMinNReasonable; + unsigned int methOGraphMinN; + double methOUncFitRange; + + std::map alignment_x_relative_ranges; + unsigned int nearFarMinEntries; + + std::map alignment_y_ranges; + unsigned int modeGraphMinN; + unsigned int multSelProjYMinEntries; + + PPSAlignmentConfigRun3v1::Binning binning; + + std::string label; +}; + +//--------------------------------------------------------------------------------------------- + +PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::ParameterSet &iConfig) { + label = iConfig.getParameter("label"); + + debug = iConfig.getParameter("debug"); + TFile *debugFile = nullptr; + if (debug) { + debugFile = new TFile(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate"); + } + + sectorConfig45.name_ = "sector 45"; + + sectorConfig45.rp_N_.position_ = "N"; + sectorConfig45.rp_F_.position_ = "F"; + + sectorConfig56.name_ = "sector 56"; + + sectorConfig56.rp_N_.position_ = "N"; + sectorConfig56.rp_F_.position_ = "F"; + + for (std::string sectorName : {"sector_45", "sector_56"}) { + const auto &sps = iConfig.getParameter(sectorName); + PPSAlignmentConfigRun3v1::SectorConfig *sc; + if (sectorName == "sector_45") + sc = §orConfig45; + else + sc = §orConfig56; + + for (std::string rpName : {"rp_N", "rp_F"}) { + const auto &rpps = sps.getParameter(rpName); + PPSAlignmentConfigRun3v1::RPConfig *rc; + if (rpName == "rp_N") + rc = &sc->rp_N_; + else + rc = &sc->rp_F_; + + rc->name_ = rpps.getParameter("name"); + rc->id_ = rpps.getParameter("id"); + + rc->slope_ = rpps.getParameter("slope"); + rc->sh_x_ = rpps.getParameter("sh_x"); + + rc->x_min_fit_mode_ = rpps.getParameter("x_min_fit_mode"); + rc->x_max_fit_mode_ = rpps.getParameter("x_max_fit_mode"); + rc->y_max_fit_mode_ = rpps.getParameter("y_max_fit_mode"); + rc->y_cen_add_ = rpps.getParameter("y_cen_add"); + rc->y_width_mult_ = rpps.getParameter("y_width_mult"); + + rc->x_slice_min_ = rpps.getParameter("x_slice_min"); + rc->x_slice_w_ = rpps.getParameter("x_slice_w"); + rc->x_slice_n_ = std::ceil((rpps.getParameter("x_slice_max") - rc->x_slice_min_) / rc->x_slice_w_); + } + + sc->slope_ = sps.getParameter("slope"); + + sc->cut_h_apply_ = sps.getParameter("cut_h_apply"); + sc->cut_h_a_ = sps.getParameter("cut_h_a"); + sc->cut_h_c_ = sps.getParameter("cut_h_c"); + sc->cut_h_si_ = sps.getParameter("cut_h_si"); + + sc->cut_v_apply_ = sps.getParameter("cut_v_apply"); + sc->cut_v_a_ = sps.getParameter("cut_v_a"); + sc->cut_v_c_ = sps.getParameter("cut_v_c"); + sc->cut_v_si_ = sps.getParameter("cut_v_si"); + } + + std::map rpTags = {{sectorConfig45.rp_F_.id_, "rp_L_F"}, + {sectorConfig45.rp_N_.id_, "rp_L_N"}, + {sectorConfig56.rp_N_.id_, "rp_R_N"}, + {sectorConfig56.rp_F_.id_, "rp_R_F"}}; + + std::map sectorNames = {{sectorConfig45.rp_F_.id_, sectorConfig45.name_}, + {sectorConfig45.rp_N_.id_, sectorConfig45.name_}, + {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, + {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; + + std::map rpConfigs = { + {sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, + {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, + {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, + {sectorConfig56.rp_F_.id_, §orConfig56.rp_F_}}; + + x_ali_sh_step = iConfig.getParameter("x_ali_sh_step"); + + y_mode_sys_unc = iConfig.getParameter("y_mode_sys_unc"); + chiSqThreshold = iConfig.getParameter("chiSqThreshold"); + y_mode_unc_max_valid = iConfig.getParameter("y_mode_unc_max_valid"); + y_mode_max_valid = iConfig.getParameter("y_mode_max_valid"); + + minRPTracksSize = iConfig.getParameter("min_RP_tracks_size"); + maxRPTracksSize = iConfig.getParameter("max_RP_tracks_size"); + n_si = iConfig.getParameter("n_si"); + + const auto &c_axo = iConfig.getParameter("x_alignment_meth_o"); + for (const auto &p : rpTags) { + const auto &ps = c_axo.getParameter(p.second); + alignment_x_meth_o_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + fitProfileMinBinEntries = c_axo.getParameter("fit_profile_min_bin_entries"); + fitProfileMinNReasonable = c_axo.getParameter("fit_profile_min_N_reasonable"); + methOGraphMinN = c_axo.getParameter("meth_o_graph_min_N"); + methOUncFitRange = c_axo.getParameter("meth_o_unc_fit_range"); + + const auto &c_m = iConfig.getParameter("matching"); + const auto &referenceDataset = c_m.getParameter("reference_dataset"); + + // constructing vectors with reference data + if (!referenceDataset.empty()) { + TFile *f_ref = TFile::Open(referenceDataset.c_str()); + if (!f_ref->IsOpen()) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset; + } else { + TDirectory *ad_ref = findDirectoryWithName((TDirectory *)f_ref, sectorConfig45.name_); + if (ad_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset; + } else { + edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath(); + + for (const auto &p : rpTags) { + if (debug) + gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref"); + + auto *d_ref = (TDirectory *)ad_ref->Get( + (sectorNames[p.first] + "/near_far/x slices, " + rpConfigs[p.first]->position_).c_str()); + if (d_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not load d_ref"; + } else { + matchingReferencePoints[p.first] = buildVectorFromDirectory(d_ref, *rpConfigs[p.first]); + } + } + } + } + delete f_ref; + } + + for (const auto &p : rpTags) { + const auto &ps = c_m.getParameter(p.second); + matchingShiftRanges[p.first] = {ps.getParameter("sh_min"), ps.getParameter("sh_max")}; + } + + const auto &c_axr = iConfig.getParameter("x_alignment_relative"); + for (const auto &p : rpTags) { + if (p.second.back() == 'N') { // only near RPs + const auto &ps = c_axr.getParameter(p.second); + alignment_x_relative_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + } + nearFarMinEntries = c_axr.getParameter("near_far_min_entries"); + + const auto &c_ay = iConfig.getParameter("y_alignment"); + for (const auto &p : rpTags) { + const auto &ps = c_ay.getParameter(p.second); + alignment_y_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + modeGraphMinN = c_ay.getParameter("mode_graph_min_N"); + multSelProjYMinEntries = c_ay.getParameter("mult_sel_proj_y_min_entries"); + + const auto &bps = iConfig.getParameter("binning"); + binning.bin_size_x_ = bps.getParameter("bin_size_x"); + binning.n_bins_x_ = bps.getParameter("n_bins_x"); + binning.pixel_x_offset_ = bps.getParameter("pixel_x_offset"); + binning.n_bins_y_ = bps.getParameter("n_bins_y"); + binning.y_min_ = bps.getParameter("y_min"); + binning.y_max_ = bps.getParameter("y_max"); + + binning.diffFN_n_bins_x_ = bps.getParameter("diffFN_n_bins_x"); + binning.diffFN_x_min_ = bps.getParameter("diffFN_x_min"); + binning.diffFN_x_max_ = bps.getParameter("diffFN_x_max"); + + binning.slice_n_bins_x_ = bps.getParameter("slice_n_bins_x"); + binning.slice_x_min_ = bps.getParameter("slice_x_min"); + binning.slice_x_max_ = bps.getParameter("slice_x_max"); + binning.slice_n_bins_y_ = bps.getParameter("slice_n_bins_y"); + binning.slice_y_min_ = bps.getParameter("slice_y_min"); + binning.slice_y_max_ = bps.getParameter("slice_y_max"); + + setWhatProduced(this, label); + findingRecord(); + + if (debug) + delete debugFile; +} + +//--------------------------------------------------------------------------------------------- + +std::unique_ptr PPSAlignmentConfigRun3v1ESSource::produce(const PPSAlignmentConfigRun3v1Rcd &) { + auto p = std::make_unique(); + + p->setSectorConfig45(sectorConfig45); + p->setSectorConfig56(sectorConfig56); + + p->setX_ali_sh_step(x_ali_sh_step); + + p->setY_mode_sys_unc(y_mode_sys_unc); + p->setChiSqThreshold(chiSqThreshold); + p->setY_mode_unc_max_valid(y_mode_unc_max_valid); + p->setY_mode_max_valid(y_mode_max_valid); + + p->setMinRPTracksSize(minRPTracksSize); + p->setMaxRPTracksSize(maxRPTracksSize); + p->setN_si(n_si); + + p->setMatchingReferencePoints(matchingReferencePoints); + p->setMatchingShiftRanges(matchingShiftRanges); + + p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges); + p->setFitProfileMinBinEntries(fitProfileMinBinEntries); + p->setFitProfileMinNReasonable(fitProfileMinNReasonable); + p->setMethOGraphMinN(methOGraphMinN); + p->setMethOUncFitRange(methOUncFitRange); + + p->setAlignment_x_relative_ranges(alignment_x_relative_ranges); + p->setNearFarMinEntries(nearFarMinEntries); + + p->setAlignment_y_ranges(alignment_y_ranges); + p->setModeGraphMinN(modeGraphMinN); + p->setMultSelProjYMinEntries(multSelProjYMinEntries); + + p->setBinning(binning); + + edm::LogInfo("PPS") << "\n" + << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n" + << (*p); + + return p; +} + +//--------------------------------------------------------------------------------------------- + +// most default values come from 2018 period +void PPSAlignmentConfigRun3v1ESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + + desc.add("debug", false); + + desc.add("label", ""); + + // sector_45 + { + edm::ParameterSetDescription sector45; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "L_1_F"); + rp_N.add("id", 3); + + rp_N.add("slope", 0.19); + rp_N.add("sh_x", -3.6); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.0); + rp_N.add("y_max_fit_mode", 7.0); + rp_N.add("y_cen_add", -0.3); + rp_N.add("y_width_mult", 1.1); + + rp_N.add("x_slice_min", 7.); + rp_N.add("x_slice_max", 19.); + rp_N.add("x_slice_w", 0.2); + sector45.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "L_2_F"); + rp_F.add("id", 23); + + rp_F.add("slope", 0.19); + rp_F.add("sh_x", -42.); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 7.5); + rp_F.add("y_max_fit_mode", 7.5); + rp_F.add("y_cen_add", -0.3); + rp_F.add("y_width_mult", 1.1); + + rp_F.add("x_slice_min", 46.); + rp_F.add("x_slice_max", 58.); + rp_F.add("x_slice_w", 0.2); + sector45.add("rp_F", rp_F); + + sector45.add("slope", 0.006); + sector45.add("cut_h_apply", true); + sector45.add("cut_h_a", -1.); + sector45.add("cut_h_c", -38.55); + sector45.add("cut_h_si", 0.2); + sector45.add("cut_v_apply", true); + sector45.add("cut_v_a", -1.07); + sector45.add("cut_v_c", 1.63); + sector45.add("cut_v_si", 0.15); + + desc.add("sector_45", sector45); + } + + // sector_56 + { + edm::ParameterSetDescription sector56; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "R_1_F"); + rp_N.add("id", 103); + + rp_N.add("slope", 0.40); + rp_N.add("sh_x", -2.8); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.4); + rp_N.add("y_max_fit_mode", 7.4); + rp_N.add("y_cen_add", -0.8); + rp_N.add("y_width_mult", 1.0); + + rp_N.add("x_slice_min", 6.); + rp_N.add("x_slice_max", 17.); + rp_N.add("x_slice_w", 0.2); + sector56.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "R_2_F"); + rp_F.add("id", 123); + + rp_F.add("slope", 0.39); + rp_F.add("sh_x", -41.9); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 8.0); + rp_F.add("y_max_fit_mode", 8.0); + rp_F.add("y_cen_add", -0.8); + rp_F.add("y_width_mult", 1.0); + + rp_F.add("x_slice_min", 45.); + rp_F.add("x_slice_max", 57.); + rp_F.add("x_slice_w", 0.2); + sector56.add("rp_F", rp_F); + + sector56.add("slope", -0.015); + sector56.add("cut_h_apply", true); + sector56.add("cut_h_a", -1.); + sector56.add("cut_h_c", -39.26); + sector56.add("cut_h_si", 0.2); + sector56.add("cut_v_apply", true); + sector56.add("cut_v_a", -1.07); + sector56.add("cut_v_c", 1.49); + sector56.add("cut_v_si", 0.15); + + desc.add("sector_56", sector56); + } + + desc.add("x_ali_sh_step", 0.01); + + desc.add("y_mode_sys_unc", 0.03); + desc.add("chiSqThreshold", 50.); + desc.add("y_mode_unc_max_valid", 5.); + desc.add("y_mode_max_valid", 20.); + + desc.add("min_RP_tracks_size", 1); + desc.add("max_RP_tracks_size", 1); + desc.add("n_si", 4.); + + // matching + { + edm::ParameterSetDescription matching; + matching.add("reference_dataset", ""); + + edm::ParameterSetDescription rpLF; + rpLF.add("sh_min", -43.); + rpLF.add("sh_max", -41.); + matching.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("sh_min", -4.2); + rpLN.add("sh_max", -2.4); + matching.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("sh_min", -3.6); + rpRN.add("sh_max", -1.8); + matching.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("sh_min", -43.2); + rpRF.add("sh_max", -41.2); + matching.add("rp_R_F", rpRF); + + desc.add("matching", matching); + } + + // x alignment meth o + { + edm::ParameterSetDescription x_alignment_meth_o; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 47.); + rpLF.add("x_max", 56.5); + x_alignment_meth_o.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 9.); + rpLN.add("x_max", 18.5); + x_alignment_meth_o.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 7.); + rpRN.add("x_max", 15.); + x_alignment_meth_o.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 46.); + rpRF.add("x_max", 54.); + x_alignment_meth_o.add("rp_R_F", rpRF); + + x_alignment_meth_o.add("fit_profile_min_bin_entries", 5); + x_alignment_meth_o.add("fit_profile_min_N_reasonable", 10); + x_alignment_meth_o.add("meth_o_graph_min_N", 5); + x_alignment_meth_o.add("meth_o_unc_fit_range", 0.5); + + desc.add("x_alignment_meth_o", x_alignment_meth_o); + } + + // x alignment relative + { + edm::ParameterSetDescription x_alignment_relative; + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 7.5); + rpLN.add("x_max", 12.); + x_alignment_relative.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 6.); + rpRN.add("x_max", 10.); + x_alignment_relative.add("rp_R_N", rpRN); + + x_alignment_relative.add("near_far_min_entries", 100); + + desc.add("x_alignment_relative", x_alignment_relative); + } + + // y alignment + { + edm::ParameterSetDescription y_alignment; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 44.5); + rpLF.add("x_max", 49.); + y_alignment.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 6.7); + rpLN.add("x_max", 11.); + y_alignment.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 5.9); + rpRN.add("x_max", 10.); + y_alignment.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 44.5); + rpRF.add("x_max", 49.); + y_alignment.add("rp_R_F", rpRF); + + y_alignment.add("mode_graph_min_N", 5); + y_alignment.add("mult_sel_proj_y_min_entries", 300); + + desc.add("y_alignment", y_alignment); + } + + // binning + { + edm::ParameterSetDescription binning; + + binning.add("bin_size_x", 142.3314E-3); + binning.add("n_bins_x", 210); + binning.add("pixel_x_offset", 40.); + binning.add("n_bins_y", 400); + binning.add("y_min", -20.); + binning.add("y_max", 20.); + + binning.add("diffFN_n_bins_x", 100); + binning.add("diffFN_x_min", 0.); + binning.add("diffFN_x_max", 20.); + + binning.add("slice_n_bins_x", 100); + binning.add("slice_x_min", -10.); + binning.add("slice_x_max", 10.); + binning.add("slice_n_bins_y", 100); + binning.add("slice_y_min", -2.); + binning.add("slice_y_max", 2.); + + desc.add("binning", binning); + } + + descriptions.add("ppsAlignmentConfigRun3v1ESSource", desc); +} + +//--------------------------------------------------------------------------------------------- + +// Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). +int PPSAlignmentConfigRun3v1ESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { + unsigned int n_reasonable = 0; + for (int bi = 1; bi <= p->GetNbinsX(); bi++) { + if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { + p->SetBinContent(bi, 0.); + p->SetBinError(bi, 0.); + } else { + n_reasonable++; + } + } + + if (n_reasonable < fitProfileMinNReasonable) + return 1; + + double x_min = x_mean - x_rms, x_max = x_mean + x_rms; + + TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); + + ff_pol1->SetParameter(0., 0.); + p->Fit(ff_pol1, "Q", "", x_min, x_max); + + sl = ff_pol1->GetParameter(1); + sl_unc = ff_pol1->GetParError(1); + + return 0; +} + +//--------------------------------------------------------------------------------------------- + +// Performs a breadth first search on dir. If found, returns the directory with object +// named searchName inside. Otherwise, returns nullptr. +TDirectory *PPSAlignmentConfigRun3v1ESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { + TIter next(dir->GetListOfKeys()); + std::queue dirQueue; + TObject *o; + while ((o = next())) { + TKey *k = (TKey *)o; + + std::string name = k->GetName(); + if (name == searchName) + return dir; + + if (((TSystemFile *)k)->IsDirectory()) + dirQueue.push((TDirectory *)k->ReadObj()); + } + + while (!dirQueue.empty()) { + TDirectory *resultDir = findDirectoryWithName(dirQueue.front(), searchName); + dirQueue.pop(); + if (resultDir != nullptr) + return resultDir; + } + + return nullptr; +} + +//--------------------------------------------------------------------------------------------- + +// Builds vector of PointErrors instances from slice plots in dir. +std::vector PPSAlignmentConfigRun3v1ESSource::buildVectorFromDirectory( + TDirectory *dir, const PPSAlignmentConfigRun3v1::RPConfig &rpd) { + std::vector pv; + + TIter next(dir->GetListOfKeys()); + TObject *o; + while ((o = next())) { + TKey *k = (TKey *)o; + + std::string name = k->GetName(); + size_t d = name.find('-'); + const double x_min = std::stod(name.substr(0, d)); + const double x_max = std::stod(name.substr(d + 1)); + + TDirectory *d_slice = (TDirectory *)k->ReadObj(); + + TH1D *h_y = (TH1D *)d_slice->Get("h_y"); + TProfile *p_y_diffFN_vs_y = (TProfile *)d_slice->Get("p_y_diffFN_vs_y"); + + double y_cen = h_y->GetMean(); + double y_width = h_y->GetRMS(); + + y_cen += rpd.y_cen_add_; + y_width *= rpd.y_width_mult_; + + double sl = 0., sl_unc = 0.; + int fr = fitProfile(p_y_diffFN_vs_y, y_cen, y_width, sl, sl_unc); + if (fr != 0) + continue; + + if (debug) + p_y_diffFN_vs_y->Write(name.c_str()); + + pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc}); + } + + return pv; +} + +//--------------------------------------------------------------------------------------------- + +void PPSAlignmentConfigRun3v1ESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, + const edm::IOVSyncValue &iosv, + edm::ValidityInterval &oValidity) { + edm::LogInfo("PPS") << ">> PPSAlignmentConfigRun3v1ESSource::setIntervalFor(" << key.name() << ")\n" + << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); + + edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); + oValidity = infinity; +} + +DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigRun3v1ESSource); diff --git a/CondCore/CTPPSPlugins/src/plugin.cc b/CondCore/CTPPSPlugins/src/plugin.cc index 7f9f109e123f1..e18a087d7b628 100644 --- a/CondCore/CTPPSPlugins/src/plugin.cc +++ b/CondCore/CTPPSPlugins/src/plugin.cc @@ -21,6 +21,8 @@ #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" REGISTER_PLUGIN(CTPPSBeamParametersRcd, CTPPSBeamParameters); REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd, CTPPSPixelDAQMapping); @@ -34,3 +36,4 @@ REGISTER_PLUGIN(CTPPSOpticsRcd, LHCOpticalFunctionsSetCollection); REGISTER_PLUGIN(PPSDirectSimulationDataRcd, PPSDirectSimulationData); REGISTER_PLUGIN(PPSPixelTopologyRcd, PPSPixelTopology); REGISTER_PLUGIN(PPSAlignmentConfigRcd, PPSAlignmentConfig); +REGISTER_PLUGIN(PPSAlignmentConfigRun3v1Rcd, PPSAlignmentConfigRun3v1); diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index ad1e52c5724d5..0187588fd9a5e 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -31,6 +31,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping); PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations); PAYLOAD_2XML_CLASS(PPSAlignmentConfig) + PAYLOAD_2XML_CLASS(PPSAlignmentConfigRun3v1) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); PAYLOAD_2XML_CLASS(CastorGainWidths); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index 25aa9d1e16edd..25dbbb916b014 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -57,6 +57,7 @@ namespace cond { FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations) FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) FETCH_PAYLOAD_CASE(PPSAlignmentConfig) + FETCH_PAYLOAD_CASE(PPSAlignmentConfigRun3v1) 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 0a93d0b0346b4..4f97c82efeb9b 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -77,6 +77,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations) IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) IMPORT_PAYLOAD_CASE(PPSAlignmentConfig) + IMPORT_PAYLOAD_CASE(PPSAlignmentConfigRun3v1) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) IMPORT_PAYLOAD_CASE(CastorElectronicsMap) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 48fe8f23f996b..0ab9c8df6eae7 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -33,6 +33,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSPixelGainCalibrations.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DTObjects/interface/DTCCBConfig.h" diff --git a/CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h b/CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h new file mode 100644 index 0000000000000..24efe950734a9 --- /dev/null +++ b/CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h @@ -0,0 +1,14 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#ifndef CondFormats_DataRecord_PPSAlignmentConfigRun3v1Rcd_h +#define CondFormats_DataRecord_PPSAlignmentConfigRun3v1Rcd_h + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class PPSAlignmentConfigRun3v1Rcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc b/CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc new file mode 100644 index 0000000000000..68cd26ab0a06b --- /dev/null +++ b/CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc @@ -0,0 +1,10 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(PPSAlignmentConfigRun3v1Rcd); diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h new file mode 100644 index 0000000000000..604240aa87627 --- /dev/null +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h @@ -0,0 +1,193 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#ifndef CondFormats_PPSObjects_PPSAlignmentConfigRun3v1_h +#define CondFormats_PPSObjects_PPSAlignmentConfigRun3v1_h + +#include "CondFormats/Serialization/interface/Serializable.h" + +#include +#include +#include + +class PPSAlignmentConfigRun3v1 { +public: + // Auxiliary structures + struct PointErrors { + double x_; + double y_; + double ex_; // error x + double ey_; // error y + + COND_SERIALIZABLE; + }; + + struct SelectionRange { + double x_min_; + double x_max_; + + COND_SERIALIZABLE; + }; + + struct RPConfig { + std::string name_; + unsigned int id_; + std::string position_; + double slope_; + double sh_x_; + + double x_min_fit_mode_, x_max_fit_mode_; + double y_max_fit_mode_; + double y_cen_add_; + double y_width_mult_; + + int x_slice_n_; + double x_slice_min_, x_slice_w_; + + COND_SERIALIZABLE; + }; + + struct SectorConfig { + std::string name_; + RPConfig rp_N_, rp_F_; + double slope_; + + bool cut_h_apply_; + double cut_h_a_, cut_h_c_, cut_h_si_; + + bool cut_v_apply_; + double cut_v_a_, cut_v_c_, cut_v_si_; + + COND_SERIALIZABLE; + }; + + struct Binning { + double bin_size_x_; // mm + unsigned int n_bins_x_; + + double pixel_x_offset_; + + unsigned int n_bins_y_; + double y_min_, y_max_; + + unsigned int diffFN_n_bins_x_; + double diffFN_x_min_, diffFN_x_max_; + + unsigned int slice_n_bins_x_, slice_n_bins_y_; + double slice_x_min_, slice_x_max_, slice_y_min_, slice_y_max_; + + COND_SERIALIZABLE; + }; + + // Getters + const SectorConfig §orConfig45() const; + const SectorConfig §orConfig56() const; + + double x_ali_sh_step() const; + + double y_mode_sys_unc() const; + double chiSqThreshold() const; + double y_mode_unc_max_valid() const; + double y_mode_max_valid() const; + + double minRPTracksSize() const; + double maxRPTracksSize() const; + double n_si() const; + + const std::map> &matchingReferencePoints() const; + const std::map &matchingShiftRanges() const; + + const std::map &alignment_x_meth_o_ranges() const; + unsigned int fitProfileMinBinEntries() const; + unsigned int fitProfileMinNReasonable() const; + unsigned int methOGraphMinN() const; + double methOUncFitRange() const; + + const std::map &alignment_x_relative_ranges() const; + unsigned int nearFarMinEntries() const; + + const std::map &alignment_y_ranges() const; + unsigned int modeGraphMinN() const; + unsigned int multSelProjYMinEntries() const; + + const Binning &binning() const; + + // Setters + void setSectorConfig45(SectorConfig §orConfig45); + void setSectorConfig56(SectorConfig §orConfig56); + + void setX_ali_sh_step(double x_ali_sh_step); + + void setY_mode_sys_unc(double y_mode_sys_unc); + void setChiSqThreshold(double chiSqThreshold); + void setY_mode_unc_max_valid(double y_mode_unc_max_valid); + void setY_mode_max_valid(double y_mode_max_valid); + + void setMinRPTracksSize(unsigned int minRPTracksSize); + void setMaxRPTracksSize(unsigned int maxRPTracksSize); + void setN_si(double n_si); + + void setMatchingReferencePoints(std::map> &matchingReferencePoints); + void setMatchingShiftRanges(std::map &matchingShiftRanges); + + void setAlignment_x_meth_o_ranges(std::map &alignment_x_meth_o_ranges); + void setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries); + void setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable); + void setMethOGraphMinN(unsigned int methOGraphMinN); + void setMethOUncFitRange(double methOUncFitRange); + + void setAlignment_x_relative_ranges(std::map &alignment_x_relative_ranges); + void setNearFarMinEntries(unsigned int nearFarMinEntries); + + void setAlignment_y_ranges(std::map &alignment_y_ranges); + void setModeGraphMinN(unsigned int modeGraphMinN); + void setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries); + + void setBinning(Binning &binning); + + // << operator + friend std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1 &c); + +private: + SectorConfig sectorConfig45_, sectorConfig56_; + + double x_ali_sh_step_; // mm + + double y_mode_sys_unc_; + double chiSqThreshold_; + double y_mode_unc_max_valid_; + double y_mode_max_valid_; + + unsigned int minRPTracksSize_; + unsigned int maxRPTracksSize_; + double n_si_; + + std::map> matchingReferencePoints_; + std::map matchingShiftRanges_; + + std::map alignment_x_meth_o_ranges_; + unsigned int fitProfileMinBinEntries_; + unsigned int fitProfileMinNReasonable_; + unsigned int methOGraphMinN_; + double methOUncFitRange_; // mm + + std::map alignment_x_relative_ranges_; + unsigned int nearFarMinEntries_; + + std::map alignment_y_ranges_; + unsigned int modeGraphMinN_; + unsigned int multSelProjYMinEntries_; + + Binning binning_; + + COND_SERIALIZABLE; +}; + +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::RPConfig &rc); +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::SectorConfig &sc); +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Binning &b); + +#endif diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc new file mode 100644 index 0000000000000..26f41f0380ce2 --- /dev/null +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc @@ -0,0 +1,244 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" + +#include +#include +#include + +// -------------------------------- PPSAlignmentConfigRun3v1 getters -------------------------------- + +const PPSAlignmentConfigRun3v1::SectorConfig &PPSAlignmentConfigRun3v1::sectorConfig45() const { return sectorConfig45_; } +const PPSAlignmentConfigRun3v1::SectorConfig &PPSAlignmentConfigRun3v1::sectorConfig56() const { return sectorConfig56_; } + +double PPSAlignmentConfigRun3v1::x_ali_sh_step() const { return x_ali_sh_step_; } + +double PPSAlignmentConfigRun3v1::y_mode_sys_unc() const { return y_mode_sys_unc_; } +double PPSAlignmentConfigRun3v1::chiSqThreshold() const { return chiSqThreshold_; } +double PPSAlignmentConfigRun3v1::y_mode_unc_max_valid() const { return y_mode_unc_max_valid_; } +double PPSAlignmentConfigRun3v1::y_mode_max_valid() const { return y_mode_max_valid_; } + +double PPSAlignmentConfigRun3v1::minRPTracksSize() const { return minRPTracksSize_; } +double PPSAlignmentConfigRun3v1::maxRPTracksSize() const { return maxRPTracksSize_; } +double PPSAlignmentConfigRun3v1::n_si() const { return n_si_; } + +const std::map> + &PPSAlignmentConfigRun3v1::matchingReferencePoints() const { + return matchingReferencePoints_; +} +const std::map &PPSAlignmentConfigRun3v1::matchingShiftRanges() const { + return matchingShiftRanges_; +} + +const std::map &PPSAlignmentConfigRun3v1::alignment_x_meth_o_ranges() const { + return alignment_x_meth_o_ranges_; +} +unsigned int PPSAlignmentConfigRun3v1::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; } +unsigned int PPSAlignmentConfigRun3v1::fitProfileMinNReasonable() const { return fitProfileMinNReasonable_; } +unsigned int PPSAlignmentConfigRun3v1::methOGraphMinN() const { return methOGraphMinN_; } +double PPSAlignmentConfigRun3v1::methOUncFitRange() const { return methOUncFitRange_; } + +const std::map &PPSAlignmentConfigRun3v1::alignment_x_relative_ranges() + const { + return alignment_x_relative_ranges_; +} +unsigned int PPSAlignmentConfigRun3v1::nearFarMinEntries() const { return nearFarMinEntries_; } + +const std::map &PPSAlignmentConfigRun3v1::alignment_y_ranges() const { + return alignment_y_ranges_; +} +unsigned int PPSAlignmentConfigRun3v1::modeGraphMinN() const { return modeGraphMinN_; } +unsigned int PPSAlignmentConfigRun3v1::multSelProjYMinEntries() const { return multSelProjYMinEntries_; } + +const PPSAlignmentConfigRun3v1::Binning &PPSAlignmentConfigRun3v1::binning() const { return binning_; } + +// -------------------------------- PPSAlignmentConfigRun3v1 setters -------------------------------- + +void PPSAlignmentConfigRun3v1::setSectorConfig45(PPSAlignmentConfigRun3v1::SectorConfig §orConfig45) { + sectorConfig45_ = sectorConfig45; +} +void PPSAlignmentConfigRun3v1::setSectorConfig56(PPSAlignmentConfigRun3v1::SectorConfig §orConfig56) { + sectorConfig56_ = sectorConfig56; +} + +void PPSAlignmentConfigRun3v1::setX_ali_sh_step(double x_ali_sh_step) { x_ali_sh_step_ = x_ali_sh_step; } + +void PPSAlignmentConfigRun3v1::setY_mode_sys_unc(double y_mode_sys_unc) { y_mode_sys_unc_ = y_mode_sys_unc; } +void PPSAlignmentConfigRun3v1::setChiSqThreshold(double chiSqThreshold) { chiSqThreshold_ = chiSqThreshold; } +void PPSAlignmentConfigRun3v1::setY_mode_unc_max_valid(double y_mode_unc_max_valid) { + y_mode_unc_max_valid_ = y_mode_unc_max_valid; +} +void PPSAlignmentConfigRun3v1::setY_mode_max_valid(double y_mode_max_valid) { y_mode_max_valid_ = y_mode_max_valid; } + +void PPSAlignmentConfigRun3v1::setMinRPTracksSize(unsigned int minRPTracksSize) { minRPTracksSize_ = minRPTracksSize; } +void PPSAlignmentConfigRun3v1::setMaxRPTracksSize(unsigned int maxRPTracksSize) { maxRPTracksSize_ = maxRPTracksSize; } +void PPSAlignmentConfigRun3v1::setN_si(double n_si) { n_si_ = n_si; } + +void PPSAlignmentConfigRun3v1::setMatchingReferencePoints( + std::map> &matchingReferencePoints) { + matchingReferencePoints_ = matchingReferencePoints; +} +void PPSAlignmentConfigRun3v1::setMatchingShiftRanges( + std::map &matchingShiftRanges) { + matchingShiftRanges_ = matchingShiftRanges; +} + +void PPSAlignmentConfigRun3v1::setAlignment_x_meth_o_ranges( + std::map &alignment_x_meth_o_ranges) { + alignment_x_meth_o_ranges_ = alignment_x_meth_o_ranges; +} +void PPSAlignmentConfigRun3v1::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) { + fitProfileMinBinEntries_ = fitProfileMinBinEntries; +} +void PPSAlignmentConfigRun3v1::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) { + fitProfileMinNReasonable_ = fitProfileMinNReasonable; +} +void PPSAlignmentConfigRun3v1::setMethOGraphMinN(unsigned int methOGraphMinN) { methOGraphMinN_ = methOGraphMinN; } +void PPSAlignmentConfigRun3v1::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; } + +void PPSAlignmentConfigRun3v1::setAlignment_x_relative_ranges( + std::map &alignment_x_relative_ranges) { + alignment_x_relative_ranges_ = alignment_x_relative_ranges; +} +void PPSAlignmentConfigRun3v1::setNearFarMinEntries(unsigned int nearFarMinEntries) { + nearFarMinEntries_ = nearFarMinEntries; +} + +void PPSAlignmentConfigRun3v1::setAlignment_y_ranges( + std::map &alignment_y_ranges) { + alignment_y_ranges_ = alignment_y_ranges; +} +void PPSAlignmentConfigRun3v1::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; } +void PPSAlignmentConfigRun3v1::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) { + multSelProjYMinEntries_ = multSelProjYMinEntries; +} + +void PPSAlignmentConfigRun3v1::setBinning(PPSAlignmentConfigRun3v1::Binning &binning) { binning_ = binning; } + +// -------------------------------- << operators -------------------------------- + +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::RPConfig &rc) { + os << std::fixed << std::setprecision(3); + os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n"; + os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n"; + os << " x_min_fit_mode = " << rc.x_min_fit_mode_ << ", x_max_fit_mode = " << rc.x_max_fit_mode_ << "\n"; + os << " y_max_fit_mode = " << rc.y_max_fit_mode_ << "\n"; + os << " y_cen_add = " << rc.y_cen_add_ << ", y_width_mult = " << rc.y_width_mult_ << "\n"; + os << std::setprecision(2); + os << " x slices: min = " << rc.x_slice_min_ << ", w = " << rc.x_slice_w_ << ", n = " << rc.x_slice_n_; + + return os; +} + +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::SectorConfig &sc) { + os << std::fixed << std::setprecision(3); + os << sc.name_ << ":\n"; + os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n"; + os << std::setprecision(3); + os << " slope = " << sc.slope_ << "\n"; + os << " cut_h: apply = " << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_ + << ", si = " << sc.cut_h_si_ << "\n"; + os << " cut_v: apply = " << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_ + << ", si = " << sc.cut_v_si_ << "\n"; + + return os; +} + +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Binning &b) { + os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n"; + os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n"; + os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_ << "\n"; + os << " diff far-near:" + << "\n"; + os << " n_bins_x = " << b.diffFN_n_bins_x_ << ", x_min = " << b.diffFN_x_min_ + << ", x_max = " << b.diffFN_x_max_ << "\n"; + os << " slice plots:" + << "\n"; + os << " n_bins_x = " << b.slice_n_bins_x_ << ", x_min = " << b.slice_x_min_ << ", x_max = " << b.slice_x_max_ + << "\n"; + os << " n_bins_y = " << b.slice_n_bins_x_ << ", y_min = " << b.slice_x_min_ << ", y_max = " << b.slice_x_max_; + + return os; +} + +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1 &c) { + os << "* " << c.sectorConfig45_ << "\n\n"; + os << "* " << c.sectorConfig56_ << "\n\n"; + + std::map rpTags = {{c.sectorConfig45_.rp_F_.id_, c.sectorConfig45_.rp_F_.name_}, + {c.sectorConfig45_.rp_N_.id_, c.sectorConfig45_.rp_N_.name_}, + {c.sectorConfig56_.rp_N_.id_, c.sectorConfig56_.rp_N_.name_}, + {c.sectorConfig56_.rp_F_.id_, c.sectorConfig56_.rp_F_.name_}}; + + os << "* x alignment shift step\n"; + os << " x_ali_sh_step = " << c.x_ali_sh_step_ << "\n\n"; + + os << "* mode graph parameters\n"; + os << " y_mode_sys_unc = " << c.y_mode_sys_unc_ << "\n"; + os << " chiSqThreshold = " << c.chiSqThreshold_ << "\n"; + os << " y_mode_unc_max_valid = " << c.y_mode_unc_max_valid_ << "\n"; + os << " y_mode_max_valid = " << c.y_mode_max_valid_ << "\n\n"; + + os << "* selection\n"; + os << " min_RP_tracks_size = " << c.minRPTracksSize_ << "\n"; + os << " max_RP_tracks_size = " << c.maxRPTracksSize_ << "\n\n"; + + os << "* cuts\n"; + os << " n_si = " << c.n_si_ << "\n\n"; + + os << "* matching\n" << std::setprecision(3); + + os << " shift ranges:\n"; + for (const auto &p : c.matchingShiftRanges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + + os << " reference points:\n"; + for (const auto &pm : c.matchingReferencePoints_) { + os << " " << std::setw(3) << pm.first << ": "; + for (unsigned int i = 0; i < pm.second.size(); i++) { + const auto &p = pm.second[i]; + if (i % 5 == 0 && i > 0) + os << "\n "; + os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), "; + } + os << "\n"; + } + + os << "\n" + << "* alignment_x_meth_o\n"; + for (const auto &p : c.alignment_x_meth_o_ranges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + os << " fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n"; + os << " fit_profile_min_N_reasonable = " << c.fitProfileMinNReasonable_ << "\n"; + os << " meth_o_graph_min_N = " << c.methOGraphMinN_ << "\n"; + os << " meth_o_unc_fit_range = " << c.methOUncFitRange_ << "\n"; + + os << "\n" + << "* alignment_x_relative\n"; + for (const auto &p : c.alignment_x_relative_ranges_) + if (rpTags[p.first][2] == '1') { // only near RPs + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + } + os << " near_far_min_entries = " << c.nearFarMinEntries_ << "\n"; + + os << "\n" + << "* alignment_y\n"; + for (const auto &p : c.alignment_y_ranges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + os << " mode_graph_min_N = " << c.modeGraphMinN_ << "\n"; + os << " mult_sel_proj_y_min_entries = " << c.multSelProjYMinEntries_ << "\n"; + + os << "\n" + << "* binning\n"; + os << c.binning_ << "\n"; + + return os; +} diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc new file mode 100644 index 0000000000000..a2c3735343df6 --- /dev/null +++ b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(PPSAlignmentConfigRun3v1); diff --git a/CondFormats/PPSObjects/src/classes_def.xml b/CondFormats/PPSObjects/src/classes_def.xml index 74cfa9a9761dc..174f172cfdf3f 100644 --- a/CondFormats/PPSObjects/src/classes_def.xml +++ b/CondFormats/PPSObjects/src/classes_def.xml @@ -81,4 +81,16 @@ -
\ No newline at end of file + + + + + + + + + + + + +
diff --git a/CondFormats/PPSObjects/src/headers.h b/CondFormats/PPSObjects/src/headers.h index 1b77a578cb8ca..e000d3ad82f65 100644 --- a/CondFormats/PPSObjects/src/headers.h +++ b/CondFormats/PPSObjects/src/headers.h @@ -5,6 +5,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsDataSequence.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSet.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" diff --git a/CondFormats/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index edb32ad3438ca..3770da1b7308d 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -13,3 +13,7 @@ + + + + diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc new file mode 100644 index 0000000000000..28ef21f611fe0 --- /dev/null +++ b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.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/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc new file mode 100644 index 0000000000000..f30e0119e4e1f --- /dev/null +++ b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.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/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" + +#include + +class RetrievePPSAlignmentConfigRun3v1 : public edm::one::EDAnalyzer<> { +public: + explicit RetrievePPSAlignmentConfigRun3v1(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +RetrievePPSAlignmentConfigRun3v1::RetrievePPSAlignmentConfigRun3v1(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} + +void RetrievePPSAlignmentConfigRun3v1::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAlignmentConfigRun3v1 = iSetup.getData(esToken_); + + edm::LogInfo("PPS") << ppsAlignmentConfigRun3v1; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RetrievePPSAlignmentConfigRun3v1); diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc new file mode 100644 index 0000000000000..ac4792687217e --- /dev/null +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.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/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" + +#include + +class WritePPSAlignmentConfigRun3v1 : public edm::one::EDAnalyzer<> { +public: + explicit WritePPSAlignmentConfigRun3v1(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +WritePPSAlignmentConfigRun3v1::WritePPSAlignmentConfigRun3v1(const edm::ParameterSet &iConfig) + : esToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))) {} + +void WritePPSAlignmentConfigRun3v1::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAlignmentConfigRun3v1 = iSetup.getData(esToken_); + + // store the data in a DB object + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + poolDbService->writeOne(&ppsAlignmentConfigRun3v1, poolDbService->currentTime(), "PPSAlignmentConfigRun3v1Rcd"); + } else { + throw cms::Exception("WritePPSAlignmentConfigRun3v1") << "PoolDBService required."; + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(WritePPSAlignmentConfigRun3v1); diff --git a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py new file mode 100644 index 0000000000000..77199b0f0d6d7 --- /dev/null +++ b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_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 = 'PPSAlignmentConfigRun3v1_v1_express' # database tag +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("retrievePPSAlignmentConfigRun3v1") + +# Message Logger +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfigRun3v1'), + retrieve_PPSAlignmentConfigRun3v1 = 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('PPSAlignmentConfigRun3v1Rcd'), + tag = cms.string(db_tag) + )) +) + +# DB object retrieve module +process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfigRun3v1", + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigRun3v1Rcd'), + data = cms.vstring('PPSAlignmentConfigRun3v1') + )), + verbose = cms.untracked.bool(True) +) + +process.path = cms.Path(process.retrieve_config) diff --git a/CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py b/CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py new file mode 100644 index 0000000000000..7335233e988a0 --- /dev/null +++ b/CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py @@ -0,0 +1,89 @@ +##### configuration ##### +output_conditions = 'sqlite_file:alignment_config.db' # output database +run_number = 1 # beginning of the IOV +db_tag = 'PPSAlignmentConfigRun3v1_v1_express' # database tag +produce_logs = True # if set to True, a file with logs will be produced. +product_instance_label = 'db_test' # ES product label +# ESSource parameters can be configured below +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("writePPSAlignmentConfigRun3v1") + +# Message Logger +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('write_PPSAlignmentConfigRun3v1', + 'cout' + ), + write_PPSAlignmentConfigRun3v1 = 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('PPSAlignmentConfigRun3v1Rcd'), + tag = cms.string(db_tag) + )) +) + +# ESSource +process.ppsAlignmentConfigRun3v1ESSource = cms.ESSource("PPSAlignmentConfigRun3v1ESSource", + # PPSAlignmentConfigRun3v1ESSource 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("WritePPSAlignmentConfigRun3v1", + record = cms.string('PPSAlignmentConfigRun3v1Rcd'), + 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) From 26016107f9d6cdbb5ffd9e8936fd8c781c7caa16 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 31 Aug 2021 14:27:32 -0500 Subject: [PATCH 265/923] Run endStream concurrently as part of endJob --- FWCore/Framework/src/EventProcessor.cc | 44 +++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 34de94d38becb..30c086dd421c3 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -698,13 +698,47 @@ namespace edm { //make the services available ServiceRegistry::Operate operate(serviceToken_); - //NOTE: this really should go elsewhere in the future - for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) { - c.call([this, i]() { this->schedule_->endStream(i); }); - for (auto& subProcess : subProcesses_) { - c.call([&subProcess, i]() { subProcess.doEndStream(i); }); + using namespace edm::waiting_task::chain; + + edm::FinalWaitingTask waitTask; + tbb::task_group group; + + { + //handle endStream transitions + edm::WaitingTaskHolder taskHolder(group, &waitTask); + std::mutex collectorMutex; + for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) { + first([this, i, &c, &collectorMutex](auto nextTask) { + std::exception_ptr ep; + try { + this->schedule_->endStream(i); + } catch (...) { + ep = std::current_exception(); + } + if (ep) { + std::lock_guard l(collectorMutex); + c.call([&ep]() { std::rethrow_exception(ep); }); + } + }) | then([this, i, &c, &collectorMutex](auto nextTask) { + for (auto& subProcess : subProcesses_) { + first([i, &c, &collectorMutex, &subProcess](auto nextTask) { + std::exception_ptr ep; + try { + subProcess.doEndStream(i); + } catch (...) { + ep = std::current_exception(); + } + if (ep) { + std::lock_guard l(collectorMutex); + c.call([&ep]() { std::rethrow_exception(ep); }); + } + }) | lastTask(nextTask); + } + }) | lastTask(taskHolder); } } + group.wait(); + auto actReg = actReg_.get(); c.call([actReg]() { actReg->preEndJobSignal_(); }); schedule_->endJob(c); From 143fc44696458b6f0973fbd9a7f87a163e0f218b Mon Sep 17 00:00:00 2001 From: Jeongeun Lee Date: Wed, 1 Sep 2021 05:03:37 +0200 Subject: [PATCH 266/923] replace EDProducer with clone default cfipy, drop type spec --- .../python/patPFMETCorrections_cff.py | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py index c95b00af81c3f..336ed4be7fd65 100644 --- a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py +++ b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py @@ -10,9 +10,7 @@ # produce "raw" (uncorrected) pat::MET of PF-type from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs patPFMet = patMETs.clone( - metSource = cms.InputTag('pfMet'), - addMuonCorrections = cms.bool(False), - genMETSource = cms.InputTag('genMetTrue') + metSource = 'pfMet' ) #-------------------------------------------------------------------------------- @@ -35,23 +33,20 @@ #-------------------------------------------------------------------------------- # produce Type 1 + 2 MET corrections for pat::Jets of PF-type -patPFMetT1T2Corr = cms.EDProducer("PATPFJetMETcorrInputProducer", - src = cms.InputTag('selectedPatJetsForMetT1T2Corr'), - offsetCorrLabel = cms.InputTag("L1FastJet"), - jetCorrLabel = cms.InputTag("L3Absolute"), # for MC - jetCorrLabelRes = cms.InputTag("L2L3Residual"), # for Data automatic switch - type1JetPtThreshold = cms.double(15.0), - skipEM = cms.bool(True), - skipEMfractionThreshold = cms.double(0.90), - skipMuons = cms.bool(True), - skipMuonSelection = cms.string("isGlobalMuon | isStandAloneMuon") +import PhysicsTools.PatUtils.pfJetMETcorrInputProducerTPatJetPATJetCorrExtractor_cfi as _mod + +patPFMetT1T2Corr = _mod.pfJetMETcorrInputProducerTPatJetPATJetCorrExtractor.clone( + src = 'selectedPatJetsForMetT1T2Corr', + offsetCorrLabel = "L1FastJet", + jetCorrLabel = "L3Absolute", # for MC + jetCorrLabelRes = "L2L3Residual" # for Data automatic switch ) patPFMetT1T2CorrTask = cms.Task(selectedPatJetsForMetT1T2Corr, patPFMetT1T2Corr) patPFMetT1T2CorrSequence = cms.Sequence(patPFMetT1T2CorrTask) patPFMetT2Corr = patPFMetT1T2Corr.clone( - src = cms.InputTag('selectedPatJetsForMetT2Corr') + src = 'selectedPatJetsForMetT2Corr' ) patPFMetT2CorrTask = cms.Task(patPFMetT2Corr) patPFMetT2CorrSequence = cms.Sequence(patPFMetT2CorrTask) @@ -61,6 +56,7 @@ #-------------------------------------------------------------------------------- # produce Type 0 MET corrections from JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi import * + patPFMetT0Corr = pfMETcorrType0.clone() patPFMetT0CorrTask = cms.Task(type0PFMEtCorrectionPFCandToVertexAssociationTask, patPFMetT0Corr) patPFMetT0CorrSequence = cms.Sequence(patPFMetT0CorrTask) @@ -152,11 +148,11 @@ ) patPFMetT1T2SmearCorr = patPFMetT1T2Corr.clone( - src = cms.InputTag('selectedPatJetsForMetT1T2SmearCorr') + src = 'selectedPatJetsForMetT1T2SmearCorr' ) patPFMetT2SmearCorr = patPFMetT2Corr.clone( - src = cms.InputTag('selectedPatJetsForMetT2SmearCorr') + src = 'selectedPatJetsForMetT2SmearCorr' ) patPFMetSmearCorrTask = cms.Task(patSmearedJets, @@ -205,8 +201,8 @@ ## smeared METs -patPFMetT1Smear = patPFMetT1.clone( srcCorrections = cms.VInputTag( - cms.InputTag('patPFMetT1T2SmearCorr', 'type1') ) +patPFMetT1Smear = patPFMetT1.clone( + srcCorrections = ['patPFMetT1T2SmearCorr:type1'] ) patPFMetT1T2Smear = patPFMetT1Smear.clone() From 48f9dcf2cb1f609fec5dbb19d64a07d12e301559 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 31 Aug 2021 17:15:26 +0200 Subject: [PATCH 267/923] modernize CondTools/RunInfo --- .../RunInfo/interface/BTransitionAnalyzer.h | 22 ++++-- .../RunInfo/plugins/FillInfoESAnalyzer.cc | 41 ++++++----- .../RunInfo/plugins/LHCInfoESAnalyzer.cc | 39 ++++++----- .../RunInfo/plugins/RunInfoESAnalyzer.cc | 69 +++++++------------ .../RunInfo/plugins/RunSummaryESAnalyzer.cc | 64 +++++++---------- .../RunInfo/plugins/XangleBetaStarFilter.cc | 5 +- .../src/FillInfoPopConSourceHandler.cc | 3 +- CondTools/RunInfo/src/RunInfoRead.cc | 30 ++++---- CondTools/RunInfo/src/RunSummaryHandler.cc | 1 - 9 files changed, 127 insertions(+), 147 deletions(-) diff --git a/CondTools/RunInfo/interface/BTransitionAnalyzer.h b/CondTools/RunInfo/interface/BTransitionAnalyzer.h index b4078a7f7793c..fb0d058840ebb 100644 --- a/CondTools/RunInfo/interface/BTransitionAnalyzer.h +++ b/CondTools/RunInfo/interface/BTransitionAnalyzer.h @@ -17,7 +17,11 @@ namespace cond { class BTransitionAnalyzer : public edm::one::EDAnalyzer { public: BTransitionAnalyzer(const edm::ParameterSet& pset) - : m_currentThreshold(pset.getUntrackedParameter("currentThreshold", 18000.)) {} + : m_currentThreshold(pset.getUntrackedParameter("currentThreshold", 18000.)), + m_RunInfoToken(esConsumes()), + m_ESToken(esConsumes()), + m_ESTokenB0T(esConsumes(edm::ESInputTag("", "0T"))), + m_ESTokenB38T(esConsumes(edm::ESInputTag("", "38T"))) {} #ifdef __INTEL_COMPILER virtual ~BTransitionAnalyzer() = default; #endif @@ -28,9 +32,8 @@ namespace cond { void beginRun(edm::Run const&, edm::EventSetup const&) final{}; void analyze(edm::Event const&, edm::EventSetup const&) final{}; void endRun(edm::Run const& run, edm::EventSetup const& eventSetup) final { - edm::ESHandle runInfoHandle; + edm::ESHandle runInfoHandle = eventSetup.getHandle(m_RunInfoToken); edm::ESHandle payloadHandle, payloadRefHandle; - eventSetup.get().get(runInfoHandle); double avg_current = (double)runInfoHandle->m_avg_current; double current_default = -1; std::string bOnLabel = std::string("38T"); @@ -40,13 +43,16 @@ namespace cond { << " A for run: " << run.run() << " with the corresponding threshold: " << m_currentThreshold << " A." << std::endl; - if (avg_current != current_default && avg_current <= m_currentThreshold) + if (avg_current != current_default && avg_current <= m_currentThreshold) { bFieldLabel = bOffLabel; + payloadHandle = eventSetup.getHandle(m_ESTokenB0T); + } else { + payloadHandle = eventSetup.getHandle(m_ESTokenB38T); + } edm::LogInfo("BTransitionAnalyzer") << "The magnet was " << (bFieldLabel == bOnLabel ? "ON" : "OFF") << " during run " << run.run() << ".\nLoading the product for the corrisponding label " << bFieldLabel << std::endl; - eventSetup.get().get(bFieldLabel, payloadHandle); - eventSetup.get().get(payloadRefHandle); + payloadRefHandle = eventSetup.getHandle(m_ESToken); edm::Service mydbservice; if (mydbservice.isAvailable()) { if (!equalPayloads(payloadHandle, payloadRefHandle)) { @@ -68,6 +74,10 @@ namespace cond { private: double m_currentThreshold; + const edm::ESGetToken m_RunInfoToken; + const edm::ESGetToken m_ESToken; + const edm::ESGetToken m_ESTokenB0T; + const edm::ESGetToken m_ESTokenB38T; }; } //namespace cond #endif //BTRANSITIONANALYZER_H diff --git a/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc index b0a671da4fd40..7f37da876acb8 100644 --- a/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc @@ -1,8 +1,7 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.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" @@ -10,33 +9,39 @@ #include "CondFormats/DataRecord/interface/FillInfoRcd.h" namespace edmtest { - class FillInfoESAnalyzer : public edm::EDAnalyzer { + class FillInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_FillInfoToken; + public: - explicit FillInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "FillInfoESAnalyzer" << std::endl; } - explicit FillInfoESAnalyzer(int i) { std::cout << "FillInfoESAnalyzer " << i << std::endl; } - ~FillInfoESAnalyzer() override { std::cout << "~FillInfoESAnalyzer " << std::endl; } + explicit FillInfoESAnalyzer(edm::ParameterSet const& p) : m_FillInfoToken(esConsumes()) { + edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer" << std::endl; + } + explicit FillInfoESAnalyzer(int i) { + edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer " << i << std::endl; + } + ~FillInfoESAnalyzer() override { edm::LogPrint("FillInfoESAnalyzer") << "~FillInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; }; void FillInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { - std::cout << "###FillInfoESAnalyzer::analyze" << std::endl; - std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; - std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "###FillInfoESAnalyzer::analyze" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl; edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("FillInfoRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"FillInfoRcd" - << "\" does not exist " << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "Record \"FillInfoRcd" + << "\" does not exist " << std::endl; } - edm::ESHandle sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_FillInfoToken); + edm::LogPrint("FillInfoESAnalyzer") << "got context" << std::endl; const FillInfo* summary = sum.product(); - std::cout << "got FillInfo* " << std::endl; - std::cout << "print result" << std::endl; - std::cout << *summary; + edm::LogPrint("FillInfoESAnalyzer") << "got FillInfo* " << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "print result" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << *summary; } DEFINE_FWK_MODULE(FillInfoESAnalyzer); } // namespace edmtest diff --git a/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc index ef8aef7e5674a..652326164a95e 100644 --- a/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc @@ -1,8 +1,7 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.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" @@ -10,33 +9,37 @@ #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" namespace edmtest { - class LHCInfoESAnalyzer : public edm::EDAnalyzer { + class LHCInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_LHCInfoToken; + public: - explicit LHCInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "LHCInfoESAnalyzer" << std::endl; } - explicit LHCInfoESAnalyzer(int i) { std::cout << "LHCInfoESAnalyzer " << i << std::endl; } - ~LHCInfoESAnalyzer() override { std::cout << "~LHCInfoESAnalyzer " << std::endl; } + explicit LHCInfoESAnalyzer(edm::ParameterSet const& p) : m_LHCInfoToken(esConsumes()) { + edm::LogPrint("LHCInfoESAnalyzer") << "LHCInfoESAnalyzer" << std::endl; + } + explicit LHCInfoESAnalyzer(int i) { edm::LogPrint("LHCInfoESAnalyzer") << "LHCInfoESAnalyzer " << i << std::endl; } + ~LHCInfoESAnalyzer() override { edm::LogPrint("LHCInfoESAnalyzer") << "~LHCInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; }; void LHCInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { - std::cout << "###LHCInfoESAnalyzer::analyze" << std::endl; - std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; - std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "###LHCInfoESAnalyzer::analyze" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl; edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("LHCInfoRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"LHCInfoRcd" - << "\" does not exist " << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "Record \"LHCInfoRcd" + << "\" does not exist " << std::endl; } - edm::ESHandle sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_LHCInfoToken); + edm::LogPrint("LHCInfoESAnalyzer") << "got context" << std::endl; const LHCInfo* summary = sum.product(); - std::cout << "got LHCInfo* " << std::endl; - std::cout << "print result" << std::endl; - std::cout << *summary; + edm::LogPrint("LHCInfoESAnalyzer") << "got LHCInfo* " << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "print result" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << *summary; } DEFINE_FWK_MODULE(LHCInfoESAnalyzer); } // namespace edmtest diff --git a/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc index 73ed2cea5619b..b50861abf30f6 100644 --- a/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc @@ -2,75 +2,54 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/RunInfo.h" - #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" using namespace std; namespace edmtest { - class RunInfoESAnalyzer : public edm::EDAnalyzer { + class RunInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_RunInfoToken; + public: - explicit RunInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "RunInfoESAnalyzer" << std::endl; } - explicit RunInfoESAnalyzer(int i) { std::cout << "RunInfoESAnalyzer " << i << std::endl; } - ~RunInfoESAnalyzer() override { std::cout << "~RunInfoESAnalyzer " << std::endl; } - // virtual void beginJob(); - // virtual void beginRun(const edm::Run&, const edm::EventSetup& context); + explicit RunInfoESAnalyzer(edm::ParameterSet const& p) : m_RunInfoToken(esConsumes()) { + edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer" << std::endl; + } + explicit RunInfoESAnalyzer(int i) { edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer " << i << std::endl; } + ~RunInfoESAnalyzer() override { edm::LogPrint("RunInfoESAnalyzer") << "~RunInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; - - private: }; - - /* void - RunInfoESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){ - std::cout<<"###RunInfoESAnalyzer::beginRun"< RunInfo_lumiarray; - std::cout<<"got eshandle"<().get(RunInfo_lumiarray); - std::cout<<"got data"< sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_RunInfoToken); + edm::LogPrint("RunInfoESAnalyzer") << "got context" << std::endl; const RunInfo* summary = sum.product(); - std::cout << "got RunInfo* " << std::endl; - - std::cout << "print result" << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "got RunInfo* " << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "print result" << std::endl; summary->printAllValues(); - /* std::vector subdet = summary->getSubdtIn(); - std::cout<<"subdetector in the run "<< std::endl; + /* + std::vector subdet = summary->getSubdtIn(); + edm::LogPrint("RunInfoESAnalyzer")<<"subdetector in the run "<< std::endl; for (size_t i=0; i " << subdet[i] << std::endl; + edm::LogPrint("RunInfoESAnalyzer")<<"--> " << subdet[i] << std::endl; } */ } diff --git a/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc b/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc index ae4b69b5f47a3..1d23fb1b5c283 100644 --- a/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc @@ -2,75 +2,59 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/RunSummary.h" - #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" using namespace std; namespace edmtest { - class RunSummaryESAnalyzer : public edm::EDAnalyzer { + class RunSummaryESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_RunSummaryToken; + public: - explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) { std::cout << "RunSummaryESAnalyzer" << std::endl; } - explicit RunSummaryESAnalyzer(int i) { std::cout << "RunSummaryESAnalyzer " << i << std::endl; } - ~RunSummaryESAnalyzer() override { std::cout << "~RunSummaryESAnalyzer " << std::endl; } - // virtual void beginJob(); - // virtual void beginRun(const edm::Run&, const edm::EventSetup& context); + explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) : m_RunSummaryToken(esConsumes()) { + edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer" << std::endl; + } + explicit RunSummaryESAnalyzer(int i) { + edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer " << i << std::endl; + } + ~RunSummaryESAnalyzer() override { edm::LogPrint("RunSummaryESAnalyzer") << "~RunSummaryESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: }; - /* void - RunSummaryESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){ - std::cout<<"###RunSummaryESAnalyzer::beginRun"< RunSummary_lumiarray; - std::cout<<"got eshandle"<().get(RunSummary_lumiarray); - std::cout<<"got data"< sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_RunSummaryToken); + edm::LogPrint("RunSummaryESAnalyzer") << "got context" << std::endl; const RunSummary* summary = sum.product(); - std::cout << "got RunSummary* " << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "got RunSummary* " << std::endl; - std::cout << "print result" << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "print result" << std::endl; summary->printAllValues(); std::vector subdet = summary->getSubdtIn(); - std::cout << "subdetector in the run " << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "subdetector in the run " << std::endl; for (size_t i = 0; i < subdet.size(); i++) { - std::cout << "--> " << subdet[i] << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "--> " << subdet[i] << std::endl; } } DEFINE_FWK_MODULE(RunSummaryESAnalyzer); diff --git a/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc b/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc index 3f15ee08ca43b..25efa0de9d5fd 100644 --- a/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc +++ b/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc @@ -6,17 +6,16 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/LHCInfo.h" #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" //---------------------------------------------------------------------------------------------------- -class XangleBetaStarFilter : public edm::EDFilter { +class XangleBetaStarFilter : public edm::stream::EDFilter<> { public: explicit XangleBetaStarFilter(const edm::ParameterSet &); diff --git a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc index 0ecb37fbdb8be..545be7b1827df 100644 --- a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc @@ -145,7 +145,8 @@ void FillInfoPopConSourceHandler::getNewObjects() { //execute the query coral::ICursor &fillDataCursor = fillDataQuery->execute(); //initialize loop variables - unsigned short previousFillNumber = 1, currentFill = m_firstFill; + unsigned short previousFillNumber = 1; + unsigned short currentFill = m_firstFill; cond::Time_t previousFillEndTime = 0ULL, afterPreviousFillEndTime = 0ULL, beforeStableBeamStartTime = 0ULL; if (tagInfo().size > 0) { previousFillNumber = previousFill->fillNumber(); diff --git a/CondTools/RunInfo/src/RunInfoRead.cc b/CondTools/RunInfo/src/RunInfoRead.cc index 1b7ac4230dafa..f135f1aa3945b 100644 --- a/CondTools/RunInfo/src/RunInfoRead.cc +++ b/CondTools/RunInfo/src/RunInfoRead.cc @@ -23,22 +23,22 @@ #include namespace { - std::string dot("."); - std::string quote("\""); - std::string bNOTb(" NOT "); - std::string squoted(const std::string& s) { return quote + s + quote; } + const std::string dot("."); + const std::string quote("\""); + const std::string bNOTb(" NOT "); + const std::string squoted(const std::string& s) { return quote + s + quote; } //now strings for the tables and columns to be queried - std::string sParameterTable("RUNSESSION_PARAMETER"); - std::string sDateTable("RUNSESSION_DATE"); - std::string sStringTable("RUNSESSION_STRING"); - std::string sIdParameterColumn("ID"); - std::string sRunNumberParameterColumn("RUNNUMBER"); - std::string sNameParameterColumn("NAME"); - std::string sRunSessionParameterIdDataColumn("RUNSESSION_PARAMETER_ID"); - std::string sValueDataColumn("VALUE"); - std::string sDCSMagnetTable("CMSFWMAGNET"); - std::string sDCSMagnetCurrentColumn("CURRENT"); - std::string sDCSMagnetChangeDateColumn("CHANGE_DATE"); + const std::string sParameterTable("RUNSESSION_PARAMETER"); + const std::string sDateTable("RUNSESSION_DATE"); + const std::string sStringTable("RUNSESSION_STRING"); + const std::string sIdParameterColumn("ID"); + const std::string sRunNumberParameterColumn("RUNNUMBER"); + const std::string sNameParameterColumn("NAME"); + const std::string sRunSessionParameterIdDataColumn("RUNSESSION_PARAMETER_ID"); + const std::string sValueDataColumn("VALUE"); + const std::string sDCSMagnetTable("CMSFWMAGNET"); + const std::string sDCSMagnetCurrentColumn("CURRENT"); + const std::string sDCSMagnetChangeDateColumn("CHANGE_DATE"); } // namespace RunInfoRead::RunInfoRead(const std::string& connectionString, const edm::ParameterSet& connectionPset) diff --git a/CondTools/RunInfo/src/RunSummaryHandler.cc b/CondTools/RunInfo/src/RunSummaryHandler.cc index eddf3499f8c76..3232e3fea56c2 100644 --- a/CondTools/RunInfo/src/RunSummaryHandler.cc +++ b/CondTools/RunInfo/src/RunSummaryHandler.cc @@ -47,7 +47,6 @@ void RunSummaryHandler::getNewObjects() { size_t n_empty_run = 0; if (tagInfo().size > 0 && (tagInfo().lastInterval.since + 1) < snc) { - n_empty_run = snc - tagInfo().lastInterval.since - 1; edm::LogInfo("RunSummaryHandler") << "------- " << "entering fake run from " << tagInfo().lastInterval.since + 1 << "to " << snc - 1 << "- > getNewObjects" << std::endl; From b8b48059a9b04e706de2f246a06c62a3e16bbcca Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 1 Sep 2021 09:03:48 +0200 Subject: [PATCH 268/923] get rid of the unneeded conf_ class member in SiPixelPhase1EfficiencyExtras --- .../plugins/SiPixelPhase1EfficiencyExtras.cc | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc index 2f33461cee144..806caf980429c 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc @@ -24,9 +24,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" // DQM Framework #include "DQMServices/Core/interface/DQMStore.h" @@ -45,24 +42,19 @@ class SiPixelPhase1EfficiencyExtras : public DQMEDHarvester { void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override; - std::string effFolderName_; - std::string vtxFolderName_; - std::string instLumiFolderName_; - -private: - edm::ParameterSet conf_; + const std::string effFolderName_; + const std::string vtxFolderName_; + const std::string instLumiFolderName_; }; -SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& iConfig) : conf_(iConfig) { +SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& iConfig) + : effFolderName_(iConfig.getParameter("EffFolderName")), + vtxFolderName_(iConfig.getParameter("VtxFolderName")), + instLumiFolderName_(iConfig.getParameter("InstLumiFolderName")) { LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras: Hello!" << endl; - effFolderName_ = conf_.getParameter("EffFolderName"); - vtxFolderName_ = conf_.getParameter("VtxFolderName"); - instLumiFolderName_ = conf_.getParameter("InstLumiFolderName"); } SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras: Destructor" << endl; } From 241f74d058c2d4065305138cae25646e1d0681c3 Mon Sep 17 00:00:00 2001 From: Andre Stahl Date: Fri, 6 Aug 2021 14:59:47 +0200 Subject: [PATCH 269/923] Increased maxNumberOfTuples and maxCellsPerHit to avoid overflow in HI events --- RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h index 8ea536465814c..8d651479060c5 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 -> 256 cells) + constexpr uint32_t maxNumberOfTuples = 32 * 1024; constexpr uint32_t maxNumberOfDoublets = 512 * 1024; - constexpr uint32_t maxCellsPerHit = 128; + constexpr uint32_t maxCellsPerHit = 256; #endif // GPU_SMALL_EVENTS #endif // ONLY_PHICUT constexpr uint32_t maxNumOfActiveDoublets = maxNumberOfDoublets / 8; From 0f6d12d5dec1896d045122fa7e4032db0b76bd26 Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 1 Sep 2021 09:53:41 +0200 Subject: [PATCH 270/923] modernize Configuration/Skimming --- .../Skimming/interface/LeptonRecoSkim.h | 32 ++++---- Configuration/Skimming/src/LeptonRecoSkim.cc | 82 ++++++++----------- Configuration/Skimming/src/LeptonSkimming.cc | 4 +- 3 files changed, 51 insertions(+), 67 deletions(-) diff --git a/Configuration/Skimming/interface/LeptonRecoSkim.h b/Configuration/Skimming/interface/LeptonRecoSkim.h index 9edb3d3fa467e..233681149dd1e 100644 --- a/Configuration/Skimming/interface/LeptonRecoSkim.h +++ b/Configuration/Skimming/interface/LeptonRecoSkim.h @@ -17,15 +17,13 @@ #include // user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" - +#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/EDGetToken.h" //includes for reco objects #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" @@ -54,7 +52,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "FWCore/Common/interface/TriggerNames.h" -class LeptonRecoSkim : public edm::EDFilter { +class LeptonRecoSkim : public edm::one::EDFilter<> { public: explicit LeptonRecoSkim(const edm::ParameterSet&); ~LeptonRecoSkim() override; @@ -66,15 +64,20 @@ class LeptonRecoSkim : public edm::EDFilter { void handleObjects(const edm::Event&, const edm::EventSetup& iSetup); + // ----------member data --------------------------- + const edm::ESGetToken m_CaloGeoToken; + const edm::ESGetToken m_CaloTopoToken; + edm::InputTag hltLabel; std::string filterName; - edm::InputTag m_electronSrc; - edm::InputTag m_pfelectronSrc; - edm::InputTag m_muonSrc; - edm::InputTag m_jetsSrc; - edm::InputTag m_pfjetsSrc; - edm::InputTag m_ebRecHitsSrc; - edm::InputTag m_eeRecHitsSrc; + + edm::EDGetTokenT gsfElectronCollectionToken_; + edm::EDGetTokenT pfCandidateCollectionToken_; + edm::EDGetTokenT muonCollectionToken_; + edm::EDGetTokenT caloJetCollectionToken_; + edm::EDGetTokenT pfJetCollectionToken_; + edm::EDGetTokenT ebRecHitCollectionToken_; + edm::EDGetTokenT eeRecHitCollectionToken_; const reco::GsfElectronCollection* theElectronCollection; const reco::PFCandidateCollection* thePfCandidateCollection; @@ -119,5 +122,4 @@ class LeptonRecoSkim : public edm::EDFilter { int NtotalElectrons; int NmvaElectrons; - // ----------member data --------------------------- }; diff --git a/Configuration/Skimming/src/LeptonRecoSkim.cc b/Configuration/Skimming/src/LeptonRecoSkim.cc index b6f620cc33b9a..dce52f9011549 100644 --- a/Configuration/Skimming/src/LeptonRecoSkim.cc +++ b/Configuration/Skimming/src/LeptonRecoSkim.cc @@ -28,15 +28,17 @@ using namespace std; // constructors and destructor // LeptonRecoSkim::LeptonRecoSkim(const edm::ParameterSet& iConfig) - : hltLabel(iConfig.getParameter("HltLabel")), + : m_CaloGeoToken(esConsumes()), + m_CaloTopoToken(esConsumes()), + hltLabel(iConfig.getParameter("HltLabel")), filterName(iConfig.getParameter("@module_label")), - m_electronSrc(iConfig.getParameter("electronCollection")), - m_pfelectronSrc(iConfig.getParameter("pfElectronCollection")), - m_muonSrc(iConfig.getParameter("muonCollection")), - m_jetsSrc(iConfig.getParameter("caloJetCollection")), - m_pfjetsSrc(iConfig.getParameter("PFJetCollection")), - m_ebRecHitsSrc(iConfig.getParameter("ecalBarrelRecHitsCollection")), - m_eeRecHitsSrc(iConfig.getParameter("ecalEndcapRecHitsCollection")), + gsfElectronCollectionToken_(consumes(iConfig.getParameter("electronCollection"))), + pfCandidateCollectionToken_(consumes(iConfig.getParameter("pfElectronCollection"))), + muonCollectionToken_(consumes(iConfig.getParameter("muonCollection"))), + caloJetCollectionToken_(consumes(iConfig.getParameter("caloJetCollection"))), + pfJetCollectionToken_(consumes(iConfig.getParameter("PFJetCollection"))), + ebRecHitCollectionToken_(consumes(iConfig.getParameter("ecalBarrelRecHitsCollection"))), + eeRecHitCollectionToken_(consumes(iConfig.getParameter("ecalEndcapRecHitsCollection"))), useElectronSelection(iConfig.getParameter("UseElectronSelection")), usePfElectronSelection(iConfig.getParameter("UsePfElectronSelection")), useMuonSelection(iConfig.getParameter("UseMuonSelection")), @@ -204,65 +206,45 @@ void LeptonRecoSkim::beginJob() { firstEvent = true; } // ------------ method called once each job just after ending the event loop ------------ void LeptonRecoSkim::endJob() { - cout << "Filter Name = " << filterName << endl; - cout << "Total number of events = " << NeventsTotal << endl; - cout << "Total HLT_Mu9 = " << NHltMu9 << endl; - cout << "Total HLT_DoubleMu3 = " << NHltDiMu3 << endl; - cout << "Filtered events = " << NeventsFiltered << endl; - cout << "Filter Efficiency = " << (float)NeventsFiltered / (float)NeventsTotal << endl; - cout << endl; - cout << "N total electrons = " << NtotalElectrons << endl; - cout << "N mva>-0.1 electrons = " << NmvaElectrons << endl; - cout << endl; - cout << endl; + edm::LogPrint("LeptonRecoSkim") << "Filter Name = " << filterName << endl; + edm::LogPrint("LeptonRecoSkim") << "Total number of events = " << NeventsTotal << endl; + edm::LogPrint("LeptonRecoSkim") << "Total HLT_Mu9 = " << NHltMu9 << endl; + edm::LogPrint("LeptonRecoSkim") << "Total HLT_DoubleMu3 = " << NHltDiMu3 << endl; + edm::LogPrint("LeptonRecoSkim") << "Filtered events = " << NeventsFiltered << endl; + edm::LogPrint("LeptonRecoSkim") << "Filter Efficiency = " << (float)NeventsFiltered / (float)NeventsTotal + << endl; + edm::LogPrint("LeptonRecoSkim") << endl; + edm::LogPrint("LeptonRecoSkim") << "N total electrons = " << NtotalElectrons << endl; + edm::LogPrint("LeptonRecoSkim") << "N mva>-0.1 electrons = " << NmvaElectrons << endl; + edm::LogPrint("LeptonRecoSkim") << endl; + edm::LogPrint("LeptonRecoSkim") << endl; } void LeptonRecoSkim::handleObjects(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Get the electrons - Handle theElectronCollectionHandle; - iEvent.getByLabel(m_electronSrc, theElectronCollectionHandle); - theElectronCollection = theElectronCollectionHandle.product(); + theElectronCollection = &iEvent.get(gsfElectronCollectionToken_); //Get the pf electrons - Handle thePfCandidateHandle; - iEvent.getByLabel(m_pfelectronSrc, thePfCandidateHandle); - thePfCandidateCollection = thePfCandidateHandle.product(); + thePfCandidateCollection = &iEvent.get(pfCandidateCollectionToken_); //Get the Muons - Handle theMuonCollectionHandle; - iEvent.getByLabel(m_muonSrc, theMuonCollectionHandle); - theMuonCollection = theMuonCollectionHandle.product(); + theMuonCollection = &iEvent.get(muonCollectionToken_); //Get the CaloJets - Handle theCaloJetCollectionHandle; - iEvent.getByLabel(m_jetsSrc, theCaloJetCollectionHandle); - theCaloJetCollection = theCaloJetCollectionHandle.product(); + theCaloJetCollection = &iEvent.get(caloJetCollectionToken_); //Get the PfJets - Handle thePFJetCollectionHandle; - iEvent.getByLabel(m_pfjetsSrc, thePFJetCollectionHandle); - thePFJetCollection = thePFJetCollectionHandle.product(); + thePFJetCollection = &iEvent.get(pfJetCollectionToken_); - //Get the ECAL rechhits to clean the spikes + // Get the ECAL rechhits to clean the spikes // Get EB RecHits - edm::Handle ebRecHitsHandle; - iEvent.getByLabel(m_ebRecHitsSrc, ebRecHitsHandle); - theEcalBarrelCollection = ebRecHitsHandle.product(); + theEcalBarrelCollection = &iEvent.get(ebRecHitCollectionToken_); // Get EE RecHits - edm::Handle eeRecHitsHandle; - iEvent.getByLabel(m_eeRecHitsSrc, eeRecHitsHandle); - theEcalEndcapCollection = eeRecHitsHandle.product(); + theEcalEndcapCollection = &iEvent.get(eeRecHitCollectionToken_); // Get topology for spike cleaning - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - theCaloGeometry = geometryHandle.product(); - // theCaloBarrelSubdetTopology = new EcalBarrelTopology(geometryHandle); - // theCaloEndcapSubdetTopology = new EcalEndcapTopology(geometryHandle); - - edm::ESHandle pTopology; - iSetup.get().get(pTopology); - theCaloTopology = pTopology.product(); + theCaloGeometry = &iSetup.getData(m_CaloGeoToken); + theCaloTopology = &iSetup.getData(m_CaloTopoToken); } //define this as a plug-in diff --git a/Configuration/Skimming/src/LeptonSkimming.cc b/Configuration/Skimming/src/LeptonSkimming.cc index 6fc1c7f3f610a..e7ffe11affd61 100644 --- a/Configuration/Skimming/src/LeptonSkimming.cc +++ b/Configuration/Skimming/src/LeptonSkimming.cc @@ -1,10 +1,10 @@ // -*- C++ -*- // -// Package: SkimmingForB/LeptonSkimming +// Package: Configuration/Skimming // Class: LeptonSkimming // -/**\class LeptonSkimming LeptonSkimming.cc SkimmingForB/LeptonSkimming/plugins/LeptonSkimming.cc +/**\class LeptonSkimming LeptonSkimming.cc Configuration/Skimming/src/LeptonSkimming.cc Description: [one line class summary] From 5618cd0965e11858be07de4c71b734294eb99881 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Wed, 1 Sep 2021 19:42:38 +0800 Subject: [PATCH 271/923] restore AVXVec.h and extBasic2DVector.h --- .../interface/private/extBasic2DVector.h | 264 ++++++++++++++++++ DataFormats/Math/interface/private/AVXVec.h | 187 +++++++++++++ 2 files changed, 451 insertions(+) create mode 100644 DataFormats/GeometryVector/interface/private/extBasic2DVector.h create mode 100644 DataFormats/Math/interface/private/AVXVec.h diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h new file mode 100644 index 0000000000000..7d6a871576de7 --- /dev/null +++ b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h @@ -0,0 +1,264 @@ +#ifndef GeometryVector_newBasic2DVector_h +#define GeometryVector_newBasic2DVector_h + +#include "DataFormats/GeometryVector/interface/Phi.h" +#include "DataFormats/GeometryVector/interface/PreciseFloatType.h" +#include "DataFormats/GeometryVector/interface/CoordinateSets.h" +#include "DataFormats/Math/interface/ExtVec.h" + + +#include +#include + + +template < class T> +class Basic2DVector { +public: + + typedef T ScalarType; + typedef Vec2 VectorType; + typedef Vec2 MathVector; + typedef Geom::Polar2Cartesian Polar; + + /** default constructor uses default constructor of T to initialize the + * components. For built-in floating-point types this means initialization + * to zero + */ + Basic2DVector() : v{0,0} {} + + /// Copy constructor from same type. Should not be needed but for gcc bug 12685 + Basic2DVector( const Basic2DVector & p) : v(p.v) {} + + template + Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} + + + /** Explicit constructor from other (possibly unrelated) vector classes + * The only constraint on the argument type is that it has methods + * x() and y(), and that these methods return a type convertible to T. + * Examples of use are + *
construction from a Basic2DVector with different precision + *
construction from a coordinate system converter + */ + template + explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} + + /// construct from cartesian coordinates + Basic2DVector( const T& x, const T& y) : v{x,y} {} + + // constructor from Vec2 or vec4 + Basic2DVector(MathVector const& iv) : v(iv){} + template + Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} + template + Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} + + MathVector const & mathVector() const { return v;} + MathVector & mathVector() { return v;} + + T operator[](int i) const { return v[i];} + T & operator[](int i) { return v[i];} + + + /// Cartesian x coordinate + T x() const { return v[0];} + + /// Cartesian y coordinate + T y() const { return v[1];} + + /// The vector magnitude squared. Equivalent to vec.dot(vec) + T mag2() const { return ::dot(v,v);} + + /// The vector magnitude. Equivalent to sqrt(vec.mag2()) + T mag() const { return std::sqrt( mag2());} + + /// Radius, same as mag() + T r() const { return mag();} + + /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. + * Same precision as the system atan2(x,y) function. + * The return type is Geom::Phi, see it's documentation. + */ + T barePhi() const {return std::atan2(y(),x());} + Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} + + /** Unit vector parallel to this. + * If mag() is zero, a zero vector is returned. + */ + Basic2DVector unit() const { + T my_mag = mag(); + return my_mag == 0 ? *this : *this / my_mag; + } + + /** Operator += with a Basic2DVector of possibly different precision. + */ + template + Basic2DVector& operator+= ( const Basic2DVector& p) { + v = v + p.v; + return *this; + } + + /** Operator -= with a Basic2DVector of possibly different precision. + */ + template + Basic2DVector& operator-= ( const Basic2DVector& p) { + v = v - p.v; + return *this; + } + + /// Unary minus, returns a vector with components (-x(),-y(),-z()) + Basic2DVector operator-() const { return Basic2DVector(-v);} + + /// Scaling by a scalar value (multiplication) + Basic2DVector& operator*= ( T t) { + v = v*t; + return *this; + } + + /// Scaling by a scalar value (division) + Basic2DVector& operator/= ( T t) { + t = T(1)/t; + v = v*t; + return *this; + } + + /// Scalar product, or "dot" product, with a vector of same type. + T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} + + /** Scalar (or dot) product with a vector of different precision. + * The product is computed without loss of precision. The type + * of the returned scalar is the more precise of the scalar types + * of the two vectors. + */ + template + typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this) + .dot(Basic2DVector::Type>(lh)); + } + + /// Vector product, or "cross" product, with a vector of same type. + T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} + + /** Vector (or cross) product with a vector of different precision. + * The product is computed without loss of precision. The type + * of the returned scalar is the more precise of the scalar types + * of the two vectors. + */ + template + typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this) + .cross(Basic2DVector::Type>(lh)); + } + + +public: + + Vec2 v; + +}; + + +namespace geometryDetails { + std::ostream & print2D(std::ostream& s, double x, double y); + +} + +/// simple text output to standard streams +template +inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { + return geometryDetails::print2D(s, v.x(),v.y()); +} + + +/// vector sum and subtraction of vectors of possibly different precision +template +inline Basic2DVector +operator+( const Basic2DVector& a, const Basic2DVector& b) { + return a.v+b.v; +} +template +inline Basic2DVector +operator-( const Basic2DVector& a, const Basic2DVector& b) { + return a.v-b.v; +} + +template +inline Basic2DVector::Type> +operator+( const Basic2DVector& a, const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a) + RT(b); +} + +template +inline Basic2DVector::Type> +operator-( const Basic2DVector& a, const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a)-RT(b); +} + + + + +// scalar product of vectors of same precision +template +inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { + return v1.dot(v2); +} + +/// scalar product of vectors of different precision +template +inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, + const Basic2DVector& v2) { + return v1.dot(v2); +} + + +/** Multiplication by scalar, does not change the precision of the vector. + * The return type is the same as the type of the vector argument. + */ +template +inline Basic2DVector operator*( const Basic2DVector& v, T t) { + return v.v*t; +} + +/// Same as operator*( Vector, Scalar) +template +inline Basic2DVector operator*(T t, const Basic2DVector& v) { + return v.v*t; +} + + + +template +inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { + T t = static_cast(s); + return v*t; +} + +/// Same as operator*( Vector, Scalar) +template +inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { + T t = static_cast(s); + return v*t; +} + +/** Division by scalar, does not change the precision of the vector. + * The return type is the same as the type of the vector argument. + */ +template +inline Basic2DVector operator/(const Basic2DVector& v, T t) { + return v.v/t; +} + +template +inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { + // T t = static_cast(Scalar(1)/s); return v*t; + T t = static_cast(s); + return v/t; +} + +typedef Basic2DVector Basic2DVectorF; +typedef Basic2DVector Basic2DVectorD; + + +#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h new file mode 100644 index 0000000000000..9fe33e8c3d1fd --- /dev/null +++ b/DataFormats/Math/interface/private/AVXVec.h @@ -0,0 +1,187 @@ +#ifndef DataFormat_Math_AVXVec_H +#define DataFormat_Math_AVXVec_H + +// in principle it should not be used alone +// only as part of SSEVec +namespace mathSSE { + + template<> + union Vec4 { + typedef __m256d nativeType; + __m256d vec; + double __attribute__ ((aligned(32))) arr[4]; + OldVec o; + + Vec4(__m256d ivec) : vec(ivec) {} + + Vec4(OldVec const & ivec) : o(ivec) {} + + Vec4() { + vec = _mm256_setzero_pd(); + } + + + inline Vec4(Vec4 ivec) { + vec = _mm256_cvtps_pd(ivec.vec); + } + + explicit Vec4(double f1) { + set1(f1); + } + + Vec4(double f1, double f2, double f3, double f4=0) { + arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; + } + + + Vec4( Vec2 ivec0, Vec2 ivec1) { + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + vec = _mm256_insertf128_pd(vec,ivec1.vec,1); + + } + + Vec4( Vec2 ivec0, double f3, double f4=0) { + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + arr[2] = f3; arr[3] = f4; + } + + Vec4( Vec2 ivec0) { + vec = _mm256_setzero_pd(); + vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + } + + + // for masking + void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { + Mask4 mask(m1,m2,m3,m4); vec=mask.vec; + } + + void set(double f1, double f2, double f3, double f4=0) { + vec = _mm256_set_pd(f4, f3, f2, f1); + } + + void set1(double f1) { + vec = _mm256_set1_pd(f1); + } + + template + Vec4 get1() const { + return _mm256_set1_pd(arr[N]); //FIXME + } + /* + Vec4 get1(unsigned int n) const { + return _mm256_set1_pd(arr[n]); //FIXME + } + */ + double & operator[](unsigned int n) { + return arr[n]; + } + + double operator[](unsigned int n) const { + return arr[n]; + } + + Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} + Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} + + }; + + inline Vec4::Vec4(Vec4 ivec) { + vec = _mm256_cvtpd_ps(ivec.vec); + } +} // namespace mathSSE + + + +inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; +} + +inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); +} + +inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); +} + +inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_hadd_pd(a.vec,b.vec); +} + + + +inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { + const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); + return _mm256_xor_pd(a.vec,neg); +} + +inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_and_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_or_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_xor_pd(a.vec,b.vec); +} +inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_andnot_pd(a.vec,b.vec); +} + + +inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_add_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_sub_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_mul_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { + return _mm256_div_pd(a.vec,b.vec); +} + +inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { + return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +} + +inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { + return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +} + +inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { + return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); +} + + +inline double +__attribute__((always_inline)) __attribute__ ((pure)) +dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { + using mathSSE::_mm256_dot_pd; + mathSSE::Vec4 ret; + ret.vec = _mm256_dot_pd(a.vec,b.vec); + return ret.arr[0]; +} + +inline mathSSE::Vec4 +__attribute__((always_inline)) __attribute__ ((pure)) +cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { + using mathSSE::_mm256_cross_pd; + return _mm256_cross_pd(a.vec,b.vec); +} + +inline double +__attribute__((always_inline)) __attribute__ ((pure)) +dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { + mathSSE::Vec4 mul = a*b; + mul = hadd(mul,mul); + return mul.arr[0]; +} + + +#endif From eb09de61b5670ec1c5ed140f6804f6b2cc46b0ca Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 1 Sep 2021 11:47:49 +0200 Subject: [PATCH 272/923] modernize DPGAnalysis/Skims --- DPGAnalysis/Skims/interface/BeamSplash.h | 4 +-- DPGAnalysis/Skims/interface/CSCSkim.h | 7 ++-- DPGAnalysis/Skims/interface/ECALActivity.h | 4 +-- DPGAnalysis/Skims/interface/EcalSkim.h | 4 +-- .../Skims/interface/EcalTangentFilter.h | 14 ++++---- .../Skims/interface/FilterOutScraping.h | 4 +-- .../FilterScrapingPixelProbability.h | 4 +-- DPGAnalysis/Skims/interface/HLTInspect.h | 4 +-- .../Skims/interface/MatchedProbeMaker.h | 4 +-- DPGAnalysis/Skims/interface/MuonPtFilter.h | 4 +-- DPGAnalysis/Skims/interface/PhysDecl.h | 4 +-- DPGAnalysis/Skims/interface/SelectHFMinBias.h | 7 ++-- .../Skims/interface/TagProbeMassEDMFilter.h | 4 +-- .../Skims/interface/TagProbeMassProducer.h | 6 ++-- DPGAnalysis/Skims/src/CSCSkim.cc | 5 ++- DPGAnalysis/Skims/src/EcalTangentFilter.cc | 6 ---- DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc | 12 ++----- DPGAnalysis/Skims/src/HcalHPDFilter.cc | 20 ++---------- DPGAnalysis/Skims/src/NMaxPerLumi.cc | 12 ++----- DPGAnalysis/Skims/src/PickEvents.cc | 4 +-- DPGAnalysis/Skims/src/RPCNoise.cc | 4 +-- DPGAnalysis/Skims/src/RPCRecHitFilter.cc | 32 +++++-------------- DPGAnalysis/Skims/src/RPCRecHitFilter.h | 14 ++++++-- DPGAnalysis/Skims/src/RecHitEnergyFilter.cc | 12 ++----- .../Skims/src/SecondaryVertexFilter.cc | 4 +-- DPGAnalysis/Skims/src/SelectHFMinBias.cc | 2 -- DPGAnalysis/Skims/src/SimpleJetFilter.cc | 20 ++---------- DPGAnalysis/Skims/src/TagProbeMassProducer.cc | 6 ---- .../Skims/src/WZInterestingEventSelector.cc | 4 +-- 29 files changed, 74 insertions(+), 157 deletions(-) diff --git a/DPGAnalysis/Skims/interface/BeamSplash.h b/DPGAnalysis/Skims/interface/BeamSplash.h index 1b76149e447e0..d2ed149274934 100644 --- a/DPGAnalysis/Skims/interface/BeamSplash.h +++ b/DPGAnalysis/Skims/interface/BeamSplash.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class BeamSplash : public edm::EDFilter { +class BeamSplash : public edm::stream::EDFilter<> { public: explicit BeamSplash(const edm::ParameterSet &); ~BeamSplash() override; diff --git a/DPGAnalysis/Skims/interface/CSCSkim.h b/DPGAnalysis/Skims/interface/CSCSkim.h index b303c4caba8a2..16c5424463854 100644 --- a/DPGAnalysis/Skims/interface/CSCSkim.h +++ b/DPGAnalysis/Skims/interface/CSCSkim.h @@ -20,7 +20,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -69,7 +69,7 @@ #include "TString.h" #include "TTree.h" -class CSCSkim : public edm::EDFilter { +class CSCSkim : public edm::one::EDFilter<> { public: // Constructor explicit CSCSkim(const edm::ParameterSet &pset); @@ -137,6 +137,9 @@ class CSCSkim : public edm::EDFilter { std::string outputFileName; std::string histogramFileName; + // es token names + const edm::ESGetToken m_CSCGeomToken; + // token names edm::EDGetTokenT wds_token; edm::EDGetTokenT sds_token; diff --git a/DPGAnalysis/Skims/interface/ECALActivity.h b/DPGAnalysis/Skims/interface/ECALActivity.h index 3d43bae77cf0c..89a4620c56dfc 100644 --- a/DPGAnalysis/Skims/interface/ECALActivity.h +++ b/DPGAnalysis/Skims/interface/ECALActivity.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class ECALActivity : public edm::EDFilter { +class ECALActivity : public edm::stream::EDFilter<> { public: explicit ECALActivity(const edm::ParameterSet &); ~ECALActivity() override; diff --git a/DPGAnalysis/Skims/interface/EcalSkim.h b/DPGAnalysis/Skims/interface/EcalSkim.h index 5012e9f976de7..e4680e20d0573 100644 --- a/DPGAnalysis/Skims/interface/EcalSkim.h +++ b/DPGAnalysis/Skims/interface/EcalSkim.h @@ -22,7 +22,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -41,7 +41,7 @@ class TFile; -class EcalSkim : public edm::EDFilter { +class EcalSkim : public edm::stream::EDFilter<> { public: explicit EcalSkim(const edm::ParameterSet &); ~EcalSkim() override; diff --git a/DPGAnalysis/Skims/interface/EcalTangentFilter.h b/DPGAnalysis/Skims/interface/EcalTangentFilter.h index a55fd1cdccc15..cbcdc7ceaed76 100644 --- a/DPGAnalysis/Skims/interface/EcalTangentFilter.h +++ b/DPGAnalysis/Skims/interface/EcalTangentFilter.h @@ -3,31 +3,29 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include -#include -#include +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackBase.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" // // class declaration // -class EcalTangentFilter : public edm::EDFilter { +class EcalTangentFilter : public edm::stream::EDFilter<> { public: explicit EcalTangentFilter(const edm::ParameterSet&); ~EcalTangentFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- int fNgood, fNtot, fEvt; diff --git a/DPGAnalysis/Skims/interface/FilterOutScraping.h b/DPGAnalysis/Skims/interface/FilterOutScraping.h index c48ab634c8773..673bbe9c9f70e 100644 --- a/DPGAnalysis/Skims/interface/FilterOutScraping.h +++ b/DPGAnalysis/Skims/interface/FilterOutScraping.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -30,7 +30,7 @@ // class declaration // -class FilterOutScraping : public edm::EDFilter { +class FilterOutScraping : public edm::stream::EDFilter<> { public: explicit FilterOutScraping(const edm::ParameterSet &); ~FilterOutScraping() override; diff --git a/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h b/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h index cf3075f9cbe10..c3494050cd43c 100644 --- a/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h +++ b/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h @@ -27,7 +27,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -39,7 +39,7 @@ #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -class FilterScrapingPixelProbability : public edm::EDFilter { +class FilterScrapingPixelProbability : public edm::stream::EDFilter<> { public: explicit FilterScrapingPixelProbability(const edm::ParameterSet &); ~FilterScrapingPixelProbability() override; diff --git a/DPGAnalysis/Skims/interface/HLTInspect.h b/DPGAnalysis/Skims/interface/HLTInspect.h index 4ad12849c9ee4..18ec2753b6ec9 100644 --- a/DPGAnalysis/Skims/interface/HLTInspect.h +++ b/DPGAnalysis/Skims/interface/HLTInspect.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.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/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class HLTInspect : public edm::EDAnalyzer { +class HLTInspect : public edm::one::EDAnalyzer<> { public: explicit HLTInspect(const edm::ParameterSet&); ~HLTInspect() override; diff --git a/DPGAnalysis/Skims/interface/MatchedProbeMaker.h b/DPGAnalysis/Skims/interface/MatchedProbeMaker.h index 7698a64111b40..97ac94e95cb2a 100644 --- a/DPGAnalysis/Skims/interface/MatchedProbeMaker.h +++ b/DPGAnalysis/Skims/interface/MatchedProbeMaker.h @@ -16,7 +16,7 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandMatchMap.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -27,7 +27,7 @@ // template -class MatchedProbeMaker : public edm::EDProducer { +class MatchedProbeMaker : public edm::one::EDProducer<> { public: typedef std::vector collection; diff --git a/DPGAnalysis/Skims/interface/MuonPtFilter.h b/DPGAnalysis/Skims/interface/MuonPtFilter.h index 74cfbe361ccee..d5b857d81ea36 100644 --- a/DPGAnalysis/Skims/interface/MuonPtFilter.h +++ b/DPGAnalysis/Skims/interface/MuonPtFilter.h @@ -13,7 +13,7 @@ /* Base Class Headers */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -27,7 +27,7 @@ class Propagator; /* Class MuonPtFilter Interface */ -class MuonPtFilter : public edm::EDFilter { +class MuonPtFilter : public edm::stream::EDFilter<> { public: /// Constructor MuonPtFilter(const edm::ParameterSet &); diff --git a/DPGAnalysis/Skims/interface/PhysDecl.h b/DPGAnalysis/Skims/interface/PhysDecl.h index 0cfed4703c990..98062df9abe5c 100644 --- a/DPGAnalysis/Skims/interface/PhysDecl.h +++ b/DPGAnalysis/Skims/interface/PhysDecl.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -31,7 +31,7 @@ // class declaration // -class PhysDecl : public edm::EDFilter { +class PhysDecl : public edm::one::EDFilter<> { public: explicit PhysDecl(const edm::ParameterSet &); ~PhysDecl() override; diff --git a/DPGAnalysis/Skims/interface/SelectHFMinBias.h b/DPGAnalysis/Skims/interface/SelectHFMinBias.h index 6176bbdf3848c..a5abfe139568f 100644 --- a/DPGAnalysis/Skims/interface/SelectHFMinBias.h +++ b/DPGAnalysis/Skims/interface/SelectHFMinBias.h @@ -17,20 +17,17 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" // // class declaration // -class SelectHFMinBias : public edm::EDFilter { +class SelectHFMinBias : public edm::stream::EDFilter<> { public: explicit SelectHFMinBias(const edm::ParameterSet &); ~SelectHFMinBias() override; diff --git a/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h b/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h index a2eb52c657304..83c16a601c395 100644 --- a/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h +++ b/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -35,7 +35,7 @@ // class declaration // -class TagProbeMassEDMFilter : public edm::EDFilter { +class TagProbeMassEDMFilter : public edm::one::EDFilter<> { public: explicit TagProbeMassEDMFilter(const edm::ParameterSet&); ~TagProbeMassEDMFilter() override; diff --git a/DPGAnalysis/Skims/interface/TagProbeMassProducer.h b/DPGAnalysis/Skims/interface/TagProbeMassProducer.h index 468ff474d793f..26caba3bf5143 100644 --- a/DPGAnalysis/Skims/interface/TagProbeMassProducer.h +++ b/DPGAnalysis/Skims/interface/TagProbeMassProducer.h @@ -24,22 +24,20 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" // forward declarations -class TagProbeMassProducer : public edm::EDProducer { +class TagProbeMassProducer : public edm::stream::EDProducer<> { public: explicit TagProbeMassProducer(const edm::ParameterSet&); ~TagProbeMassProducer() override; private: - void beginJob() override; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; bool isPassingProbe(const unsigned int iprobe) const; diff --git a/DPGAnalysis/Skims/src/CSCSkim.cc b/DPGAnalysis/Skims/src/CSCSkim.cc index 4762965ac2bae..9e91ded30c630 100644 --- a/DPGAnalysis/Skims/src/CSCSkim.cc +++ b/DPGAnalysis/Skims/src/CSCSkim.cc @@ -48,7 +48,7 @@ using namespace edm; //=================== // CONSTRUCTOR //=================== -CSCSkim::CSCSkim(const edm::ParameterSet& pset) { +CSCSkim::CSCSkim(const edm::ParameterSet& pset) : m_CSCGeomToken(esConsumes()) { // tokens from tags // Really should define the wire and digi tags in config, but for now, to avoid having to modify @@ -222,8 +222,7 @@ bool CSCSkim::filter(edm::Event& event, const edm::EventSetup& eventSetup) { LogDebug("[CSCSkim] EventInfo") << "Run: " << iRun << "\tEvent: " << iEvent << "\tn Analyzed: " << nEventsAnalyzed; // Get the CSC Geometry : - ESHandle cscGeom; - eventSetup.get().get(cscGeom); + ESHandle cscGeom = eventSetup.getHandle(m_CSCGeomToken); // Get the DIGI collections edm::Handle wires; diff --git a/DPGAnalysis/Skims/src/EcalTangentFilter.cc b/DPGAnalysis/Skims/src/EcalTangentFilter.cc index 3586e00025ae1..fd579e64e697e 100644 --- a/DPGAnalysis/Skims/src/EcalTangentFilter.cc +++ b/DPGAnalysis/Skims/src/EcalTangentFilter.cc @@ -49,11 +49,5 @@ bool EcalTangentFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup return goodEvent; } -// ------------ method called once each job just before starting event loop ------------ -void EcalTangentFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void EcalTangentFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(EcalTangentFilter); diff --git a/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc b/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc index 696e100c9cfde..9b0875b0859cd 100644 --- a/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc +++ b/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -45,15 +45,13 @@ using namespace edm; //using namespace l1extra; -class HCALHighEnergyFilter : public edm::EDFilter { +class HCALHighEnergyFilter : public edm::stream::EDFilter<> { public: explicit HCALHighEnergyFilter(const edm::ParameterSet&); ~HCALHighEnergyFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // bool jetGood(L1JetParticleCollection::const_iterator &); bool jetGood(reco::CaloJetCollection::const_iterator&); // ----------member data --------------------------- @@ -134,11 +132,5 @@ bool HCALHighEnergyFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSe return false; } -// ------------ method called once each job just before starting event loop ------------ -void HCALHighEnergyFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HCALHighEnergyFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(HCALHighEnergyFilter); diff --git a/DPGAnalysis/Skims/src/HcalHPDFilter.cc b/DPGAnalysis/Skims/src/HcalHPDFilter.cc index 1ce6f455727f3..2780cd2509305 100644 --- a/DPGAnalysis/Skims/src/HcalHPDFilter.cc +++ b/DPGAnalysis/Skims/src/HcalHPDFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -35,27 +35,17 @@ // class declaration // -class HcalHPDFilter : public edm::EDFilter { +class HcalHPDFilter : public edm::stream::EDFilter<> { public: explicit HcalHPDFilter(const edm::ParameterSet&); ~HcalHPDFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // @@ -84,11 +74,5 @@ bool HcalHPDFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { return false; } -// ------------ method called once each job just before starting event loop ------------ -void HcalHPDFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HcalHPDFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(HcalHPDFilter); diff --git a/DPGAnalysis/Skims/src/NMaxPerLumi.cc b/DPGAnalysis/Skims/src/NMaxPerLumi.cc index 89426ad92f6a5..bb39fddeb753e 100644 --- a/DPGAnalysis/Skims/src/NMaxPerLumi.cc +++ b/DPGAnalysis/Skims/src/NMaxPerLumi.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -33,15 +33,13 @@ // class declaration // -class NMaxPerLumi : public edm::EDFilter { +class NMaxPerLumi : public edm::stream::EDFilter<> { public: explicit NMaxPerLumi(const edm::ParameterSet&); ~NMaxPerLumi() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- std::map > counters; @@ -86,11 +84,5 @@ bool NMaxPerLumi::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { } } -// ------------ method called once each job just before starting event loop ------------ -void NMaxPerLumi::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void NMaxPerLumi::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(NMaxPerLumi); diff --git a/DPGAnalysis/Skims/src/PickEvents.cc b/DPGAnalysis/Skims/src/PickEvents.cc index 850f09c0853f0..1ce402347a99d 100644 --- a/DPGAnalysis/Skims/src/PickEvents.cc +++ b/DPGAnalysis/Skims/src/PickEvents.cc @@ -32,7 +32,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -51,7 +51,7 @@ bool orderLuminosityBlockRange(edm::LuminosityBlockRange u, edm::LuminosityBlock // class declaration // -class PickEvents : public edm::EDFilter { +class PickEvents : public edm::one::EDFilter<> { public: explicit PickEvents(const edm::ParameterSet&); ~PickEvents() override; diff --git a/DPGAnalysis/Skims/src/RPCNoise.cc b/DPGAnalysis/Skims/src/RPCNoise.cc index 88ea0a3255791..cb49f4efc96ae 100644 --- a/DPGAnalysis/Skims/src/RPCNoise.cc +++ b/DPGAnalysis/Skims/src/RPCNoise.cc @@ -28,7 +28,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -84,7 +84,7 @@ using namespace edm; // class declaration // -class RPCNoise : public edm::EDFilter { +class RPCNoise : public edm::one::EDFilter<> { public: explicit RPCNoise(const edm::ParameterSet &); ~RPCNoise() override; diff --git a/DPGAnalysis/Skims/src/RPCRecHitFilter.cc b/DPGAnalysis/Skims/src/RPCRecHitFilter.cc index 513313cd53a9e..138a0580f5a4e 100644 --- a/DPGAnalysis/Skims/src/RPCRecHitFilter.cc +++ b/DPGAnalysis/Skims/src/RPCRecHitFilter.cc @@ -4,11 +4,8 @@ // #include "DPGAnalysis/Skims/src/RPCRecHitFilter.h" -//#include "../interface/RecHitFilter.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "DataFormats/RPCDigi/interface/RPCDigi.h" -//#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -17,7 +14,6 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" #include -#include #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" @@ -40,14 +36,6 @@ #include "CondFormats/L1TObjects/interface/L1GtParameters.h" #include "CondFormats/DataRecord/interface/L1GtParametersRcd.h" -/*#include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h" -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" - -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" - -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h" -*/ - using namespace reco; typedef std::vector L1MuRegionalCandCollection; @@ -75,12 +63,12 @@ using namespace edm; using namespace reco; using namespace std; -RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) { - LogTrace("RPCEffTrackExtrapolation") << "Dentro Costruttore" << std::endl; +RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) + : rpcGeomToken_(esConsumes()), trackingGeoToken_(esConsumes()) { + LogTrace("RPCEffTrackExtrapolation") << "inside constructor" << std::endl; - RPCDataLabel = iConfig.getUntrackedParameter("rpcRecHitLabel"); - - // RPCRecHits = iConfig.getParameter< edm::InputTag >("RPCRecHits"); + RPCDataLabel_ = iConfig.getUntrackedParameter("rpcRecHitLabel"); + rpcRecHitToken_ = consumes(edm::InputTag(RPCDataLabel_)); centralBX_ = iConfig.getUntrackedParameter("CentralBunchCrossing", 0); BXWindow_ = iConfig.getUntrackedParameter("BunchCrossingWindow", 9999); @@ -99,14 +87,10 @@ RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) { } bool RPCRecHitFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle rpcGeo; - iSetup.get().get(rpcGeo); - - edm::Handle rpcHits; - iEvent.getByLabel(RPCDataLabel, rpcHits); + edm::ESHandle rpcGeo = iSetup.getHandle(rpcGeomToken_); + edm::ESHandle theTrackingGeometry = iSetup.getHandle(trackingGeoToken_); - ESHandle theTrackingGeometry; - iSetup.get().get(theTrackingGeometry); + edm::Handle rpcHits = iEvent.getHandle(rpcRecHitToken_); std::map numberOfRecHitsBarrel; std::map numberOfDigisBarrel; diff --git a/DPGAnalysis/Skims/src/RPCRecHitFilter.h b/DPGAnalysis/Skims/src/RPCRecHitFilter.h index 30a900d8e7a14..bb7d10b21ea88 100644 --- a/DPGAnalysis/Skims/src/RPCRecHitFilter.h +++ b/DPGAnalysis/Skims/src/RPCRecHitFilter.h @@ -42,7 +42,8 @@ #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "TDirectory.h" #include "TFile.h" @@ -58,7 +59,7 @@ typedef std::vector MeasurementContainer; typedef std::pair DetWithState; typedef std::vector Trajectories; -class RPCRecHitFilter : public edm::EDFilter { +class RPCRecHitFilter : public edm::stream::EDFilter<> { public: explicit RPCRecHitFilter(const edm::ParameterSet &); ~RPCRecHitFilter() override {} @@ -66,7 +67,14 @@ class RPCRecHitFilter : public edm::EDFilter { private: bool filter(edm::Event &, const edm::EventSetup &) override; - std::string RPCDataLabel; + // es token + const edm::ESGetToken rpcGeomToken_; + const edm::ESGetToken trackingGeoToken_; + + // event token + edm::EDGetTokenT rpcRecHitToken_; + + std::string RPCDataLabel_; int centralBX_, BXWindow_, minHits_, hitsInStations_; diff --git a/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc b/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc index 0ecad4a2dcea9..8f5ff55b53de6 100644 --- a/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc +++ b/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -32,15 +32,13 @@ // class declaration // -class RecHitEnergyFilter : public edm::EDFilter { +class RecHitEnergyFilter : public edm::stream::EDFilter<> { public: explicit RecHitEnergyFilter(const edm::ParameterSet&); ~RecHitEnergyFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // RecHit input tags edm::InputTag ebRecHitsTag_; @@ -103,11 +101,5 @@ bool RecHitEnergyFilter::filter(edm::Event& evt, const edm::EventSetup& iSetup) return false; } -// ------------ method called once each job just before starting event loop ------------ -void RecHitEnergyFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void RecHitEnergyFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(RecHitEnergyFilter); diff --git a/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc b/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc index e0782f0d8c74e..5b25597186137 100644 --- a/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc +++ b/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -36,7 +36,7 @@ // class declaration // -class SecondaryVertexFilter : public edm::EDFilter { +class SecondaryVertexFilter : public edm::stream::EDFilter<> { public: explicit SecondaryVertexFilter(const edm::ParameterSet&); ~SecondaryVertexFilter() override; diff --git a/DPGAnalysis/Skims/src/SelectHFMinBias.cc b/DPGAnalysis/Skims/src/SelectHFMinBias.cc index fa6eea0b1d291..b1728ee558fdc 100644 --- a/DPGAnalysis/Skims/src/SelectHFMinBias.cc +++ b/DPGAnalysis/Skims/src/SelectHFMinBias.cc @@ -15,11 +15,9 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DPGAnalysis/Skims/interface/SelectHFMinBias.h" diff --git a/DPGAnalysis/Skims/src/SimpleJetFilter.cc b/DPGAnalysis/Skims/src/SimpleJetFilter.cc index 3e8654921b583..3a519c25ce9ed 100644 --- a/DPGAnalysis/Skims/src/SimpleJetFilter.cc +++ b/DPGAnalysis/Skims/src/SimpleJetFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -45,15 +45,13 @@ // class declaration // -class SimpleJetFilter : public edm::EDFilter { +class SimpleJetFilter : public edm::stream::EDFilter<> { public: explicit SimpleJetFilter(const edm::ParameterSet&); ~SimpleJetFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- @@ -65,14 +63,6 @@ class SimpleJetFilter : public edm::EDFilter { JetIDSelectionFunctor m_jetIDfunc; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // @@ -139,11 +129,5 @@ bool SimpleJetFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) return selected; } -// ------------ method called once each job just before starting event loop ------------ -void SimpleJetFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void SimpleJetFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(SimpleJetFilter); diff --git a/DPGAnalysis/Skims/src/TagProbeMassProducer.cc b/DPGAnalysis/Skims/src/TagProbeMassProducer.cc index ab5b84bae6e1d..69f86ea8a2387 100644 --- a/DPGAnalysis/Skims/src/TagProbeMassProducer.cc +++ b/DPGAnalysis/Skims/src/TagProbeMassProducer.cc @@ -119,12 +119,6 @@ void TagProbeMassProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS iEvent.put(std::move(TPmass), "TPmass"); } -// ------------ method called once each job just before starting event loop ------------ -void TagProbeMassProducer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void TagProbeMassProducer::endJob() {} - bool TagProbeMassProducer::isPassingProbe(const unsigned int iProbe) const { if (iProbe > probes->size()) return false; diff --git a/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc b/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc index 355428018afe6..f6bb4da82a547 100644 --- a/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc +++ b/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc @@ -14,7 +14,7 @@ #include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -41,7 +41,7 @@ using namespace reco; -class WZInterestingEventSelector : public edm::EDFilter { +class WZInterestingEventSelector : public edm::one::EDFilter<> { public: struct event { long run; From 2c3e3e84cb714e866e295092db423809454dff12 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Wed, 1 Sep 2021 21:26:12 +0800 Subject: [PATCH 273/923] fixed code check error --- .../interface/private/extBasic2DVector.h | 178 ++++++++---------- DataFormats/Math/interface/private/AVXVec.h | 156 +++++++-------- 2 files changed, 144 insertions(+), 190 deletions(-) diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h index 7d6a871576de7..68e6c69d56d81 100644 --- a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h +++ b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h @@ -6,32 +6,28 @@ #include "DataFormats/GeometryVector/interface/CoordinateSets.h" #include "DataFormats/Math/interface/ExtVec.h" - #include #include - -template < class T> +template class Basic2DVector { public: - - typedef T ScalarType; + typedef T ScalarType; typedef Vec2 VectorType; typedef Vec2 MathVector; - typedef Geom::Polar2Cartesian Polar; + typedef Geom::Polar2Cartesian Polar; /** default constructor uses default constructor of T to initialize the * components. For built-in floating-point types this means initialization * to zero */ - Basic2DVector() : v{0,0} {} + Basic2DVector() : v{0, 0} {} /// Copy constructor from same type. Should not be needed but for gcc bug 12685 - Basic2DVector( const Basic2DVector & p) : v(p.v) {} - - template - Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} + Basic2DVector(const Basic2DVector& p) : v(p.v) {} + template + Basic2DVector(const Basic2DVector& p) : v{T(p.v[0]), T(p.v[1])} {} /** Explicit constructor from other (possibly unrelated) vector classes * The only constraint on the argument type is that it has methods @@ -40,47 +36,46 @@ class Basic2DVector { *
construction from a Basic2DVector with different precision *
construction from a coordinate system converter */ - template - explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} + template + explicit Basic2DVector(const Other& p) : v{T(p.x()), T(p.y())} {} /// construct from cartesian coordinates - Basic2DVector( const T& x, const T& y) : v{x,y} {} + Basic2DVector(const T& x, const T& y) : v{x, y} {} // constructor from Vec2 or vec4 - Basic2DVector(MathVector const& iv) : v(iv){} - template - Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} - template - Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} - - MathVector const & mathVector() const { return v;} - MathVector & mathVector() { return v;} + Basic2DVector(MathVector const& iv) : v(iv) {} + template + Basic2DVector(Vec2 const& iv) : v{iv[0], iv[1]} {} + template + Basic2DVector(Vec4 const& iv) : v{iv[0], iv[1]} {} - T operator[](int i) const { return v[i];} - T & operator[](int i) { return v[i];} + MathVector const& mathVector() const { return v; } + MathVector& mathVector() { return v; } + T operator[](int i) const { return v[i]; } + T& operator[](int i) { return v[i]; } /// Cartesian x coordinate - T x() const { return v[0];} + T x() const { return v[0]; } /// Cartesian y coordinate - T y() const { return v[1];} + T y() const { return v[1]; } /// The vector magnitude squared. Equivalent to vec.dot(vec) - T mag2() const { return ::dot(v,v);} + T mag2() const { return ::dot(v, v); } /// The vector magnitude. Equivalent to sqrt(vec.mag2()) - T mag() const { return std::sqrt( mag2());} + T mag() const { return std::sqrt(mag2()); } /// Radius, same as mag() - T r() const { return mag();} + T r() const { return mag(); } /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. * Same precision as the system atan2(x,y) function. * The return type is Geom::Phi, see it's documentation. - */ - T barePhi() const {return std::atan2(y(),x());} - Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} + */ + T barePhi() const { return std::atan2(y(), x()); } + Geom::Phi phi() const { return Geom::Phi(atan2(y(), x())); } /** Unit vector parallel to this. * If mag() is zero, a zero vector is returned. @@ -92,154 +87,140 @@ class Basic2DVector { /** Operator += with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator+= ( const Basic2DVector& p) { + template + Basic2DVector& operator+=(const Basic2DVector& p) { v = v + p.v; return *this; - } + } /** Operator -= with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator-= ( const Basic2DVector& p) { + template + Basic2DVector& operator-=(const Basic2DVector& p) { v = v - p.v; return *this; - } + } /// Unary minus, returns a vector with components (-x(),-y(),-z()) - Basic2DVector operator-() const { return Basic2DVector(-v);} + Basic2DVector operator-() const { return Basic2DVector(-v); } /// Scaling by a scalar value (multiplication) - Basic2DVector& operator*= ( T t) { - v = v*t; + Basic2DVector& operator*=(T t) { + v = v * t; return *this; - } + } /// Scaling by a scalar value (division) - Basic2DVector& operator/= ( T t) { - t = T(1)/t; - v = v*t; + Basic2DVector& operator/=(T t) { + t = T(1) / t; + v = v * t; return *this; - } + } /// Scalar product, or "dot" product, with a vector of same type. - T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} + T dot(const Basic2DVector& lh) const { return ::dot(v, lh.v); } /** Scalar (or dot) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .dot(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type dot(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).dot( + Basic2DVector::Type>(lh)); } /// Vector product, or "cross" product, with a vector of same type. - T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} + T cross(const Basic2DVector& lh) const { return ::cross2(v, lh.v); } /** Vector (or cross) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .cross(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type cross(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).cross( + Basic2DVector::Type>(lh)); } - public: - Vec2 v; - }; - namespace geometryDetails { - std::ostream & print2D(std::ostream& s, double x, double y); + std::ostream& print2D(std::ostream& s, double x, double y); } /// simple text output to standard streams template -inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { - return geometryDetails::print2D(s, v.x(),v.y()); +inline std::ostream& operator<<(std::ostream& s, const Basic2DVector& v) { + return geometryDetails::print2D(s, v.x(), v.y()); } - /// vector sum and subtraction of vectors of possibly different precision template -inline Basic2DVector -operator+( const Basic2DVector& a, const Basic2DVector& b) { - return a.v+b.v; +inline Basic2DVector operator+(const Basic2DVector& a, const Basic2DVector& b) { + return a.v + b.v; } template -inline Basic2DVector -operator-( const Basic2DVector& a, const Basic2DVector& b) { - return a.v-b.v; +inline Basic2DVector operator-(const Basic2DVector& a, const Basic2DVector& b) { + return a.v - b.v; } template -inline Basic2DVector::Type> -operator+( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; +inline Basic2DVector::Type> operator+(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; return RT(a) + RT(b); } template -inline Basic2DVector::Type> -operator-( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a)-RT(b); +inline Basic2DVector::Type> operator-(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a) - RT(b); } - - - // scalar product of vectors of same precision template -inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { +inline T operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } /// scalar product of vectors of different precision template -inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, - const Basic2DVector& v2) { +inline typename PreciseFloatType::Type operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } - /** Multiplication by scalar, does not change the precision of the vector. * The return type is the same as the type of the vector argument. */ template -inline Basic2DVector operator*( const Basic2DVector& v, T t) { - return v.v*t; +inline Basic2DVector operator*(const Basic2DVector& v, T t) { + return v.v * t; } /// Same as operator*( Vector, Scalar) template inline Basic2DVector operator*(T t, const Basic2DVector& v) { - return v.v*t; + return v.v * t; } - - template -inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator*(const Basic2DVector& v, const Scalar& s) { T t = static_cast(s); - return v*t; + return v * t; } /// Same as operator*( Vector, Scalar) template -inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { +inline Basic2DVector operator*(const Scalar& s, const Basic2DVector& v) { T t = static_cast(s); - return v*t; + return v * t; } /** Division by scalar, does not change the precision of the vector. @@ -247,18 +228,17 @@ inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { */ template inline Basic2DVector operator/(const Basic2DVector& v, T t) { - return v.v/t; + return v.v / t; } template -inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator/(const Basic2DVector& v, const Scalar& s) { // T t = static_cast(Scalar(1)/s); return v*t; - T t = static_cast(s); - return v/t; + T t = static_cast(s); + return v / t; } typedef Basic2DVector Basic2DVectorF; typedef Basic2DVector Basic2DVectorD; - -#endif // GeometryVector_Basic2DVector_h +#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h index 9fe33e8c3d1fd..78850716bba21 100644 --- a/DataFormats/Math/interface/private/AVXVec.h +++ b/DataFormats/Math/interface/private/AVXVec.h @@ -5,183 +5,157 @@ // only as part of SSEVec namespace mathSSE { - template<> + template <> union Vec4 { - typedef __m256d nativeType; + typedef __m256d nativeType; __m256d vec; - double __attribute__ ((aligned(32))) arr[4]; + double __attribute__((aligned(32))) arr[4]; OldVec o; - + Vec4(__m256d ivec) : vec(ivec) {} - Vec4(OldVec const & ivec) : o(ivec) {} - - Vec4() { - vec = _mm256_setzero_pd(); - } + Vec4(OldVec const& ivec) : o(ivec) {} + Vec4() { vec = _mm256_setzero_pd(); } - inline Vec4(Vec4 ivec) { - vec = _mm256_cvtps_pd(ivec.vec); - } + inline Vec4(Vec4 ivec) { vec = _mm256_cvtps_pd(ivec.vec); } - explicit Vec4(double f1) { - set1(f1); - } + explicit Vec4(double f1) { set1(f1); } - Vec4(double f1, double f2, double f3, double f4=0) { - arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; + Vec4(double f1, double f2, double f3, double f4 = 0) { + arr[0] = f1; + arr[1] = f2; + arr[2] = f3; + arr[3] = f4; } - - Vec4( Vec2 ivec0, Vec2 ivec1) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - vec = _mm256_insertf128_pd(vec,ivec1.vec,1); - - } - - Vec4( Vec2 ivec0, double f3, double f4=0) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - arr[2] = f3; arr[3] = f4; + Vec4(Vec2 ivec0, Vec2 ivec1) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + vec = _mm256_insertf128_pd(vec, ivec1.vec, 1); } - Vec4( Vec2 ivec0) { - vec = _mm256_setzero_pd(); - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + Vec4(Vec2 ivec0, double f3, double f4 = 0) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + arr[2] = f3; + arr[3] = f4; } + Vec4(Vec2 ivec0) { + vec = _mm256_setzero_pd(); + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + } // for masking void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { - Mask4 mask(m1,m2,m3,m4); vec=mask.vec; + Mask4 mask(m1, m2, m3, m4); + vec = mask.vec; } - void set(double f1, double f2, double f3, double f4=0) { - vec = _mm256_set_pd(f4, f3, f2, f1); - } + void set(double f1, double f2, double f3, double f4 = 0) { vec = _mm256_set_pd(f4, f3, f2, f1); } - void set1(double f1) { - vec = _mm256_set1_pd(f1); - } + void set1(double f1) { vec = _mm256_set1_pd(f1); } - template + template Vec4 get1() const { - return _mm256_set1_pd(arr[N]); //FIXME + return _mm256_set1_pd(arr[N]); //FIXME } /* Vec4 get1(unsigned int n) const { return _mm256_set1_pd(arr[n]); //FIXME } */ - double & operator[](unsigned int n) { - return arr[n]; - } + double& operator[](unsigned int n) { return arr[n]; } - double operator[](unsigned int n) const { - return arr[n]; - } - - Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} - Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} + double operator[](unsigned int n) const { return arr[n]; } + Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec)); } + Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec, vec, 1))); } }; - - inline Vec4::Vec4(Vec4 ivec) { - vec = _mm256_cvtpd_ps(ivec.vec); - } -} // namespace mathSSE - + inline Vec4::Vec4(Vec4 ivec) { vec = _mm256_cvtpd_ps(ivec.vec); } +} // namespace mathSSE inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; + return _mm256_movemask_pd(_mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS)) == 0xf; } - + inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS); } inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_GT_OS); } inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_hadd_pd(a.vec,b.vec); + return _mm256_hadd_pd(a.vec, b.vec); } - - inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { - const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); - return _mm256_xor_pd(a.vec,neg); + const __m256d neg = _mm256_set_pd(-0.0, -0.0, -0.0, -0.0); + return _mm256_xor_pd(a.vec, neg); } inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_and_pd(a.vec,b.vec); + return _mm256_and_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_or_pd(a.vec,b.vec); + return _mm256_or_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_xor_pd(a.vec,b.vec); + return _mm256_xor_pd(a.vec, b.vec); } inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_andnot_pd(a.vec,b.vec); + return _mm256_andnot_pd(a.vec, b.vec); } - inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_add_pd(a.vec,b.vec); + return _mm256_add_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_sub_pd(a.vec,b.vec); + return _mm256_sub_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_mul_pd(a.vec,b.vec); + return _mm256_mul_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_div_pd(a.vec,b.vec); + return _mm256_div_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +inline mathSSE::Vec4 operator*(mathSSE::Vec4 b, double a) { + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { - return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); +inline mathSSE::Vec4 operator/(mathSSE::Vec4 b, double a) { + return _mm256_div_pd(b.vec, _mm256_set1_pd(a)); } - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_dot_pd; + using mathSSE::_mm256_dot_pd; mathSSE::Vec4 ret; - ret.vec = _mm256_dot_pd(a.vec,b.vec); + ret.vec = _mm256_dot_pd(a.vec, b.vec); return ret.arr[0]; } -inline mathSSE::Vec4 -__attribute__((always_inline)) __attribute__ ((pure)) +inline mathSSE::Vec4 __attribute__((always_inline)) __attribute__((pure)) cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_cross_pd; - return _mm256_cross_pd(a.vec,b.vec); + using mathSSE::_mm256_cross_pd; + return _mm256_cross_pd(a.vec, b.vec); } -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { - mathSSE::Vec4 mul = a*b; - mul = hadd(mul,mul); + mathSSE::Vec4 mul = a * b; + mul = hadd(mul, mul); return mul.arr[0]; } - #endif From 70a8a1ea6a438eec3b5acd9a9034fe9dc8f7f497 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 18:23:22 +0200 Subject: [PATCH 274/923] esConsumes migration SelectedElectronFEDListProducer --- .../SelectedElectronFEDListProducer.cc | 46 ++++++------------- .../plugins/SelectedElectronFEDListProducer.h | 36 +++++++++++---- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc index c020bc7a498c9..1347e84b6423e 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc @@ -8,21 +8,13 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -//#include "DataFormats/Common/interface/Handle.h" - #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "FWCore/Utilities/interface/InputTag.h" // raw data #include "DataFormats/FEDRawData/interface/FEDRawData.h" -//#include "DataFormats/FEDRawData/interface/FEDNumbering.h" // Geometry -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -// strip geometry -#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" // egamma objects #include "DataFormats/EgammaReco/interface/SuperCluster.h" @@ -37,7 +29,6 @@ // Strip and pixel #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" // detector id #include "DataFormats/HcalDetId/interface/HcalDetId.h" @@ -47,30 +38,27 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" // Geometry #include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // strip geometry #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" -#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" // Message logger #include "FWCore/MessageLogger/interface/MessageLogger.h" // Strip and pixel #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h" -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" -// Hcal objects -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" - using namespace std; /// Producer constructor template -SelectedElectronFEDListProducer::SelectedElectronFEDListProducer(const edm::ParameterSet& iConfig) { +SelectedElectronFEDListProducer::SelectedElectronFEDListProducer(const edm::ParameterSet& iConfig) + : hcalDbToken_(esConsumes()), + ecalMappingToken_(esConsumes()), + caloGeometryToken_(esConsumes()), + siPixelFedCablingMapToken_(esConsumes()), + trackerGeometryToken_(esConsumes()), + siStripRegionCablingToken_(esConsumes()) +{ // input electron collection Tag if (iConfig.existsAs>("electronTags")) { electronTags_ = iConfig.getParameter>("electronTags"); @@ -309,31 +297,26 @@ void SelectedElectronFEDListProducer::beginJob() { template void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // get the hcal electronics map - edm::ESHandle pSetup; - iSetup.get().get(pSetup); + const auto pSetup = iSetup.getHandle(hcalDbToken_); HcalReadoutMap_ = pSetup->getHcalMapping(); // get the ecal electronics map - edm::ESHandle ecalmapping; - iSetup.get().get(ecalmapping); + const auto ecalmapping = iSetup.getHandle(ecalMappingToken_); EcalMapping_ = ecalmapping.product(); // get the calo geometry - edm::ESHandle caloGeometry; - iSetup.get().get(caloGeometry); + const auto caloGeometry = iSetup.getHandle(caloGeometryToken_); GeometryCalo_ = caloGeometry.product(); //ES geometry GeometryES_ = caloGeometry->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); // pixel tracker cabling map - edm::ESTransientHandle pixelCablingMap; - iSetup.get().get(pixelCablingMap); + const auto pixelCablingMap = iSetup.getTransientHandle(siPixelFedCablingMapToken_); PixelCabling_.reset(); PixelCabling_ = pixelCablingMap->cablingTree(); - edm::ESHandle trackerGeometry; - iSetup.get().get(trackerGeometry); + const auto trackerGeometry = iSetup.getHandle(trackerGeometryToken_); if (pixelModuleVector_.empty()) { // build the tracker pixel module map @@ -357,8 +340,7 @@ void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, c std::sort(pixelModuleVector_.begin(), pixelModuleVector_.end()); } - edm::ESHandle SiStripCablingHandle; - iSetup.get().get(SiStripCablingHandle); + const auto SiStripCablingHandle = iSetup.getHandle(siStripRegionCablingToken_); StripRegionCabling_ = SiStripCablingHandle.product(); SiStripRegionCabling::Cabling SiStripCabling; diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h index 006b01cf69721..16157c5d0e6ec 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h @@ -1,17 +1,33 @@ -#ifndef SelectedElectronFEDListProducer_h -#define SelectedElectronFEDListProducer_h +#ifndef Calibration_EcalAlCaRecoProducers_SelectedElectronFEDListProducer_h +#define Calibration_EcalAlCaRecoProducers_SelectedElectronFEDListProducer_h #include "DataFormats/BeamSpot/interface/BeamSpot.h" // egamma objects #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +// Geometry +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +// strip geometry +#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" +#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" +// Strip and pixel +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +// Hcal objects +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" + // Math #include "DataFormats/Math/interface/normalizedPhi.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -// #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" // Message logger #include "FWCore/ServiceRegistry/interface/Service.h" @@ -19,14 +35,10 @@ class InputTag; class FEDRawDataCollection; -class SiPixelFedCablingMap; class SiPixelFedCablingTree; class SiStripFedCabling; -class SiStripRegionCabling; -class CaloGeometry; class CaloSubdetectorGeometry; -class EcalElectronicsMapping; class HcalElectronicsMap; // Hcal rec hit: this is a Fwd file defining typedefs @@ -131,6 +143,14 @@ class SelectedElectronFEDListProducer : public edm::stream::EDProducer<> { std::vector > recoEcalCandidateToken_; std::vector > electronToken_; + // Token for the input collection + const edm::ESGetToken hcalDbToken_; + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken caloGeometryToken_; + const edm::ESGetToken siPixelFedCablingMapToken_; + const edm::ESGetToken trackerGeometryToken_; + const edm::ESGetToken siStripRegionCablingToken_; + // used inside the producer math::XYZVector beamSpotPosition_; From 3d1dde029331ea669891f627f3fe6e490edc19c0 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 18:58:07 +0200 Subject: [PATCH 275/923] esConsumes migration ECALpedestalPCLHarvester. --- .../interface/ECALpedestalPCLHarvester.h | 34 +++++++++------- .../src/ECALpedestalPCLHarvester.cc | 39 +++++++++---------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h index 388ccf14639be..6966160010b7d 100644 --- a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h +++ b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h @@ -29,6 +29,8 @@ #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" class ECALpedestalPCLHarvester : public DQMEDHarvester { public: @@ -41,24 +43,30 @@ class ECALpedestalPCLHarvester : public DQMEDHarvester { void dqmPlots(const EcalPedestals& newpeds, DQMStore::IBooker& ibooker); - const EcalPedestals* currentPedestals_; - const EcalPedestals* g6g1Pedestals_; - const EcalChannelStatus* channelStatus_; + bool checkVariation(const EcalPedestalsMap& oldPedestals, const EcalPedestalsMap& newPedestals); bool checkStatusCode(const DetId& id); bool isGood(const DetId& id); - bool checkVariation(const EcalPedestalsMap& oldPedestals, const EcalPedestalsMap& newPedestals); std::vector chStatusToExclude_; - int minEntries_; + const int minEntries_; int entriesEB_[EBDetId::kSizeForDenseIndexing]; int entriesEE_[EEDetId::kSizeForDenseIndexing]; - bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals - double nSigma_; // threshold in sigmas to define a pedestal as changed - double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file - std::string dqmDir_; // DQM directory where histograms are stored - std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied - float threshDiffEB_; // if the new pedestals differs more than this from old, keep old - float threshDiffEE_; // same as above for EE. Stray channel protection - float threshChannelsAnalyzed_; // threshold for minimum percentage of channels analized to produce DQM plots + const bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals + const double nSigma_; // threshold in sigmas to define a pedestal as changed + const double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file + const std::string dqmDir_; // DQM directory where histograms are stored + const std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied + const float threshDiffEB_; // if the new pedestals differs more than this from old, keep old + const float threshDiffEE_; // same as above for EE. Stray channel protection + const float threshChannelsAnalyzed_; // threshold for minimum percentage of channels analized to produce DQM plots + + // ES token + const edm::ESGetToken channelsStatusToken_; + const edm::ESGetToken pedestalsToken_; + const edm::ESGetToken g6g1PedestalsToken_; + + const EcalPedestals* currentPedestals_; + const EcalPedestals* g6g1Pedestals_; + const EcalChannelStatus* channelStatus_; }; diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc index 1b2d111e3006f..61bb5ea785c29 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc @@ -5,29 +5,29 @@ // user include files #include "Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CommonTools/Utils/interface/StringToEnumValue.h" -#include #include ECALpedestalPCLHarvester::ECALpedestalPCLHarvester(const edm::ParameterSet& ps) - : currentPedestals_(nullptr), channelStatus_(nullptr) { + : minEntries_(ps.getParameter("MinEntries")), + checkAnomalies_(ps.getParameter("checkAnomalies")), + nSigma_(ps.getParameter("nSigma")), + thresholdAnomalies_(ps.getParameter("thresholdAnomalies")), + dqmDir_(ps.getParameter("dqmDir")), + labelG6G1_(ps.getParameter("labelG6G1")), + threshDiffEB_(ps.getParameter("threshDiffEB")), + threshDiffEE_(ps.getParameter("threshDiffEE")), + threshChannelsAnalyzed_(ps.getParameter("threshChannelsAnalyzed")), + channelsStatusToken_(esConsumes()), + pedestalsToken_(esConsumes()), + g6g1PedestalsToken_(esConsumes(edm::ESInputTag("", labelG6G1_))), + currentPedestals_(nullptr), + g6g1Pedestals_(nullptr), + channelStatus_(nullptr) { chStatusToExclude_ = StringToEnumValue( ps.getParameter >("ChannelStatusToExclude")); - minEntries_ = ps.getParameter("MinEntries"); - checkAnomalies_ = ps.getParameter("checkAnomalies"); - nSigma_ = ps.getParameter("nSigma"); - thresholdAnomalies_ = ps.getParameter("thresholdAnomalies"); - dqmDir_ = ps.getParameter("dqmDir"); - labelG6G1_ = ps.getParameter("labelG6G1"); - threshDiffEB_ = ps.getParameter("threshDiffEB"); - threshDiffEE_ = ps.getParameter("threshDiffEE"); - threshChannelsAnalyzed_ = ps.getParameter("threshChannelsAnalyzed"); } void ECALpedestalPCLHarvester::dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) { @@ -155,16 +155,13 @@ void ECALpedestalPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& } void ECALpedestalPCLHarvester::endRun(edm::Run const& run, edm::EventSetup const& isetup) { - edm::ESHandle chStatus; - isetup.get().get(chStatus); + const auto chStatus = isetup.getHandle(channelsStatusToken_); channelStatus_ = chStatus.product(); - edm::ESHandle peds; - isetup.get().get(peds); + const auto peds = isetup.getHandle(pedestalsToken_); currentPedestals_ = peds.product(); - edm::ESHandle g6g1peds; - isetup.get().get(labelG6G1_, g6g1peds); + const auto g6g1peds = isetup.getHandle(g6g1PedestalsToken_); g6g1Pedestals_ = g6g1peds.product(); } From 688dfcd2b47f6cf57708172848f707bd87860e3d Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 19:13:05 +0200 Subject: [PATCH 276/923] esConsumes migration ECALpedestalPCLworker. --- .../EcalCalibAlgos/interface/ECALpedestalPCLworker.h | 3 +++ .../EcalCalibAlgos/src/ECALpedestalPCLworker.cc | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h index 8c5014c873740..2dc10a29a8577 100644 --- a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h +++ b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h @@ -23,6 +23,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/TCDS/interface/BSTRecord.h" #include "DataFormats/TCDS/interface/TCDSRecord.h" @@ -43,6 +45,7 @@ class ECALpedestalPCLworker : public DQMEDAnalyzer { edm::EDGetTokenT digiTokenEB_; edm::EDGetTokenT digiTokenEE_; edm::EDGetTokenT tcdsToken_; + const edm::ESGetToken pedestalToken_; std::vector meEB_; std::vector meEE_; diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc index 90296dc37b65c..5c72def53a390 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc @@ -2,15 +2,10 @@ #include "Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include #include -ECALpedestalPCLworker::ECALpedestalPCLworker(const edm::ParameterSet& iConfig) - +ECALpedestalPCLworker::ECALpedestalPCLworker(const edm::ParameterSet& iConfig) : pedestalToken_(esConsumes()) { edm::InputTag digiTagEB = iConfig.getParameter("BarrelDigis"); edm::InputTag digiTagEE = iConfig.getParameter("EndcapDigis"); @@ -106,8 +101,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run ibooker.cd(); ibooker.setCurrentFolder(dqmDir_); - edm::ESHandle peds; - es.get().get(peds); + const auto peds = es.getHandle(pedestalToken_); for (uint32_t i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) { ibooker.setCurrentFolder(dqmDir_ + "/EB/" + std::to_string(int(i / 100))); From 0e84d06df2dd068b3dac2d63f3b2f9a0a4245623 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 10:49:44 +0200 Subject: [PATCH 277/923] esConsumes migration of EcalEleCalibLooper. --- .../EcalCalibAlgos/interface/EcalEleCalibLooper.h | 5 +++++ Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc | 10 +++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h index 4508b89ebd4a0..c2f1a428b6d53 100644 --- a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h +++ b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h @@ -25,6 +25,8 @@ #include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "CLHEP/Matrix/GenMatrix.h" #include "CLHEP/Matrix/Matrix.h" @@ -59,6 +61,9 @@ class EcalEleCalibLooper : public edm::EDLooper { int etaShifter(const int) const; private: + //! ES token + const edm::ESGetToken m_geometryToken; + //! EcalBarrel Input Collection name edm::InputTag m_barrelAlCa; //! EcalEndcap Input Collection name diff --git a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc index 137c8cd0c5719..37872355a350b 100644 --- a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc +++ b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc @@ -1,6 +1,5 @@ #include #include -#include #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -9,9 +8,7 @@ #include "Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/EgammaReco/interface/ClusterShape.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/calibXMLwriter.h" @@ -31,7 +28,8 @@ //!LP ctor EcalEleCalibLooper::EcalEleCalibLooper(const edm::ParameterSet& iConfig) - : m_barrelAlCa(iConfig.getParameter("alcaBarrelHitCollection")), + : m_geometryToken(esConsumes()), + m_barrelAlCa(iConfig.getParameter("alcaBarrelHitCollection")), m_endcapAlCa(iConfig.getParameter("alcaEndcapHitCollection")), m_recoWindowSidex(iConfig.getParameter("recoWindowSidex")), m_recoWindowSidey(iConfig.getParameter("recoWindowSidey")), @@ -168,9 +166,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c // with the beginJob without arguments migration if (isfirstcall_) { - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; + const auto& geometry = iSetup.getData(m_geometryToken); m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); for (std::vector::const_iterator barrelIt = m_barrelCells.begin(); barrelIt != m_barrelCells.end(); From 8afc1fb42ded64a8a1f9451045f5bc2d5485d275 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 11:49:38 +0200 Subject: [PATCH 278/923] Modernisation of ElectronCalibrationUniv. --- .../interface/ElectronCalibrationUniv.h | 71 +++++++------- .../src/ElectronCalibrationUniv.cc | 95 +++++++++---------- 2 files changed, 81 insertions(+), 85 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h index d5d2d4d9d215c..a8611b090be06 100644 --- a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h +++ b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h @@ -24,7 +24,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/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -40,6 +40,9 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaCandidates/interface/Electron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "Calibration/Tools/interface/HouseholderDecomposition.h" #include "Calibration/Tools/interface/MinL3Algorithm.h" #include "Calibration/Tools/interface/CalibrationCluster.h" @@ -53,7 +56,8 @@ // class decleration // -class ElectronCalibrationUniv : public edm::EDAnalyzer { +class ElectronCalibrationUniv : public edm::one::EDAnalyzer { + public: explicit ElectronCalibrationUniv(const edm::ParameterSet &); ~ElectronCalibrationUniv() override; @@ -61,6 +65,7 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { void analyze(const edm::Event &, const edm::EventSetup &) override; void beginJob() override; void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &, edm::EventSetup const &) override; void endJob() override; private: @@ -69,35 +74,32 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { // ----------member data --------------------------- - std::string rootfile_; - edm::InputTag EBrecHitLabel_; - edm::InputTag EErecHitLabel_; - edm::InputTag electronLabel_; - edm::InputTag trackLabel_; - std::string calibAlgo_; - std::string miscalibfile_; - std::string miscalibfileEndCap_; - int keventweight_; - double ElePt_; - int maxeta_; - int mineta_; - int maxphi_; - int minphi_; - double cut1_; - double cut2_; - double cut3_; - double cutEPCalo1_; - double cutEPCalo2_; - double cutEPin1_; - double cutEPin2_; - double cutCalo1_; - double cutCalo2_; - double cutESeed_; - int ClusterSize_; - int elecclass_; - int theMaxLoops; - - bool FirstIteration; + const edm::InputTag ebRecHitLabel_; + const edm::InputTag eeRecHitLabel_; + const edm::InputTag electronLabel_; + const std::string rootfile_; + const std::string calibAlgo_; + const std::string miscalibfile_; + const std::string miscalibfileEndCap_; + const int keventweight_; + const double elePt_; + const int maxeta_; + const int mineta_; + const int maxphi_; + const int minphi_; + const double cut1_; + const double cut2_; + const double cut3_; + const int numevent_; + const double cutEPCalo1_; + const double cutEPCalo2_; + const double cutEPin1_; + const double cutEPin2_; + const double cutCalo1_; + const double cutCalo2_; + const double cutESeed_; + const int clusterSize_; + const int elecclass_; int read_events; @@ -116,7 +118,11 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { MinL3Algorithm *MyL3Algo1; MinL3AlgoUniv *UnivL3; - edm::ESHandle theCaloTopology; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT gsfElectronToken_; + const edm::ESGetToken topologyToken_; + edm::ESHandle theCaloTopology_; std::vector solution; std::vector solutionNoCuts; @@ -126,7 +132,6 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { std::map Univsolution; // int eventcrystal[25][25]; - int numevent_; TFile *f; diff --git a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc index fe6aefb4eba96..b0d68f65abc27 100644 --- a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc +++ b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc @@ -1,25 +1,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/DetId/interface/DetId.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/calibXMLwriter.h" #include "Calibration/Tools/interface/CalibrationCluster.h" #include "Calibration/Tools/interface/HouseholderDecomposition.h" #include "Calibration/Tools/interface/MinL3Algorithm.h" #include "Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/TrackExtraFwd.h" #include "FWCore/Utilities/interface/isFinite.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" #include "TF1.h" #include "TRandom.h" @@ -28,39 +17,37 @@ #include #include -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" - -ElectronCalibrationUniv::ElectronCalibrationUniv(const edm::ParameterSet& iConfig) { - rootfile_ = iConfig.getParameter("rootfile"); - EBrecHitLabel_ = iConfig.getParameter("ebRecHitsLabel"); - EErecHitLabel_ = iConfig.getParameter("eeRecHitsLabel"); - electronLabel_ = iConfig.getParameter("electronLabel"); - trackLabel_ = iConfig.getParameter("trackLabel"); - calibAlgo_ = iConfig.getParameter("CALIBRATION_ALGO"); - keventweight_ = iConfig.getParameter("keventweight"); - ClusterSize_ = iConfig.getParameter("Clustersize"); - ElePt_ = iConfig.getParameter("ElePt"); - maxeta_ = iConfig.getParameter("maxeta"); - mineta_ = iConfig.getParameter("mineta"); - maxphi_ = iConfig.getParameter("maxphi"); - minphi_ = iConfig.getParameter("minphi"); - cut1_ = iConfig.getParameter("cut1"); - cut2_ = iConfig.getParameter("cut2"); - cut3_ = iConfig.getParameter("cut3"); - elecclass_ = iConfig.getParameter("elecclass"); - numevent_ = iConfig.getParameter("numevent"); - miscalibfile_ = iConfig.getParameter("miscalibfile"); - miscalibfileEndCap_ = iConfig.getParameter("miscalibfileEndCap"); - - cutEPCalo1_ = iConfig.getParameter("cutEPCaloMin"); - cutEPCalo2_ = iConfig.getParameter("cutEPCaloMax"); - cutEPin1_ = iConfig.getParameter("cutEPinMin"); - cutEPin2_ = iConfig.getParameter("cutEPinMax"); - cutCalo1_ = iConfig.getParameter("cutCaloMin"); - cutCalo2_ = iConfig.getParameter("cutCaloMax"); - - cutESeed_ = iConfig.getParameter("cutESeed"); +ElectronCalibrationUniv::ElectronCalibrationUniv(const edm::ParameterSet& iConfig) + : ebRecHitLabel_(iConfig.getParameter("ebRecHitsLabel")), + eeRecHitLabel_(iConfig.getParameter("eeRecHitsLabel")), + electronLabel_(iConfig.getParameter("electronLabel")), + rootfile_(iConfig.getParameter("rootfile")), + calibAlgo_(iConfig.getParameter("CALIBRATION_ALGO")), + miscalibfile_(iConfig.getParameter("miscalibfile")), + miscalibfileEndCap_(iConfig.getParameter("miscalibfileEndCap")), + keventweight_(iConfig.getParameter("keventweight")), + elePt_(iConfig.getParameter("ElePt")), + maxeta_(iConfig.getParameter("maxeta")), + mineta_(iConfig.getParameter("mineta")), + maxphi_(iConfig.getParameter("maxphi")), + minphi_(iConfig.getParameter("minphi")), + cut1_(iConfig.getParameter("cut1")), + cut2_(iConfig.getParameter("cut2")), + cut3_(iConfig.getParameter("cut3")), + numevent_(iConfig.getParameter("numevent")), + cutEPCalo1_(iConfig.getParameter("cutEPCaloMin")), + cutEPCalo2_(iConfig.getParameter("cutEPCaloMax")), + cutEPin1_(iConfig.getParameter("cutEPinMin")), + cutEPin2_(iConfig.getParameter("cutEPinMax")), + cutCalo1_(iConfig.getParameter("cutCaloMin")), + cutCalo2_(iConfig.getParameter("cutCaloMax")), + cutESeed_(iConfig.getParameter("cutESeed")), + clusterSize_(iConfig.getParameter("Clustersize")), + elecclass_(iConfig.getParameter("elecclass")), + ebRecHitToken_(consumes(ebRecHitLabel_)), + eeRecHitToken_(consumes(eeRecHitLabel_)), + gsfElectronToken_(consumes(electronLabel_)), + topologyToken_(esConsumes()) { } ElectronCalibrationUniv::~ElectronCalibrationUniv() {} @@ -223,7 +210,7 @@ void ElectronCalibrationUniv::beginJob() { GeneralMapEndCapPlusBeforePt = new TH2F("GeneralMapEndCapPlusBeforePt", "Map without any cuts", 100, 0, 100, 100, 0, 100); - calibClusterSize = ClusterSize_; + calibClusterSize = clusterSize_; etaMin = int(mineta_); etaMax = int(maxeta_); phiMin = int(minphi_); @@ -250,9 +237,13 @@ void ElectronCalibrationUniv::beginRun(edm::Run const&, edm::EventSetup const& i //======================================================================== //To Deal with Geometry: - iSetup.get().get(theCaloTopology); + theCaloTopology_ = iSetup.getHandle(topologyToken_); } +//======================================================================== +void ElectronCalibrationUniv::endRun(edm::Run const&, edm::EventSetup const& iSetup) {} +//======================================================================== + //======================================================================== void ElectronCalibrationUniv::endJob() { @@ -622,7 +613,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get EBRecHits edm::Handle EBphits; - iEvent.getByLabel(EBrecHitLabel_, EBphits); + iEvent.getByToken(ebRecHitToken_, EBphits); if (!EBphits.isValid()) { std::cerr << "Error! can't get the product EBRecHitCollection: " << std::endl; } @@ -631,7 +622,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get EERecHits edm::Handle EEphits; - iEvent.getByLabel(EErecHitLabel_, EEphits); + iEvent.getByToken(eeRecHitToken_, EEphits); if (!EEphits.isValid()) { std::cerr << "Error! can't get the product EERecHitCollection: " << std::endl; } @@ -639,7 +630,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get pixelElectrons edm::Handle pElectrons; - iEvent.getByLabel(electronLabel_, pElectrons); + iEvent.getByToken(gsfElectronToken_, pElectrons); if (!pElectrons.isValid()) { std::cerr << "Error! can't get the product ElectronCollection: " << std::endl; } @@ -737,9 +728,9 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event float energy3x3 = 0.; float energy5x5 = 0.; //Should be moved to cfg file! - int ClusterSize = ClusterSize_; + int ClusterSize = clusterSize_; - const CaloSubdetectorTopology* topology = theCaloTopology->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); + const CaloSubdetectorTopology* topology = theCaloTopology_->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); std::vector NxNaroundMax = topology->getWindow(maxHitId, ClusterSize, ClusterSize); //ToCompute 3x3 std::vector S9aroundMax = topology->getWindow(maxHitId, 3, 3); @@ -822,7 +813,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event } EventsAfterCuts->Fill(11); - if (highestElePt < ElePt_) + if (highestElePt < elePt_) return; if (maxHitId.subdetId() == EcalBarrel) { From 43172b040f813dd1fcdcc5269fbe5d3d0ee4a5be Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 12:12:05 +0200 Subject: [PATCH 279/923] Modernise InvRingCalib. --- .../EcalCalibAlgos/interface/InvRingCalib.h | 53 +++++++++++-------- .../EcalCalibAlgos/src/InvRingCalib.cc | 33 +++++------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/InvRingCalib.h b/Calibration/EcalCalibAlgos/interface/InvRingCalib.h index 822ca0c490944..8e0b4623b9980 100644 --- a/Calibration/EcalCalibAlgos/interface/InvRingCalib.h +++ b/Calibration/EcalCalibAlgos/interface/InvRingCalib.h @@ -13,13 +13,17 @@ #include "FWCore/Framework/interface/Event.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include #include -//#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" #include "Calibration/EcalCalibAlgos/interface/VFillMap.h" @@ -60,37 +64,37 @@ class InvRingCalib : public edm::EDLooper { private: //! EcalBarrel Input Collection name - edm::InputTag m_barrelAlCa; + const edm::InputTag m_barrelAlCa; //! EcalEndcap Input Collection name - edm::InputTag m_endcapAlCa; + const edm::InputTag m_endcapAlCa; //! To take the electrons - edm::InputTag m_ElectronLabel; + const edm::InputTag m_ElectronLabel; //! reconstruction window size - int m_recoWindowSidex; - int m_recoWindowSidey; + const int m_recoWindowSidex; + const int m_recoWindowSidey; //! minimum energy per crystal cut - double m_minEnergyPerCrystal; + const double m_minEnergyPerCrystal; //! maximum energy per crystal cut - double m_maxEnergyPerCrystal; + const double m_maxEnergyPerCrystal; //! eta start of the zone of interest - int m_etaStart; + const int m_etaStart; //! eta end of the zone of interest - int m_etaEnd; + const int m_etaEnd; //! eta size of the regions - int m_etaWidth; + const int m_etaWidth; // std::map m_eta; //! maximum number of events per Ring - int m_maxSelectedNumPerRing; + const int m_maxSelectedNumPerRing; //! number of events already read per Ring std::map m_RingNumOfHits; //! single blocks calibrators std::vector m_IMACalibBlocks; //! minimum coefficient accepted (RAW) - double m_minCoeff; + const double m_minCoeff; //! maximum coefficient accepted (RAW) - double m_maxCoeff; + const double m_maxCoeff; //! to exclude the blocksolver - int m_usingBlockSolver; + const int m_usingBlockSolver; //!position of the cell, borders, coords etc... std::map m_cellPos; std::map m_cellPhi; @@ -101,8 +105,8 @@ class InvRingCalib : public edm::EDLooper { //! LP sets the number of loops to do unsigned int m_loops; //! LP define the EE region to calibrate - int m_startRing; - int m_endRing; + const int m_startRing; + const int m_endRing; //!association map between Raw detIds and Rings std::map m_xtalRing; //!association map between raw detIds and Region @@ -114,14 +118,21 @@ class InvRingCalib : public edm::EDLooper { std::vector m_barrelCells; std::vector m_endcapCells; //!coeffs filenames - std::string m_EBcoeffFile; - std::string m_EEcoeffFile; + const std::string m_EBcoeffFile; + const std::string m_EEcoeffFile; //!endcap zone to be calibrated - int m_EEZone; + const int m_EEZone; //!EB regions vs. eta index std::map m_Reg; std::string m_mapFillerType; bool isfirstcall_; + + //! ED token + const edm::EDGetTokenT m_ebRecHitToken; + const edm::EDGetTokenT m_eeRecHitToken; + const edm::EDGetTokenT m_gsfElectronToken; + //! ES token + const edm::ESGetToken m_geometryToken; }; #endif #endif diff --git a/Calibration/EcalCalibAlgos/src/InvRingCalib.cc b/Calibration/EcalCalibAlgos/src/InvRingCalib.cc index 0d0f78d9ae3bd..e476a262457af 100644 --- a/Calibration/EcalCalibAlgos/src/InvRingCalib.cc +++ b/Calibration/EcalCalibAlgos/src/InvRingCalib.cc @@ -1,8 +1,6 @@ #include #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Calibration/EcalCalibAlgos/interface/InvRingCalib.h" @@ -12,7 +10,6 @@ #include "Calibration/Tools/interface/calibXMLwriter.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalBarrel.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalEndcap.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" @@ -23,7 +20,6 @@ //Not to remain in the final version #include "TH2.h" #include "TFile.h" -#include //---------------------------------------------------------------- //ctor @@ -46,7 +42,11 @@ InvRingCalib::InvRingCalib(const edm::ParameterSet& iConfig) m_endRing(iConfig.getParameter("endRing")), m_EBcoeffFile(iConfig.getParameter("EBcoeffs")), m_EEcoeffFile(iConfig.getParameter("EEcoeffs")), - m_EEZone(iConfig.getParameter("EEZone")) { + m_EEZone(iConfig.getParameter("EEZone")), + m_ebRecHitToken(consumes(m_barrelAlCa)), + m_eeRecHitToken(consumes(m_endcapAlCa)), + m_gsfElectronToken(consumes(m_ElectronLabel)), + m_geometryToken(esConsumes()) { //controls if the parameters inputed are correct if ((m_etaEnd * m_etaStart) > 0) assert(!((m_etaEnd - m_etaStart) % m_etaWidth)); @@ -130,13 +130,11 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e if (isfirstcall_) { edm::LogInfo("IML") << "[InvRingCalib][beginOfJob]"; //gets the geometry from the event setup - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); - const CaloGeometry* geometry = geoHandle.product(); + const auto& geometry = iSetup.getData(m_geometryToken); edm::LogInfo("IML") << "[InvRingCalib] Event Setup read"; //fills a vector with all the cells - m_barrelCells = geometry->getValidDetIds(DetId::Ecal, EcalBarrel); - m_endcapCells = geometry->getValidDetIds(DetId::Ecal, EcalEndcap); + m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); //Defines the EB regions edm::LogInfo("IML") << "[InvRingCalib] Defining Barrel Regions"; EBRegionDef(); @@ -234,17 +232,18 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e double pTk = 0.; const EcalRecHitCollection* barrelHitsCollection = nullptr; edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(m_barrelAlCa, barrelRecHitsHandle); + iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle); barrelHitsCollection = barrelRecHitsHandle.product(); if (!barrelRecHitsHandle.isValid()) { edm::LogError("IML") << "[EcalEleCalibLooper] barrel rec hits not found"; return kContinue; } + //gets the endcap recHits const EcalRecHitCollection* endcapHitsCollection = nullptr; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(m_endcapAlCa, endcapRecHitsHandle); + iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle); endcapHitsCollection = endcapRecHitsHandle.product(); if (!endcapRecHitsHandle.isValid()) { @@ -254,7 +253,7 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e //gets the electrons edm::Handle pElectrons; - iEvent.getByLabel(m_ElectronLabel, pElectrons); + iEvent.getByToken(m_gsfElectronToken, pElectrons); if (!pElectrons.isValid()) { edm::LogError("IML") << "[EcalEleCalibLooper] electrons not found"; @@ -382,13 +381,9 @@ void InvRingCalib::endOfJob() { //!EE ring definition void InvRingCalib::EERingDef(const edm::EventSetup& iSetup) { - //Gets the Handle for the geometry from the eventSetup - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); //Gets the geometry of the endcap - const CaloGeometry* geometry = geoHandle.product(); - const CaloSubdetectorGeometry* endcapGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); - // const CaloSubdetectorGeometry *barrelGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto& geometry = iSetup.getData(m_geometryToken); + const CaloSubdetectorGeometry* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); //for every xtal gets the position Vector and the phi position // for (std::vector::const_iterator barrelIt = m_barrelCells.begin(); From 97d66d53346cad76167571923a3d6bddd3a4b9b8 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 12:24:39 +0200 Subject: [PATCH 280/923] Modernise EcalEleCalibLooper. --- .../interface/EcalEleCalibLooper.h | 60 ++++++++++--------- .../EcalCalibAlgos/src/EcalEleCalibLooper.cc | 16 ++--- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h index c2f1a428b6d53..856124fc12240 100644 --- a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h +++ b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h @@ -61,68 +61,65 @@ class EcalEleCalibLooper : public edm::EDLooper { int etaShifter(const int) const; private: - //! ES token - const edm::ESGetToken m_geometryToken; - //! EcalBarrel Input Collection name - edm::InputTag m_barrelAlCa; + const edm::InputTag m_barrelAlCa; //! EcalEndcap Input Collection name - edm::InputTag m_endcapAlCa; + const edm::InputTag m_endcapAlCa; + //! To take the electrons + edm::InputTag m_ElectronLabel; //! reconstruction window size - int m_recoWindowSidex; - int m_recoWindowSidey; + const int m_recoWindowSidex; + const int m_recoWindowSidey; //! eta size of the sub-matrix - int m_etaWidth; //PG sub matrix size and borders + const int m_etaWidth; //PG sub matrix size and borders //! eta size of the additive border to the sub-matrix // int m_etaBorder ; //FIXME //! phi size of the sub-matrix - int m_phiWidthEB; + const int m_phiWidthEB; //! phi size of the additive border to the sub-matrix // int m_phiBorderEB //FIXME; //! eta start of the region of interest - int m_etaStart; //PG ECAL region to be calibrated + const int m_etaStart; //PG ECAL region to be calibrated //! eta end of the region of interest - int m_etaEnd; + const int m_etaEnd; //! phi start of the region of interest - int m_phiStartEB; + const int m_phiStartEB; //! phi end of the region of interest - int m_phiEndEB; + const int m_phiEndEB; //!DS For the EE - int m_radStart; - int m_radEnd; - int m_radWidth; + const int m_radStart; + const int m_radEnd; + const int m_radWidth; //FIXME int m_radBorder ; - int m_phiStartEE; - int m_phiEndEE; - int m_phiWidthEE; + const int m_phiStartEE; + const int m_phiEndEE; + const int m_phiWidthEE; //! maximum number of events per crystal - int m_maxSelectedNumPerXtal; + const int m_maxSelectedNumPerXtal; //! single blocks calibrators std::vector m_EcalCalibBlocks; //! minimum energy per crystal cut - double m_minEnergyPerCrystal; + const double m_minEnergyPerCrystal; //! maximum energy per crystal cut - double m_maxEnergyPerCrystal; + const double m_maxEnergyPerCrystal; //! minimum coefficient accepted (RAW) - double m_minCoeff; + const double m_minCoeff; //! maximum coefficient accepted (RAW) - double m_maxCoeff; + const double m_maxCoeff; //! to exclude the blocksolver - int m_usingBlockSolver; + const int m_usingBlockSolver; //!the maps of recalib coeffs EcalIntercalibConstantMap m_barrelMap; EcalIntercalibConstantMap m_endcapMap; //! DS sets the number of loops to do - unsigned int m_loops; - //! To take the electrons - edm::InputTag m_ElectronLabel; + const unsigned int m_loops; //The map Filler VFillMap *m_MapFiller; @@ -141,6 +138,13 @@ class EcalEleCalibLooper : public edm::EDLooper { std::map m_xtalNumOfHits; bool isfirstcall_; + + //! ED token + const edm::EDGetTokenT m_ebRecHitToken; + const edm::EDGetTokenT m_eeRecHitToken; + const edm::EDGetTokenT m_gsfElectronToken; + //! ES token + const edm::ESGetToken m_geometryToken; }; #endif #endif diff --git a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc index 37872355a350b..f6b3c73d5b09b 100644 --- a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc +++ b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc @@ -10,7 +10,6 @@ #include "DataFormats/EgammaReco/interface/ClusterShape.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/calibXMLwriter.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" @@ -28,9 +27,9 @@ //!LP ctor EcalEleCalibLooper::EcalEleCalibLooper(const edm::ParameterSet& iConfig) - : m_geometryToken(esConsumes()), - m_barrelAlCa(iConfig.getParameter("alcaBarrelHitCollection")), + : m_barrelAlCa(iConfig.getParameter("alcaBarrelHitCollection")), m_endcapAlCa(iConfig.getParameter("alcaEndcapHitCollection")), + m_ElectronLabel(iConfig.getParameter("electronLabel")), m_recoWindowSidex(iConfig.getParameter("recoWindowSidex")), m_recoWindowSidey(iConfig.getParameter("recoWindowSidey")), m_etaWidth(iConfig.getParameter("etaWidth")), @@ -52,7 +51,10 @@ EcalEleCalibLooper::EcalEleCalibLooper(const edm::ParameterSet& iConfig) m_maxCoeff(iConfig.getParameter("maxCoeff")), m_usingBlockSolver(iConfig.getParameter("usingBlockSolver")), m_loops(iConfig.getParameter("loops")), - m_ElectronLabel(iConfig.getParameter("electronLabel")) { + m_ebRecHitToken(consumes(m_barrelAlCa)), + m_eeRecHitToken(consumes(m_endcapAlCa)), + m_gsfElectronToken(consumes(m_ElectronLabel)), + m_geometryToken(esConsumes()) { edm::LogInfo("IML") << "[EcalEleCalibLooper][ctor] asserts"; assert(!((m_etaEnd - m_etaStart) % m_etaWidth)); @@ -186,7 +188,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //take the collection of recHits in the barrel const EBRecHitCollection* barrelHitsCollection = nullptr; edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(m_barrelAlCa, barrelRecHitsHandle); + iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle); barrelHitsCollection = barrelRecHitsHandle.product(); if (!barrelRecHitsHandle.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] barrel rec hits not found"; @@ -196,7 +198,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //take the collection of rechis in the endcap const EERecHitCollection* endcapHitsCollection = nullptr; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(m_endcapAlCa, endcapRecHitsHandle); + iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle); endcapHitsCollection = endcapRecHitsHandle.product(); if (!endcapRecHitsHandle.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] endcap rec hits not found"; @@ -205,7 +207,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //Takes the electron collection of the pixel detector edm::Handle pElectrons; - iEvent.getByLabel(m_ElectronLabel, pElectrons); + iEvent.getByToken(m_gsfElectronToken, pElectrons); if (!pElectrons.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] electrons not found"; return kContinue; From 9b54a4ec95e49ce9f2bc11bd01653fc298b1a958 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 13:12:01 +0200 Subject: [PATCH 281/923] Modernise PhiSymmetryCalibration. --- .../interface/PhiSymmetryCalibration.h | 39 ++++++++++----- .../src/PhiSymmetryCalibration.cc | 48 ++++++++++--------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h index 00033a1c2e5c9..0aa3f4b0a0040 100644 --- a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h @@ -19,19 +19,24 @@ #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" // Framework -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" class TH1F; -class PhiSymmetryCalibration : public edm::EDAnalyzer { +class PhiSymmetryCalibration : public edm::one::EDAnalyzer { public: /// Constructor PhiSymmetryCalibration(const edm::ParameterSet& iConfig); @@ -41,7 +46,9 @@ class PhiSymmetryCalibration : public edm::EDAnalyzer { /// Called at beginning of job void beginJob() override; + void beginRun(edm::Run const&, const edm::EventSetup&) override; void endRun(edm::Run const&, const edm::EventSetup&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; /// Called at end of job @@ -111,27 +118,33 @@ class PhiSymmetryCalibration : public edm::EDAnalyzer { // steering parameters - std::string ecalHitsProducer_; - std::string barrelHits_; - std::string endcapHits_; + const std::string ecalHitsProducer_; + const std::string barrelHits_; + const std::string endcapHits_; + + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; + edm::ESGetToken intercalibConstantsToken_; // energy cut in the barrel - double eCut_barl_; + const double eCut_barl_; // parametrized energy cut EE : e_cut = ap + eta_ring*b - double ap_; - double b_; + const double ap_; + const double b_; - int eventSet_; + const int eventSet_; /// threshold in channel status beyond which channel is marked bad - int statusThreshold_; + const int statusThreshold_; static const int kMaxEndciPhi = 360; float phi_endc[kMaxEndciPhi][kEndcEtaRings]; - bool reiteration_; - std::string oldcalibfile_; //searched for in Calibration/EcalCalibAlgos/data + const bool reiteration_; + const std::string oldcalibfile_; //searched for in Calibration/EcalCalibAlgos/data /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc index d0f5d8f8e449a..20c93521fdf19 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc @@ -5,26 +5,19 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "FWCore/Framework/interface/LuminosityBlock.h" // Geometry -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" //Channel status -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" #include "FWCore/Framework/interface/Run.h" @@ -47,11 +40,13 @@ const float PhiSymmetryCalibration::kMiscalRangeEE = .10; // Class constructor PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) - : - - ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), + : ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), barrelHits_(iConfig.getParameter("barrelHitCollection")), endcapHits_(iConfig.getParameter("endcapHitCollection")), + ebRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + eeRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, endcapHits_))), + channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), eCut_barl_(iConfig.getParameter("eCut_barrel")), ap_(iConfig.getParameter("ap")), b_(iConfig.getParameter("b")), @@ -61,6 +56,10 @@ PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalintercalibConstants.xml")) { isfirstpass_ = true; + if (!reiteration_) { + intercalibConstantsToken_ = esConsumes(); + } + et_spectrum_b_histos.resize(kBarlRings); e_spectrum_b_histos.resize(kBarlRings); et_spectrum_e_histos.resize(kEndcEtaRings); @@ -71,6 +70,9 @@ PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) nevents_ = 0; eventsinrun_ = 0; eventsinlb_ = 0; + + // because ROOT draws something + usesResource(); } //_____________________________________________________________________________ @@ -239,21 +241,20 @@ void PhiSymmetryCalibration::analyze(const edm::Event& event, const edm::EventSe Handle barrelRecHitsHandle; Handle endcapRecHitsHandle; - event.getByLabel(ecalHitsProducer_, barrelHits_, barrelRecHitsHandle); + event.getByToken(ebRecHitToken_, barrelRecHitsHandle); if (!barrelRecHitsHandle.isValid()) { LogError("") << "[PhiSymmetryCalibration] Error! Can't get product!" << std::endl; } - event.getByLabel(ecalHitsProducer_, endcapHits_, endcapRecHitsHandle); + event.getByToken(ebRecHitToken_, endcapRecHitsHandle); if (!endcapRecHitsHandle.isValid()) { LogError("") << "[PhiSymmetryCalibration] Error! Can't get product!" << std::endl; } // get the ecal geometry - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloSubdetectorGeometry* barrelGeometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - const CaloSubdetectorGeometry* endcapGeometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); + const auto& geometry = setup.getData(geometryToken_); + const auto* barrelGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); bool pass = false; // select interesting EcalRecHits (barrel) @@ -377,6 +378,8 @@ void PhiSymmetryCalibration::analyze(const edm::Event& event, const edm::EventSe } } +void PhiSymmetryCalibration::beginRun(edm::Run const&, const edm::EventSetup&) {} + void PhiSymmetryCalibration::endRun(edm::Run const& run, const edm::EventSetup&) { std::cout << "PHIREPRT : run " << run.run() << " start " << (run.beginTime().value() >> 32) << " end " << (run.endTime().value() >> 32) << " dur " @@ -478,13 +481,11 @@ void PhiSymmetryCalibration::getKfactors() { //_____________________________________________________________________________ void PhiSymmetryCalibration::setUp(const edm::EventSetup& setup) { - edm::ESHandle chStatus; - setup.get().get(chStatus); + const auto& chStatus = setup.getData(channelStatusToken_); - edm::ESHandle geoHandle; - setup.get().get(geoHandle); + const auto& geometry = setup.getData(geometryToken_); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); if (reiteration_) { EcalCondHeader h; @@ -502,12 +503,13 @@ void PhiSymmetryCalibration::setUp(const edm::EventSetup& setup) { } else { // in fact if not reiterating, oldCalibs_ will never be used - edm::ESHandle pIcal; - setup.get().get(pIcal); + const auto pIcal = setup.getHandle(intercalibConstantsToken_); oldCalibs_ = *pIcal; } } +void PhiSymmetryCalibration::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {} + void PhiSymmetryCalibration::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const&) { if ((lb.endTime().value() >> 32) - (lb.beginTime().value() >> 32) < 60) return; From 5ef63d6d49bbdfed69aa890b0bbdc50c3072488e Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 13:28:41 +0200 Subject: [PATCH 282/923] esConsumes migration PhiSymmetryCalibration_step2. --- .../src/PhiSymmetryCalibration_step2.cc | 31 +++++++++---------- .../src/PhiSymmetryCalibration_step2.h | 25 ++++++++++----- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc index b0a3b2cbb9883..12ded874b1962 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc @@ -4,9 +4,6 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "TH2F.h" @@ -20,13 +17,15 @@ using namespace std; PhiSymmetryCalibration_step2::~PhiSymmetryCalibration_step2() {} -PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig) { - statusThreshold_ = iConfig.getUntrackedParameter("statusThreshold", 0); - have_initial_miscalib_ = iConfig.getUntrackedParameter("haveInitialMiscalib", false); - initialmiscalibfile_ = iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml"); - oldcalibfile_ = iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml"); - reiteration_ = iConfig.getUntrackedParameter("reiteration", false); - firstpass_ = true; +PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig) + : channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), + firstpass_(true), + statusThreshold_(iConfig.getUntrackedParameter("statusThreshold", 0)), + reiteration_(iConfig.getUntrackedParameter("reiteration", false)), + oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), + have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) { } void PhiSymmetryCalibration_step2::analyze(const edm::Event& ev, const edm::EventSetup& se) { @@ -37,16 +36,14 @@ void PhiSymmetryCalibration_step2::analyze(const edm::Event& ev, const edm::Even } void PhiSymmetryCalibration_step2::setUp(const edm::EventSetup& se) { - edm::ESHandle chStatus; - se.get().get(chStatus); + const auto& chStatus = se.getData(channelStatusToken_); - edm::ESHandle geoHandle; - se.get().get(geoHandle); + const auto& geometry = se.getData(geometryToken_); - barrelCells = geoHandle->getValidDetIds(DetId::Ecal, EcalBarrel); - endcapCells = geoHandle->getValidDetIds(DetId::Ecal, EcalEndcap); + barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); /// if a miscalibration was applied, load it, if not put it to 1 if (have_initial_miscalib_) { diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h index 99bb7044b2611..bc6de209ed439 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h @@ -1,15 +1,20 @@ +#ifndef Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_h +#define Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_h + #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" class TH1F; class TH2F; -class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { +class PhiSymmetryCalibration_step2 : public edm::one::EDAnalyzer<> { public: PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig); ~PhiSymmetryCalibration_step2() override; @@ -29,6 +34,9 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { void readEtSums(); private: + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; + // Transverse energy sum arrays double etsum_barl_[kBarlRings][kBarlWedges][kSides]; double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]; @@ -62,10 +70,10 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { std::vector endcapCells; bool firstpass_; - int statusThreshold_; + const int statusThreshold_; - bool reiteration_; - std::string oldcalibfile_; + const bool reiteration_; + const std::string oldcalibfile_; /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; @@ -77,8 +85,8 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { EcalIntercalibConstants miscalib_; /// - bool have_initial_miscalib_; - std::string initialmiscalibfile_; + const bool have_initial_miscalib_; + const std::string initialmiscalibfile_; /// res miscalib histos std::vector miscal_resid_barl_histos; @@ -87,3 +95,4 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { std::vector miscal_resid_endc_histos; std::vector correl_endc_histos; }; +#endif From ec26c2b90ce331eeb503eed03c85f8747399f310 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 13:49:06 +0200 Subject: [PATCH 283/923] esConsumes migration PhiSymmetryCalibration_step2_SM. --- .../src/PhiSymmetryCalibration_step2_SM.cc | 31 +++++++++---------- .../src/PhiSymmetryCalibration_step2_SM.h | 25 ++++++++++----- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc index 26920ad29267f..4c05df0987c3c 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc @@ -4,9 +4,6 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "TH2F.h" @@ -20,13 +17,15 @@ using namespace std; PhiSymmetryCalibration_step2_SM::~PhiSymmetryCalibration_step2_SM() {} -PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig) { - statusThreshold_ = iConfig.getUntrackedParameter("statusThreshold", 0); - have_initial_miscalib_ = iConfig.getUntrackedParameter("haveInitialMiscalib", false); - initialmiscalibfile_ = iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml"); - oldcalibfile_ = iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml"); - reiteration_ = iConfig.getUntrackedParameter("reiteration", false); - firstpass_ = true; +PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig) + : channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), + firstpass_(true), + statusThreshold_(iConfig.getUntrackedParameter("statusThreshold", 0)), + reiteration_(iConfig.getUntrackedParameter("reiteration", false)), + oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), + have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) { } void PhiSymmetryCalibration_step2_SM::analyze(const edm::Event& ev, const edm::EventSetup& se) { @@ -37,16 +36,14 @@ void PhiSymmetryCalibration_step2_SM::analyze(const edm::Event& ev, const edm::E } void PhiSymmetryCalibration_step2_SM::setUp(const edm::EventSetup& se) { - edm::ESHandle chStatus; - se.get().get(chStatus); + const auto& chStatus = se.getData(channelStatusToken_); - edm::ESHandle geoHandle; - se.get().get(geoHandle); + const auto& geometry = se.getData(geometryToken_); - barrelCells = geoHandle->getValidDetIds(DetId::Ecal, EcalBarrel); - endcapCells = geoHandle->getValidDetIds(DetId::Ecal, EcalEndcap); + barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); for (int sign = 0; sign < kSides; sign++) { for (int ieta = 0; ieta < kBarlRings; ieta++) { diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h index 9e6fb71e8d9ea..a042821b6c560 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h @@ -1,15 +1,20 @@ +#ifndef Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_SM_h +#define Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_SM_h + #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" class TH1F; class TH2F; -class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { +class PhiSymmetryCalibration_step2_SM : public edm::one::EDAnalyzer<> { public: PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig); ~PhiSymmetryCalibration_step2_SM() override; @@ -29,6 +34,9 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { void readEtSums(); private: + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; + // Transverse energy sum arrays double etsum_barl_[kBarlRings][kBarlWedges][kSides]; @@ -71,10 +79,10 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { std::vector endcapCells; bool firstpass_; - int statusThreshold_; + const int statusThreshold_; - bool reiteration_; - std::string oldcalibfile_; + const bool reiteration_; + const std::string oldcalibfile_; /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; @@ -86,8 +94,8 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { EcalIntercalibConstants miscalib_; /// - bool have_initial_miscalib_; - std::string initialmiscalibfile_; + const bool have_initial_miscalib_; + const std::string initialmiscalibfile_; /// res miscalib histos std::vector miscal_resid_barl_histos; @@ -96,3 +104,4 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { std::vector miscal_resid_endc_histos; std::vector correl_endc_histos; }; +#endif From 5ade040f404738e14f643d4c6965ddc451158559 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 14:38:14 +0200 Subject: [PATCH 284/923] esConsumes migration of Pi0FixedMassWindowCalibration. --- .../interface/Pi0FixedMassWindowCalibration.h | 20 ++++----- .../src/Pi0FixedMassWindowCalibration.cc | 43 ++++++------------- 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h b/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h index 1d462def498a3..b39ceb82c72e3 100644 --- a/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h @@ -11,16 +11,15 @@ // Framework #include "FWCore/Framework/interface/LooperFactory.h" #include "FWCore/Framework/interface/ESProducerLooper.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" @@ -34,13 +33,10 @@ #include "DataFormats/EcalDetId/interface/ESDetId.h" #include "DataFormats/DetId/interface/DetId.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "RecoEcal/EgammaClusterAlgos/interface/IslandClusterAlgo.h" #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" #include "RecoEcal/EgammaCoreTools/interface/ClusterShapeAlgo.h" @@ -87,9 +83,9 @@ class Pi0FixedMassWindowCalibration : public edm::ESProducerLooper { int nevent; - unsigned int theMaxLoops; - std::string ecalHitsProducer_; - std::string barrelHits_; + const unsigned int theMaxLoops; + const std::string ecalHitsProducer_; + const std::string barrelHits_; IslandClusterAlgo::VerbosityLevel verbosity; @@ -140,6 +136,10 @@ class Pi0FixedMassWindowCalibration : public edm::ESProducerLooper { const EcalRecHitCollection* ecalRecHitBarrelCollection; const EcalRecHitCollection* recalibEcalRecHitCollection; + const edm::EDGetTokenT recHitToken_; + const edm::ESGetToken intercalibConstantsToken_; + const edm::ESGetToken geometryToken_; + // root tree TFile* theFile; diff --git a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc index 3a7c38e93878c..aa99914366aa9 100644 --- a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc @@ -6,17 +6,14 @@ // Conditions database -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/Pi0CalibXMLwriter.h" // Reconstruction Classes #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" // Geometry -#include "Geometry/Records/interface/CaloGeometryRecord.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" @@ -35,7 +32,10 @@ using namespace std; Pi0FixedMassWindowCalibration::Pi0FixedMassWindowCalibration(const edm::ParameterSet& iConfig) : theMaxLoops(iConfig.getUntrackedParameter("maxLoops", 0)), ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), - barrelHits_(iConfig.getParameter("barrelHitCollection")) { + barrelHits_(iConfig.getParameter("barrelHitCollection")), + recHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + intercalibConstantsToken_(esConsumes()), + geometryToken_(esConsumes()) { std::cout << "[Pi0FixedMassWindowCalibration] Constructor " << std::endl; // The verbosity level std::string verbosityString = iConfig.getParameter("VerbosityLevel"); @@ -272,6 +272,9 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event // this chunk used to belong to beginJob(isetup). Moved here // with the beginJob without arguments migration + // get the ecal geometry: + const auto& geometry = setup.getData(geometryToken_); + if (isfirstcall_) { // initialize arrays @@ -288,23 +291,9 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event // get initial constants out of DB - edm::ESHandle pIcal; - EcalIntercalibConstantMap imap; - - try { - setup.get().get(pIcal); - std::cout << "Taken EcalIntercalibConstants" << std::endl; - imap = pIcal.product()->getMap(); - std::cout << "imap.size() = " << imap.size() << std::endl; - } catch (std::exception& ex) { - std::cerr << "Error! can't get EcalIntercalibConstants " << std::endl; - } - - // get the ecal geometry: - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; - //const CaloSubdetectorGeometry *barrelGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto& pIcal = setup.getData(intercalibConstantsToken_); + const auto imap = pIcal.getMap(); + std::cout << "imap.size() = " << imap.size() << std::endl; // loop over all barrel crystals barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); @@ -340,7 +329,7 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event int nRecHitsEB = 0; Handle pEcalRecHitBarrelCollection; - event.getByLabel(ecalHitsProducer_, barrelHits_, pEcalRecHitBarrelCollection); + event.getByToken(recHitToken_, pEcalRecHitBarrelCollection); const EcalRecHitCollection* ecalRecHitBarrelCollection = pEcalRecHitBarrelCollection.product(); cout << " ECAL Barrel RecHits # " << ecalRecHitBarrelCollection->size() << endl; for (EcalRecHitCollection::const_iterator aRecHitEB = ecalRecHitBarrelCollection->begin(); @@ -380,18 +369,14 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event irecalib++; } - // get the geometry and topology from the event setup: - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloSubdetectorGeometry* geometry_p; std::string clustershapetag; - geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - EcalBarrelTopology topology{*geoHandle}; + geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + EcalBarrelTopology topology{geometry}; const CaloSubdetectorGeometry* geometryES_p; - geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); + geometryES_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); /* reco::BasicClusterCollection clusters; From 315d590c8a59bdc1123aefe0fe8d2a87632e8414 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 15:46:28 +0200 Subject: [PATCH 285/923] esConsumes migration of ZeeCalibration. --- .../EcalCalibAlgos/interface/ZeeCalibration.h | 53 +++++---- .../EcalCalibAlgos/src/ZeeCalibration.cc | 103 ++++++------------ 2 files changed, 64 insertions(+), 92 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h b/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h index b10e543e039df..9e78f35854233 100644 --- a/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h @@ -21,17 +21,16 @@ #include #include #include +#include // user include files #include "FWCore/Framework/interface/LooperFactory.h" #include "FWCore/Framework/interface/ESProducerLooper.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/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 "Calibration/Tools/interface/ZIterativeAlgorithmWithFit.h" #include "Calibration/Tools/interface/CalibElectron.h" @@ -42,9 +41,13 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + #include "TTree.h" #include "TFile.h" #include "TGraph.h" @@ -53,18 +56,12 @@ #include "TH2.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" #include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include -#include - // class declaration // @@ -145,23 +142,33 @@ class ZeeCalibration : public edm::ESProducerLooper { std::string outputFileName_; - std::string rechitProducer_; - std::string rechitCollection_; - std::string erechitProducer_; - std::string erechitCollection_; - std::string scProducer_; - std::string scCollection_; + const edm::InputTag hlTriggerResults_; - std::string scIslandProducer_; - std::string scIslandCollection_; + const std::string mcProducer_; + const std::string rechitProducer_; + const std::string rechitCollection_; + const std::string erechitProducer_; + const std::string erechitCollection_; + const std::string scProducer_; + const std::string scCollection_; + + const std::string scIslandProducer_; + const std::string scIslandCollection_; + + const std::string electronProducer_; + const std::string electronCollection_; - std::string mcProducer_; std::string calibMode_; - std::string electronProducer_; - std::string electronCollection_; + const edm::EDGetTokenT trigResultsToken_; + const edm::EDGetTokenT hepMCToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT scToken_; + const edm::EDGetTokenT islandSCToken_; + const edm::EDGetTokenT gsfElectronToken_; - std::string RecalibBarrelHits_; + const edm::ESGetToken geometryToken_; unsigned int etaBins_; unsigned int etBins_; @@ -338,8 +345,6 @@ class ZeeCalibration : public edm::ESProducerLooper { int CRACK_ELECTRONS_IN_BARREL; int CRACK_ELECTRONS_IN_ENDCAP; - edm::InputTag hlTriggerResults_; - unsigned int nEvents_; // number of events processed unsigned int nWasRun_; // # where at least one HLT was run diff --git a/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc b/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc index 7d483783b7514..316830af6c303 100644 --- a/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc @@ -1,22 +1,12 @@ #include #include -#include -#include -#include #include -#include #include #include #include -#include -#include -#include -#include -#include #include #include -#include #include @@ -35,36 +25,39 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "DataFormats/CaloRecHit/interface/CaloRecHit.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackExtraFwd.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/TriggerNamesService.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #define MZ 91.1876 #define DEBUG 1 -ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { +ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) + : hlTriggerResults_(iConfig.getParameter("HLTriggerResults")), + mcProducer_(iConfig.getUntrackedParameter("mcProducer", "")), + rechitProducer_(iConfig.getParameter("rechitProducer")), + rechitCollection_(iConfig.getParameter("rechitCollection")), + erechitProducer_(iConfig.getParameter("erechitProducer")), + erechitCollection_(iConfig.getParameter("erechitCollection")), + scProducer_(iConfig.getParameter("scProducer")), + scCollection_(iConfig.getParameter("scCollection")), + scIslandProducer_(iConfig.getParameter("scIslandProducer")), + scIslandCollection_(iConfig.getParameter("scIslandCollection")), + electronProducer_(iConfig.getParameter("electronProducer")), + electronCollection_(iConfig.getParameter("electronCollection")), + trigResultsToken_(consumes(hlTriggerResults_)), + hepMCToken_(consumes(edm::InputTag(mcProducer_))), + ebRecHitToken_(consumes(edm::InputTag(rechitProducer_, rechitCollection_))), + eeRecHitToken_(consumes(edm::InputTag(erechitProducer_, erechitCollection_))), + scToken_(consumes(edm::InputTag(scProducer_, scCollection_))), + islandSCToken_(consumes(edm::InputTag(scIslandProducer_, scIslandCollection_))), + gsfElectronToken_(consumes(edm::InputTag(electronProducer_, electronCollection_))), + geometryToken_(esConsumes()) { #ifdef DEBUG std::cout << "[ZeeCalibration] Starting the ctor" << std::endl; #endif @@ -78,25 +71,8 @@ ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { minInvMassCut_ = iConfig.getUntrackedParameter("minInvMassCut", 70.); maxInvMassCut_ = iConfig.getUntrackedParameter("maxInvMassCut", 110.); - rechitProducer_ = iConfig.getParameter("rechitProducer"); - rechitCollection_ = iConfig.getParameter("rechitCollection"); - - erechitProducer_ = iConfig.getParameter("erechitProducer"); - erechitCollection_ = iConfig.getParameter("erechitCollection"); - - scProducer_ = iConfig.getParameter("scProducer"); - scCollection_ = iConfig.getParameter("scCollection"); - - scIslandProducer_ = iConfig.getParameter("scIslandProducer"); - scIslandCollection_ = iConfig.getParameter("scIslandCollection"); - calibMode_ = iConfig.getUntrackedParameter("ZCalib_CalibType"); - mcProducer_ = iConfig.getUntrackedParameter("mcProducer", ""); - - electronProducer_ = iConfig.getParameter("electronProducer"); - electronCollection_ = iConfig.getParameter("electronCollection"); - outputFile_ = TFile::Open(outputFileName_.c_str(), "RECREATE"); // open output file to store histograms myTree = new TTree("myTree", "myTree"); @@ -124,8 +100,6 @@ ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { //ZeeCalibrationPLots("zeeCalibPlots"); //ZeecaPlots->bookHistos(maxsIter); - hlTriggerResults_ = iConfig.getParameter("HLTriggerResults"); - theParameterSet = iConfig; EcalIndexingTools* myIndexTool = nullptr; @@ -585,9 +559,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // code that used to be in beginJob if (isfirstcall_) { //inizializzare la geometria di ecal - edm::ESHandle pG; - iSetup.get().get(pG); - EcalRingCalibrationTools::setCaloGeometry(&(*pG)); + const auto& geometry = iSetup.getData(geometryToken_); + EcalRingCalibrationTools::setCaloGeometry(&geometry); myZeePlots_ = new ZeePlots("zeePlots.root"); // myZeeRescaleFactorPlots_ = new ZeeRescaleFactorPlots("zeeRescaleFactorPlots.root"); @@ -717,7 +690,7 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const #endif edm::Handle hltTriggerResultHandle; - iEvent.getByLabel(hlTriggerResults_, hltTriggerResultHandle); + iEvent.getByToken(trigResultsToken_, hltTriggerResultHandle); if (!hltTriggerResultHandle.isValid()) { //std::cout << "invalid handle for HLT TriggerResults" << std::endl; @@ -757,8 +730,7 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const if (!mcProducer_.empty()) { //DUMP GENERATED Z MASS - BEGIN Handle hepProd; - // iEvent.getByLabel( "source", hepProd ) ; - iEvent.getByLabel(mcProducer_, hepProd); + iEvent.getByToken(hepMCToken_, hepProd); const HepMC::GenEvent* myGenEvent = hepProd->GetEvent(); @@ -809,27 +781,24 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // Get EBRecHits Handle phits; - try { - iEvent.getByLabel(rechitProducer_, rechitCollection_, phits); - } catch (std::exception& ex) { + iEvent.getByToken(ebRecHitToken_, phits); + if (!phits.isValid()) { std::cerr << "Error! can't get the product EBRecHitCollection " << std::endl; } const EBRecHitCollection* hits = phits.product(); // get a ptr to the product // Get EERecHits Handle ephits; - try { - iEvent.getByLabel(erechitProducer_, erechitCollection_, ephits); - } catch (std::exception& ex) { + iEvent.getByToken(eeRecHitToken_, ephits); + if (!ephits.isValid()) { std::cerr << "Error! can't get the product EERecHitCollection " << std::endl; } const EERecHitCollection* ehits = ephits.product(); // get a ptr to the product //Get Hybrid SuperClusters Handle pSuperClusters; - try { - iEvent.getByLabel(scProducer_, scCollection_, pSuperClusters); - } catch (std::exception& ex) { + iEvent.getByToken(scToken_, pSuperClusters); + if (!pSuperClusters.isValid()) { std::cerr << "Error! can't get the product SuperClusterCollection " << std::endl; } const reco::SuperClusterCollection* scCollection = pSuperClusters.product(); @@ -843,9 +812,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const //Get Island SuperClusters Handle pIslandSuperClusters; - try { - iEvent.getByLabel(scIslandProducer_, scIslandCollection_, pIslandSuperClusters); - } catch (std::exception& ex) { + iEvent.getByToken(islandSCToken_, pIslandSuperClusters); + if (!pIslandSuperClusters.isValid()) { std::cerr << "Error! can't get the product IslandSuperClusterCollection " << std::endl; } const reco::SuperClusterCollection* scIslandCollection = pIslandSuperClusters.product(); @@ -859,9 +827,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // Get Electrons Handle pElectrons; - try { - iEvent.getByLabel(electronProducer_, electronCollection_, pElectrons); - } catch (std::exception& ex) { + iEvent.getByToken(gsfElectronToken_, pElectrons); + if (!pElectrons.isValid()) { std::cerr << "Error! can't get the product ElectronCollection " << std::endl; } const reco::GsfElectronCollection* electronCollection = pElectrons.product(); From 378159c40d9b5651582b04716be90e83f350f578 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Wed, 1 Sep 2021 15:59:43 +0200 Subject: [PATCH 286/923] Apply code-checks and code-format. --- .../plugins/SelectedElectronFEDListProducer.cc | 3 +-- .../interface/ECALpedestalPCLHarvester.h | 14 +++++++------- .../interface/ElectronCalibrationUniv.h | 1 - .../interface/PhiSymmetryCalibration.h | 3 ++- .../EcalCalibAlgos/src/ECALpedestalPCLworker.cc | 4 ++-- .../EcalCalibAlgos/src/ElectronCalibrationUniv.cc | 3 +-- .../src/PhiSymmetryCalibration_step2.cc | 3 +-- .../src/PhiSymmetryCalibration_step2_SM.cc | 3 +-- .../src/Pi0FixedMassWindowCalibration.cc | 2 +- 9 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc index 1347e84b6423e..1d861acad6e7e 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc @@ -57,8 +57,7 @@ SelectedElectronFEDListProducer::SelectedElectronFEDListProducer(co caloGeometryToken_(esConsumes()), siPixelFedCablingMapToken_(esConsumes()), trackerGeometryToken_(esConsumes()), - siStripRegionCablingToken_(esConsumes()) -{ + siStripRegionCablingToken_(esConsumes()) { // input electron collection Tag if (iConfig.existsAs>("electronTags")) { electronTags_ = iConfig.getParameter>("electronTags"); diff --git a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h index 6966160010b7d..bb607057da860 100644 --- a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h +++ b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h @@ -52,13 +52,13 @@ class ECALpedestalPCLHarvester : public DQMEDHarvester { int entriesEB_[EBDetId::kSizeForDenseIndexing]; int entriesEE_[EEDetId::kSizeForDenseIndexing]; - const bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals - const double nSigma_; // threshold in sigmas to define a pedestal as changed - const double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file - const std::string dqmDir_; // DQM directory where histograms are stored - const std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied - const float threshDiffEB_; // if the new pedestals differs more than this from old, keep old - const float threshDiffEE_; // same as above for EE. Stray channel protection + const bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals + const double nSigma_; // threshold in sigmas to define a pedestal as changed + const double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file + const std::string dqmDir_; // DQM directory where histograms are stored + const std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied + const float threshDiffEB_; // if the new pedestals differs more than this from old, keep old + const float threshDiffEE_; // same as above for EE. Stray channel protection const float threshChannelsAnalyzed_; // threshold for minimum percentage of channels analized to produce DQM plots // ES token diff --git a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h index a8611b090be06..aeb203a8d978f 100644 --- a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h +++ b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h @@ -57,7 +57,6 @@ // class ElectronCalibrationUniv : public edm::one::EDAnalyzer { - public: explicit ElectronCalibrationUniv(const edm::ParameterSet &); ~ElectronCalibrationUniv() override; diff --git a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h index 0aa3f4b0a0040..ceef0c6444f92 100644 --- a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h @@ -36,7 +36,8 @@ class TH1F; -class PhiSymmetryCalibration : public edm::one::EDAnalyzer { +class PhiSymmetryCalibration + : public edm::one::EDAnalyzer { public: /// Constructor PhiSymmetryCalibration(const edm::ParameterSet& iConfig); diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc index 5c72def53a390..a92e92a762e4d 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc @@ -5,8 +5,8 @@ #include "FWCore/Framework/interface/EventSetup.h" #include -ECALpedestalPCLworker::ECALpedestalPCLworker(const edm::ParameterSet& iConfig) : pedestalToken_(esConsumes()) -{ +ECALpedestalPCLworker::ECALpedestalPCLworker(const edm::ParameterSet& iConfig) + : pedestalToken_(esConsumes()) { edm::InputTag digiTagEB = iConfig.getParameter("BarrelDigis"); edm::InputTag digiTagEE = iConfig.getParameter("EndcapDigis"); diff --git a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc index b0d68f65abc27..469eed1688de1 100644 --- a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc +++ b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc @@ -47,8 +47,7 @@ ElectronCalibrationUniv::ElectronCalibrationUniv(const edm::ParameterSet& iConfi ebRecHitToken_(consumes(ebRecHitLabel_)), eeRecHitToken_(consumes(eeRecHitLabel_)), gsfElectronToken_(consumes(electronLabel_)), - topologyToken_(esConsumes()) { -} + topologyToken_(esConsumes()) {} ElectronCalibrationUniv::~ElectronCalibrationUniv() {} diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc index 12ded874b1962..525c8a40c77ea 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc @@ -25,8 +25,7 @@ PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2(const edm::ParameterS reiteration_(iConfig.getUntrackedParameter("reiteration", false)), oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), - initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) { -} + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) {} void PhiSymmetryCalibration_step2::analyze(const edm::Event& ev, const edm::EventSetup& se) { if (firstpass_) { diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc index 4c05df0987c3c..412de801b7bf1 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc @@ -25,8 +25,7 @@ PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM(const edm::Para reiteration_(iConfig.getUntrackedParameter("reiteration", false)), oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), - initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) { -} + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) {} void PhiSymmetryCalibration_step2_SM::analyze(const edm::Event& ev, const edm::EventSetup& se) { if (firstpass_) { diff --git a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc index aa99914366aa9..dc0f53472473e 100644 --- a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc @@ -292,7 +292,7 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event // get initial constants out of DB const auto& pIcal = setup.getData(intercalibConstantsToken_); - const auto imap = pIcal.getMap(); + const auto& imap = pIcal.getMap(); std::cout << "imap.size() = " << imap.size() << std::endl; // loop over all barrel crystals From 9a87288087fe70c0b0aac6d6371cc503656f7d2a Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 14:57:25 -0500 Subject: [PATCH 287/923] remove unnecessary L1AbstractProcessor base class --- .../interface/L1AbstractProcessor.h | 48 ------------------- .../DTTrackFinder/src/L1MuDTAssignmentUnit.h | 13 +++-- L1Trigger/DTTrackFinder/src/L1MuDTERS.h | 10 ++-- L1Trigger/DTTrackFinder/src/L1MuDTEUX.h | 13 +++-- .../src/L1MuDTExtrapolationUnit.h | 13 +++-- .../DTTrackFinder/src/L1MuDTMuonSorter.h | 10 ++-- L1Trigger/DTTrackFinder/src/L1MuDTSEU.h | 12 ++--- .../DTTrackFinder/src/L1MuDTTrackAssembler.h | 10 ++-- .../DTTrackFinder/src/L1MuDTWedgeSorter.h | 10 ++-- 9 files changed, 39 insertions(+), 100 deletions(-) delete mode 100644 L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h diff --git a/L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h b/L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h deleted file mode 100644 index 82727583b8e49..0000000000000 --- a/L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------- -// -/** \class L1AbstractProcessor - * - * Abstract Base Class for L1 Trigger Devices with EventSetup -*/ -// -// -// Author : -// N. Neumeister CERN EP -// -//-------------------------------------------------- -#ifndef L1_ABSTRACT_PROCESSOR_H -#define L1_ABSTRACT_PROCESSOR_H - -//--------------- -// C++ Headers -- -//--------------- - -//---------------------- -// Base Class Headers -- -//---------------------- - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ - -#include - -// --------------------- -// -- Class Interface -- -// --------------------- - -class L1AbstractProcessor { -public: - /// destructor - virtual ~L1AbstractProcessor() {} - - /// run processor logic - virtual void run(){}; - - virtual void run(const edm::EventSetup& c){}; - - /// clear event memory of processor - virtual void reset() = 0; -}; - -#endif diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h index 62fd059f5c84a..150148f065e20 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h @@ -29,13 +29,12 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ -#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/L1TObjects/interface/L1MuDTAssParam.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTPhiLut; @@ -47,19 +46,19 @@ class L1MuDTSectorProcessor; // -- Class Interface -- // --------------------- -class L1MuDTAssignmentUnit : public L1AbstractProcessor { +class L1MuDTAssignmentUnit { public: /// constructor L1MuDTAssignmentUnit(L1MuDTSectorProcessor& sp, int id); /// destructor - ~L1MuDTAssignmentUnit() override; + ~L1MuDTAssignmentUnit(); /// run Assignment Unit - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Assignment Unit - void reset() override; + void reset(); /// assign phi void PhiAU(const edm::EventSetup& c); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTERS.h b/L1Trigger/DTTrackFinder/src/L1MuDTERS.h index 5c98b311aaf81..1969004662405 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTERS.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTERS.h @@ -27,8 +27,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -40,19 +38,19 @@ class L1MuDTSEU; // -- Class Interface -- // --------------------- -class L1MuDTERS : public L1AbstractProcessor { +class L1MuDTERS { public: /// constructor L1MuDTERS(const L1MuDTSEU&); /// destructor - ~L1MuDTERS() override; + ~L1MuDTERS(); /// run L1MuDTERS - void run() override; + void run(); /// reset ERS - void reset() override; + void reset(); /// return extrapolation quality inline unsigned int quality(int id) const { return m_quality[id]; } diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h index 9e628320493d2..86116bd73c544 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h @@ -28,13 +28,12 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ -#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" class L1MuDTTrackSegPhi; class L1MuDTSectorProcessor; class L1MuDTSEU; @@ -45,22 +44,22 @@ class L1MuDTTFParameters; // -- Class Interface -- // --------------------- -class L1MuDTEUX : public L1AbstractProcessor { +class L1MuDTEUX { public: /// constructor L1MuDTEUX(const L1MuDTSectorProcessor& sp, const L1MuDTSEU& seu, int id); /// destructor - ~L1MuDTEUX() override; + ~L1MuDTEUX(); /// equal operator bool operator==(const L1MuDTEUX&) const; /// run Extrapolator - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Extrapolator - void reset() override; + void reset(); /// load data into EUX void load(const L1MuDTTrackSegPhi* start_ts, const L1MuDTTrackSegPhi* target_ts); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h index d1eb5d63ce3c3..007a83c3178d8 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h @@ -33,14 +33,13 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" -#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" class L1MuDTSectorProcessor; class L1MuDTSEU; class L1MuDTTFParameters; @@ -49,7 +48,7 @@ class L1MuDTTFParameters; // -- Class Interface -- // --------------------- -class L1MuDTExtrapolationUnit : public L1AbstractProcessor { +class L1MuDTExtrapolationUnit { public: typedef std::pair SEUId; typedef std::map > SEUmap; @@ -58,13 +57,13 @@ class L1MuDTExtrapolationUnit : public L1AbstractProcessor { L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor&); /// destructor - ~L1MuDTExtrapolationUnit() override; + ~L1MuDTExtrapolationUnit(); /// run Extrapolation Unit - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset Extrapolation Unit - void reset() override; + void reset(); /// reset a single extrapolation void reset(Extrapolation ext, unsigned int startAdr, unsigned int relAdr); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.h b/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.h index 229dcf57085b0..f0e09628fb99a 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTMuonSorter.h @@ -28,8 +28,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -42,19 +40,19 @@ class L1MuDTSecProcId; // -- Class Interface -- // --------------------- -class L1MuDTMuonSorter : public L1AbstractProcessor { +class L1MuDTMuonSorter { public: /// constructor L1MuDTMuonSorter(const L1MuDTTrackFinder&); /// destructor - ~L1MuDTMuonSorter() override; + ~L1MuDTMuonSorter(); /// run Muon Sorter - void run() override; + void run(); /// reset Muon Sorter - void reset() override; + void reset(); /// print results after sorting void print() const; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h index d10b0591c113d..6be71448bcafe 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h @@ -29,12 +29,10 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ - +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" class L1MuDTSectorProcessor; class L1MuDTTrackSegPhi; @@ -45,19 +43,19 @@ class L1MuDTERS; // -- Class Interface -- // --------------------- -class L1MuDTSEU : public L1AbstractProcessor { +class L1MuDTSEU { public: /// constructor L1MuDTSEU(const L1MuDTSectorProcessor& sp, Extrapolation ext, unsigned int tsId); /// destructor - ~L1MuDTSEU() override; + ~L1MuDTSEU(); /// run SEU - void run(const edm::EventSetup& c) override; + void run(const edm::EventSetup& c); /// reset SEU - void reset() override; + void reset(); /// reset single extrapolation void reset(unsigned int relAdr); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h index 4c1972bdbd947..46e64ea02bb57 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h @@ -32,8 +32,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -46,19 +44,19 @@ class L1MuDTSectorProcessor; // -- Class Interface -- // --------------------- -class L1MuDTTrackAssembler : public L1AbstractProcessor { +class L1MuDTTrackAssembler { public: /// constructor L1MuDTTrackAssembler(const L1MuDTSectorProcessor&); /// destructor - ~L1MuDTTrackAssembler() override; + ~L1MuDTTrackAssembler(); /// run Track Assembler - void run() override; + void run(); /// reset Track Assembler - void reset() override; + void reset(); /// print result of Track Assembler void print() const; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.h b/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.h index 2dc333841c8b4..1bf1c9bc08bb7 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTWedgeSorter.h @@ -28,8 +28,6 @@ // Base Class Headers -- //---------------------- -#include "L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h" - //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -42,22 +40,22 @@ class L1MuDTSecProcId; // -- Class Interface -- // --------------------- -class L1MuDTWedgeSorter : public L1AbstractProcessor { +class L1MuDTWedgeSorter { public: /// constructor L1MuDTWedgeSorter(const L1MuDTTrackFinder&, int id); /// destructor - ~L1MuDTWedgeSorter() override; + ~L1MuDTWedgeSorter(); /// return Wedge Sorter identifier (0-11) inline int id() const { return m_wsid; } /// run Wedge Sorter - void run() override; + void run(); /// reset Wedge Sorter - void reset() override; + void reset(); /// print results after sorting void print() const; From d3a33e1f4c54e97ac682e555a4123d1b7671c1d2 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 15:29:39 -0500 Subject: [PATCH 288/923] Pass ConsumesCollector by value --- L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc index 7b977e3747603..67713eb52bae0 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc @@ -53,7 +53,7 @@ using namespace std; //---------------- // Constructors -- //---------------- -L1MuDTSectorReceiver::L1MuDTSectorReceiver(L1MuDTSectorProcessor& sp, edm::ConsumesCollector&& iC) +L1MuDTSectorReceiver::L1MuDTSectorReceiver(L1MuDTSectorProcessor& sp, edm::ConsumesCollector iC) : m_sp(sp), m_DTDigiToken(iC.consumes(m_sp.tf().config()->getDTDigiInputTag())), m_CSCTrSToken(iC.mayConsume >(m_sp.tf().config()->getCSCTrSInputTag())) {} diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h index c041da93b2ca4..4251c914a8289 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h @@ -54,7 +54,7 @@ namespace csctf { class L1MuDTSectorReceiver { public: /// constructor - L1MuDTSectorReceiver(L1MuDTSectorProcessor&, edm::ConsumesCollector&& iC); + L1MuDTSectorReceiver(L1MuDTSectorProcessor&, edm::ConsumesCollector iC); /// destructor virtual ~L1MuDTSectorReceiver(); From c4acef355880d388a4d67989f8fa2d5c5f2630d5 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 16:00:46 -0500 Subject: [PATCH 289/923] Better memory management in L1MuDTSectorProcessor --- .../src/L1MuDTSectorProcessor.cc | 249 +++++++----------- .../DTTrackFinder/src/L1MuDTSectorProcessor.h | 47 ++-- 2 files changed, 119 insertions(+), 177 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc index 5a82f72c8c648..362c1d5ed6efc 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc @@ -38,7 +38,6 @@ #include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h" #include "L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackFinder.h" -#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h" using namespace std; @@ -52,47 +51,23 @@ using namespace std; L1MuDTSectorProcessor::L1MuDTSectorProcessor(const L1MuDTTrackFinder& tf, const L1MuDTSecProcId& id, - edm::ConsumesCollector&& iC) + edm::ConsumesCollector iC) : m_tf(tf), m_spid(id), - m_SectorReceiver(new L1MuDTSectorReceiver(*this, std::move(iC))), - m_DataBuffer(new L1MuDTDataBuffer(*this)), - m_EU(new L1MuDTExtrapolationUnit(*this)), - m_TA(new L1MuDTTrackAssembler(*this)), - m_AUs(), - m_TrackCands(), - m_TracKCands() { - // 2 assignment units - m_AUs.reserve(2); - m_AUs.push_back(new L1MuDTAssignmentUnit(*this, 0)); - m_AUs.push_back(new L1MuDTAssignmentUnit(*this, 1)); - - // now the 2 track candidates - m_TrackCands.reserve(2); - m_TrackCands.push_back(new L1MuDTTrack(m_spid)); - m_TrackCands.push_back(new L1MuDTTrack(m_spid)); - - m_TracKCands.reserve(2); - m_TracKCands.push_back(new L1MuDTTrack(m_spid)); - m_TracKCands.push_back(new L1MuDTTrack(m_spid)); + m_SectorReceiver(*this, iC), + m_DataBuffer(*this), + m_EU(*this), + m_TA(*this), + m_AUs{{{*this, 0}, {*this, 1}}}, + m_TrackCands{{{m_spid}, {m_spid}}}, + m_TracKCands{{{m_spid}, {m_spid}}} { } //-------------- // Destructor -- //-------------- -L1MuDTSectorProcessor::~L1MuDTSectorProcessor() { - delete m_SectorReceiver; - delete m_DataBuffer; - delete m_EU; - delete m_TA; - delete m_AUs[0]; - delete m_AUs[1]; - delete m_TrackCands[0]; - delete m_TrackCands[1]; - delete m_TracKCands[0]; - delete m_TracKCands[1]; -} +L1MuDTSectorProcessor::~L1MuDTSectorProcessor() {} //-------------- // Operations -- @@ -103,25 +78,22 @@ L1MuDTSectorProcessor::~L1MuDTSectorProcessor() { // void L1MuDTSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSetup& c) { // receive data and store them into the data buffer - if (m_SectorReceiver) - m_SectorReceiver->run(bx, e, c); + m_SectorReceiver.run(bx, e, c); // check content of data buffer - if (m_DataBuffer) { - if (m_tf.config()->Debug(4) && m_DataBuffer->numberTSphi() > 0) { - cout << "Phi track segments received by " << m_spid << " : " << endl; - m_DataBuffer->printTSphi(); - } + if (m_tf.config()->Debug(4) && m_DataBuffer.numberTSphi() > 0) { + cout << "Phi track segments received by " << m_spid << " : " << endl; + m_DataBuffer.printTSphi(); } // perform all extrapolations int n_ext = 0; // number of successful extrapolations - if (m_EU && m_DataBuffer && m_DataBuffer->numberTSphi() > 1) { - m_EU->run(c); - n_ext = m_EU->numberOfExt(); + if (m_DataBuffer.numberTSphi() > 1) { + m_EU.run(c); + n_ext = m_EU.numberOfExt(); if (m_tf.config()->Debug(3) && n_ext > 0) { cout << "Number of successful extrapolations : " << n_ext << endl; - m_EU->print(); + m_EU.print(); } } @@ -129,98 +101,74 @@ void L1MuDTSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSet // m_EU->print(1); // perform track assembling - if (m_TA && n_ext > 0) { - m_TA->run(); + if (n_ext > 0) { + m_TA.run(); if (m_tf.config()->Debug(3)) - m_TA->print(); + m_TA.print(); } // assign pt, eta, phi and quality - if (m_AUs[0] && !m_TA->isEmpty(0)) - m_AUs[0]->run(c); - if (m_AUs[1] && !m_TA->isEmpty(1)) - m_AUs[1]->run(c); + if (!m_TA.isEmpty(0)) + m_AUs[0].run(c); + if (!m_TA.isEmpty(1)) + m_AUs[1].run(c); if (m_spid.wheel() == -1) { - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2) > 3 && - m_TrackCands[0]->address(2) < 6) - m_TrackCands[0]->reset(); - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3) > 3 && - m_TrackCands[0]->address(3) < 6) - m_TrackCands[0]->reset(); - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4) > 3 && - m_TrackCands[0]->address(4) < 6) - m_TrackCands[0]->reset(); - - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2) > 3 && - m_TracKCands[0]->address(2) < 6) - m_TracKCands[0]->reset(); - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3) > 3 && - m_TracKCands[0]->address(3) < 6) - m_TracKCands[0]->reset(); - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4) > 3 && - m_TracKCands[0]->address(4) < 6) - m_TracKCands[0]->reset(); - - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2) > 3 && - m_TrackCands[1]->address(2) < 6) - m_TrackCands[1]->reset(); - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3) > 3 && - m_TrackCands[1]->address(3) < 6) - m_TrackCands[1]->reset(); - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4) > 3 && - m_TrackCands[1]->address(4) < 6) - m_TrackCands[1]->reset(); - - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2) > 3 && - m_TracKCands[1]->address(2) < 6) - m_TracKCands[1]->reset(); - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3) > 3 && - m_TracKCands[1]->address(3) < 6) - m_TracKCands[1]->reset(); - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4) > 3 && - m_TracKCands[1]->address(4) < 6) - m_TracKCands[1]->reset(); - - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2) > 7 && - m_TrackCands[0]->address(2) < 10) - m_TrackCands[0]->reset(); - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3) > 7 && - m_TrackCands[0]->address(3) < 10) - m_TrackCands[0]->reset(); - if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4) > 7 && - m_TrackCands[0]->address(4) < 10) - m_TrackCands[0]->reset(); - - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2) > 7 && - m_TracKCands[0]->address(2) < 10) - m_TracKCands[0]->reset(); - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3) > 7 && - m_TracKCands[0]->address(3) < 10) - m_TracKCands[0]->reset(); - if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4) > 7 && - m_TracKCands[0]->address(4) < 10) - m_TracKCands[0]->reset(); - - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2) > 7 && - m_TrackCands[1]->address(2) < 10) - m_TrackCands[1]->reset(); - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3) > 7 && - m_TrackCands[1]->address(3) < 10) - m_TrackCands[1]->reset(); - if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4) > 7 && - m_TrackCands[1]->address(4) < 10) - m_TrackCands[1]->reset(); - - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2) > 7 && - m_TracKCands[1]->address(2) < 10) - m_TracKCands[1]->reset(); - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3) > 7 && - m_TracKCands[1]->address(3) < 10) - m_TracKCands[1]->reset(); - if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4) > 7 && - m_TracKCands[1]->address(4) < 10) - m_TracKCands[1]->reset(); + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(2) > 3 && m_TrackCands[0].address(2) < 6) + m_TrackCands[0].reset(); + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(3) > 3 && m_TrackCands[0].address(3) < 6) + m_TrackCands[0].reset(); + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(4) > 3 && m_TrackCands[0].address(4) < 6) + m_TrackCands[0].reset(); + + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(2) > 3 && m_TracKCands[0].address(2) < 6) + m_TracKCands[0].reset(); + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(3) > 3 && m_TracKCands[0].address(3) < 6) + m_TracKCands[0].reset(); + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(4) > 3 && m_TracKCands[0].address(4) < 6) + m_TracKCands[0].reset(); + + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(2) > 3 && m_TrackCands[1].address(2) < 6) + m_TrackCands[1].reset(); + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(3) > 3 && m_TrackCands[1].address(3) < 6) + m_TrackCands[1].reset(); + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(4) > 3 && m_TrackCands[1].address(4) < 6) + m_TrackCands[1].reset(); + + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(2) > 3 && m_TracKCands[1].address(2) < 6) + m_TracKCands[1].reset(); + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(3) > 3 && m_TracKCands[1].address(3) < 6) + m_TracKCands[1].reset(); + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(4) > 3 && m_TracKCands[1].address(4) < 6) + m_TracKCands[1].reset(); + + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(2) > 7 && m_TrackCands[0].address(2) < 10) + m_TrackCands[0].reset(); + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(3) > 7 && m_TrackCands[0].address(3) < 10) + m_TrackCands[0].reset(); + if (!m_TrackCands[0].empty() && m_TrackCands[0].address(4) > 7 && m_TrackCands[0].address(4) < 10) + m_TrackCands[0].reset(); + + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(2) > 7 && m_TracKCands[0].address(2) < 10) + m_TracKCands[0].reset(); + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(3) > 7 && m_TracKCands[0].address(3) < 10) + m_TracKCands[0].reset(); + if (!m_TracKCands[0].empty() && m_TracKCands[0].address(4) > 7 && m_TracKCands[0].address(4) < 10) + m_TracKCands[0].reset(); + + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(2) > 7 && m_TrackCands[1].address(2) < 10) + m_TrackCands[1].reset(); + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(3) > 7 && m_TrackCands[1].address(3) < 10) + m_TrackCands[1].reset(); + if (!m_TrackCands[1].empty() && m_TrackCands[1].address(4) > 7 && m_TrackCands[1].address(4) < 10) + m_TrackCands[1].reset(); + + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(2) > 7 && m_TracKCands[1].address(2) < 10) + m_TracKCands[1].reset(); + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(3) > 7 && m_TracKCands[1].address(3) < 10) + m_TracKCands[1].reset(); + if (!m_TracKCands[1].empty() && m_TracKCands[1].address(4) > 7 && m_TracKCands[1].address(4) < 10) + m_TracKCands[1].reset(); } } @@ -228,26 +176,16 @@ void L1MuDTSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSet // reset Sector Processor // void L1MuDTSectorProcessor::reset() { - if (m_SectorReceiver) - m_SectorReceiver->reset(); - if (m_DataBuffer) - m_DataBuffer->reset(); - if (m_EU) - m_EU->reset(); - if (m_TA) - m_TA->reset(); - if (m_AUs[0]) - m_AUs[0]->reset(); - if (m_AUs[1]) - m_AUs[1]->reset(); - if (m_TrackCands[0]) - m_TrackCands[0]->reset(); - if (m_TrackCands[1]) - m_TrackCands[1]->reset(); - if (m_TracKCands[0]) - m_TracKCands[0]->reset(); - if (m_TracKCands[1]) - m_TracKCands[1]->reset(); + m_SectorReceiver.reset(); + m_DataBuffer.reset(); + m_EU.reset(); + m_TA.reset(); + m_AUs[0].reset(); + m_AUs[1].reset(); + m_TrackCands[0].reset(); + m_TrackCands[1].reset(); + m_TracKCands[0].reset(); + m_TracKCands[1].reset(); } // @@ -256,10 +194,9 @@ void L1MuDTSectorProcessor::reset() { void L1MuDTSectorProcessor::print() const { if (anyTrack()) { cout << "Muon candidates found in " << m_spid << " : " << endl; - vector::const_iterator iter = m_TrackCands.begin(); + auto iter = m_TrackCands.cbegin(); while (iter != m_TrackCands.end()) { - if (*iter) - (*iter)->print(); + iter->print(); iter++; } } @@ -289,9 +226,9 @@ const L1MuDTSectorProcessor* L1MuDTSectorProcessor::neighbour() const { // are there any muon candidates? // bool L1MuDTSectorProcessor::anyTrack() const { - if (m_TrackCands[0] && !m_TrackCands[0]->empty()) + if (!m_TrackCands[0].empty()) return true; - if (m_TrackCands[1] && !m_TrackCands[1]->empty()) + if (!m_TrackCands[1].empty()) return true; return false; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h index 560790bda1c6c..c5302b28adb9b 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.h @@ -25,6 +25,7 @@ //--------------- #include +#include //---------------------- // Base Class Headers -- @@ -38,13 +39,15 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" -class L1MuDTSectorReceiver; -class L1MuDTDataBuffer; -class L1MuDTExtrapolationUnit; -class L1MuDTTrackAssembler; -class L1MuDTAssignmentUnit; + +#include "L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h" +#include "L1Trigger/DTTrackFinder/src/L1MuDTDataBuffer.h" +#include "L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h" +#include "L1Trigger/DTTrackFinder/src/L1MuDTTrackAssembler.h" + +#include "L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h" +#include "L1Trigger/DTTrackFinder/interface/L1MuDTTrack.h" class L1MuDTTrackFinder; -class L1MuDTTrack; // --------------------- // -- Class Interface -- @@ -53,7 +56,7 @@ class L1MuDTTrack; class L1MuDTSectorProcessor { public: /// constructor - L1MuDTSectorProcessor(const L1MuDTTrackFinder&, const L1MuDTSecProcId&, edm::ConsumesCollector&&); + L1MuDTSectorProcessor(const L1MuDTTrackFinder&, const L1MuDTSecProcId&, edm::ConsumesCollector); /// destructor virtual ~L1MuDTSectorProcessor(); @@ -83,23 +86,25 @@ class L1MuDTSectorProcessor { inline bool ovl() const { return m_spid.ovl(); } /// return pointer to Data Buffer - inline const L1MuDTDataBuffer* data() const { return m_DataBuffer; } - inline L1MuDTDataBuffer* data() { return m_DataBuffer; } + inline const L1MuDTDataBuffer* data() const { return &m_DataBuffer; } + inline L1MuDTDataBuffer* data() { return &m_DataBuffer; } /// return pointer to Extrapolation Unit - inline const L1MuDTExtrapolationUnit* EU() const { return m_EU; } + inline const L1MuDTExtrapolationUnit* EU() const { return &m_EU; } /// return pointer to Track Assembler - inline const L1MuDTTrackAssembler* TA() const { return m_TA; } + inline const L1MuDTTrackAssembler* TA() const { return &m_TA; } /// return pointer to Assignment Unit, index [0,1] - inline const L1MuDTAssignmentUnit* AU(int id) const { return m_AUs[id]; } + inline const L1MuDTAssignmentUnit* AU(int id) const { return &m_AUs[id]; } /// return pointer to muon candidate, index [0,1] - inline L1MuDTTrack* track(int id) const { return m_TrackCands[id]; } + inline const L1MuDTTrack* track(int id) const { return &m_TrackCands[id]; } + inline L1MuDTTrack* track(int id) { return &m_TrackCands[id]; } /// return pointer to muon candidate, index [0,1] - inline L1MuDTTrack* tracK(int id) const { return m_TracKCands[id]; } + inline const L1MuDTTrack* tracK(int id) const { return &m_TracKCands[id]; } + inline L1MuDTTrack* tracK(int id) { return &m_TracKCands[id]; } private: /// are there any non-empty muon candidates? @@ -109,14 +114,14 @@ class L1MuDTSectorProcessor { const L1MuDTTrackFinder& m_tf; L1MuDTSecProcId m_spid; - L1MuDTSectorReceiver* m_SectorReceiver; - L1MuDTDataBuffer* m_DataBuffer; - L1MuDTExtrapolationUnit* m_EU; - L1MuDTTrackAssembler* m_TA; - std::vector m_AUs; + L1MuDTSectorReceiver m_SectorReceiver; + L1MuDTDataBuffer m_DataBuffer; + L1MuDTExtrapolationUnit m_EU; + L1MuDTTrackAssembler m_TA; + std::array m_AUs; - std::vector m_TrackCands; - std::vector m_TracKCands; + std::array m_TrackCands; + std::array m_TracKCands; }; #endif From 4dece66d0b0a59d00feecc065e98b43b3c0debd3 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 16:19:50 -0500 Subject: [PATCH 290/923] Add esConsumes to L1MuDT(Assignment|Extrapolation)Unit --- .../DTTrackFinder/src/L1MuDTAssignmentUnit.cc | 16 ++++++++++++---- .../DTTrackFinder/src/L1MuDTAssignmentUnit.h | 8 +++++++- .../DTTrackFinder/src/L1MuDTExtrapolationUnit.cc | 5 +++-- .../DTTrackFinder/src/L1MuDTExtrapolationUnit.h | 5 ++++- .../DTTrackFinder/src/L1MuDTSectorProcessor.cc | 7 +++---- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc index be36c1df67171..1abbf0abd889e 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.cc @@ -54,8 +54,16 @@ using namespace std; // Constructors -- //---------------- -L1MuDTAssignmentUnit::L1MuDTAssignmentUnit(L1MuDTSectorProcessor& sp, int id) - : m_sp(sp), m_id(id), m_addArray(), m_TSphi(), m_ptAssMethod(NODEF), nbit_phi(12), nbit_phib(10) { +L1MuDTAssignmentUnit::L1MuDTAssignmentUnit(L1MuDTSectorProcessor& sp, int id, edm::ConsumesCollector iC) + : m_sp(sp), + m_id(id), + m_addArray(), + m_TSphi(), + m_ptAssMethod(NODEF), + thePhiToken(iC.esConsumes()), + thePtaToken(iC.esConsumes()), + nbit_phi(12), + nbit_phib(10) { m_TSphi.reserve(4); // a track candidate can consist of max 4 TS reset(); @@ -133,7 +141,7 @@ void L1MuDTAssignmentUnit::reset() { void L1MuDTAssignmentUnit::PhiAU(const edm::EventSetup& c) { // calculate phi at station 2 using 8 bits (precision = 2.5 degrees) - c.get().get(thePhiLUTs); + thePhiLUTs = c.getHandle(thePhiToken); int sh_phi = 12 - m_sp.tf().config()->getNbitsPhiPhi(); int sh_phib = 10 - m_sp.tf().config()->getNbitsPhiPhib(); @@ -203,7 +211,7 @@ void L1MuDTAssignmentUnit::PhiAU(const edm::EventSetup& c) { // assign pt with 5 bit precision // void L1MuDTAssignmentUnit::PtAU(const edm::EventSetup& c) { - c.get().get(thePtaLUTs); + thePtaLUTs = c.getHandle(thePtaToken); // get pt-assignment method as function of track class and TS phib values m_ptAssMethod = getPtMethod(); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h index 150148f065e20..dd84461ba65f5 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTAssignmentUnit.h @@ -35,10 +35,14 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "CondFormats/L1TObjects/interface/L1MuDTAssParam.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTPhiLut; class L1MuDTPtaLut; +class L1MuDTPhiLutRcd; +class L1MuDTPtaLutRcd; class L1MuDTTrackSegPhi; class L1MuDTSectorProcessor; @@ -49,7 +53,7 @@ class L1MuDTSectorProcessor; class L1MuDTAssignmentUnit { public: /// constructor - L1MuDTAssignmentUnit(L1MuDTSectorProcessor& sp, int id); + L1MuDTAssignmentUnit(L1MuDTSectorProcessor& sp, int id, edm::ConsumesCollector); /// destructor ~L1MuDTAssignmentUnit(); @@ -102,6 +106,8 @@ class L1MuDTAssignmentUnit { std::vector m_TSphi; PtAssMethod m_ptAssMethod; + edm::ESGetToken thePhiToken; + edm::ESGetToken thePtaToken; edm::ESHandle thePhiLUTs; ///< phi-assignment look-up tables edm::ESHandle thePtaLUTs; ///< pt-assignment look-up tables unsigned short nbit_phi; ///< # of bits used for pt-assignment diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc index 472e6e74e12b1..b0aec58e6629e 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc @@ -52,7 +52,8 @@ using namespace std; // Constructors -- //---------------- -L1MuDTExtrapolationUnit::L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor& sp) : m_sp(sp), m_SEUs() { +L1MuDTExtrapolationUnit::L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor& sp, edm::ConsumesCollector iC) + : m_sp(sp), m_SEUs(), m_parsToken(iC.esConsumes()) { for (int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++) { Extrapolation ext = static_cast(ext_idx); @@ -92,7 +93,7 @@ L1MuDTExtrapolationUnit::~L1MuDTExtrapolationUnit() { // run Extrapolation Unit // void L1MuDTExtrapolationUnit::run(const edm::EventSetup& c) { - c.get().get(pars); + pars = c.getHandle(m_parsToken); SEUmap::const_iterator iter; for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) { diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h index 007a83c3178d8..48880dd7f211e 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h @@ -40,9 +40,11 @@ #include "CondFormats/L1TObjects/interface/L1MuDTExtParam.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" class L1MuDTSectorProcessor; class L1MuDTSEU; class L1MuDTTFParameters; +class L1MuDTTFParametersRcd; // --------------------- // -- Class Interface -- @@ -54,7 +56,7 @@ class L1MuDTExtrapolationUnit { typedef std::map > SEUmap; /// constructor - L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor&); + L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor&, edm::ConsumesCollector); /// destructor ~L1MuDTExtrapolationUnit(); @@ -94,6 +96,7 @@ class L1MuDTExtrapolationUnit { mutable SEUmap m_SEUs; // Single Extrapolation Units + edm::ESGetToken m_parsToken; edm::ESHandle pars; }; diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc index 362c1d5ed6efc..87082bf32a2bb 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorProcessor.cc @@ -56,12 +56,11 @@ L1MuDTSectorProcessor::L1MuDTSectorProcessor(const L1MuDTTrackFinder& tf, m_spid(id), m_SectorReceiver(*this, iC), m_DataBuffer(*this), - m_EU(*this), + m_EU(*this, iC), m_TA(*this), - m_AUs{{{*this, 0}, {*this, 1}}}, + m_AUs{{{*this, 0, iC}, {*this, 1, iC}}}, m_TrackCands{{{m_spid}, {m_spid}}}, - m_TracKCands{{{m_spid}, {m_spid}}} { -} + m_TracKCands{{{m_spid}, {m_spid}}} {} //-------------- // Destructor -- From 800c6d648fec077f9f2f6a6f5a53d1eae23910ff Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 16:26:30 -0500 Subject: [PATCH 291/923] Add esConsumes to L1MuDTSectorReceiver --- L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc | 8 +++++--- L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc index 67713eb52bae0..d3839715cc2cc 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.cc @@ -56,7 +56,9 @@ using namespace std; L1MuDTSectorReceiver::L1MuDTSectorReceiver(L1MuDTSectorProcessor& sp, edm::ConsumesCollector iC) : m_sp(sp), m_DTDigiToken(iC.consumes(m_sp.tf().config()->getDTDigiInputTag())), - m_CSCTrSToken(iC.mayConsume >(m_sp.tf().config()->getCSCTrSInputTag())) {} + m_CSCTrSToken(iC.mayConsume >(m_sp.tf().config()->getCSCTrSInputTag())), + m_parsToken(iC.esConsumes()), + m_msksToken(iC.esConsumes()) {} //-------------- // Destructor -- @@ -73,8 +75,8 @@ L1MuDTSectorReceiver::~L1MuDTSectorReceiver() { // receive track segment data from the DTBX and CSC chamber triggers // void L1MuDTSectorReceiver::run(int bx, const edm::Event& e, const edm::EventSetup& c) { - c.get().get(pars); - c.get().get(msks); + pars = c.getHandle(m_parsToken); + msks = c.getHandle(m_msksToken); // get track segments from DTBX chamber trigger receiveDTBXData(bx, e, c); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h index 4251c914a8289..99ea92bca2d68 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSectorReceiver.h @@ -41,6 +41,8 @@ class L1MuDTChambPhContainer; class L1MuDTSectorProcessor; class L1MuDTTFParameters; class L1MuDTTFMasks; +class L1MuDTTFParametersRcd; +class L1MuDTTFMasksRcd; template class CSCTriggerContainer; namespace csctf { @@ -83,6 +85,8 @@ class L1MuDTSectorReceiver { edm::EDGetTokenT m_DTDigiToken; edm::EDGetTokenT > m_CSCTrSToken; + edm::ESGetToken m_parsToken; + edm::ESGetToken m_msksToken; edm::ESHandle pars; edm::ESHandle msks; }; From f2052433eaacc54f6193d50d05f0dc47e1c6ca76 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 30 Aug 2021 16:33:26 -0500 Subject: [PATCH 292/923] Addes esConsumes to L1MuDTEtaProcessor --- L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc | 11 +++++++---- L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc index 991b5cc5338a4..7080ede3e9489 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.cc @@ -65,7 +65,10 @@ L1MuDTEtaProcessor::L1MuDTEtaProcessor(const L1MuDTTrackFinder& tf, int id, edm: m_epid(id), m_foundPattern(0), m_tseta(15), - m_DTDigiToken(iC.consumes(m_tf.config()->getDTDigiInputTag())) { + m_DTDigiToken(iC.consumes(m_tf.config()->getDTDigiInputTag())), + theEtaToken(iC.esConsumes()), + theQualToken(iC.esConsumes()), + theMsksToken(iC.esConsumes()) { m_tseta.reserve(15); } @@ -208,7 +211,7 @@ void L1MuDTEtaProcessor::print() const { // receive data ( 15*3 DTBX eta trigger primitives ) // void L1MuDTEtaProcessor::receiveData(int bx, const edm::Event& e, const edm::EventSetup& c) { - c.get().get(msks); + msks = c.getHandle(theMsksToken); edm::Handle dttrig; e.getByToken(m_DTDigiToken, dttrig); @@ -301,7 +304,7 @@ void L1MuDTEtaProcessor::receiveAddresses() { // run Eta Track Finder (ETF) // void L1MuDTEtaProcessor::runEtaTrackFinder(const edm::EventSetup& c) { - c.get().get(theEtaPatternLUT); + theEtaPatternLUT = c.getHandle(theEtaToken); // check if there are any data bool empty = true; @@ -347,7 +350,7 @@ void L1MuDTEtaProcessor::runEtaTrackFinder(const edm::EventSetup& c) { // run Eta Matching Unit (EMU) // void L1MuDTEtaProcessor::runEtaMatchingUnit(const edm::EventSetup& c) { - c.get().get(theQualPatternLUT); + theQualPatternLUT = c.getHandle(theQualToken); // loop over all addresses for (int i = 0; i < 12; i++) { diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h index 282364a7543dd..e33809b65cacb 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEtaProcessor.h @@ -38,6 +38,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTAddressArray.h" class L1MuDTChambThContainer; @@ -47,7 +48,9 @@ class L1MuDTTrack; class L1MuDTEtaPatternLut; class L1MuDTQualPatternLut; class L1MuDTTFMasks; - +class L1MuDTTFMasksRcd; +class L1MuDTEtaPatternLutRcd; +class L1MuDTQualPatternLutRcd; // --------------------- // -- Class Interface -- // --------------------- @@ -118,6 +121,9 @@ class L1MuDTEtaProcessor { std::vector m_tseta; edm::EDGetTokenT m_DTDigiToken; + edm::ESGetToken theEtaToken; + edm::ESGetToken theQualToken; + edm::ESGetToken theMsksToken; edm::ESHandle theEtaPatternLUT; // ETF look-up table edm::ESHandle theQualPatternLUT; // EMU look-up tables edm::ESHandle msks; From 73dc6aa3e1938651ad136d10ac4310d02e0a48dd Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Wed, 1 Sep 2021 17:57:44 +0200 Subject: [PATCH 293/923] code checks --- .../LCToCPAssociatorByEnergyScoreImpl.cc | 24 ++++----- .../LCToCPAssociatorByEnergyScoreImpl.h | 42 +++++++-------- .../LCToSCAssociatorByEnergyScoreImpl.cc | 40 +++++++------- .../LCToSCAssociatorByEnergyScoreImpl.h | 38 ++++++------- .../TSToSimTSAssociatorByEnergyScoreImpl.cc | 8 +-- .../TSToSimTSAssociatorByEnergyScoreImpl.h | 54 +++++++++---------- 6 files changed, 103 insertions(+), 103 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 59b26a7477bbe..94725eeca352a 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -30,9 +30,9 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( removeCPFromPU(caloParticles, cPIndices, hardScatterOnly_); auto nCaloParticles = cPIndices.size(); - // Initialize cPOnLayer. It contains the caloParticleOnLayer structure for all CaloParticles in each layer and + // Initialize cPOnLayer. It contains the caloParticleOnLayer structure for all CaloParticles in each layer and // among other the information to compute the CaloParticle-To-LayerCluster score. It is one of the two objects that - // build the output of the makeConnections function. + // build the output of the makeConnections function. // cPOnLayer[cpId][layerId] hgcal::caloParticleToLayerCluster cPOnLayer; cPOnLayer.resize(nCaloParticles); @@ -47,10 +47,10 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } // Fill detIdToCaloParticleId_Map and update cPOnLayer - // The detIdToCaloParticleId_Map is used to connect a hit Detid (key) with all the CaloParticles that - // contributed to that hit by storing the CaloParticle id and the fraction of the hit. Observe here - // that all the different contributions of the same CaloParticle to a single hit (coming from their - // internal SimClusters) are merged into a single entry with the fractions properly summed. + // The detIdToCaloParticleId_Map is used to connect a hit Detid (key) with all the CaloParticles that + // contributed to that hit by storing the CaloParticle id and the fraction of the hit. Observe here + // that all the different contributions of the same CaloParticle to a single hit (coming from their + // internal SimClusters) are merged into a single entry with the fractions properly summed. std::unordered_map> detIdToCaloParticleId_Map; for (const auto& cpId : cPIndices) { const SimClusterRefVector& simClusterRefVector = caloParticles[cpId].simClusters(); @@ -348,7 +348,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } // Compute the correct normalization - // It is the inverse of the denominator of the LCToCP score formula. Observe that this is the sum of the squares. + // It is the inverse of the denominator of the LCToCP score formula. Observe that this is the sum of the squares. float invLayerClusterEnergyWeight = 0.f; for (auto const& haf : clusters[lcId].hitsAndFractions()) { invLayerClusterEnergyWeight += @@ -376,8 +376,8 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } cpPair.second += (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invLayerClusterEnergyWeight; - } //End of loop over CaloParticles related the this LayerCluster. - } // End of loop over Hits within a LayerCluster + } //End of loop over CaloParticles related the this LayerCluster. + } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (cpsInLayerCluster[lcId].empty()) LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " @@ -416,7 +416,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( << CPNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInCP << "\t" << std::setw(15) << maxEnergyLCinCP << "\t" << std::setw(20) << CPEnergyFractionInLC << "\n"; #endif - // Compute the correct normalization. Observe that this is the sum of the squares. + // Compute the correct normalization. Observe that this is the sum of the squares. float invCPEnergyWeight = 0.f; for (auto const& haf : cPOnLayer[cpId][layerId].hits_and_fractions) { invCPEnergyWeight += std::pow(haf.second * hitMap_->at(haf.first)->energy(), 2); @@ -470,8 +470,8 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( << (lcPair.second.first / CPenergy) << "\n"; } #endif - } // End of loop over layers - } // End of loop over CaloParticles + } // End of loop over layers + } // End of loop over CaloParticles return {cpsInLayerCluster, cPOnLayer}; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index 7cdea2eaf79a8..2eed7b3f058e4 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -16,9 +16,9 @@ namespace edm { namespace hgcal { // This structure is used both for LayerClusters and CaloParticles storing their id and the fraction of a hit - // that belongs to the LayerCluster or CaloParticle. The meaning of the operator is extremely important since + // that belongs to the LayerCluster or CaloParticle. The meaning of the operator is extremely important since // this struct will be used inside maps and other containers and when searching for one particular occurence - // only the clusterId member will be used in the check, skipping the fraction part. + // only the clusterId member will be used in the check, skipping the fraction part. struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -30,17 +30,17 @@ namespace hgcal { }; // This introduces a CaloParticle on layer concept. For a CaloParticle it stores: - // 1. Its id: caloParticleId. - // 2. The energy that the CaloParticle deposited in a specific layer and it was reconstructed. - // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed - // and doesn't have any matched rechits are disregarded. Keep in mind that since a CaloParticle + // 1. Its id: caloParticleId. + // 2. The energy that the CaloParticle deposited in a specific layer and it was reconstructed. + // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed + // and doesn't have any matched rechits are disregarded. Keep in mind that since a CaloParticle // should most probably have more than one SimCluster, all different contributions from the same CaloParticle - // to a single hit are merged into a single entry, with the fractions properly summed. - // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the CaloParticle under study - // together with the energy that the LayerCluster reconstructed from the CaloParticle and the score. The energy - // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the CaloParticle. - // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's - // cells that the CaloParticle didn't contribute. + // to a single hit are merged into a single entry, with the fractions properly summed. + // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the CaloParticle under study + // together with the energy that the LayerCluster reconstructed from the CaloParticle and the score. The energy + // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the CaloParticle. + // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's + // cells that the CaloParticle didn't contribute. struct caloParticleOnLayer { unsigned int caloParticleId; float energy = 0; @@ -48,17 +48,17 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; - // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the CaloParticles - // (via their ids (cpIds)) that share at least one cell with the LayerCluster. In that pair it - // stores the score (lcId->(cpId,score)). Keep in mind that the association is not unique, since there could be several instances - // of the same CaloParticle from several related SimClusters that each contributed to the same LayerCluster. + // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the CaloParticles + // (via their ids (cpIds)) that share at least one cell with the LayerCluster. In that pair it + // stores the score (lcId->(cpId,score)). Keep in mind that the association is not unique, since there could be several instances + // of the same CaloParticle from several related SimClusters that each contributed to the same LayerCluster. typedef std::vector>> layerClusterToCaloParticle; - // This is used to save the caloParticleOnLayer structure for all CaloParticles in each layer. - // It is not exactly what is returned outside, but out of its entries, the output object is build. + // This is used to save the caloParticleOnLayer structure for all CaloParticles in each layer. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector> caloParticleToLayerCluster; - //This is the output of the makeConnections function that contain all the work with CP2LC and LC2CP - //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to - //provide the final product. + //This is the output of the makeConnections function that contain all the work with CP2LC and LC2CP + //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to + //provide the final product. typedef std::tuple association; } // namespace hgcal diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc index 38ea2e2d7023a..79f795d6a9d27 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc @@ -35,9 +35,9 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( } nSimClusters = sCIndices.size(); - // Initialize lcsInSimCluster. It contains the simClusterOnLayer structure for all simClusters in each layer and + // Initialize lcsInSimCluster. It contains the simClusterOnLayer structure for all simClusters in each layer and // among other the information to compute the SimCluster-To-LayerCluster score. It is one of the two objects that - // build the output of the makeConnections function. + // build the output of the makeConnections function. // lcsInSimCluster[scId][layerId] hgcal::simClusterToLayerCluster lcsInSimCluster; lcsInSimCluster.resize(nSimClusters); @@ -51,10 +51,10 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( } // Fill detIdToSimClusterId_Map and update lcsInSimCluster - // The detIdToSimClusterId_Map is used to connect a hit Detid (key) with all the SimClusters that - // contributed to that hit by storing the SimCluster id and the fraction of the hit. Observe here - // that in contrast to the CaloParticle case there is no merging and summing of the fractions, which - // in the CaloParticle's case was necessary due to the multiple SimClusters of a single CaloParticle. + // The detIdToSimClusterId_Map is used to connect a hit Detid (key) with all the SimClusters that + // contributed to that hit by storing the SimCluster id and the fraction of the hit. Observe here + // that in contrast to the CaloParticle case there is no merging and summing of the fractions, which + // in the CaloParticle's case was necessary due to the multiple SimClusters of a single CaloParticle. std::unordered_map> detIdToSimClusterId_Map; for (const auto& scId : sCIndices) { const auto& hits_and_fractions = simClusters[scId].hits_and_fractions(); @@ -110,10 +110,10 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; - // At this point here if you activate the printing you will notice cases where in a + // At this point here if you activate the printing you will notice cases where in a // specific detId there are more that one SimClusters contributing with fractions less than 1. - // This is important since it effects the score computation, since the fraction is also in the - // denominator of the score formula. + // This is important since it effects the score computation, since the fraction is also in the + // denominator of the score formula. for (auto const& sclu : sc.second) { LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction @@ -123,12 +123,12 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( #endif // Fill detIdToLayerClusterId_Map and scsInLayerCluster; update lcsInSimCluster - // The detIdToLayerClusterId_Map is used to connect a hit Detid (key) with all the LayerClusters that - // contributed to that hit by storing the LayerCluster id and the fraction of the corresponding hit. + // The detIdToLayerClusterId_Map is used to connect a hit Detid (key) with all the LayerClusters that + // contributed to that hit by storing the LayerCluster id and the fraction of the corresponding hit. std::unordered_map> detIdToLayerClusterId_Map; - // scsInLayerCluster together with lcsInSimCluster are the two objects that are used to build the - // output of the makeConnections function. scsInLayerCluster connects a LayerCluster with - // all the SimClusters that share at least one cell with the LayerCluster and for each pair (LC,SC) + // scsInLayerCluster together with lcsInSimCluster are the two objects that are used to build the + // output of the makeConnections function. scsInLayerCluster connects a LayerCluster with + // all the SimClusters that share at least one cell with the LayerCluster and for each pair (LC,SC) // it stores the score. hgcal::layerClusterToSimCluster scsInLayerCluster; //[lcId][scId]->(score) scsInLayerCluster.resize(nLayerClusters); @@ -354,8 +354,8 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( continue; } - // Compute the correct normalization. - // It is the inverse of the denominator of the LCToSC score formula. Observe that this is the sum of the squares. + // Compute the correct normalization. + // It is the inverse of the denominator of the LCToSC score formula. Observe that this is the sum of the squares. float invLayerClusterEnergyWeight = 0.f; for (auto const& haf : clusters[lcId].hitsAndFractions()) { invLayerClusterEnergyWeight += @@ -411,7 +411,7 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( int lcWithMaxEnergyInSC = -1; //energy of the most energetic LC from all that were linked to SC float maxEnergyLCinSC = 0.f; - //Energy of the SC scId on layer layerId that was reconstructed. + //Energy of the SC scId on layer layerId that was reconstructed. float SCenergy = lcsInSimCluster[scId][layerId].energy; //most energetic LC from all LCs linked to SC over SC energy. float SCEnergyFractionInLC = 0.f; @@ -435,7 +435,7 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( << "\t" << std::setw(18) << lcWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyLCinSC << "\t" << std::setw(20) << SCEnergyFractionInLC << "\n"; #endif - // Compute the correct normalization. Observe that this is the sum of the squares. + // Compute the correct normalization. Observe that this is the sum of the squares. float invSCEnergyWeight = 0.f; for (auto const& haf : lcsInSimCluster[scId][layerId].hits_and_fractions) { invSCEnergyWeight += std::pow(haf.second * hitMap_->at(haf.first)->energy(), 2); @@ -490,8 +490,8 @@ hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( << (lcPair.second.first / SCenergy) << "\n"; } #endif - } // End of loop over layers - } // End of loop over SimClusters + } // End of loop over layers + } // End of loop over SimClusters return {scsInLayerCluster, lcsInSimCluster}; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index f5b4d29b6a014..14982a6bee40f 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -16,9 +16,9 @@ namespace edm { namespace hgcal { // This structure is used both for LayerClusters and SimClusters storing their id and the fraction of a hit - // that belongs to the LayerCluster or SimCluster. The meaning of the operator is extremely important since + // that belongs to the LayerCluster or SimCluster. The meaning of the operator is extremely important since // this struct will be used inside maps and other containers and when searching for one particular occurence - // only the clusterId member will be used in the check, skipping the fraction part. + // only the clusterId member will be used in the check, skipping the fraction part. struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -30,15 +30,15 @@ namespace hgcal { }; // This introduces a simCluster on layer concept. For a simCluster it stores: - // 1. Its id: simClusterId. - // 2. The energy that the simCluster deposited in a specific layer and it was reconstructed. - // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed - // and doesn't have any matched rechits are disregarded. - // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the simCluster under study - // together with the energy that the Layercluster reconstructed from the SimClusters and the score. The energy - // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the SimCluster. - // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's - // cells that the SimCluster didn't contribute. + // 1. Its id: simClusterId. + // 2. The energy that the simCluster deposited in a specific layer and it was reconstructed. + // 3. The hits_and_fractions that contributed to that deposition. SimHits that aren't reconstructed + // and doesn't have any matched rechits are disregarded. + // 4. A map to save the LayerClusters ids (id is the key) that reconstructed at least one SimHit of the simCluster under study + // together with the energy that the Layercluster reconstructed from the SimClusters and the score. The energy + // is not the energy of the LayerCluster, but the energy of the LayerCluster coming from the SimCluster. + // So, there will be energy of the LayerCluster that is disregarded here, since there may be LayerCluster's + // cells that the SimCluster didn't contribute. struct simClusterOnLayer { unsigned int simClusterId; float energy = 0; @@ -46,16 +46,16 @@ namespace hgcal { std::unordered_map> layerClusterIdToEnergyAndScore; }; - // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the SimClusters - // (via their ids (scIds)) that share at least one cell with the LayerCluster. In that pair it - // stores the score (lcId->(scId,score)). + // This object connects a LayerCluster, identified through its id (lcId), with a vector of pairs containing all the SimClusters + // (via their ids (scIds)) that share at least one cell with the LayerCluster. In that pair it + // stores the score (lcId->(scId,score)). typedef std::vector>> layerClusterToSimCluster; - // This is used to save the simClusterOnLayer structure for all simClusters in each layer. - // It is not exactly what is returned outside, but out of its entries, the output object is build. + // This is used to save the simClusterOnLayer structure for all simClusters in each layer. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector> simClusterToLayerCluster; - //This is the output of the makeConnections function that contain all the work with SC2LC and LC2SC - //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to - //provide the final product. + //This is the output of the makeConnections function that contain all the work with SC2LC and LC2SC + //association. It will be read by the relevant associateSimToReco and associateRecoToSim functions to + //provide the final product. typedef std::tuple association; } // namespace hgcal diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc index 3eecfc5f474cd..bdb3ec90dc582 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.cc @@ -34,9 +34,9 @@ hgcal::association TSToSimTSAssociatorByEnergyScoreImpl::makeConnections( } nSimTracksters = sTIndices.size(); - // Initialize tssInSimTrackster. It contains the simTracksterOnLayer structure for all CaloParticles in each layer and + // Initialize tssInSimTrackster. It contains the simTracksterOnLayer structure for all CaloParticles in each layer and // among other the information to compute the SimTrackster-To-Trackster score. It is one of the two objects that - // build the output of the makeConnections function. + // build the output of the makeConnections function. // tssInSimTrackster[stId] hgcal::simTracksterToTrackster tssInSimTrackster; tssInSimTrackster.resize(nSimTracksters); @@ -47,9 +47,9 @@ hgcal::association TSToSimTSAssociatorByEnergyScoreImpl::makeConnections( } // Fill lcToSimTracksterId_Map and update tssInSimTrackster - // The lcToSimTracksterId_Map is used to connect a LayerCluster, via its id (key), with all the SimTracksters that + // The lcToSimTracksterId_Map is used to connect a LayerCluster, via its id (key), with all the SimTracksters that // contributed to that LayerCluster by storing the SimTrackster id and the fraction of the LayerCluster's energy - // in which the SimTrackster contributed. + // in which the SimTrackster contributed. std::unordered_map> lcToSimTracksterId_Map; for (const auto& stId : sTIndices) { const auto& lcs = simTracksters[stId].vertices(); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h index 05f0652a65106..0de2bb23bd1da 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSimTSAssociatorByEnergyScoreImpl.h @@ -15,12 +15,12 @@ namespace edm { } namespace hgcal { - // This structure is used for SimTracksters storing its id and the energy fraction of - // a LayerCluster that is related to that SimTrackster. Be careful not to be confused by the fact that - // similar structs are used in other HGCAL associators where the fraction is a hit's fraction. - // The meaning of the operator is extremely important since this struct will be used inside maps and - // other containers and when searching for one particular occurence only the clusterId member will be - // used in the check, skipping the fraction part. + // This structure is used for SimTracksters storing its id and the energy fraction of + // a LayerCluster that is related to that SimTrackster. Be careful not to be confused by the fact that + // similar structs are used in other HGCAL associators where the fraction is a hit's fraction. + // The meaning of the operator is extremely important since this struct will be used inside maps and + // other containers and when searching for one particular occurence only the clusterId member will be + // used in the check, skipping the fraction part. struct lcInfoInTrackster { bool operator==(const lcInfoInTrackster &o) const { return clusterId == o.clusterId; }; long unsigned int clusterId; @@ -31,20 +31,20 @@ namespace hgcal { } }; - // In this structure, although it contains LayerClusters and per layer information through them, - // most of the information is 3D information. For a simTrackster it stores: - // 1. Its id: simTracksterId. - // 2. The energy related to the SimTrackster. It is the sum of the LayerClusters energy in which a SimCluster - // contributed. Therefore, there will be energy from each LayerCluster that is disregarded. - // 3. lcs_and_fractions: This is a vector of pairs. The pair is build from the LayerCluster id and the energy - // fraction of that LayerCluster which contributed to SimTrackster under study. So, be careful this is not the - // fraction of the hits. This is the fraction of the LayerCluster's energy in which the SimCluster contributed. - // This quantifies the statement above in 2 about the disregarded energy, by exactly storing the ratio of the - // reconstructed from SimCluster energy over the total LayerCluster energy. - // 4. A map to save the tracksters id (id is the key) that have at least one LayerCluster in common with the - // SimTrackster under study together with the energy and score. Energy in this case is defined as the sum of all - // LayerClusters (shared between the SimTrackster and the trackster) energy (coming from SimCluster of the SimTrackster) - // times the LayerCluster's fraction in trackster. + // In this structure, although it contains LayerClusters and per layer information through them, + // most of the information is 3D information. For a simTrackster it stores: + // 1. Its id: simTracksterId. + // 2. The energy related to the SimTrackster. It is the sum of the LayerClusters energy in which a SimCluster + // contributed. Therefore, there will be energy from each LayerCluster that is disregarded. + // 3. lcs_and_fractions: This is a vector of pairs. The pair is build from the LayerCluster id and the energy + // fraction of that LayerCluster which contributed to SimTrackster under study. So, be careful this is not the + // fraction of the hits. This is the fraction of the LayerCluster's energy in which the SimCluster contributed. + // This quantifies the statement above in 2 about the disregarded energy, by exactly storing the ratio of the + // reconstructed from SimCluster energy over the total LayerCluster energy. + // 4. A map to save the tracksters id (id is the key) that have at least one LayerCluster in common with the + // SimTrackster under study together with the energy and score. Energy in this case is defined as the sum of all + // LayerClusters (shared between the SimTrackster and the trackster) energy (coming from SimCluster of the SimTrackster) + // times the LayerCluster's fraction in trackster. struct simTracksterOnLayer { unsigned int simTracksterId; float energy = 0; @@ -52,13 +52,13 @@ namespace hgcal { std::unordered_map> tracksterIdToEnergyAndScore; }; - // This object connects a Trackster, identified through its id (tsId), with a vector of pairs containing all - // the SimTracksters (via their ids (stIds)) that share at least one LayerCluster. In that pair - // it stores the score (tsId->(stId,score)). Keep in mind that the association is not unique, since there could be - // several instances of the same SimTrackster from several related SimClusters that each contributed to the same Trackster. - typedef std::vector>> tracksterToSimTrackster; - // This is used to save the simTracksterOnLayer structure for all simTracksters. - // It is not exactly what is returned outside, but out of its entries, the output object is build. + // This object connects a Trackster, identified through its id (tsId), with a vector of pairs containing all + // the SimTracksters (via their ids (stIds)) that share at least one LayerCluster. In that pair + // it stores the score (tsId->(stId,score)). Keep in mind that the association is not unique, since there could be + // several instances of the same SimTrackster from several related SimClusters that each contributed to the same Trackster. + typedef std::vector>> tracksterToSimTrackster; + // This is used to save the simTracksterOnLayer structure for all simTracksters. + // It is not exactly what is returned outside, but out of its entries, the output object is build. typedef std::vector simTracksterToTrackster; typedef std::tuple association; } // namespace hgcal From e6c80e4a91ca4a9c88917a5497a40c3ac8b91887 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 1 Sep 2021 18:02:12 +0200 Subject: [PATCH 294/923] [GCC11] Fix warnings for EgammaHLTProducers --- .../EgammaHLTProducers/plugins/HLTCaloObjInRegionsProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaHLTProducers/plugins/HLTCaloObjInRegionsProducer.cc b/RecoEgamma/EgammaHLTProducers/plugins/HLTCaloObjInRegionsProducer.cc index ad50363c7355b..0de37f35003c4 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/HLTCaloObjInRegionsProducer.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/HLTCaloObjInRegionsProducer.cc @@ -213,7 +213,7 @@ std::unique_ptr HLTCaloObjInRegionsProducerempty()) { const CaloSubdetectorGeometry* subDetGeom = caloGeomHandle.getSubdetectorGeometry(inputColl->begin()->id()); if (!regions.empty()) { - for (const CaloObjType& obj : *inputColl) { + for (auto const& obj : *inputColl) { auto objGeom = subDetGeom->getGeometry(obj.id()); if (objGeom == nullptr) { //wondering what to do here From a4cad2f12584723c855c5da0c24604dcfcb154c2 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 1 Sep 2021 18:43:55 +0200 Subject: [PATCH 295/923] [GCC11] Fix comopiler warnings for LumiProducer --- .../plugins/ExpressLumiProducer.cc | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/RecoLuminosity/LumiProducer/plugins/ExpressLumiProducer.cc b/RecoLuminosity/LumiProducer/plugins/ExpressLumiProducer.cc index ae8dc24af8cc0..5e61fe86ba506 100644 --- a/RecoLuminosity/LumiProducer/plugins/ExpressLumiProducer.cc +++ b/RecoLuminosity/LumiProducer/plugins/ExpressLumiProducer.cc @@ -61,12 +61,12 @@ namespace edm { class ExpressLumiProducer : public edm::one::EDProducer { public: struct PerLSData { - unsigned int lsnum; - float lumivalue; - unsigned long long deadcount; - unsigned int numorbit; - unsigned int startorbit; - unsigned int bitzerocount; + unsigned int lsnum = 0; + float lumivalue = 0.0; + unsigned long long deadcount = 0; + unsigned int numorbit = 0; + unsigned int startorbit = 0; + unsigned int bitzerocount = 0; std::vector bunchlumivalue; std::vector bunchlumierror; std::vector bunchlumiquality; @@ -215,14 +215,8 @@ void ExpressLumiProducer::fillLSCache(unsigned int runnumber, unsigned int curre lsmin = (lsmax - m_cachesize) > 0 ? (lsmax - m_cachesize + 1) : 1; } for (unsigned int n = lsmin; n <= lsmax; ++n) { - PerLSData l; - std::vector mytmp(3564, 0.0); - l.bunchlumivalue.swap(mytmp); - std::vector myerrtmp(3564, 0.0); - l.bunchlumierror.swap(myerrtmp); - std::vector myqtmp(3564, 0); - l.bunchlumiquality.swap(myqtmp); - m_lscache.insert(std::make_pair(n, l)); + m_lscache.insert(std::make_pair( + n, PerLSData{.bunchlumivalue = {3564, 0.0}, .bunchlumierror = {3564, 0.0}, .bunchlumiquality = {3564, 0}})); } coral::AttributeList lumisummaryBindVariables; From 426a7d9d86938714ef8367133a30c420a5ddebf8 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 1 Sep 2021 19:01:03 +0200 Subject: [PATCH 296/923] [GCC11] Fxi compiler warnings for RecoPPS --- .../plugins/CTPPSProtonProducer.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc index 41f538d941fd5..8e0abcbb3b31d 100644 --- a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc @@ -168,9 +168,9 @@ CTPPSProtonProducer::CTPPSProtonProducer(const edm::ParameterSet &iConfig) opticalFunctionsToken_(esConsumes( edm::ESInputTag("", opticsLabel_))), geometryToken_(esConsumes()) { - for (const std::string §or : {"45", "56"}) { - const unsigned int arm = (sector == "45") ? 0 : 1; - association_cuts_[arm].load(iConfig.getParameterSet("association_cuts_" + sector)); + for (auto §or : {"45", "56"}) { + const unsigned int arm = strcmp(sector, "45") == 0 ? 0 : 1; + association_cuts_[arm].load(iConfig.getParameterSet("association_cuts_" + std::string(sector))); } if (doSingleRPReconstruction_) @@ -212,9 +212,10 @@ void CTPPSProtonProducer::fillDescriptions(edm::ConfigurationDescriptions &descr desc.add("localAngleYMin", -0.04)->setComment("minimal accepted value of local vertical angle (rad)"); desc.add("localAngleYMax", +0.04)->setComment("maximal accepted value of local vertical angle (rad)"); - for (const std::string §or : {"45", "56"}) { - desc.add("association_cuts_" + sector, AssociationCuts::getDefaultParameters()) - ->setComment("track-association cuts for sector " + sector); + for (auto §or : {"45", "56"}) { + desc.add("association_cuts_" + std::string(sector), + AssociationCuts::getDefaultParameters()) + ->setComment("track-association cuts for sector " + std::string(sector)); } std::vector config; From 77d014d9a773923665cc0250df94b9c8d8e96a98 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 1 Sep 2021 19:46:36 +0200 Subject: [PATCH 297/923] [GCC11] Ignore used uninitialized warning in DTDigiSimLink --- SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc b/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc index ee2ea7c7b41c3..ef0ae98ac6556 100644 --- a/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc +++ b/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc @@ -22,11 +22,14 @@ DTDigiSimLink::DTDigiSimLink() : theWire(0), theDigiNumber(0), theTDCBase(32), theCounts(0), theSimTrackId(0), theEventId(0) {} DTDigiSimLink::ChannelType DTDigiSimLink::channel() const { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" ChannelPacking result; result.wi = theWire; result.num = theDigiNumber; DTDigiSimLink::ChannelType* p_result = reinterpret_cast(&result); return *p_result; +#pragma GCC diagnostic pop } int DTDigiSimLink::wire() const { return theWire; } From c8d0f3a7d4829be581fa7fbda7cca2008922b5b9 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 1 Sep 2021 20:01:58 +0200 Subject: [PATCH 298/923] Clean up a few cfi's for HCAL and SimDB geometry --- Configuration/Geometry/python/GeometryDDDSimDB_cff.py | 6 ++---- Geometry/HcalCommonData/python/hcalSimDBConstants_cff.py | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py index f78a9d05efb85..06d6ab32f408f 100644 --- a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py +++ b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py @@ -8,8 +8,6 @@ from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * from Geometry.TrackerNumberingBuilder.trackerNumberingGeometryDB_cfi import * from Geometry.EcalCommonData.ecalSimulationParameters_cff import * -from Geometry.HcalCommonData.hcalSimulationParameters_cff import * -from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import * -from Geometry.HcalCommonData.hcalSimulationConstants_cfi import * -from Geometry.HcalCommonData.caloSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalSimDBConstants_cff import * from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * diff --git a/Geometry/HcalCommonData/python/hcalSimDBConstants_cff.py b/Geometry/HcalCommonData/python/hcalSimDBConstants_cff.py index b9c2efa9f9e2b..bc851f1c7a76a 100644 --- a/Geometry/HcalCommonData/python/hcalSimDBConstants_cff.py +++ b/Geometry/HcalCommonData/python/hcalSimDBConstants_cff.py @@ -4,5 +4,3 @@ from Geometry.HcalCommonData.hcalSimulationConstants_cfi import * from Geometry.HcalCommonData.hcalDBConstants_cff import * from Geometry.HcalCommonData.caloSimulationParameters_cff import * -from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import * -from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * From 4264b1fd5e10a5ba49ccc0c06612c5faa206d0b6 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Wed, 1 Sep 2021 20:57:02 +0200 Subject: [PATCH 299/923] Renamed PPSAlignmentConfigRun3v1 to PPSAlignmentConfiguration. --- ...c => PPSAlignmentConfigurationESSource.cc} | 62 ++++----- CondCore/CTPPSPlugins/src/plugin.cc | 6 +- CondCore/Utilities/plugins/Module_2XML.cc | 2 +- CondCore/Utilities/src/CondDBFetch.cc | 2 +- CondCore/Utilities/src/CondDBImport.cc | 2 +- CondCore/Utilities/src/CondFormats.h | 2 +- ...v1Rcd.h => PPSAlignmentConfigurationRcd.h} | 6 +- ...Rcd.cc => PPSAlignmentConfigurationRcd.cc} | 4 +- ...igRun3v1.h => PPSAlignmentConfiguration.h} | 14 +-- ...Run3v1.cc => PPSAlignmentConfiguration.cc} | 118 +++++++++--------- .../T_EventSetup_PPSAlignmentConfigRun3v1.cc | 4 - .../T_EventSetup_PPSAlignmentConfiguration.cc | 4 + CondFormats/PPSObjects/src/classes_def.xml | 22 ++-- CondFormats/PPSObjects/src/headers.h | 2 +- CondFormats/PPSObjects/test/BuildFile.xml | 2 +- ...stSerializationPPSAlignmentConfigRun3v1.cc | 17 --- ...tSerializationPPSAlignmentConfiguration.cc | 17 +++ ...c => RetrievePPSAlignmentConfiguration.cc} | 20 +-- ...1.cc => WritePPSAlignmentConfiguration.cc} | 24 ++-- ...retrieve_PPSAlignmentConfiguration_cfg.py} | 18 +-- ...=> write_PPSAlignmentConfiguration_cfg.py} | 18 +-- 21 files changed, 183 insertions(+), 183 deletions(-) rename CalibPPS/ESProducers/plugins/{PPSAlignmentConfigRun3v1ESSource.cc => PPSAlignmentConfigurationESSource.cc} (87%) rename CondFormats/DataRecord/interface/{PPSAlignmentConfigRun3v1Rcd.h => PPSAlignmentConfigurationRcd.h} (55%) rename CondFormats/DataRecord/src/{PPSAlignmentConfigRun3v1Rcd.cc => PPSAlignmentConfigurationRcd.cc} (70%) rename CondFormats/PPSObjects/interface/{PPSAlignmentConfigRun3v1.h => PPSAlignmentConfiguration.h} (92%) rename CondFormats/PPSObjects/src/{PPSAlignmentConfigRun3v1.cc => PPSAlignmentConfiguration.cc} (54%) delete mode 100644 CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc create mode 100644 CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc delete mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc create mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc rename CondTools/CTPPS/plugins/{RetrievePPSAlignmentConfigRun3v1.cc => RetrievePPSAlignmentConfiguration.cc} (50%) rename CondTools/CTPPS/plugins/{WritePPSAlignmentConfigRun3v1.cc => WritePPSAlignmentConfiguration.cc} (51%) rename CondTools/CTPPS/test/{retrieve_PPSAlignmentConfigRun3v1_cfg.py => retrieve_PPSAlignmentConfiguration_cfg.py} (74%) rename CondTools/CTPPS/test/{write_PPSAlignmentConfigRun3v1_cfg.py => write_PPSAlignmentConfiguration_cfg.py} (77%) diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc similarity index 87% rename from CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc rename to CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc index f6466ae9300d3..4af9a8b9279cd 100644 --- a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigRun3v1ESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc @@ -15,8 +15,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/ESInputTag.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" #include #include @@ -32,18 +32,18 @@ //--------------------------------------------------------------------------------------------- -class PPSAlignmentConfigRun3v1ESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +class PPSAlignmentConfigurationESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { public: - PPSAlignmentConfigRun3v1ESSource(const edm::ParameterSet &iConfig); + PPSAlignmentConfigurationESSource(const edm::ParameterSet &iConfig); - std::unique_ptr produce(const PPSAlignmentConfigRun3v1Rcd &); + std::unique_ptr produce(const PPSAlignmentConfigurationRcd &); static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); private: int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc); TDirectory *findDirectoryWithName(TDirectory *dir, std::string searchName); - std::vector buildVectorFromDirectory(TDirectory *dir, - const PPSAlignmentConfigRun3v1::RPConfig &rpd); + std::vector buildVectorFromDirectory(TDirectory *dir, + const PPSAlignmentConfiguration::RPConfig &rpd); void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, const edm::IOVSyncValue &iosv, @@ -51,7 +51,7 @@ class PPSAlignmentConfigRun3v1ESSource : public edm::ESProducer, public edm::Eve bool debug; - PPSAlignmentConfigRun3v1::SectorConfig sectorConfig45, sectorConfig56; + PPSAlignmentConfiguration::SectorConfig sectorConfig45, sectorConfig56; double x_ali_sh_step; @@ -64,30 +64,30 @@ class PPSAlignmentConfigRun3v1ESSource : public edm::ESProducer, public edm::Eve unsigned int maxRPTracksSize; double n_si; - std::map> matchingReferencePoints; - std::map matchingShiftRanges; + std::map> matchingReferencePoints; + std::map matchingShiftRanges; - std::map alignment_x_meth_o_ranges; + std::map alignment_x_meth_o_ranges; unsigned int fitProfileMinBinEntries; unsigned int fitProfileMinNReasonable; unsigned int methOGraphMinN; double methOUncFitRange; - std::map alignment_x_relative_ranges; + std::map alignment_x_relative_ranges; unsigned int nearFarMinEntries; - std::map alignment_y_ranges; + std::map alignment_y_ranges; unsigned int modeGraphMinN; unsigned int multSelProjYMinEntries; - PPSAlignmentConfigRun3v1::Binning binning; + PPSAlignmentConfiguration::Binning binning; std::string label; }; //--------------------------------------------------------------------------------------------- -PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::ParameterSet &iConfig) { +PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm::ParameterSet &iConfig) { label = iConfig.getParameter("label"); debug = iConfig.getParameter("debug"); @@ -108,7 +108,7 @@ PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::Pa for (std::string sectorName : {"sector_45", "sector_56"}) { const auto &sps = iConfig.getParameter(sectorName); - PPSAlignmentConfigRun3v1::SectorConfig *sc; + PPSAlignmentConfiguration::SectorConfig *sc; if (sectorName == "sector_45") sc = §orConfig45; else @@ -116,7 +116,7 @@ PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::Pa for (std::string rpName : {"rp_N", "rp_F"}) { const auto &rpps = sps.getParameter(rpName); - PPSAlignmentConfigRun3v1::RPConfig *rc; + PPSAlignmentConfiguration::RPConfig *rc; if (rpName == "rp_N") rc = &sc->rp_N_; else @@ -162,7 +162,7 @@ PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::Pa {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; - std::map rpConfigs = { + std::map rpConfigs = { {sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, @@ -263,7 +263,7 @@ PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::Pa binning.slice_y_max_ = bps.getParameter("slice_y_max"); setWhatProduced(this, label); - findingRecord(); + findingRecord(); if (debug) delete debugFile; @@ -271,8 +271,8 @@ PPSAlignmentConfigRun3v1ESSource::PPSAlignmentConfigRun3v1ESSource(const edm::Pa //--------------------------------------------------------------------------------------------- -std::unique_ptr PPSAlignmentConfigRun3v1ESSource::produce(const PPSAlignmentConfigRun3v1Rcd &) { - auto p = std::make_unique(); +std::unique_ptr PPSAlignmentConfigurationESSource::produce(const PPSAlignmentConfigurationRcd &) { + auto p = std::make_unique(); p->setSectorConfig45(sectorConfig45); p->setSectorConfig56(sectorConfig56); @@ -316,7 +316,7 @@ std::unique_ptr PPSAlignmentConfigRun3v1ESSource::prod //--------------------------------------------------------------------------------------------- // most default values come from 2018 period -void PPSAlignmentConfigRun3v1ESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { +void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("debug", false); @@ -574,13 +574,13 @@ void PPSAlignmentConfigRun3v1ESSource::fillDescriptions(edm::ConfigurationDescri desc.add("binning", binning); } - descriptions.add("ppsAlignmentConfigRun3v1ESSource", desc); + descriptions.add("ppsAlignmentConfigurationESSource", desc); } //--------------------------------------------------------------------------------------------- // Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). -int PPSAlignmentConfigRun3v1ESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { +int PPSAlignmentConfigurationESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { unsigned int n_reasonable = 0; for (int bi = 1; bi <= p->GetNbinsX(); bi++) { if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { @@ -611,7 +611,7 @@ int PPSAlignmentConfigRun3v1ESSource::fitProfile(TProfile *p, double x_mean, dou // Performs a breadth first search on dir. If found, returns the directory with object // named searchName inside. Otherwise, returns nullptr. -TDirectory *PPSAlignmentConfigRun3v1ESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { +TDirectory *PPSAlignmentConfigurationESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { TIter next(dir->GetListOfKeys()); std::queue dirQueue; TObject *o; @@ -639,9 +639,9 @@ TDirectory *PPSAlignmentConfigRun3v1ESSource::findDirectoryWithName(TDirectory * //--------------------------------------------------------------------------------------------- // Builds vector of PointErrors instances from slice plots in dir. -std::vector PPSAlignmentConfigRun3v1ESSource::buildVectorFromDirectory( - TDirectory *dir, const PPSAlignmentConfigRun3v1::RPConfig &rpd) { - std::vector pv; +std::vector PPSAlignmentConfigurationESSource::buildVectorFromDirectory( + TDirectory *dir, const PPSAlignmentConfiguration::RPConfig &rpd) { + std::vector pv; TIter next(dir->GetListOfKeys()); TObject *o; @@ -680,14 +680,14 @@ std::vector PPSAlignmentConfigRun3v1ESSou //--------------------------------------------------------------------------------------------- -void PPSAlignmentConfigRun3v1ESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, +void PPSAlignmentConfigurationESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, const edm::IOVSyncValue &iosv, edm::ValidityInterval &oValidity) { - edm::LogInfo("PPS") << ">> PPSAlignmentConfigRun3v1ESSource::setIntervalFor(" << key.name() << ")\n" + edm::LogInfo("PPS") << ">> PPSAlignmentConfigurationESSource::setIntervalFor(" << key.name() << ")\n" << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); oValidity = infinity; } -DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigRun3v1ESSource); +DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigurationESSource); diff --git a/CondCore/CTPPSPlugins/src/plugin.cc b/CondCore/CTPPSPlugins/src/plugin.cc index e18a087d7b628..603d0d02862f8 100644 --- a/CondCore/CTPPSPlugins/src/plugin.cc +++ b/CondCore/CTPPSPlugins/src/plugin.cc @@ -21,8 +21,8 @@ #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" REGISTER_PLUGIN(CTPPSBeamParametersRcd, CTPPSBeamParameters); REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd, CTPPSPixelDAQMapping); @@ -36,4 +36,4 @@ REGISTER_PLUGIN(CTPPSOpticsRcd, LHCOpticalFunctionsSetCollection); REGISTER_PLUGIN(PPSDirectSimulationDataRcd, PPSDirectSimulationData); REGISTER_PLUGIN(PPSPixelTopologyRcd, PPSPixelTopology); REGISTER_PLUGIN(PPSAlignmentConfigRcd, PPSAlignmentConfig); -REGISTER_PLUGIN(PPSAlignmentConfigRun3v1Rcd, PPSAlignmentConfigRun3v1); +REGISTER_PLUGIN(PPSAlignmentConfigurationRcd, PPSAlignmentConfiguration); diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 0187588fd9a5e..639ffe22fe632 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -31,7 +31,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping); PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations); PAYLOAD_2XML_CLASS(PPSAlignmentConfig) - PAYLOAD_2XML_CLASS(PPSAlignmentConfigRun3v1) + PAYLOAD_2XML_CLASS(PPSAlignmentConfiguration) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); PAYLOAD_2XML_CLASS(CastorGainWidths); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index 25dbbb916b014..d7ff2191b49ee 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -57,7 +57,7 @@ namespace cond { FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations) FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) FETCH_PAYLOAD_CASE(PPSAlignmentConfig) - FETCH_PAYLOAD_CASE(PPSAlignmentConfigRun3v1) + FETCH_PAYLOAD_CASE(PPSAlignmentConfiguration) 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 4f97c82efeb9b..3d68b71a3e9de 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -77,7 +77,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations) IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) IMPORT_PAYLOAD_CASE(PPSAlignmentConfig) - IMPORT_PAYLOAD_CASE(PPSAlignmentConfigRun3v1) + IMPORT_PAYLOAD_CASE(PPSAlignmentConfiguration) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) IMPORT_PAYLOAD_CASE(CastorElectronicsMap) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 0ab9c8df6eae7..8fb8a6358cd47 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -33,7 +33,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSPixelGainCalibrations.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DTObjects/interface/DTCCBConfig.h" diff --git a/CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h similarity index 55% rename from CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h rename to CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h index 24efe950734a9..0cea1cc246488 100644 --- a/CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h +++ b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h @@ -4,11 +4,11 @@ * Mateusz Kocot (mateuszkocot99@gmail.com) ****************************************************************************/ -#ifndef CondFormats_DataRecord_PPSAlignmentConfigRun3v1Rcd_h -#define CondFormats_DataRecord_PPSAlignmentConfigRun3v1Rcd_h +#ifndef CondFormats_DataRecord_PPSAlignmentConfigurationRcd_h +#define CondFormats_DataRecord_PPSAlignmentConfigurationRcd_h #include "FWCore/Framework/interface/EventSetupRecordImplementation.h" -class PPSAlignmentConfigRun3v1Rcd : public edm::eventsetup::EventSetupRecordImplementation {}; +class PPSAlignmentConfigurationRcd : public edm::eventsetup::EventSetupRecordImplementation {}; #endif diff --git a/CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc b/CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc similarity index 70% rename from CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc rename to CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc index 68cd26ab0a06b..4c952462c6597 100644 --- a/CondFormats/DataRecord/src/PPSAlignmentConfigRun3v1Rcd.cc +++ b/CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc @@ -4,7 +4,7 @@ * Mateusz Kocot (mateuszkocot99@gmail.com) ****************************************************************************/ -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" #include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" -EVENTSETUP_RECORD_REG(PPSAlignmentConfigRun3v1Rcd); +EVENTSETUP_RECORD_REG(PPSAlignmentConfigurationRcd); diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h similarity index 92% rename from CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h rename to CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h index 604240aa87627..3d1ab028440a6 100644 --- a/CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h @@ -4,8 +4,8 @@ * Mateusz Kocot (mateuszkocot99@gmail.com) ****************************************************************************/ -#ifndef CondFormats_PPSObjects_PPSAlignmentConfigRun3v1_h -#define CondFormats_PPSObjects_PPSAlignmentConfigRun3v1_h +#ifndef CondFormats_PPSObjects_PPSAlignmentConfiguration_h +#define CondFormats_PPSObjects_PPSAlignmentConfiguration_h #include "CondFormats/Serialization/interface/Serializable.h" @@ -13,7 +13,7 @@ #include #include -class PPSAlignmentConfigRun3v1 { +class PPSAlignmentConfiguration { public: // Auxiliary structures struct PointErrors { @@ -149,7 +149,7 @@ class PPSAlignmentConfigRun3v1 { void setBinning(Binning &binning); // << operator - friend std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1 &c); + friend std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c); private: SectorConfig sectorConfig45_, sectorConfig56_; @@ -186,8 +186,8 @@ class PPSAlignmentConfigRun3v1 { COND_SERIALIZABLE; }; -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::RPConfig &rc); -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::SectorConfig &sc); -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Binning &b); +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::RPConfig &rc); +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::SectorConfig &sc); +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Binning &b); #endif diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc similarity index 54% rename from CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc rename to CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc index 26f41f0380ce2..96e4232925032 100644 --- a/CondFormats/PPSObjects/src/PPSAlignmentConfigRun3v1.cc +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc @@ -4,124 +4,124 @@ * Mateusz Kocot (mateuszkocot99@gmail.com) ****************************************************************************/ -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" #include #include #include -// -------------------------------- PPSAlignmentConfigRun3v1 getters -------------------------------- +// -------------------------------- PPSAlignmentConfiguration getters -------------------------------- -const PPSAlignmentConfigRun3v1::SectorConfig &PPSAlignmentConfigRun3v1::sectorConfig45() const { return sectorConfig45_; } -const PPSAlignmentConfigRun3v1::SectorConfig &PPSAlignmentConfigRun3v1::sectorConfig56() const { return sectorConfig56_; } +const PPSAlignmentConfiguration::SectorConfig &PPSAlignmentConfiguration::sectorConfig45() const { return sectorConfig45_; } +const PPSAlignmentConfiguration::SectorConfig &PPSAlignmentConfiguration::sectorConfig56() const { return sectorConfig56_; } -double PPSAlignmentConfigRun3v1::x_ali_sh_step() const { return x_ali_sh_step_; } +double PPSAlignmentConfiguration::x_ali_sh_step() const { return x_ali_sh_step_; } -double PPSAlignmentConfigRun3v1::y_mode_sys_unc() const { return y_mode_sys_unc_; } -double PPSAlignmentConfigRun3v1::chiSqThreshold() const { return chiSqThreshold_; } -double PPSAlignmentConfigRun3v1::y_mode_unc_max_valid() const { return y_mode_unc_max_valid_; } -double PPSAlignmentConfigRun3v1::y_mode_max_valid() const { return y_mode_max_valid_; } +double PPSAlignmentConfiguration::y_mode_sys_unc() const { return y_mode_sys_unc_; } +double PPSAlignmentConfiguration::chiSqThreshold() const { return chiSqThreshold_; } +double PPSAlignmentConfiguration::y_mode_unc_max_valid() const { return y_mode_unc_max_valid_; } +double PPSAlignmentConfiguration::y_mode_max_valid() const { return y_mode_max_valid_; } -double PPSAlignmentConfigRun3v1::minRPTracksSize() const { return minRPTracksSize_; } -double PPSAlignmentConfigRun3v1::maxRPTracksSize() const { return maxRPTracksSize_; } -double PPSAlignmentConfigRun3v1::n_si() const { return n_si_; } +double PPSAlignmentConfiguration::minRPTracksSize() const { return minRPTracksSize_; } +double PPSAlignmentConfiguration::maxRPTracksSize() const { return maxRPTracksSize_; } +double PPSAlignmentConfiguration::n_si() const { return n_si_; } -const std::map> - &PPSAlignmentConfigRun3v1::matchingReferencePoints() const { +const std::map> + &PPSAlignmentConfiguration::matchingReferencePoints() const { return matchingReferencePoints_; } -const std::map &PPSAlignmentConfigRun3v1::matchingShiftRanges() const { +const std::map &PPSAlignmentConfiguration::matchingShiftRanges() const { return matchingShiftRanges_; } -const std::map &PPSAlignmentConfigRun3v1::alignment_x_meth_o_ranges() const { +const std::map &PPSAlignmentConfiguration::alignment_x_meth_o_ranges() const { return alignment_x_meth_o_ranges_; } -unsigned int PPSAlignmentConfigRun3v1::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; } -unsigned int PPSAlignmentConfigRun3v1::fitProfileMinNReasonable() const { return fitProfileMinNReasonable_; } -unsigned int PPSAlignmentConfigRun3v1::methOGraphMinN() const { return methOGraphMinN_; } -double PPSAlignmentConfigRun3v1::methOUncFitRange() const { return methOUncFitRange_; } +unsigned int PPSAlignmentConfiguration::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; } +unsigned int PPSAlignmentConfiguration::fitProfileMinNReasonable() const { return fitProfileMinNReasonable_; } +unsigned int PPSAlignmentConfiguration::methOGraphMinN() const { return methOGraphMinN_; } +double PPSAlignmentConfiguration::methOUncFitRange() const { return methOUncFitRange_; } -const std::map &PPSAlignmentConfigRun3v1::alignment_x_relative_ranges() +const std::map &PPSAlignmentConfiguration::alignment_x_relative_ranges() const { return alignment_x_relative_ranges_; } -unsigned int PPSAlignmentConfigRun3v1::nearFarMinEntries() const { return nearFarMinEntries_; } +unsigned int PPSAlignmentConfiguration::nearFarMinEntries() const { return nearFarMinEntries_; } -const std::map &PPSAlignmentConfigRun3v1::alignment_y_ranges() const { +const std::map &PPSAlignmentConfiguration::alignment_y_ranges() const { return alignment_y_ranges_; } -unsigned int PPSAlignmentConfigRun3v1::modeGraphMinN() const { return modeGraphMinN_; } -unsigned int PPSAlignmentConfigRun3v1::multSelProjYMinEntries() const { return multSelProjYMinEntries_; } +unsigned int PPSAlignmentConfiguration::modeGraphMinN() const { return modeGraphMinN_; } +unsigned int PPSAlignmentConfiguration::multSelProjYMinEntries() const { return multSelProjYMinEntries_; } -const PPSAlignmentConfigRun3v1::Binning &PPSAlignmentConfigRun3v1::binning() const { return binning_; } +const PPSAlignmentConfiguration::Binning &PPSAlignmentConfiguration::binning() const { return binning_; } -// -------------------------------- PPSAlignmentConfigRun3v1 setters -------------------------------- +// -------------------------------- PPSAlignmentConfiguration setters -------------------------------- -void PPSAlignmentConfigRun3v1::setSectorConfig45(PPSAlignmentConfigRun3v1::SectorConfig §orConfig45) { +void PPSAlignmentConfiguration::setSectorConfig45(PPSAlignmentConfiguration::SectorConfig §orConfig45) { sectorConfig45_ = sectorConfig45; } -void PPSAlignmentConfigRun3v1::setSectorConfig56(PPSAlignmentConfigRun3v1::SectorConfig §orConfig56) { +void PPSAlignmentConfiguration::setSectorConfig56(PPSAlignmentConfiguration::SectorConfig §orConfig56) { sectorConfig56_ = sectorConfig56; } -void PPSAlignmentConfigRun3v1::setX_ali_sh_step(double x_ali_sh_step) { x_ali_sh_step_ = x_ali_sh_step; } +void PPSAlignmentConfiguration::setX_ali_sh_step(double x_ali_sh_step) { x_ali_sh_step_ = x_ali_sh_step; } -void PPSAlignmentConfigRun3v1::setY_mode_sys_unc(double y_mode_sys_unc) { y_mode_sys_unc_ = y_mode_sys_unc; } -void PPSAlignmentConfigRun3v1::setChiSqThreshold(double chiSqThreshold) { chiSqThreshold_ = chiSqThreshold; } -void PPSAlignmentConfigRun3v1::setY_mode_unc_max_valid(double y_mode_unc_max_valid) { +void PPSAlignmentConfiguration::setY_mode_sys_unc(double y_mode_sys_unc) { y_mode_sys_unc_ = y_mode_sys_unc; } +void PPSAlignmentConfiguration::setChiSqThreshold(double chiSqThreshold) { chiSqThreshold_ = chiSqThreshold; } +void PPSAlignmentConfiguration::setY_mode_unc_max_valid(double y_mode_unc_max_valid) { y_mode_unc_max_valid_ = y_mode_unc_max_valid; } -void PPSAlignmentConfigRun3v1::setY_mode_max_valid(double y_mode_max_valid) { y_mode_max_valid_ = y_mode_max_valid; } +void PPSAlignmentConfiguration::setY_mode_max_valid(double y_mode_max_valid) { y_mode_max_valid_ = y_mode_max_valid; } -void PPSAlignmentConfigRun3v1::setMinRPTracksSize(unsigned int minRPTracksSize) { minRPTracksSize_ = minRPTracksSize; } -void PPSAlignmentConfigRun3v1::setMaxRPTracksSize(unsigned int maxRPTracksSize) { maxRPTracksSize_ = maxRPTracksSize; } -void PPSAlignmentConfigRun3v1::setN_si(double n_si) { n_si_ = n_si; } +void PPSAlignmentConfiguration::setMinRPTracksSize(unsigned int minRPTracksSize) { minRPTracksSize_ = minRPTracksSize; } +void PPSAlignmentConfiguration::setMaxRPTracksSize(unsigned int maxRPTracksSize) { maxRPTracksSize_ = maxRPTracksSize; } +void PPSAlignmentConfiguration::setN_si(double n_si) { n_si_ = n_si; } -void PPSAlignmentConfigRun3v1::setMatchingReferencePoints( - std::map> &matchingReferencePoints) { +void PPSAlignmentConfiguration::setMatchingReferencePoints( + std::map> &matchingReferencePoints) { matchingReferencePoints_ = matchingReferencePoints; } -void PPSAlignmentConfigRun3v1::setMatchingShiftRanges( - std::map &matchingShiftRanges) { +void PPSAlignmentConfiguration::setMatchingShiftRanges( + std::map &matchingShiftRanges) { matchingShiftRanges_ = matchingShiftRanges; } -void PPSAlignmentConfigRun3v1::setAlignment_x_meth_o_ranges( - std::map &alignment_x_meth_o_ranges) { +void PPSAlignmentConfiguration::setAlignment_x_meth_o_ranges( + std::map &alignment_x_meth_o_ranges) { alignment_x_meth_o_ranges_ = alignment_x_meth_o_ranges; } -void PPSAlignmentConfigRun3v1::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) { +void PPSAlignmentConfiguration::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) { fitProfileMinBinEntries_ = fitProfileMinBinEntries; } -void PPSAlignmentConfigRun3v1::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) { +void PPSAlignmentConfiguration::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) { fitProfileMinNReasonable_ = fitProfileMinNReasonable; } -void PPSAlignmentConfigRun3v1::setMethOGraphMinN(unsigned int methOGraphMinN) { methOGraphMinN_ = methOGraphMinN; } -void PPSAlignmentConfigRun3v1::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; } +void PPSAlignmentConfiguration::setMethOGraphMinN(unsigned int methOGraphMinN) { methOGraphMinN_ = methOGraphMinN; } +void PPSAlignmentConfiguration::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; } -void PPSAlignmentConfigRun3v1::setAlignment_x_relative_ranges( - std::map &alignment_x_relative_ranges) { +void PPSAlignmentConfiguration::setAlignment_x_relative_ranges( + std::map &alignment_x_relative_ranges) { alignment_x_relative_ranges_ = alignment_x_relative_ranges; } -void PPSAlignmentConfigRun3v1::setNearFarMinEntries(unsigned int nearFarMinEntries) { +void PPSAlignmentConfiguration::setNearFarMinEntries(unsigned int nearFarMinEntries) { nearFarMinEntries_ = nearFarMinEntries; } -void PPSAlignmentConfigRun3v1::setAlignment_y_ranges( - std::map &alignment_y_ranges) { +void PPSAlignmentConfiguration::setAlignment_y_ranges( + std::map &alignment_y_ranges) { alignment_y_ranges_ = alignment_y_ranges; } -void PPSAlignmentConfigRun3v1::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; } -void PPSAlignmentConfigRun3v1::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) { +void PPSAlignmentConfiguration::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; } +void PPSAlignmentConfiguration::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) { multSelProjYMinEntries_ = multSelProjYMinEntries; } -void PPSAlignmentConfigRun3v1::setBinning(PPSAlignmentConfigRun3v1::Binning &binning) { binning_ = binning; } +void PPSAlignmentConfiguration::setBinning(PPSAlignmentConfiguration::Binning &binning) { binning_ = binning; } // -------------------------------- << operators -------------------------------- -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::RPConfig &rc) { +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::RPConfig &rc) { os << std::fixed << std::setprecision(3); os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n"; os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n"; @@ -134,7 +134,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::RPCon return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::SectorConfig &sc) { +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::SectorConfig &sc) { os << std::fixed << std::setprecision(3); os << sc.name_ << ":\n"; os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n"; @@ -148,7 +148,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Secto return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Binning &b) { +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Binning &b) { os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n"; os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n"; os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_ << "\n"; @@ -165,7 +165,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1::Binni return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfigRun3v1 &c) { +std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c) { os << "* " << c.sectorConfig45_ << "\n\n"; os << "* " << c.sectorConfig56_ << "\n\n"; diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc deleted file mode 100644 index a2c3735343df6..0000000000000 --- a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfigRun3v1.cc +++ /dev/null @@ -1,4 +0,0 @@ -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" -#include "FWCore/Utilities/interface/typelookup.h" - -TYPELOOKUP_DATA_REG(PPSAlignmentConfigRun3v1); diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..66ce70016939b --- /dev/null +++ b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(PPSAlignmentConfiguration); diff --git a/CondFormats/PPSObjects/src/classes_def.xml b/CondFormats/PPSObjects/src/classes_def.xml index 174f172cfdf3f..30b9cabd974ff 100644 --- a/CondFormats/PPSObjects/src/classes_def.xml +++ b/CondFormats/PPSObjects/src/classes_def.xml @@ -81,16 +81,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/CondFormats/PPSObjects/src/headers.h b/CondFormats/PPSObjects/src/headers.h index e000d3ad82f65..bfc516c9e2727 100644 --- a/CondFormats/PPSObjects/src/headers.h +++ b/CondFormats/PPSObjects/src/headers.h @@ -5,7 +5,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsDataSequence.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSet.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" diff --git a/CondFormats/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index 3770da1b7308d..ad9fcb974a153 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -14,6 +14,6 @@ - + diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc deleted file mode 100644 index 28ef21f611fe0..0000000000000 --- a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfigRun3v1.cc +++ /dev/null @@ -1,17 +0,0 @@ -#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/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..092c293844946 --- /dev/null +++ b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.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/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc similarity index 50% rename from CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc rename to CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc index f30e0119e4e1f..069f9b6701992 100644 --- a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfigRun3v1.cc +++ b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc @@ -14,29 +14,29 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" #include -class RetrievePPSAlignmentConfigRun3v1 : public edm::one::EDAnalyzer<> { +class RetrievePPSAlignmentConfiguration : public edm::one::EDAnalyzer<> { public: - explicit RetrievePPSAlignmentConfigRun3v1(const edm::ParameterSet &); + explicit RetrievePPSAlignmentConfiguration(const edm::ParameterSet &); private: void analyze(const edm::Event &, const edm::EventSetup &) override; - edm::ESGetToken esToken_; + edm::ESGetToken esToken_; }; -RetrievePPSAlignmentConfigRun3v1::RetrievePPSAlignmentConfigRun3v1(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} +RetrievePPSAlignmentConfiguration::RetrievePPSAlignmentConfiguration(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} -void RetrievePPSAlignmentConfigRun3v1::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { +void RetrievePPSAlignmentConfiguration::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // get the data - const auto &ppsAlignmentConfigRun3v1 = iSetup.getData(esToken_); + const auto &ppsAlignmentConfiguration = iSetup.getData(esToken_); - edm::LogInfo("PPS") << ppsAlignmentConfigRun3v1; + edm::LogInfo("PPS") << ppsAlignmentConfiguration; } //define this as a plug-in -DEFINE_FWK_MODULE(RetrievePPSAlignmentConfigRun3v1); +DEFINE_FWK_MODULE(RetrievePPSAlignmentConfiguration); diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc similarity index 51% rename from CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc rename to CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc index ac4792687217e..387ec812d0bb6 100644 --- a/CondTools/CTPPS/plugins/WritePPSAlignmentConfigRun3v1.cc +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc @@ -15,37 +15,37 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfigRun3v1.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRun3v1Rcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" #include -class WritePPSAlignmentConfigRun3v1 : public edm::one::EDAnalyzer<> { +class WritePPSAlignmentConfiguration : public edm::one::EDAnalyzer<> { public: - explicit WritePPSAlignmentConfigRun3v1(const edm::ParameterSet &); + explicit WritePPSAlignmentConfiguration(const edm::ParameterSet &); private: void analyze(const edm::Event &, const edm::EventSetup &) override; - edm::ESGetToken esToken_; + edm::ESGetToken esToken_; }; -WritePPSAlignmentConfigRun3v1::WritePPSAlignmentConfigRun3v1(const edm::ParameterSet &iConfig) - : esToken_(esConsumes( +WritePPSAlignmentConfiguration::WritePPSAlignmentConfiguration(const edm::ParameterSet &iConfig) + : esToken_(esConsumes( edm::ESInputTag("", iConfig.getParameter("label")))) {} -void WritePPSAlignmentConfigRun3v1::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { +void WritePPSAlignmentConfiguration::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // get the data - const auto &ppsAlignmentConfigRun3v1 = iSetup.getData(esToken_); + const auto &ppsAlignmentConfiguration = iSetup.getData(esToken_); // store the data in a DB object edm::Service poolDbService; if (poolDbService.isAvailable()) { - poolDbService->writeOne(&ppsAlignmentConfigRun3v1, poolDbService->currentTime(), "PPSAlignmentConfigRun3v1Rcd"); + poolDbService->writeOne(&ppsAlignmentConfiguration, poolDbService->currentTime(), "PPSAlignmentConfigurationRcd"); } else { - throw cms::Exception("WritePPSAlignmentConfigRun3v1") << "PoolDBService required."; + throw cms::Exception("WritePPSAlignmentConfiguration") << "PoolDBService required."; } } //define this as a plug-in -DEFINE_FWK_MODULE(WritePPSAlignmentConfigRun3v1); +DEFINE_FWK_MODULE(WritePPSAlignmentConfiguration); diff --git a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py similarity index 74% rename from CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py rename to CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py index 77199b0f0d6d7..2a9d3ddc5b1d3 100644 --- a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfigRun3v1_cfg.py +++ b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py @@ -1,24 +1,24 @@ ##### configuration ##### input_conditions = 'sqlite_file:alignment_config.db' # input database run_number = 1 # used to select the IOV -db_tag = 'PPSAlignmentConfigRun3v1_v1_express' # database tag +db_tag = 'PPSAlignmentConfiguration_v1_express' # database tag ######################### import FWCore.ParameterSet.Config as cms -process = cms.Process("retrievePPSAlignmentConfigRun3v1") +process = cms.Process("retrievePPSAlignmentConfiguration") # Message Logger process.MessageLogger = cms.Service("MessageLogger", - destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfigRun3v1'), - retrieve_PPSAlignmentConfigRun3v1 = cms.untracked.PSet( + destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfiguration'), + retrieve_PPSAlignmentConfiguration = 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 @@ -35,16 +35,16 @@ process.CondDB, DumbStat = cms.untracked.bool(True), toGet = cms.VPSet(cms.PSet( - record = cms.string('PPSAlignmentConfigRun3v1Rcd'), + record = cms.string('PPSAlignmentConfigurationRcd'), tag = cms.string(db_tag) )) ) # DB object retrieve module -process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfigRun3v1", +process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfiguration", toGet = cms.VPSet(cms.PSet( - record = cms.string('PPSAlignmentConfigRun3v1Rcd'), - data = cms.vstring('PPSAlignmentConfigRun3v1') + record = cms.string('PPSAlignmentConfigurationRcd'), + data = cms.vstring('PPSAlignmentConfiguration') )), verbose = cms.untracked.bool(True) ) diff --git a/CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py similarity index 77% rename from CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py rename to CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py index 7335233e988a0..81a55a4c05326 100644 --- a/CondTools/CTPPS/test/write_PPSAlignmentConfigRun3v1_cfg.py +++ b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py @@ -1,7 +1,7 @@ ##### configuration ##### output_conditions = 'sqlite_file:alignment_config.db' # output database run_number = 1 # beginning of the IOV -db_tag = 'PPSAlignmentConfigRun3v1_v1_express' # database tag +db_tag = 'PPSAlignmentConfiguration_v1_express' # database tag produce_logs = True # if set to True, a file with logs will be produced. product_instance_label = 'db_test' # ES product label # ESSource parameters can be configured below @@ -9,15 +9,15 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("writePPSAlignmentConfigRun3v1") +process = cms.Process("writePPSAlignmentConfiguration") # Message Logger if produce_logs: process.MessageLogger = cms.Service("MessageLogger", - destinations = cms.untracked.vstring('write_PPSAlignmentConfigRun3v1', + destinations = cms.untracked.vstring('write_PPSAlignmentConfiguration', 'cout' ), - write_PPSAlignmentConfigRun3v1 = cms.untracked.PSet( + write_PPSAlignmentConfiguration = cms.untracked.PSet( threshold = cms.untracked.string('INFO') ), cout = cms.untracked.PSet( @@ -51,14 +51,14 @@ process.CondDB, timetype = cms.untracked.string('runnumber'), toPut = cms.VPSet(cms.PSet( - record = cms.string('PPSAlignmentConfigRun3v1Rcd'), + record = cms.string('PPSAlignmentConfigurationRcd'), tag = cms.string(db_tag) )) ) # ESSource -process.ppsAlignmentConfigRun3v1ESSource = cms.ESSource("PPSAlignmentConfigRun3v1ESSource", - # PPSAlignmentConfigRun3v1ESSource parameters, defaults will be taken from fillDescriptions +process.ppsAlignmentConfigurationESSource = cms.ESSource("PPSAlignmentConfigurationESSource", + # PPSAlignmentConfigurationESSource parameters, defaults will be taken from fillDescriptions label = cms.string(product_instance_label), sector_45 = cms.PSet( rp_N = cms.PSet( @@ -76,8 +76,8 @@ ) # DB object maker -process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfigRun3v1", - record = cms.string('PPSAlignmentConfigRun3v1Rcd'), +process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfiguration", + record = cms.string('PPSAlignmentConfigurationRcd'), loggingOn = cms.untracked.bool(True), SinceAppendMode = cms.bool(True), Source = cms.PSet( From e080d1feede5dcc785bfb273535b40860eafe8ba Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 1 Sep 2021 14:57:09 -0500 Subject: [PATCH 300/923] Extend L1T CSC DQM with option for ME4/2 and ME2/1 test stand --- DQM/L1TMonitor/interface/L1TdeCSCTPG.h | 7 +- DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py | 4 +- DQM/L1TMonitor/src/L1TdeCSCTPG.cc | 108 ++++++++++++++---- .../interface/L1TdeCSCTPGClient.h | 5 +- DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc | 24 +++- .../CSCCommissioning/src/CSCFileReader.h | 4 +- .../test/readFile_b904_Run3.py | 38 ++++-- .../test/CSCTriggerPrimitivesAnalyzer.cc | 14 ++- .../test/runCSCL1TDQMClient_cfg.py | 8 +- .../runCSCTriggerPrimitiveAnalyzer_cfg.py | 17 ++- .../runCSCTriggerPrimitiveProducer_cfg.py | 11 +- 11 files changed, 186 insertions(+), 54 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TdeCSCTPG.h b/DQM/L1TMonitor/interface/L1TdeCSCTPG.h index 9d45e16b63b23..2f1e0bc0918e5 100644 --- a/DQM/L1TMonitor/interface/L1TdeCSCTPG.h +++ b/DQM/L1TMonitor/interface/L1TdeCSCTPG.h @@ -61,9 +61,12 @@ class L1TdeCSCTPG : public DQMEDAnalyzer { /* When set to True, we assume that the data comes from the Building 904 CSC test-stand. This test-stand is a single - ME1/1 chamber. + ME1/1 chamber or ME4/2 chamber. */ - bool B904Setup_; + bool useB904_; + bool useB904ME11_; + bool useB904ME21_; + bool useB904ME234s2_; bool isRun3_; diff --git a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py index 0e5980f5513ac..c7c91ecc0f514 100644 --- a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py @@ -28,7 +28,9 @@ lctNBin = cms.vuint32(16, 116, 224, 16, 2, 448, 896, 5, 16, 2, 2), lctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), lctMaxBin = cms.vdouble(16, 116, 224, 16, 2, 448, 896, 5, 16, 2, 2), - B904Setup = cms.bool(False), + useB904ME11 = cms.bool(False), + useB904ME21 = cms.bool(False), + useB904ME234s2 = cms.bool(False), isRun3 = cms.bool(False), preTriggerAnalysis = cms.bool(False) ) diff --git a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc index 0fce802af66b2..f0f7e0f9e4970 100644 --- a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc +++ b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc @@ -30,9 +30,13 @@ L1TdeCSCTPG::L1TdeCSCTPG(const edm::ParameterSet& ps) alctMaxBin_(ps.getParameter>("alctMaxBin")), clctMaxBin_(ps.getParameter>("clctMaxBin")), lctMaxBin_(ps.getParameter>("lctMaxBin")), - B904Setup_(ps.getParameter("B904Setup")), + useB904ME11_(ps.getParameter("useB904ME11")), + useB904ME21_(ps.getParameter("useB904ME21")), + useB904ME234s2_(ps.getParameter("useB904ME234s2")), isRun3_(ps.getParameter("isRun3")), - preTriggerAnalysis_(ps.getParameter("preTriggerAnalysis")) {} + preTriggerAnalysis_(ps.getParameter("preTriggerAnalysis")) { + useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_; +} L1TdeCSCTPG::~L1TdeCSCTPG() {} @@ -45,10 +49,23 @@ void L1TdeCSCTPG::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run&, co lctVars_.resize(5); } - // remove the non-ME1/1 chambers from the list when B904Setup is set to true - if (B904Setup_) { + // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true + if (useB904ME11_) { + chambers_.resize(1); + } + // similar for ME2/1 + else if (useB904ME21_) { + auto temp = chambers_[3]; + chambers_.resize(1); + chambers_[0] = temp; + } + // similar for ME4/2 + else if (useB904ME234s2_) { + auto temp = chambers_.back(); chambers_.resize(1); + chambers_[0] = temp; } + // do not analyze the 1/4-strip bit, 1/8-strip bit else { clctVars_.resize(9); @@ -109,15 +126,23 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { e.getByToken(dataLCT_token_, dataLCTs); e.getByToken(emulLCT_token_, emulLCTs); // only do pre-trigger analysis when B904 setup is used - if (B904Setup_) + if (useB904_) e.getByToken(emulpreCLCT_token_, emulpreCLCTs); for (auto it = dataALCTs->begin(); it != dataALCTs->end(); it++) { auto range = dataALCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto alct = range.first; alct != range.second; alct++) { if (alct->isValid()) { chamberHistos[type]["alct_quality_data"]->Fill(alct->getQuality()); @@ -129,10 +154,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulALCTs->begin(); it != emulALCTs->end(); it++) { auto range = emulALCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto alct = range.first; alct != range.second; alct++) { if (alct->isValid()) { chamberHistos[type]["alct_quality_emul"]->Fill(alct->getQuality()); @@ -148,10 +181,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = dataCLCTs->begin(); it != dataCLCTs->end(); it++) { auto range = dataCLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto clct = range.first; clct != range.second; clct++) { if (clct->isValid()) { if (preTriggerAnalysis_) { @@ -167,7 +208,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_eighthstrip_data"]->Fill(clct->getKeyStrip(8)); chamberHistos[type]["clct_slope_data"]->Fill(clct->getSlope()); chamberHistos[type]["clct_compcode_data"]->Fill(clct->getCompCode()); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["clct_quartstripbit_data"]->Fill(clct->getQuartStripBit()); chamberHistos[type]["clct_eighthstripbit_data"]->Fill(clct->getEighthStripBit()); } @@ -178,10 +219,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulCLCTs->begin(); it != emulCLCTs->end(); it++) { auto range = emulCLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; // remove the duplicate CLCTs // these are CLCTs that have the same properties as CLCTs found // before by the emulator, except for the BX, which is off by +1 @@ -205,7 +254,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct.getKeyStrip(8)); chamberHistos[type]["clct_slope_emul"]->Fill(clct.getSlope()); chamberHistos[type]["clct_compcode_emul"]->Fill(clct.getCompCode()); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct.getQuartStripBit()); chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct.getEighthStripBit()); } @@ -234,10 +283,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = dataLCTs->begin(); it != dataLCTs->end(); it++) { auto range = dataLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto lct = range.first; lct != range.second; lct++) { if (lct->isValid()) { chamberHistos[type]["lct_pattern_data"]->Fill(lct->getPattern()); @@ -250,7 +307,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_slope_data"]->Fill(lct->getSlope()); chamberHistos[type]["lct_quartstrip_data"]->Fill(lct->getStrip(4)); chamberHistos[type]["lct_eighthstrip_data"]->Fill(lct->getStrip(8)); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["lct_quartstripbit_data"]->Fill(lct->getQuartStripBit()); chamberHistos[type]["lct_eighthstripbit_data"]->Fill(lct->getEighthStripBit()); } @@ -261,11 +318,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulLCTs->begin(); it != emulLCTs->end(); it++) { auto range = emulLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) continue; - + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; // remove the duplicate LCTs // these are LCTs that have the same properties as LCTs found // before by the emulator, except for the BX, which is off by +1 @@ -287,7 +351,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_slope_emul"]->Fill(lct.getSlope()); chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct.getStrip(4)); chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct.getStrip(8)); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct.getQuartStripBit()); chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct.getEighthStripBit()); } diff --git a/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h b/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h index dad9dced6b1a7..4f5a2cdbc7870 100644 --- a/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h +++ b/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h @@ -53,7 +53,10 @@ class L1TdeCSCTPGClient : public DQMEDHarvester { the Building 904 CSC test-stand. This test-stand is a single ME1/1 chamber. */ - bool B904Setup_; + bool useB904_; + bool useB904ME11_; + bool useB904ME21_; + bool useB904ME234s2_; bool isRun3_; diff --git a/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc b/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc index 9240368f9026c..7e724d9919d44 100644 --- a/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc +++ b/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc @@ -27,8 +27,12 @@ L1TdeCSCTPGClient::L1TdeCSCTPGClient(const edm::ParameterSet &ps) alctMaxBin_(ps.getParameter>("alctMaxBin")), clctMaxBin_(ps.getParameter>("clctMaxBin")), lctMaxBin_(ps.getParameter>("lctMaxBin")), - B904Setup_(ps.getParameter("B904Setup")), - isRun3_(ps.getParameter("isRun3")) {} + useB904ME11_(ps.getParameter("useB904ME11")), + useB904ME21_(ps.getParameter("useB904ME21")), + useB904ME234s2_(ps.getParameter("useB904ME234s2")), + isRun3_(ps.getParameter("isRun3")) { + useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_; +} L1TdeCSCTPGClient::~L1TdeCSCTPGClient() {} @@ -55,9 +59,21 @@ void L1TdeCSCTPGClient::book(DQMStore::IBooker &iBooker) { lctVars_.resize(5); } - // remove the non-ME1/1 chambers from the list when B904Setup is set to true - if (B904Setup_) { + // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true + if (useB904ME11_) { + chambers_.resize(1); + } + // similar for ME2/1 + else if (useB904ME21_) { + auto temp = chambers_[3]; + chambers_.resize(1); + chambers_[0] = temp; + } + // similar for ME4/2 + else if (useB904ME234s2_) { + auto temp = chambers_.back(); chambers_.resize(1); + chambers_[0] = temp; } // do not analyze the 1/4-strip bit, 1/8-strip bit else { diff --git a/IORawData/CSCCommissioning/src/CSCFileReader.h b/IORawData/CSCCommissioning/src/CSCFileReader.h index 2a599dac02b5d..5629a28816683 100644 --- a/IORawData/CSCCommissioning/src/CSCFileReader.h +++ b/IORawData/CSCCommissioning/src/CSCFileReader.h @@ -1,7 +1,7 @@ #ifndef CSCFileReader_h #define CSCFileReader_h -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Provenance/interface/EventID.h" @@ -15,7 +15,7 @@ #include "FileReaderDDU.h" #include "FileReaderDCC.h" -class CSCFileReader : public edm::EDProducer { +class CSCFileReader : public edm::stream::EDProducer<> { private: std::vector fileNames[40]; std::vector::const_iterator currentFile[40]; diff --git a/IORawData/CSCCommissioning/test/readFile_b904_Run3.py b/IORawData/CSCCommissioning/test/readFile_b904_Run3.py index 713a936e5042c..5133d32c7a84f 100644 --- a/IORawData/CSCCommissioning/test/readFile_b904_Run3.py +++ b/IORawData/CSCCommissioning/test/readFile_b904_Run3.py @@ -13,6 +13,9 @@ options.register ("firstRun", 341761, VarParsing.multiplicity.singleton, VarParsing.varType.int) options.register ("inputFilesGEM", "", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.register ("readGEMData", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME234s2", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.maxEvents = 10000 options.parseArguments() @@ -50,18 +53,39 @@ ) ) -# Note by Sven Dildick: I had to change the CSC producer module name to process.rawDataCollectorCSC so -# that the name would not conflict with the GEM source. - # For B904 setup ME11 chamber, which corresponds to ME+1/1/02 in the production system mapping # changing to FED837 and RUI16 could let to pass data without disabling mapping consistency check unpacking flags +if options.useB904ME11: + FEDRUI = cms.PSet( + FED846 = cms.untracked.vstring('RUI01'), + RUI01 = cms.untracked.vstring(options.inputFiles[0]) + ) +# Please note that after passing mapping check this chamber still would be recognized as production chamber +# ME+2/2/03, which is OK, because this is the same chamber type as ME42 hardware-wise. +elif options.useB904ME21: + FEDRUI = cms.PSet( + FED839 = cms.untracked.vstring('RUI18'), + RUI18 = cms.untracked.vstring(options.inputFiles[0]) + ) +# For B904 setup ME21 chamber, which corresponds to ME+2/1/03 VMECrate13 / DMBSlot2 RUI17 / FED838 in the production system mapping +elif options.useB904ME234s2: + FEDRUI = cms.PSet( + FED838 = cms.untracked.vstring('RUI16'), + RUI17 = cms.untracked.vstring(options.inputFiles[0]) + ) +## default case +else: + FEDRUI = cms.PSet( + FED837 = cms.untracked.vstring('RUI16'), + RUI16 = cms.untracked.vstring('/afs/cern.ch/user/b/barvic/public/cscgem_tests/csc_00000001_EmuRUI01_Local_000_210519_162820_UTC.raw') + ) + +# Note by Sven Dildick: I had to change the CSC producer module name to process.rawDataCollectorCSC so +# that the name would not conflict with the GEM source. process.rawDataCollectorCSC = cms.EDProducer( 'CSCFileReader', + FEDRUI, firstEvent = cms.untracked.int32(0), - FED846 = cms.untracked.vstring('RUI01'), - RUI01 = cms.untracked.vstring(options.inputFiles[0]) - # FED837 = cms.untracked.vstring('RUI16'), - # RUI16 = cms.untracked.vstring('/afs/cern.ch/user/b/barvic/public/cscgem_tests/csc_00000001_EmuRUI01_Local_000_210519_162820_UTC.raw') ) process.FEVT = cms.OutputModule( diff --git a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc index 86f7cce533b1b..81c6a3ec18965 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc @@ -79,7 +79,10 @@ class CSCTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer("dataVsEmulatorPlots")), mcEfficiencyPlots_(conf.getParameter("mcEfficiencyPlots")), mcResolutionPlots_(conf.getParameter("mcResolutionPlots")), - B904Setup_(conf.getParameter("B904Setup")), + useB904ME11_(conf.getParameter("useB904ME11")), + useB904ME21_(conf.getParameter("useB904ME21")), + useB904ME234s2_(conf.getParameter("useB904ME234s2")), B904RunNumber_(conf.getParameter("B904RunNumber")) { usesResource("TFileService"); + useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_; } void CSCTriggerPrimitivesAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &setup) { @@ -134,7 +140,7 @@ void CSCTriggerPrimitivesAnalyzer::makeDataVsEmulatorPlots() { } TString runTitle = "CMS_Run_" + std::to_string(runNumber_); - if (B904Setup_) + if (useB904_) runTitle = "B904_Cosmic_Run_" + TString(B904RunNumber_); TPostScript *ps = new TPostScript("CSC_dataVsEmul_" + runTitle + ".ps", 111); @@ -226,7 +232,7 @@ void CSCTriggerPrimitivesAnalyzer::makePlot(TH1F *dataMon, ps->NewPage(); TString runTitle = "(CMS Run " + std::to_string(runNumber_) + ")"; - if (B904Setup_) + if (useB904_) runTitle = "(B904 Cosmic Run " + TString(B904RunNumber_) + ")"; const TString title(chamber + " " + lcts + " " + var + " " + runTitle); c1->cd(1); diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQMClient_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQMClient_cfg.py index a9120bc6da36b..12b0553346b79 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQMClient_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQMClient_cfg.py @@ -6,7 +6,9 @@ options = VarParsing('analysis') options.register ("run3", True, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("mc", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("useB904Data", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME234s2", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("useGEMs", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.parseArguments() options.inputFiles = "file:step_DQM.root" @@ -52,7 +54,9 @@ if options.run3: process.GlobalTag = GlobalTag(process.GlobalTag, '112X_dataRun3_Prompt_v5', '') -process.l1tdeCSCTPGClient.B904Setup = options.useB904Data +process.l1tdeCSCTPGClient.useB904ME11 = options.useB904ME11 +process.l1tdeCSCTPGClient.useB904ME21 = options.useB904ME21 +process.l1tdeCSCTPGClient.useB904ME234s2 = options.useB904ME234s2 ## schedule and path definition process.dqmsequence = cms.Sequence(process.l1tdeCSCTPGClient) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py index ecee2a5a709e0..47bf9adf6f662 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py @@ -9,19 +9,22 @@ options.register ("analyzeResolution", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("dataVsEmulationFile", "empty", VarParsing.multiplicity.singleton, VarParsing.varType.string) """ -- For CMS runs, use the actual run number. Set B904Setup to False -- For B904 runs, set B904Setup to True and set runNumber >= 341761. +- For CMS runs, use the actual run number. Set useB904ME11, useB904ME21 or useB904ME234s2 to False +- For B904 runs, set useB904ME11, useB904ME21 or useB904ME234s2 to True and set runNumber >= 341761. Set B904RunNumber to when the data was taken, e.g. 210519_162820. """ options.register ("runNumber", 0, VarParsing.multiplicity.singleton, VarParsing.varType.int) -options.register ("B904Setup", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME234s2", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("B904RunNumber", "YYMMDD_HHMMSS", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.parseArguments() -if options.B904Setup and options.B904RunNumber == "YYMMDD_HHMMSS": +B904Setup = options.useB904ME11 or options.useB904ME21 or options.useB904ME234s2 +if B904Setup and options.B904RunNumber == "YYMMDD_HHMMSS": sys.exit("B904 setup was selected. Please provide a valid Run Number") -if (not options.B904Setup) and int(options.runNumber) == 0: +if (not B904Setup) and int(options.runNumber) == 0: sys.exit("Please provide a valid CMS Run Number") process = cms.Process("ANALYSIS", Run3) @@ -63,6 +66,8 @@ ) # this needs to be set here, otherwise we duplicate the B904Setup parameter -process.cscTriggerPrimitivesAnalyzer.B904Setup = options.B904Setup +process.cscTriggerPrimitivesAnalyzer.useB904ME11 = options.useB904ME11 +process.cscTriggerPrimitivesAnalyzer.useB904ME21 = options.useB904ME21 +process.cscTriggerPrimitivesAnalyzer.useB904ME234s2 = options.useB904ME234s2 process.p = cms.Path(process.cscTriggerPrimitivesAnalyzer) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py index 5aa22b8df029d..1cd991ce2e289 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py @@ -11,7 +11,9 @@ options.register ("mc", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("dqm", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("dqmGEM", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("useB904Data", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("useB904ME234s2", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("run3", True, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("runCCLUT", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("runME11ILT", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) @@ -77,7 +79,8 @@ process.cscTriggerPrimitiveDigis.CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi" ## unpacker -if options.useB904Data: +useB904Data = options.useB904ME11 or options.useB904ME21 or options.useB904ME234s2 +if useB904Data: ## CSC process.muonCSCDigis.DisableMappingCheck = True process.muonCSCDigis.B904Setup = True @@ -105,7 +108,9 @@ ## DQM monitor if options.dqm: - process.l1tdeCSCTPG.B904Setup = options.useB904Data + process.l1tdeCSCTPG.useB904ME11 = options.useB904ME11 + process.l1tdeCSCTPG.useB904ME21 = options.useB904ME21 + process.l1tdeCSCTPG.useB904ME234s2 = options.useB904ME234s2 process.l1tdeCSCTPG.emulALCT = "cscTriggerPrimitiveDigis" process.l1tdeCSCTPG.emulCLCT = "cscTriggerPrimitiveDigis" process.l1tdeCSCTPG.emulLCT = "cscTriggerPrimitiveDigis:MPCSORTED" From 0017f58a18ecf7b24078dc732a5efe55ac4e209f Mon Sep 17 00:00:00 2001 From: Salavat Date: Wed, 1 Sep 2021 22:09:06 +0200 Subject: [PATCH 301/923] update moving fix from .cc to .h --- DataFormats/CaloTowers/interface/CaloTower.h | 4 +-- DataFormats/CaloTowers/src/CaloTower.cc | 27 +++----------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/DataFormats/CaloTowers/interface/CaloTower.h b/DataFormats/CaloTowers/interface/CaloTower.h index 88975ce2cc6b5..acb100fbf77df 100644 --- a/DataFormats/CaloTowers/interface/CaloTower.h +++ b/DataFormats/CaloTowers/interface/CaloTower.h @@ -229,8 +229,8 @@ class CaloTower : public reco::LeafCandidate { GlobalPoint hadPosition_; //hcal subdetector info - HcalSubdetector subdet_; - bool inHO_, inHBHEgap_; + HcalSubdetector subdet_{HcalEmpty}; + bool inHO_{false}, inHBHEgap_{false}; // time int ecalTime_; diff --git a/DataFormats/CaloTowers/src/CaloTower.cc b/DataFormats/CaloTowers/src/CaloTower.cc index d62e497a36c92..cb9c3eb6db4ca 100644 --- a/DataFormats/CaloTowers/src/CaloTower.cc +++ b/DataFormats/CaloTowers/src/CaloTower.cc @@ -6,9 +6,6 @@ CaloTower::CaloTower() { outerE_ = 0; emLvl1_ = 0; hadLvl1_ = 0; - subdet_ = HcalEmpty; - inHO_ = false; - inHBHEgap_ = false; } CaloTower::CaloTower(const CaloTowerDetId& id, @@ -28,11 +25,7 @@ CaloTower::CaloTower(const CaloTowerDetId& id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) { - subdet_ = HcalEmpty; - inHO_ = false; - inHBHEgap_ = false; -} + hadLvl1_(hcal_tp) {} CaloTower::CaloTower(const CaloTowerDetId& id, double emE, @@ -51,11 +44,7 @@ CaloTower::CaloTower(const CaloTowerDetId& id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) { - subdet_ = HcalEmpty; - inHO_ = false; - inHBHEgap_ = false; -} + hadLvl1_(hcal_tp) {} CaloTower::CaloTower(CaloTowerDetId id, float emE, @@ -76,11 +65,7 @@ CaloTower::CaloTower(CaloTowerDetId id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) { - subdet_ = HcalEmpty; - inHO_ = false; - inHBHEgap_ = false; -} + hadLvl1_(hcal_tp) {} CaloTower::CaloTower(CaloTowerDetId id, float emE, @@ -101,11 +86,7 @@ CaloTower::CaloTower(CaloTowerDetId id, hadE_(hadE), outerE_(outerE), emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) { - subdet_ = HcalEmpty; - inHO_ = false; - inHBHEgap_ = false; -} + hadLvl1_(hcal_tp) {} // recalculated momentum-related quantities wrt user provided vertex Z position From 1df0f46b8062bef03dd97183df4b0e9f4edbc0df Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 1 Sep 2021 14:17:50 -0500 Subject: [PATCH 302/923] Created edm::bit_cast This will be replaced with std::bit_cast when available. --- DataFormats/Math/interface/libminifloat.h | 38 +++++++++-------------- FWCore/Utilities/interface/bit_cast.h | 36 +++++++++++++++++++++ 2 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 FWCore/Utilities/interface/bit_cast.h diff --git a/DataFormats/Math/interface/libminifloat.h b/DataFormats/Math/interface/libminifloat.h index c4db7de47d3af..14c88c3def68e 100644 --- a/DataFormats/Math/interface/libminifloat.h +++ b/DataFormats/Math/interface/libminifloat.h @@ -1,10 +1,10 @@ #ifndef libminifloat_h #define libminifloat_h #include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "FWCore/Utilities/interface/bit_cast.h" #include #include #include -#include // ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf class MiniFloatConverter { @@ -12,17 +12,17 @@ class MiniFloatConverter { MiniFloatConverter(); inline static float float16to32(uint16_t h) { uint32_t i32 = mantissatable[offsettable[h >> 10] + (h & 0x3ff)] + exponenttable[h >> 10]; - return bit_cast(i32); + return edm::bit_cast(i32); } inline static uint16_t float32to16(float x) { return float32to16round(x); } /// Fast implementation, but it crops the number so it biases low inline static uint16_t float32to16crop(float x) { - uint32_t i32 = bit_cast(x); + uint32_t i32 = edm::bit_cast(x); return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >> shifttable[(i32 >> 23) & 0x1ff]); } /// Slower implementation, but it rounds to avoid biases inline static uint16_t float32to16round(float x) { - uint32_t i32 = bit_cast(x); + uint32_t i32 = edm::bit_cast(x); uint8_t shift = shifttable[(i32 >> 23) & 0x1ff]; if (shift == 13) { uint16_t base2 = (i32 & 0x007fffff) >> 12; @@ -38,15 +38,15 @@ class MiniFloatConverter { inline static float reduceMantissaToNbits(const float &f) { static_assert(bits <= 23, "max mantissa size is 23 bits"); constexpr uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - uint32_t i32 = bit_cast(f); + uint32_t i32 = edm::bit_cast(f); i32 &= mask; - return bit_cast(i32); + return edm::bit_cast(i32); } inline static float reduceMantissaToNbits(const float &f, int bits) { uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - uint32_t i32 = bit_cast(f); + uint32_t i32 = edm::bit_cast(f); i32 &= mask; - return bit_cast(i32); + return edm::bit_cast(i32); } class ReduceMantissaToNbitsRounding { @@ -58,7 +58,7 @@ class MiniFloatConverter { float operator()(float f) const { constexpr uint32_t low23 = (0x007FFFFF); // mask to keep lowest 23 bits = mantissa constexpr uint32_t hi9 = (0xFF800000); // mask to keep highest 9 bits = the rest - uint32_t i32 = bit_cast(f); + uint32_t i32 = edm::bit_cast(f); if (i32 & test) { // need to round uint32_t mantissa = (i32 & low23) >> shift; if (mantissa < maxn) @@ -67,7 +67,7 @@ class MiniFloatConverter { } else { i32 &= mask; } - return bit_cast(i32); + return edm::bit_cast(i32); } private: @@ -92,7 +92,7 @@ class MiniFloatConverter { inline static float max() { constexpr uint32_t i32 = 0x477fe000; // = mantissatable[offsettable[0x1e]+0x3ff]+exponenttable[0x1e] - return bit_cast(i32); + return edm::bit_cast(i32); } // Maximum float32 value that gets rounded to max() @@ -100,12 +100,12 @@ class MiniFloatConverter { // 2^16 in float32 is the first to result inf in float16, so // 2^16-1 is the last float32 to result max() in float16 constexpr uint32_t i32 = (0x8f << 23) - 1; - return bit_cast(i32); + return edm::bit_cast(i32); } inline static float min() { constexpr uint32_t i32 = 0x38800000; // = mantissatable[offsettable[1]+0]+exponenttable[1] - return bit_cast(i32); + return edm::bit_cast(i32); } // Minimum float32 value that gets rounded to min() @@ -113,12 +113,12 @@ class MiniFloatConverter { // 2^-14-1 in float32 is the first to result denormalized in float16, so // 2^-14 is the first float32 to result min() in float16 constexpr uint32_t i32 = (0x71 << 23); - return bit_cast(i32); + return edm::bit_cast(i32); } inline static float denorm_min() { constexpr uint32_t i32 = 0x33800000; // mantissatable[offsettable[0]+1]+exponenttable[0] - return bit_cast(i32); + return edm::bit_cast(i32); } inline static bool isdenorm(uint16_t h) { @@ -127,14 +127,6 @@ class MiniFloatConverter { } private: - //in C++20 we can use std::bit_cast which is constexpr - template - inline static To bit_cast(const From &src) noexcept { - static_assert(sizeof(To) == sizeof(From), "incompatible types"); - To dst; - std::memcpy(&dst, &src, sizeof(To)); - return dst; - } CMS_THREAD_SAFE static uint32_t mantissatable[2048]; CMS_THREAD_SAFE static uint32_t exponenttable[64]; CMS_THREAD_SAFE static uint16_t offsettable[64]; diff --git a/FWCore/Utilities/interface/bit_cast.h b/FWCore/Utilities/interface/bit_cast.h new file mode 100644 index 0000000000000..d8301a7100b06 --- /dev/null +++ b/FWCore/Utilities/interface/bit_cast.h @@ -0,0 +1,36 @@ +#ifndef FWCore_Utilities_bit_cast_h +#define FWCore_Utilities_bit_cast_h +// -*- C++ -*- +// +// Package: FWCore/Utilities +// Class : bit_cast +// +/**\function edm::bit_cast bit_cast.h "FWCore/Utilities/interface/bit_cast.h" + + Description: C++ 20 std::bit_cast stand-in + + Usage: + See documentation on std::bit_cast in C++ 20 + +*/ +// +// Original Author: Christopher Jones +// Created: Wed, 01 Sep 2021 19:11:41 GMT +// + +// system include files +#include + +// user include files + +namespace edm { + //in C++20 we can use std::bit_cast which is constexpr + template + inline To bit_cast(const From &src) noexcept { + static_assert(sizeof(To) == sizeof(From), "incompatible types"); + To dst; + std::memcpy(&dst, &src, sizeof(To)); + return dst; + } +} // namespace edm +#endif From 7809f0b6e11c16373d73c6b5ca5ac57a662ee26e Mon Sep 17 00:00:00 2001 From: Norraphat Date: Thu, 2 Sep 2021 04:51:54 +0200 Subject: [PATCH 303/923] adding fake alignment to make tracker geometry test work --- .../test/python/testTrackerHierarchy_cfg.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Geometry/TrackerGeometryBuilder/test/python/testTrackerHierarchy_cfg.py b/Geometry/TrackerGeometryBuilder/test/python/testTrackerHierarchy_cfg.py index 177eec759fc3a..a10920d3b0946 100644 --- a/Geometry/TrackerGeometryBuilder/test/python/testTrackerHierarchy_cfg.py +++ b/Geometry/TrackerGeometryBuilder/test/python/testTrackerHierarchy_cfg.py @@ -15,6 +15,9 @@ fromDDD = cms.bool(True) ) +process.load("Alignment.CommonAlignmentProducer.FakeAlignmentSource_cfi") +process.preferFakeAlign = cms.ESPrefer("FakeAlignmentSource") + process.p1 = cms.Path(process.prod) From 3bfd79666e2a1b63cf2e115c80256391a8f5845a Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 1 Sep 2021 21:58:23 -0500 Subject: [PATCH 304/923] Enable services in concurrent endJob processing --- FWCore/Framework/src/EventProcessor.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 30c086dd421c3..8e3fe85612854 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -711,6 +711,7 @@ namespace edm { first([this, i, &c, &collectorMutex](auto nextTask) { std::exception_ptr ep; try { + ServiceRegistry::Operate operate(serviceToken_); this->schedule_->endStream(i); } catch (...) { ep = std::current_exception(); @@ -721,9 +722,10 @@ namespace edm { } }) | then([this, i, &c, &collectorMutex](auto nextTask) { for (auto& subProcess : subProcesses_) { - first([i, &c, &collectorMutex, &subProcess](auto nextTask) { + first([this, i, &c, &collectorMutex, &subProcess](auto nextTask) { std::exception_ptr ep; try { + ServiceRegistry::Operate operate(serviceToken_); subProcess.doEndStream(i); } catch (...) { ep = std::current_exception(); From 905a86b6fc8ee7a4fef38bcfd2545f1a437e9bb2 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Thu, 2 Sep 2021 06:17:03 +0200 Subject: [PATCH 305/923] update another test config --- Geometry/TrackerGeometryBuilder/test/python/testTracker_cfg.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Geometry/TrackerGeometryBuilder/test/python/testTracker_cfg.py b/Geometry/TrackerGeometryBuilder/test/python/testTracker_cfg.py index 438d450d03449..95ce466cfb13a 100644 --- a/Geometry/TrackerGeometryBuilder/test/python/testTracker_cfg.py +++ b/Geometry/TrackerGeometryBuilder/test/python/testTracker_cfg.py @@ -5,6 +5,9 @@ process.source = cms.Source("EmptySource") +process.load("Alignment.CommonAlignmentProducer.FakeAlignmentSource_cfi") +process.preferFakeAlign = cms.ESPrefer("FakeAlignmentSource") + process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) From bcb56d86c98e2661193f3e73066695e99015aff1 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Thu, 2 Sep 2021 08:02:41 +0200 Subject: [PATCH 306/923] disable 136.72413 in relval_standard --- Configuration/PyReleaseValidation/python/relval_standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index cfafb0124246e..733d20d4fac95 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -192,7 +192,7 @@ # reminiAOD wf on 2016B input, mainly here for PPS testing workflows[136.72411] = ['',['RunJetHT2016B_reminiaodUL','REMINIAOD_data2016UL_HIPM','HARVESTDR2_REMINIAOD_data2016UL_HIPM']] workflows[136.72412] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM','HARVESTDR2_REMININANO_data2016UL_HIPM']] -workflows[136.72413] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM_met','HARVESTDR2_REMININANO_data2016UL_HIPM_met']] +#workflows[136.72413] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM_met','HARVESTDR2_REMININANO_data2016UL_HIPM_met']] #diable for now until MET is fixed. ### run 2016C ### workflows[136.736] = ['',['RunHLTPhy2016C','HLTDR2_2016','RECODR2_2016reHLT_HIPM','HARVESTDR2']] From d6fd9b943b1987b9437113a3ecbeb3aeab251de6 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 2 Sep 2021 09:31:22 +0200 Subject: [PATCH 307/923] Remove duplicate include statements --- EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h | 4 +--- EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc | 1 - EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc | 3 --- EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc | 4 ---- EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc | 1 - 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h b/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h index 6086063d57268..e187ef1695b18 100644 --- a/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h +++ b/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -26,9 +27,6 @@ #include #include #include -#include -#include - #include class EcalElectronicsMapping; diff --git a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc index d9a8b35ebb89e..b2bd81515a3af 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc @@ -7,7 +7,6 @@ #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" #include "DataFormats/EcalDigi/interface/EcalDataFrame.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc index 7fa75f32f1127..7ec7c42219e50 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc @@ -110,9 +110,6 @@ class EcalRawToDigi : public edm::stream::EDProducer<> { #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - EcalRawToDigi::EcalRawToDigi(edm::ParameterSet const& conf) : diff --git a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc index d8437f56633fd..b3a523297c7ec 100644 --- a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc @@ -17,7 +17,6 @@ #include "EventFilter/EcalRawToDigi/interface/MatacqRawEvent.h" #include "EventFilter/EcalRawToDigi/src/MatacqDataFormatter.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include @@ -315,10 +314,8 @@ class MatacqProducer : public edm::EDProducer { #include #include -#include #include #include -#include #include #include @@ -330,7 +327,6 @@ class MatacqProducer : public edm::EDProducer { #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDigi/interface/EcalMatacqDigi.h" -#include "DataFormats/EcalDigi/interface/EcalMatacqDigi.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "EventFilter/EcalRawToDigi/src/Majority.h" diff --git a/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc b/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc index d0f038d7ef0e0..1c27e3728da07 100644 --- a/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc +++ b/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include using namespace std; From a357c340737e2f43af8a50dae2815fee8f615aab Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 2 Sep 2021 12:58:46 +0200 Subject: [PATCH 308/923] add validation plots to the harvester --- ...mondSampicTimingCalibrationPCLHarvester.cc | 142 ++++++++++-------- ...DiamondSampicTimingCalibrationPCLWorker.cc | 25 +-- ...PSDiamondSampicTimingCalibHarvester_cff.py | 8 + ...ALCARECOPPSDiamondSampicTimingCalib_cff.py | 3 +- .../DiamondSampicCalibrationHarvester_cfg.py | 21 ++- .../DiamondSampicCalibrationWorker_cfg.py | 2 +- .../python/AlCaHarvesting_cff.py | 1 - 7 files changed, 123 insertions(+), 79 deletions(-) diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc index c5459576c1821..ed66659cc760a 100644 --- a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc @@ -5,7 +5,7 @@ // /**\class PPSDiamondSampicTimingCalibrationPCLHarvester PPSDiamondSampicTimingCalibrationPCLHarvester.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLHarvester/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc - Description: Harvester of the DiamondSampicCalibration PCL which produces sqlite file with a new calibration + Description: Harvester of the DiamondSampic calibration which produces sqlite file with a new channel alignment Implementation: [Notes on implementation] @@ -15,7 +15,9 @@ // Created: Mon, 26 Jul 2021 16:36:13 GMT // // - +#include "TAxis.h" +#include "TH1.h" +#include "TArrayD.h" #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -40,13 +42,6 @@ namespace pt = boost::property_tree; -struct Histograms_PPSDiamondSampicTimingCalibrationPCLWorker { - std::unordered_map timeHisto; - std::unordered_map db; - std::unordered_map sampic; - std::unordered_map channel; -}; - class PPSDiamondSampicTimingCalibrationPCLHarvester : public DQMEDHarvester { public: PPSDiamondSampicTimingCalibrationPCLHarvester(const edm::ParameterSet&); @@ -57,14 +52,15 @@ class PPSDiamondSampicTimingCalibrationPCLHarvester : public DQMEDHarvester { void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; void calibJson(DQMStore::IGetter& iGetter); void calibDb(DQMStore::IGetter& iGetter); - + bool getDbSampicChannel( + DQMStore::IGetter& iGetter, int& db, int& sampic, int& channel, std::string ch_name, CTPPSDiamondDetId detid); edm::ESGetToken geomEsToken_; edm::ESGetToken timingCalibrationToken_; edm::ESHandle hTimingCalib_; std::vector detids_; const std::string dqmDir_; const unsigned int min_entries_; - const std::string jsonCalibFile_; + const std::string jsonCalibFile_, jsonOutputPath_; }; //------------------------------------------------------------------------------ @@ -74,7 +70,8 @@ PPSDiamondSampicTimingCalibrationPCLHarvester::PPSDiamondSampicTimingCalibration : geomEsToken_(esConsumes()), dqmDir_(iConfig.getParameter("dqmDir")), min_entries_(iConfig.getParameter("minEntries")), - jsonCalibFile_(iConfig.getParameter("jsonCalibFile")) { + jsonCalibFile_(iConfig.getParameter("jsonCalibFile")), + jsonOutputPath_(iConfig.getParameter("jsonOutputPath")) { if (jsonCalibFile_.empty()) timingCalibrationToken_ = esConsumes( edm::ESInputTag(iConfig.getParameter("timingCalibrationTag"))); @@ -96,61 +93,93 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRu //------------------------------------------------------------------------------ +bool PPSDiamondSampicTimingCalibrationPCLHarvester::getDbSampicChannel( + DQMStore::IGetter& iGetter, int& db, int& sampic, int& channel, std::string path, CTPPSDiamondDetId detid) { + auto histDb = iGetter.get(path + "db"); + auto histSampic = iGetter.get(path + "sampic"); + auto histChannel = iGetter.get(path + "channel"); + + if (histDb == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve db for detid: " << detid; + return false; + } + + if (histSampic == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve sampic for detid: " << detid; + return false; + } + + if (histChannel == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve channel hwId for detid: " << detid; + return false; + } + + db = histDb->getIntValue(); + sampic = histSampic->getIntValue(); + channel = histChannel->getIntValue(); + + return true; +} +//------------------------------------------------------------------------------ + void PPSDiamondSampicTimingCalibrationPCLHarvester::calibJson(DQMStore::IGetter& iGetter) { - Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; - std::string ch_name; + std::unordered_map timeHisto; + std::string ch_name, path; pt::ptree node; pt::read_json(jsonCalibFile_, node); const std::string formula = node.get("formula"); for (const auto& detid : detids_) { + detid.channelName(path, CTPPSDiamondDetId::nPath); detid.channelName(ch_name); + path = dqmDir_ + "/" + path + "/" + ch_name; const auto chid = detid.rawId(); - hists.db[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "db"); - hists.sampic[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "sampic"); - hists.channel[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "channel"); - - int db = hists.db[chid]->getIntValue(); - int sampic = hists.sampic[chid]->getIntValue(); - int channel = hists.channel[chid]->getIntValue(); - - if (!node.get_child_optional("parameters." + std::to_string(db))) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "db " << db << " not present in calibration"; + int db, sampic, channel; + if (!getDbSampicChannel(iGetter, db, sampic, channel, path, detid)) continue; - } int ct = 0; for (pt::ptree::value_type& par : node.get_child("parameters." + std::to_string(db))) { double new_time_offset; if (ct == 16 * (1 - sampic) + channel) { //flip the calibration - sampic 1 is first in json double old_time_offset = par.second.get("time_offset"); - hists.timeHisto[chid] = iGetter.get(dqmDir_ + "/" + ch_name); - if (hists.timeHisto[chid] == nullptr) { + timeHisto[chid] = iGetter.get(path); + + if (timeHisto[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve time monitor for detid" << detid; par.second.put("time_offset", old_time_offset); continue; } - if (min_entries_ > 0 && hists.timeHisto[chid]->getEntries() < min_entries_) { + if (min_entries_ > 0 && timeHisto[chid]->getEntries() < min_entries_) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Not enough entries for channel (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " + << "Not enough entries for channel (" << detid << "): " << timeHisto[chid]->getEntries() << " < " << min_entries_ << ". Skipping calibration."; par.second.put("time_offset", old_time_offset); continue; } - new_time_offset = old_time_offset - hists.timeHisto[chid]->getMean(); + new_time_offset = old_time_offset - timeHisto[chid]->getMean(); + //scale x axis of the plots by calculated offset + timeHisto[chid]->getTH1F()->GetXaxis()->Set( + timeHisto[chid]->getTH1F()->GetXaxis()->GetNbins(), + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmin() + new_time_offset, // new Xmin + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmax() + new_time_offset); // new Xmax + timeHisto[chid]->getTH1F()->ResetStats(); + par.second.put("time_offset", new_time_offset); break; } ct++; } } - pt::write_json("adc_offsets_prec.cal.json", node); + pt::write_json(jsonOutputPath_, node); } //------------------------------------------------------------------------------ @@ -162,38 +191,19 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& i PPSTimingCalibration::ParametersMap params; PPSTimingCalibration::TimingMap time_info; - Histograms_PPSDiamondSampicTimingCalibrationPCLWorker hists; - std::string ch_name; + std::unordered_map timeHisto; + std::string rp_name, plane_name, ch_name, path; const std::string& formula = calib.formula(); for (const auto& detid : detids_) { + detid.channelName(path, CTPPSDiamondDetId::nPath); detid.channelName(ch_name); + path = dqmDir_ + "/" + path + "/" + ch_name; const auto chid = detid.rawId(); - hists.db[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "db"); - if (hists.db[chid] == nullptr) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Failed to retrieve db for detid: " << detid; - continue; - } - - hists.sampic[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "sampic"); - if (hists.sampic[chid] == nullptr) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Failed to retrieve sampic for detid: " << detid; + int db, sampic, channel; + if (!getDbSampicChannel(iGetter, db, sampic, channel, path, detid)) continue; - } - - hists.channel[chid] = iGetter.get(dqmDir_ + "/" + ch_name + "channel"); - if (hists.channel[chid] == nullptr) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Failed to retrieve channel hwId for detid: " << detid; - continue; - } - - int db = hists.db[chid]->getIntValue(); - int sampic = hists.sampic[chid]->getIntValue(); - int channel = hists.channel[chid]->getIntValue(); PPSTimingCalibration::Key key; key.db = db; @@ -219,21 +229,28 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& i key.cell = -1; time_info[key] = {timeOffset, timePrecision}; - hists.timeHisto[chid] = iGetter.get(dqmDir_ + "/" + ch_name); - if (hists.timeHisto[chid] == nullptr) { + timeHisto[chid] = iGetter.get(path); + if (timeHisto[chid] == nullptr) { edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") << "Failed to retrieve time monitor for detid: " << detid; continue; } - if (min_entries_ > 0 && hists.timeHisto[chid]->getEntries() < min_entries_) { + if (min_entries_ > 0 && timeHisto[chid]->getEntries() < min_entries_) { edm::LogInfo("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") - << "Not enough entries (" << detid << "): " << hists.timeHisto[chid]->getEntries() << " < " << min_entries_ + << "Not enough entries (" << detid << "): " << timeHisto[chid]->getEntries() << " < " << min_entries_ << ". Skipping calibration."; continue; } - double new_time_offset = timeOffset - hists.timeHisto[chid]->getMean(); + double new_time_offset = timeOffset - timeHisto[chid]->getMean(); + //scale x axis of the plots by calculated offset + timeHisto[chid]->getTH1F()->GetXaxis()->Set( + timeHisto[chid]->getTH1F()->GetXaxis()->GetNbins(), + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmin() + new_time_offset, // new Xmin + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmax() + new_time_offset); // new Xmax + timeHisto[chid]->getTH1F()->ResetStats(); + time_info[key] = {new_time_offset, timePrecision}; } @@ -266,6 +283,7 @@ void PPSDiamondSampicTimingCalibrationPCLHarvester::fillDescriptions(edm::Config desc.add("jsonCalibFile", "") ->setComment( "input path for json file containing calibration, if none, calibration will be obtained from db instead"); + desc.add("jsonOutputPath", "offset_cal.json")->setComment("output path for the new json calibration"); descriptions.add("PPSDiamondSampicTimingCalibrationPCLHarvester", desc); } diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc index 0977c03f6ee08..71c3b20357778 100644 --- a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc @@ -5,7 +5,7 @@ // /**\class PPSDiamondSampicTimingCalibrationPCLWorker PPSDiamondSampicTimingCalibrationPCLWorker.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc - Description: Worker of the DiamondSampicCalibration PCL which produces RecHitsTime histograms and id mapping for the Harvester + Description: Worker of DiamondSampic calibration which produces RecHitsTime histograms and id mapping for the Harvester Implementation: [Notes on implementation] @@ -92,6 +92,12 @@ void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze( iEvent.getByToken(totemTimingRecHitToken_, timingRecHit); iEvent.getByToken(totemTimingDigiToken_, timingDigi); + if (timingRecHit->empty()) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") + << "No rechits retrieved from the event content."; + return; + } + for (const auto& digis : *timingDigi) { const CTPPSDiamondDetId detId(digis.detId()); for (const auto& digi : digis) { @@ -101,12 +107,6 @@ void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze( } } - if (timingRecHit->empty()) { - edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") - << "No rechits retrieved from the event content."; - return; - } - for (const auto& recHits : *timingRecHit) { const CTPPSDiamondDetId detId(recHits.detId()); for (const auto& recHit : recHits) @@ -128,11 +128,14 @@ void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms( if (!CTPPSDiamondDetId::check(it->first)) continue; const CTPPSDiamondDetId detid(it->first); + + std::string path; + detid.channelName(path, CTPPSDiamondDetId::nPath); detid.channelName(ch_name); - histos.timeHisto[detid.rawId()] = ibook.book1D(ch_name, ch_name, 1200, -40, 40); - histos.db[detid.rawId()] = ibook.bookInt(ch_name + "db"); - histos.sampic[detid.rawId()] = ibook.bookInt(ch_name + "sampic"); - histos.channel[detid.rawId()] = ibook.bookInt(ch_name + "channel"); + histos.timeHisto[detid.rawId()] = ibook.book1D(path + "/" + ch_name, ch_name, 500, -25, 25); + histos.db[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "db"); + histos.sampic[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "sampic"); + histos.channel[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "channel"); } } diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py index 474c4d2db5e8a..210a1a50ab137 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -3,3 +3,11 @@ from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi import * + +QMStore = cms.Service("DQMStore") + +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +dqmEnv = DQMEDHarvester('DQMHarvestingMetadata', + subSystemFolder=cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL/AlignedChannels')) + +ALCAHARVESTPPSDiamondSampicTimingCalibration = cms.Sequence(PPSDiamondSampicTimingCalibrationPCLHarvester + dqmEnv) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py index 7d5ac38529738..060a364dced8e 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py @@ -8,8 +8,7 @@ Name = cms.untracked.string('MEtoEDMConverter'), Verbosity = cms.untracked.int32(0), Frequency = cms.untracked.int32(50), - MEPathToSave = cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL'), - deleteAfterCopy = cms.untracked.bool(True), + MEPathToSave = cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL') ) taskALCARECOPPSDiamondSampicTimingCalib = cms.Task( diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py index af434a75d1c1d..62477a79dae75 100644 --- a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py @@ -10,7 +10,7 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_Candidate_2021_08_24_17_11_47') +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_PPStestSampicPCL_v1') # Source (histograms) process.source = cms.Source("DQMRootSource", @@ -40,12 +40,29 @@ process.load("CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi") #process.PPSDiamondSampicTimingCalibrationPCLHarvester.jsonCalibFile=cms.string("initial.cal.json") +# load DQM framework +process.load("DQMServices.Core.DQMStore_cfi") +process.load("DQMServices.Components.DQMEnvironment_cfi") +process.dqmEnv.subSystemFolder = "CalibPPS" +process.dqmSaver.convention = 'Offline' +process.dqmSaver.workflow = "/CalibPPS/TimingCalibration/CMSSW_12_0_0_pre2" +process.dqmSaver.saveByRun = -1 +process.dqmSaver.saveAtJobEnd = True +process.dqmSaver.forceRunNumber = 999999 + process.p = cms.Path( process.PPSDiamondSampicTimingCalibrationPCLHarvester ) +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver +) + process.schedule = cms.Schedule( - process.p + process.p, + process.end_path ) + diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py index ad08ed411bea4..b1b58bb878e33 100644 --- a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py @@ -11,7 +11,7 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_Candidate_2021_08_24_17_11_47') +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_PPStestSampicPCL_v1') ################ #digi converter diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index b2c0e72c6a143..3d4ced64d0675 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -224,7 +224,6 @@ timetype = cms.untracked.string('runnumber') ) -ALCAHARVESTPPSDiamondSampicTimingCalibration = PPSDiamondSampicTimingCalibrationPCLHarvester.clone() ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_Sampic')) ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd_Sampic'), tag = cms.string('DiamondSampicCalibration'), From 837b840b1d0797aef5f99e2e378aadc36e2a6edc Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 13:27:52 +0200 Subject: [PATCH 309/923] Remove unused conditions import from ES. --- .../EcalCalibAlgos/interface/PhiSymmetryCalibration.h | 1 - .../EcalCalibAlgos/src/PhiSymmetryCalibration.cc | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h index ceef0c6444f92..ec976ea70b01a 100644 --- a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h @@ -127,7 +127,6 @@ class PhiSymmetryCalibration const edm::EDGetTokenT eeRecHitToken_; const edm::ESGetToken channelStatusToken_; const edm::ESGetToken geometryToken_; - edm::ESGetToken intercalibConstantsToken_; // energy cut in the barrel const double eCut_barl_; diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc index 20c93521fdf19..65aef4d2e594c 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc @@ -56,10 +56,6 @@ PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalintercalibConstants.xml")) { isfirstpass_ = true; - if (!reiteration_) { - intercalibConstantsToken_ = esConsumes(); - } - et_spectrum_b_histos.resize(kBarlRings); e_spectrum_b_histos.resize(kBarlRings); et_spectrum_e_histos.resize(kEndcEtaRings); @@ -499,12 +495,6 @@ void PhiSymmetryCalibration::setUp(const edm::EventSetup& setup) { int ret = EcalIntercalibConstantsXMLTranslator::readXML(fip.fullPath(), h, oldCalibs_); if (ret) edm::LogError("PhiSym") << "Error reading XML files" << endl; - ; - - } else { - // in fact if not reiterating, oldCalibs_ will never be used - const auto pIcal = setup.getHandle(intercalibConstantsToken_); - oldCalibs_ = *pIcal; } } From 1e2fe38d238b1b35ec8c3496d58eff1618e2b214 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 13:28:31 +0200 Subject: [PATCH 310/923] Replace getHandle calls with getData. --- .../SelectedElectronFEDListProducer.cc | 22 +++++++++---------- .../interface/ElectronCalibrationUniv.h | 3 +-- .../src/ECALpedestalPCLHarvester.cc | 11 +++------- .../src/ECALpedestalPCLworker.cc | 6 ++--- .../src/ElectronCalibrationUniv.cc | 2 +- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc index 1d861acad6e7e..71e552878eb9a 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc @@ -296,31 +296,30 @@ void SelectedElectronFEDListProducer::beginJob() { template void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // get the hcal electronics map - const auto pSetup = iSetup.getHandle(hcalDbToken_); - HcalReadoutMap_ = pSetup->getHcalMapping(); + const auto& pSetup = iSetup.getData(hcalDbToken_); + HcalReadoutMap_ = pSetup.getHcalMapping(); // get the ecal electronics map - const auto ecalmapping = iSetup.getHandle(ecalMappingToken_); - EcalMapping_ = ecalmapping.product(); + EcalMapping_ = &iSetup.getData(ecalMappingToken_); // get the calo geometry - const auto caloGeometry = iSetup.getHandle(caloGeometryToken_); - GeometryCalo_ = caloGeometry.product(); + const auto& caloGeometry = iSetup.getData(caloGeometryToken_); + GeometryCalo_ = &caloGeometry; //ES geometry - GeometryES_ = caloGeometry->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); + GeometryES_ = caloGeometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); // pixel tracker cabling map const auto pixelCablingMap = iSetup.getTransientHandle(siPixelFedCablingMapToken_); PixelCabling_.reset(); PixelCabling_ = pixelCablingMap->cablingTree(); - const auto trackerGeometry = iSetup.getHandle(trackerGeometryToken_); + const auto& trackerGeometry = iSetup.getData(trackerGeometryToken_); if (pixelModuleVector_.empty()) { // build the tracker pixel module map - std::vector::const_iterator itTracker = trackerGeometry->dets().begin(); - for (; itTracker != trackerGeometry->dets().end(); ++itTracker) { + std::vector::const_iterator itTracker = trackerGeometry.dets().begin(); + for (; itTracker != trackerGeometry.dets().end(); ++itTracker) { int subdet = (*itTracker)->geographicalId().subdetId(); if (!(subdet == PixelSubdetector::PixelBarrel || subdet == PixelSubdetector::PixelEndcap)) continue; @@ -339,8 +338,7 @@ void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, c std::sort(pixelModuleVector_.begin(), pixelModuleVector_.end()); } - const auto SiStripCablingHandle = iSetup.getHandle(siStripRegionCablingToken_); - StripRegionCabling_ = SiStripCablingHandle.product(); + StripRegionCabling_ = &iSetup.getData(siStripRegionCablingToken_); SiStripRegionCabling::Cabling SiStripCabling; SiStripCabling = StripRegionCabling_->getRegionCabling(); diff --git a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h index aeb203a8d978f..21fe0d851ea85 100644 --- a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h +++ b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h @@ -26,7 +26,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" // Geometry @@ -121,7 +120,7 @@ class ElectronCalibrationUniv : public edm::one::EDAnalyzer const edm::EDGetTokenT eeRecHitToken_; const edm::EDGetTokenT gsfElectronToken_; const edm::ESGetToken topologyToken_; - edm::ESHandle theCaloTopology_; + const CaloTopology* theCaloTopology_; std::vector solution; std::vector solutionNoCuts; diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc index 61bb5ea785c29..1876ff44fd6ba 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc @@ -155,14 +155,9 @@ void ECALpedestalPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& } void ECALpedestalPCLHarvester::endRun(edm::Run const& run, edm::EventSetup const& isetup) { - const auto chStatus = isetup.getHandle(channelsStatusToken_); - channelStatus_ = chStatus.product(); - - const auto peds = isetup.getHandle(pedestalsToken_); - currentPedestals_ = peds.product(); - - const auto g6g1peds = isetup.getHandle(g6g1PedestalsToken_); - g6g1Pedestals_ = g6g1peds.product(); + channelStatus_ = &isetup.getData(channelsStatusToken_); + currentPedestals_ = &isetup.getData(pedestalsToken_); + g6g1Pedestals_ = &isetup.getData(g6g1PedestalsToken_); } bool ECALpedestalPCLHarvester::checkStatusCode(const DetId& id) { diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc index a92e92a762e4d..77cc076913f2e 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc @@ -101,7 +101,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run ibooker.cd(); ibooker.setCurrentFolder(dqmDir_); - const auto peds = es.getHandle(pedestalToken_); + const auto peds = es.getData(pedestalToken_); for (uint32_t i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) { ibooker.setCurrentFolder(dqmDir_ + "/EB/" + std::to_string(int(i / 100))); @@ -111,7 +111,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run int centralBin = fixedBookingCenterBin_; if (dynamicBooking_) { - centralBin = int((peds->find(id))->mean_x12); + centralBin = int((peds.find(id))->mean_x12); } int min = centralBin - nBins_ / 2; @@ -129,7 +129,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run int centralBin = fixedBookingCenterBin_; if (dynamicBooking_) { - centralBin = int((peds->find(id))->mean_x12); + centralBin = int((peds.find(id))->mean_x12); } int min = centralBin - nBins_ / 2; diff --git a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc index 469eed1688de1..4b49ad3749602 100644 --- a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc +++ b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc @@ -236,7 +236,7 @@ void ElectronCalibrationUniv::beginRun(edm::Run const&, edm::EventSetup const& i //======================================================================== //To Deal with Geometry: - theCaloTopology_ = iSetup.getHandle(topologyToken_); + theCaloTopology_ = &iSetup.getData(topologyToken_); } //======================================================================== From 4a68d04d7e600b376922aa3ae92d448101dd138f Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Thu, 2 Sep 2021 13:39:23 +0200 Subject: [PATCH 311/923] Removed lexical_cast boost dependency --- .../L1GtTriggerMenuConfigOnlineProd.h | 3 +- .../src/L1GtParametersConfigOnlineProd.cc | 29 +++++++++---------- ...PrescaleFactorsAlgoTrigConfigOnlineProd.cc | 2 -- ...PrescaleFactorsTechTrigConfigOnlineProd.cc | 2 -- .../src/L1GtPsbSetupConfigOnlineProd.cc | 1 - ...L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc | 2 -- ...L1GtTriggerMaskTechTrigConfigOnlineProd.cc | 1 - ...TriggerMaskVetoTechTrigConfigOnlineProd.cc | 3 -- .../src/L1GtTriggerMenuConfigOnlineProd.cc | 2 -- 9 files changed, 14 insertions(+), 31 deletions(-) diff --git a/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuConfigOnlineProd.h b/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuConfigOnlineProd.h index 7e1fd251e2c0b..ed193a9d83283 100644 --- a/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuConfigOnlineProd.h +++ b/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuConfigOnlineProd.h @@ -16,7 +16,6 @@ */ // system include files -#include "boost/lexical_cast.hpp" #include #include @@ -262,7 +261,7 @@ Result L1GtTriggerMenuConfigOnlineProd::lexical_cast_from_hex(Source& value) con Result result; if (!(convertor >> std::hex >> result) || !convertor.eof()) { - throw boost::bad_lexical_cast(); + throw std::exception(); } return result; diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtParametersConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtParametersConfigOnlineProd.cc index 7d6560e9dd2d6..100c9256af358 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtParametersConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtParametersConfigOnlineProd.cc @@ -15,9 +15,6 @@ // this class header #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtParametersConfigOnlineProd.h" -// system include files -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -169,7 +166,7 @@ std::unique_ptr L1GtParametersConfigOnlineProd::newObject(const // fill the record // total Bx's in the event - int totalBxInEventVal = boost::lexical_cast(totalBxInEventStr); + int totalBxInEventVal = std::stoi(totalBxInEventStr); pL1GtParameters->setGtTotalBxInEvent(totalBxInEventVal); // FIXME: need board maps in DB, with active bit number... @@ -187,62 +184,62 @@ std::unique_ptr L1GtParametersConfigOnlineProd::newObject(const if (activeBoardsDaqFDL) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrFDL); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrFDL); iActiveBit = 1; if (activeBoardsDaqPSB0) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB0); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB0); iActiveBit = 2; if (activeBoardsDaqPSB1) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB1); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB1); iActiveBit = 3; if (activeBoardsDaqPSB2) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB2); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB2); iActiveBit = 4; if (activeBoardsDaqPSB3) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB3); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB3); iActiveBit = 5; if (activeBoardsDaqPSB4) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB4); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB4); iActiveBit = 6; if (activeBoardsDaqPSB5) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB5); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB5); iActiveBit = 7; if (activeBoardsDaqPSB6) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrPSB6); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrPSB6); iActiveBit = 8; if (activeBoardsDaqGMT) { daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); } - daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrGMT); + daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrGMT); // FIXME fix TIM active bit //iActiveBit = 9; //if (activeBoardsDaqTIM) { // daqActiveBoardsVal = daqActiveBoardsVal | (1 << iActiveBit); //} - //daqNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrTIM); + //daqNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrTIM); // active boards in the L1 EVM record uint16_t evmActiveBoardsVal = 0; @@ -262,7 +259,7 @@ std::unique_ptr L1GtParametersConfigOnlineProd::newObject(const evmActiveBoardsVal = evmActiveBoardsVal | (1 << iActiveBit); } // FDL must have the same length in EVM and DAQ - evmNrBxBoard.at(iActiveBit) = boost::lexical_cast(daqNrBxBoardStrFDL); + evmNrBxBoard.at(iActiveBit) = std::stoi(daqNrBxBoardStrFDL); // pL1GtParameters->setGtDaqActiveBoards(daqActiveBoardsVal); @@ -271,7 +268,7 @@ std::unique_ptr L1GtParametersConfigOnlineProd::newObject(const pL1GtParameters->setGtEvmNrBxBoard(evmNrBxBoard); // - unsigned int bstLengthBytesVal = boost::lexical_cast(bstLengthBytesStr); + unsigned int bstLengthBytesVal = std::stoul(bstLengthBytesStr); pL1GtParameters->setGtBstLengthBytes(bstLengthBytesVal); if (edm::isDebugEnabled()) { diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc index 591f46b4cf825..e7692d6afd5a5 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc @@ -18,8 +18,6 @@ // system include files #include -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc index f67725d8d9492..b5713a1d2b039 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc @@ -18,8 +18,6 @@ // system include files #include -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPsbSetupConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPsbSetupConfigOnlineProd.cc index 76b86b29d2cdc..32fb5f0468a69 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtPsbSetupConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtPsbSetupConfigOnlineProd.cc @@ -17,7 +17,6 @@ #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtPsbSetupConfigOnlineProd.h" // system include files -#include "boost/lexical_cast.hpp" #include // user include files diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc index a5afe753cfebd..cd803fa57de36 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc @@ -18,8 +18,6 @@ // system include files #include -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskTechTrigConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskTechTrigConfigOnlineProd.cc index bd2373679dd6d..3a642ddbbdf1f 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskTechTrigConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskTechTrigConfigOnlineProd.cc @@ -17,7 +17,6 @@ // system include files #include -#include "boost/lexical_cast.hpp" // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc index 1de811e730e01..773e4bd701e6f 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc @@ -15,9 +15,6 @@ // this class header #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.h" -// system include files -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMenuConfigOnlineProd.cc b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMenuConfigOnlineProd.cc index 1a459e1d34a8a..4ac7244670476 100644 --- a/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMenuConfigOnlineProd.cc +++ b/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMenuConfigOnlineProd.cc @@ -23,8 +23,6 @@ #include #include -#include "boost/lexical_cast.hpp" - // user include files #include "FWCore/MessageLogger/interface/MessageLogger.h" From 391f848e2a99b163f58e4e8d82510952dba909cb Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 2 Sep 2021 13:56:55 +0200 Subject: [PATCH 312/923] fix typo in ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py --- .../python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py index 210a1a50ab137..1c6ecf70c86a7 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -4,7 +4,7 @@ from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi import * -QMStore = cms.Service("DQMStore") +DQMStore = cms.Service("DQMStore") from DQMServices.Core.DQMEDHarvester import DQMEDHarvester dqmEnv = DQMEDHarvester('DQMHarvestingMetadata', From 7a77d78fa6b7bdae916708b7674afc2d758dc2e6 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 14:10:09 +0200 Subject: [PATCH 313/923] Apply code-checks and code-format. --- Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h | 2 +- Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h index 21fe0d851ea85..a602561587602 100644 --- a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h +++ b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h @@ -120,7 +120,7 @@ class ElectronCalibrationUniv : public edm::one::EDAnalyzer const edm::EDGetTokenT eeRecHitToken_; const edm::EDGetTokenT gsfElectronToken_; const edm::ESGetToken topologyToken_; - const CaloTopology* theCaloTopology_; + const CaloTopology *theCaloTopology_; std::vector solution; std::vector solutionNoCuts; diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc index 77cc076913f2e..e90fcfbbf8427 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc @@ -101,7 +101,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run ibooker.cd(); ibooker.setCurrentFolder(dqmDir_); - const auto peds = es.getData(pedestalToken_); + const auto& peds = es.getData(pedestalToken_); for (uint32_t i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) { ibooker.setCurrentFolder(dqmDir_ + "/EB/" + std::to_string(int(i / 100))); From a6c81eac49bf871ebad0ff7d6460468141a71ad1 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 14:04:48 +0200 Subject: [PATCH 314/923] Modernise EcalRecHitRecalib. --- .../interface/EcalRecHitRecalib.h | 27 ++++++---- .../plugins/EcalRecHitRecalib.cc | 52 ++++++++----------- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h index b2cc951b731d7..58e2defd68990 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h @@ -23,18 +23,21 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.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 "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" // // class decleration // -class EcalRecHitRecalib : public edm::EDProducer { +class EcalRecHitRecalib : public edm::stream::EDProducer<> { public: explicit EcalRecHitRecalib(const edm::ParameterSet &); ~EcalRecHitRecalib() override; @@ -44,13 +47,19 @@ class EcalRecHitRecalib : public edm::EDProducer { private: // ----------member data --------------------------- - std::string ecalHitsProducer_; - std::string barrelHits_; - std::string endcapHits_; - std::string RecalibBarrelHits_; - std::string RecalibEndcapHits_; - double refactor_; - double refactor_mean_; + const std::string ecalHitsProducer_; + const std::string barrelHits_; + const std::string endcapHits_; + const std::string RecalibBarrelHits_; + const std::string RecalibEndcapHits_; + const double refactor_; + const double refactor_mean_; + + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::ESGetToken intercalibConstsToken_; + const edm::EDPutTokenT barrelHitsToken_; + const edm::EDPutTokenT endcapHitsToken_; }; #endif diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc index 784494847b81c..20881711a6298 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc @@ -1,30 +1,24 @@ - -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" - #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -EcalRecHitRecalib::EcalRecHitRecalib(const edm::ParameterSet& iConfig) { - ecalHitsProducer_ = iConfig.getParameter("ecalRecHitsProducer"); - barrelHits_ = iConfig.getParameter("barrelHitCollection"); - endcapHits_ = iConfig.getParameter("endcapHitCollection"); - RecalibBarrelHits_ = iConfig.getParameter("RecalibBarrelHitCollection"); - RecalibEndcapHits_ = iConfig.getParameter("RecalibEndcapHitCollection"); - refactor_ = iConfig.getUntrackedParameter("Refactor", (double)1); - refactor_mean_ = iConfig.getUntrackedParameter("Refactor_mean", (double)1); - - //register your products - produces(RecalibBarrelHits_); - produces(RecalibEndcapHits_); -} +EcalRecHitRecalib::EcalRecHitRecalib(const edm::ParameterSet& iConfig) + : ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), + barrelHits_(iConfig.getParameter("barrelHitCollection")), + endcapHits_(iConfig.getParameter("endcapHitCollection")), + RecalibBarrelHits_(iConfig.getParameter("RecalibBarrelHitCollection")), + RecalibEndcapHits_(iConfig.getParameter("RecalibEndcapHitCollection")), + refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), + refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)), + ebRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + eeRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, endcapHits_))), + intercalibConstsToken_(esConsumes()), + barrelHitsToken_(produces(RecalibBarrelHits_)), + endcapHitsToken_(produces(RecalibEndcapHits_)) {} EcalRecHitRecalib::~EcalRecHitRecalib() {} @@ -39,14 +33,14 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu const EBRecHitCollection* EBRecHits = nullptr; const EERecHitCollection* EERecHits = nullptr; - iEvent.getByLabel(ecalHitsProducer_, barrelHits_, barrelRecHitsHandle); + iEvent.getByToken(ebRecHitToken_, barrelRecHitsHandle); if (!barrelRecHitsHandle.isValid()) { LogDebug("") << "EcalREcHitMiscalib: Error! can't get product!" << std::endl; } else { EBRecHits = barrelRecHitsHandle.product(); // get a ptr to the product } - iEvent.getByLabel(ecalHitsProducer_, endcapHits_, endcapRecHitsHandle); + iEvent.getByToken(eeRecHitToken_, endcapRecHitsHandle); if (!endcapRecHitsHandle.isValid()) { LogDebug("") << "EcalREcHitMiscalib: Error! can't get product!" << std::endl; } else { @@ -58,19 +52,17 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu auto RecalibEERecHitCollection = std::make_unique(); // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstants* ical = pIcal.product(); + const EcalIntercalibConstants &ical = iSetup.getData(intercalibConstsToken_); if (EBRecHits) { //loop on all EcalRecHits (barrel) EBRecHitCollection::const_iterator itb; for (itb = EBRecHits->begin(); itb != EBRecHits->end(); ++itb) { // find intercalib constant for this xtal - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(itb->id().rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(itb->id().rawId()); EcalIntercalibConstant icalconst = -1; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); // edm::LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; @@ -93,10 +85,10 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu EERecHitCollection::const_iterator ite; for (ite = EERecHits->begin(); ite != EERecHits->end(); ++ite) { // find intercalib constant for this xtal - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(ite->id().rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(ite->id().rawId()); EcalIntercalibConstant icalconst = -1; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); // edm:: LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EEDetId(ite->id()) << " " << icalconst ; } else { @@ -115,6 +107,6 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } //Put Recalibrated rechit in the event - iEvent.put(std::move(RecalibEBRecHitCollection), RecalibBarrelHits_); - iEvent.put(std::move(RecalibEERecHitCollection), RecalibEndcapHits_); + iEvent.put(barrelHitsToken_, std::move(RecalibEBRecHitCollection)); + iEvent.put(endcapHitsToken_, std::move(RecalibEERecHitCollection)); } From e9c44cca920e6c8b10db3e3275688102cedac497 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 15:03:21 +0200 Subject: [PATCH 315/923] Modernise WriteEcalMiscalibConstants. --- .../interface/WriteEcalMiscalibConstants.h | 9 ++++- .../plugins/WriteEcalMiscalibConstants.cc | 38 ++++++------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h index a275dcce6c143..1bc733a246728 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h @@ -11,17 +11,20 @@ // 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 "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" // // class decleration // -class WriteEcalMiscalibConstants : public edm::EDAnalyzer { +class WriteEcalMiscalibConstants : public edm::one::EDAnalyzer<> { public: explicit WriteEcalMiscalibConstants(const edm::ParameterSet&); ~WriteEcalMiscalibConstants() override; @@ -33,4 +36,6 @@ class WriteEcalMiscalibConstants : public edm::EDAnalyzer { // ----------member data --------------------------- std::string newTagRequest_; + + const edm::ESGetToken intercalibConstsToken_; }; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc index 6b85d2ac4cd0e..d8f410b47e8bc 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc @@ -16,23 +16,15 @@ // // -// system include files -#include - // user include files - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" // DB includes #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" // user include files -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -//For Checks - //this one #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h" @@ -43,15 +35,11 @@ // // constructors and destructor // -WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - newTagRequest_ = iConfig.getParameter("NewTagRequest"); -} +WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig) + : newTagRequest_(iConfig.getParameter("NewTagRequest")), + intercalibConstsToken_(esConsumes()) {} -WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() {} // // member functions @@ -61,20 +49,17 @@ WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() { void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstants* Mcal = pIcal.product(); + const EcalIntercalibConstants* Mcal = &iSetup.getData(intercalibConstsToken_); edm::Service poolDbService; if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { - std::cout << " Creating a new one " << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Creating a new IOV"; poolDbService->createNewIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); - std::cout << "Done" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Done"; } else { - std::cout << "Old One " << std::endl; - poolDbService->appendSinceTime( - *Mcal, poolDbService->currentTime(), newTagRequest_); + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Old IOV"; + poolDbService->appendSinceTime(*Mcal, poolDbService->currentTime(), newTagRequest_); } } } @@ -84,7 +69,6 @@ void WriteEcalMiscalibConstants::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ void - WriteEcalMiscalibConstants::endJob() { - std::cout << "Here is the end" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Here is the end"; } From a55c9df34935fbdd74044d10cc47543d60173f95 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 15:03:32 +0200 Subject: [PATCH 316/923] Modernise WriteEcalMiscalibConstantsMC. --- .../interface/WriteEcalMiscalibConstantsMC.h | 9 +++-- .../plugins/WriteEcalMiscalibConstantsMC.cc | 35 ++++++------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h index 9b4577cdd1053..64eeafacc6011 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h @@ -11,17 +11,20 @@ // 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 "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" // // class decleration // -class WriteEcalMiscalibConstantsMC : public edm::EDAnalyzer { +class WriteEcalMiscalibConstantsMC : public edm::one::EDAnalyzer<> { public: explicit WriteEcalMiscalibConstantsMC(const edm::ParameterSet&); ~WriteEcalMiscalibConstantsMC() override; @@ -33,4 +36,6 @@ class WriteEcalMiscalibConstantsMC : public edm::EDAnalyzer { // ----------member data --------------------------- std::string newTagRequest_; + + const edm::ESGetToken intercalibConstsToken_; }; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc index 0846c950d1aa0..2fa4c517afca4 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc @@ -16,23 +16,15 @@ // // -// system include files -#include - // user include files - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" // DB includes #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" // user include files -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -//For Checks - //this one #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h" @@ -43,15 +35,11 @@ // // constructors and destructor // -WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - newTagRequest_ = iConfig.getParameter("NewTagRequest"); -} +WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig) + : newTagRequest_(iConfig.getParameter("NewTagRequest")), + intercalibConstsToken_(esConsumes()) {} -WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() {} // // member functions @@ -61,18 +49,16 @@ WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() { void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstantsMC* Mcal = pIcal.product(); + const EcalIntercalibConstantsMC* Mcal = &iSetup.getData(intercalibConstsToken_); edm::Service poolDbService; if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { - std::cout << " Creating a new one " << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Creating a new IOV"; poolDbService->createNewIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); - std::cout << "Done" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Done"; } else { - std::cout << "Old One " << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Old IOV"; poolDbService->appendSinceTime( *Mcal, poolDbService->currentTime(), newTagRequest_); } @@ -84,7 +70,6 @@ void WriteEcalMiscalibConstantsMC::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ void - WriteEcalMiscalibConstantsMC::endJob() { - std::cout << "Here is the end" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Here is the end"; } From 1f905fea4f8df5cd1a79a3b64387e994f3229c35 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 15:08:40 +0200 Subject: [PATCH 317/923] Code checks and code format. --- .../CaloMiscalibTools/plugins/EcalRecHitRecalib.cc | 2 +- .../plugins/WriteEcalMiscalibConstants.cc | 8 ++------ .../plugins/WriteEcalMiscalibConstantsMC.cc | 8 ++------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc index 20881711a6298..9cfe61d6ed18e 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc @@ -52,7 +52,7 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu auto RecalibEERecHitCollection = std::make_unique(); // Intercalib constants - const EcalIntercalibConstants &ical = iSetup.getData(intercalibConstsToken_); + const EcalIntercalibConstants& ical = iSetup.getData(intercalibConstsToken_); if (EBRecHits) { //loop on all EcalRecHits (barrel) diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc index d8f410b47e8bc..c54c66263ed91 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc @@ -36,8 +36,7 @@ // constructors and destructor // WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig) - : newTagRequest_(iConfig.getParameter("NewTagRequest")), - intercalibConstsToken_(esConsumes()) {} + : newTagRequest_(iConfig.getParameter("NewTagRequest")), intercalibConstsToken_(esConsumes()) {} WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() {} @@ -68,7 +67,4 @@ void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::Ev void WriteEcalMiscalibConstants::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ -void -WriteEcalMiscalibConstants::endJob() { - edm::LogVerbatim("WriteEcalMiscalibConstants") << "Here is the end"; -} +void WriteEcalMiscalibConstants::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstants") << "Here is the end"; } diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc index 2fa4c517afca4..74896397ca2b7 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc @@ -36,8 +36,7 @@ // constructors and destructor // WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig) - : newTagRequest_(iConfig.getParameter("NewTagRequest")), - intercalibConstsToken_(esConsumes()) {} + : newTagRequest_(iConfig.getParameter("NewTagRequest")), intercalibConstsToken_(esConsumes()) {} WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() {} @@ -69,7 +68,4 @@ void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm:: void WriteEcalMiscalibConstantsMC::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ -void -WriteEcalMiscalibConstantsMC::endJob() { - edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Here is the end"; -} +void WriteEcalMiscalibConstantsMC::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Here is the end"; } From 849e02a9ba0695a2ff2a61e68fbb90dfdc21c003 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 15:16:34 +0200 Subject: [PATCH 318/923] Make test configuration work. --- CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py | 2 +- .../CaloMiscalibTools/test/writeXMLinSqliteMC.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py index 0c8590990e645..7e670304126ce 100644 --- a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py +++ b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py @@ -36,7 +36,7 @@ ) process.prefer("CaloMiscalibTools") -process.WriteInDB = cms.EDFilter("WriteEcalMiscalibConstants", +process.WriteInDB = cms.EDAnalyzer("WriteEcalMiscalibConstants", NewTagRequest = cms.string('EcalIntercalibConstantsRcd') ) diff --git a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py index 7b15c2c40562f..ec3b9b78cbd6d 100644 --- a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py +++ b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py @@ -31,12 +31,12 @@ ) process.CaloMiscalibToolsMC = cms.ESSource("CaloMiscalibToolsMC", - fileNameBarrel = cms.untracked.string('inv_EcalIntercalibConstants_EB_startup.xml'), - fileNameEndcap = cms.untracked.string('inv_EcalIntercalibConstants_EE_startup.xml') + fileNameBarrel = cms.untracked.string('EcalIntercalibConstants_EB_startup.xml'), + fileNameEndcap = cms.untracked.string('EcalIntercalibConstants_EE_startup.xml') ) process.prefer("CaloMiscalibToolsMC") -process.WriteInDB = cms.EDFilter("WriteEcalMiscalibConstantsMC", +process.WriteInDB = cms.EDAnalyzer("WriteEcalMiscalibConstantsMC", NewTagRequest = cms.string('EcalIntercalibConstantsMCRcd') ) From 22d0618ea1bc8ce7cde6433a1d830fb90aee861c Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 15:30:38 +0200 Subject: [PATCH 319/923] Replace cout with LogVerbatim messages. --- .../CaloMiscalibTools/interface/CaloMiscalibMapEcal.h | 1 - .../CaloMiscalibTools/interface/CaloMiscalibMapHcal.h | 1 - .../CaloMiscalibTools/plugins/CaloMiscalibTools.cc | 7 +++---- .../CaloMiscalibTools/plugins/CaloMiscalibToolsMC.cc | 7 +++---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h index 9ddfdc473c6cf..0ffd75d042e99 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h @@ -5,7 +5,6 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h index e70c7038d491f..4e549db20337b 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h @@ -4,7 +4,6 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc index 77c34d8532ee3..0ba0639b1e844 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc @@ -25,6 +25,7 @@ // user include files #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h" #include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalBarrel.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalEndcap.h" @@ -45,8 +46,8 @@ CaloMiscalibTools::CaloMiscalibTools(const edm::ParameterSet& iConfig) { barrelfile_ = barrelfiletmp.fullPath(); endcapfile_ = endcapfiletmp.fullPath(); - std::cout << "Barrel file is:" << barrelfile_ << std::endl; - std::cout << "endcap file is:" << endcapfile_ << std::endl; + edm::LogVerbatim("CaloMiscalibTools") << "Barrel file is:" << barrelfile_; + edm::LogVerbatim("CaloMiscalibTools") << "endcap file is:" << endcapfile_; // added by Zhen (changed since 1_2_0) setWhatProduced(this, &CaloMiscalibTools::produce); @@ -75,9 +76,7 @@ CaloMiscalibTools::ReturnType CaloMiscalibTools::produce(const EcalIntercalibCon endcapreader_.parseXMLMiscalibFile(endcapfile_); map.print(); // Added by Zhen, need a new object so to not be deleted at exit - // std::cout<<"about to copy"<(map.get()); - // std::cout<<"mydata "<(map.get()); - // std::cout<<"mydata "< Date: Thu, 26 Aug 2021 16:04:12 +0200 Subject: [PATCH 320/923] Modernise HcalRecHitRecalib. --- .../interface/CaloMiscalibTools.h | 1 - .../interface/CaloMiscalibToolsMC.h | 1 - .../interface/HcalRecHitRecalib.h | 24 +++++++------ .../plugins/HcalRecHitRecalib.cc | 34 ++++++++----------- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h index 05b35da8b158b..6f4c36f36074e 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h @@ -36,7 +36,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h index da451d3c98cd6..d68efe81f4b57 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h @@ -36,7 +36,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h index 57874afc9f098..ef15ec1a70621 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h @@ -23,7 +23,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -32,8 +32,9 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -class HcalRecHitRecalib : public edm::EDProducer { +class HcalRecHitRecalib : public edm::stream::EDProducer<> { public: explicit HcalRecHitRecalib(const edm::ParameterSet &); ~HcalRecHitRecalib() override; @@ -42,18 +43,19 @@ class HcalRecHitRecalib : public edm::EDProducer { void produce(edm::Event &, const edm::EventSetup &) override; private: - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - std::string RecalibHBHEHits_; - std::string RecalibHFHits_; - std::string RecalibHOHits_; + const edm::EDGetTokenT tok_hbhe_; + const edm::EDGetTokenT tok_ho_; + const edm::EDGetTokenT tok_hf_; + const edm::ESGetToken topologyToken_; + const std::string RecalibHBHEHits_; + const std::string RecalibHFHits_; + const std::string RecalibHOHits_; std::string hcalfile_; - std::string hcalfileinpath_; + const std::string hcalfileinpath_; CaloMiscalibMapHcal mapHcal_; - double refactor_; - double refactor_mean_; + const double refactor_; + const double refactor_mean_; }; #endif diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc index 9c1dd235f249a..70c7a7279c3f1 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc @@ -2,18 +2,23 @@ #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLHcal.h" -HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) { - tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); - tok_ho_ = consumes(iConfig.getParameter("hoInput")); - tok_hf_ = consumes(iConfig.getParameter("hfInput")); - +HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) + : tok_hbhe_(consumes(iConfig.getParameter("hbheInput"))), + tok_ho_(consumes(iConfig.getParameter("hoInput"))), + tok_hf_(consumes(iConfig.getParameter("hfInput"))), + topologyToken_(esConsumes()), + RecalibHBHEHits_(iConfig.getParameter("RecalibHBHEHitCollection")), + RecalibHFHits_(iConfig.getParameter("RecalibHFHitCollection")), + RecalibHOHits_(iConfig.getParameter("RecalibHOHitCollection")), + hcalfileinpath_(iConfig.getUntrackedParameter("fileNameHcal", "")), + refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), + refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)) +{ // HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer"); // HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); // HFHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); @@ -21,33 +26,22 @@ HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) { // HFHits_ = iConfig.getParameter< std::string > ("HFHitCollection"); // HOHits_ = iConfig.getParameter< std::string > ("HOHitCollection"); - RecalibHBHEHits_ = iConfig.getParameter("RecalibHBHEHitCollection"); - RecalibHFHits_ = iConfig.getParameter("RecalibHFHitCollection"); - RecalibHOHits_ = iConfig.getParameter("RecalibHOHitCollection"); - - refactor_ = iConfig.getUntrackedParameter("Refactor", (double)1); - refactor_mean_ = iConfig.getUntrackedParameter("Refactor_mean", (double)1); - //register your products produces(RecalibHBHEHits_); produces(RecalibHFHits_); produces(RecalibHOHits_); // here read them from xml (particular to HCAL) - - hcalfileinpath_ = iConfig.getUntrackedParameter("fileNameHcal", ""); edm::FileInPath hcalfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + hcalfileinpath_); - hcalfile_ = hcalfiletmp.fullPath(); } HcalRecHitRecalib::~HcalRecHitRecalib() {} void HcalRecHitRecalib::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { - edm::ESHandle topology; - iSetup.get().get(topology); + const HcalTopology& topology = iSetup.getData(topologyToken_); - mapHcal_.prefillMap(*topology); + mapHcal_.prefillMap(topology); MiscalibReaderFromXMLHcal hcalreader_(mapHcal_); if (!hcalfile_.empty()) From c3dd1f9449c212caba4ca72d57fc8918354937b6 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 17:46:40 +0200 Subject: [PATCH 321/923] Modernise EcalABAnalyzer. --- .../plugins/EcalABAnalyzer.cc | 93 ++++++++----------- .../plugins/EcalABAnalyzer.h | 71 ++++++++------ 2 files changed, 80 insertions(+), 84 deletions(-) diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc index f376d10524991..411ee73ced9af 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc @@ -16,27 +16,16 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h" #include -#include #include #include -#include #include -#include - -#include #include - -#include -#include - #include #include #include -#include #include #include -#include #include #include @@ -52,7 +41,12 @@ using namespace std; EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), @@ -73,8 +67,10 @@ EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) _noise(iConfig.getUntrackedParameter("noise", 2.0)), _chi2cut(iConfig.getUntrackedParameter("chi2cut", 100.0)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), + _fedid(iConfig.getUntrackedParameter("fedId", -999)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), nCrys(NCRYSEB), runType(-1), runNum(0), @@ -92,15 +88,11 @@ EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization @@ -236,12 +228,12 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " + << eventHeaderProducer_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str() << std::endl; } //retrieving crystal data from Event @@ -250,33 +242,26 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - std::cout << " Wrong ecalPart in cfg file " << std::endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file"; return; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ============================= // Decode DCCHeader Information @@ -363,7 +348,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int strip = elecid_crystal.stripId(); @@ -445,7 +430,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { int iY = (eta - 1) / 5 + 1; side = MEEEGeom::side(iX, iY, iZ); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int channelID = elecid_crystal.channelId() - 1; @@ -472,7 +457,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { //=========== if ((*digiItr).size() > 10) - std::cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -522,8 +507,8 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { void EcalABAnalyzer::endJob() { //======================================================================== - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; // Adjust channel numbers for EE //=============================== @@ -551,8 +536,8 @@ void EcalABAnalyzer::endJob() { //====================== if (_fitab) { - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; TFile* fAB = nullptr; TTree* ABInit = nullptr; if (doesABTreeExist) { @@ -595,12 +580,12 @@ void EcalABAnalyzer::endJob() { isTimingOK = false; if (!isGainOK) - std::cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - std::cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; - std::cout << "\t+=+ .................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ .................................... done +=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } } diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h index 219082aa12653..8cc3b857fe180 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h @@ -1,5 +1,5 @@ -#ifndef EcalABAnalyzer_h_ -#define EcalABAnalyzer_h_ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h // $Id: EcalABAnalyzer.h @@ -7,7 +7,12 @@ #include #include -#include +#include + +#include +#include +#include +#include class TShapeAnalysis; class TAPDPulse; @@ -32,7 +37,7 @@ class TMom; // "EE" geometry #define NCRYSEE 830 // Number of crystals per EE supermodule -class EcalABAnalyzer : public edm::EDAnalyzer { +class EcalABAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalABAnalyzer(const edm::ParameterSet &iConfig); ~EcalABAnalyzer() override; @@ -46,40 +51,46 @@ class EcalABAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; - double _alpha; - double _beta; - unsigned int _nevtmax; - double _noise; - double _chi2cut; - std::string _ecalPart; - int _fedid; - double _qualpercent; - int _debug; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; + const double _alpha; + const double _beta; + const unsigned int _nevtmax; + const double _noise; + const double _chi2cut; + const std::string _ecalPart; + const int _fedid; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TMom *Delta01; TMom *Delta12; - std::string resdir_; - std::string digiCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; // Output file names From ee4a0d113b60310488791a13b0f8e26f0c8fd8dc Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 19:12:57 +0200 Subject: [PATCH 322/923] Modernise EcalLaserAnalyzer. --- .../plugins/EcalLaserAnalyzer.cc | 142 ++++++++---------- .../plugins/EcalLaserAnalyzer.h | 84 ++++++----- 2 files changed, 109 insertions(+), 117 deletions(-) diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc index 12042a2be2c0f..17f7a9767badb 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc @@ -16,28 +16,19 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h" #include -#include #include #include #include #include -#include #include -#include -#include - #include #include #include -#include #include #include -#include - -#include #include #include @@ -56,9 +47,15 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_))), + mappingToken_(esConsumes()), // Framework parameters with default values - _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -88,6 +85,8 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) _saveallevents(iConfig.getUntrackedParameter("saveAllEvents", false)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), + pncorfile_(iConfig.getUntrackedParameter("pnCorFile")), nCrys(NCRYSEB), nPNPerMod(NPNPERMOD), nMod(NMODEE), @@ -117,17 +116,11 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - pncorfile_ = iConfig.getUntrackedParameter("pnCorFile"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization @@ -318,64 +311,52 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { ++iEvent; // retrieving DCC header - edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " + << eventHeaderProducer_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str() << std::endl; } //retrieving crystal data from Event - edm::Handle pEBDigi; const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - std::cout << " Wrong ecalPart in cfg file " << std::endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file "; return; } // retrieving crystal PN diodes from Event - edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ============================ // Decode DCCHeader Information @@ -418,7 +399,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { std::vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - std::cout << " new color found " << color << " " << colors.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << " new color found " << color << " " << colors.size(); } } @@ -451,8 +432,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - std::cout << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId() - << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -472,7 +452,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { } if (pnGain != 1) - std::cout << "PN gain different from 1" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "PN gain different from 1"; // Calculate amplitude from pulse @@ -497,7 +477,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl); if (_debug == 1) - std::cout << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; } // =========================== @@ -516,7 +496,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EBDetId id_crystal(digiItr->id()); EBDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.ieta(); // global int phiG = id_crystal.iphi(); // global @@ -545,8 +525,8 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - std::cout << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID + << " module:" << module << " modules:" << modules.size(); // APD Pulse //=========== @@ -619,7 +599,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EEDetId id_crystal(digiItr->id()); EEDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.iy(); int phiG = id_crystal.ix(); @@ -652,14 +632,14 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - std::cout << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID + << " module:" << module << " modules:" << modules.size(); // APD Pulse //=========== if ((*digiItr).size() > 10) - std::cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -753,8 +733,8 @@ void EcalLaserAnalyzer::endJob() { //====================== if (_fitab) { - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; TFile* fAB = nullptr; TTree* ABInit = nullptr; if (doesABTreeExist) { @@ -764,8 +744,8 @@ void EcalLaserAnalyzer::endJob() { ABInit = (TTree*)fAB->Get("ABCol0"); } shapana->computeShape(alphafile, ABInit); - std::cout << "\t+=+ .................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ .................................... done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } // Don't do anything if there is no events @@ -776,7 +756,7 @@ void EcalLaserAnalyzer::endJob() { std::stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); - std::cout << " No Laser Events " << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << " No Laser Events "; return; } @@ -815,13 +795,13 @@ void EcalLaserAnalyzer::endJob() { // Analyze adc samples to get amplitudes //======================================= - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+"; if (!isGainOK) - std::cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - std::cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; APDFile = new TFile(APDfile.c_str(), "RECREATE"); @@ -993,7 +973,7 @@ void EcalLaserAnalyzer::endJob() { } if (_debug == 1) - std::cout << "-- debug test -- apdAmpl=" << apdAmpl << ", apdTime=" << apdTime << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- apdAmpl=" << apdAmpl << ", apdTime=" << apdTime; double pnmean; if (pn0 < 10 && pn1 > 10) { pnmean = pn1; @@ -1003,7 +983,7 @@ void EcalLaserAnalyzer::endJob() { pnmean = 0.5 * (pn0 + pn1); if (_debug == 1) - std::cout << "-- debug test -- pn0=" << pn0 << ", pn1=" << pn1 << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- pn0=" << pn0 << ", pn1=" << pn1; // Fill PN stuff //=============== @@ -1224,7 +1204,7 @@ void EcalLaserAnalyzer::endJob() { //=================== if (_debug == 1) - std::cout << "-- debug test -- Last Loop event:" << event << " apdAmpl:" << apdAmpl << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- Last Loop event:" << event << " apdAmpl:" << apdAmpl; apdAmplA = 0.0; apdAmplB = 0.0; @@ -1233,8 +1213,8 @@ void EcalLaserAnalyzer::endJob() { } if (_debug == 1) - std::cout << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB - << ", event:" << event << ", eventref:" << eventref << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB + << ", event:" << event << ", eventref:" << eventref; // Fill APD stuff //=============== @@ -1350,8 +1330,8 @@ void EcalLaserAnalyzer::endJob() { resFile->Close(); - std::cout << "\t+=+ .................................................. done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } void EcalLaserAnalyzer::setGeomEB( diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h index 259897fd07bb1..fee6e35d46253 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h @@ -5,7 +5,12 @@ #include #include -#include +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -44,7 +49,7 @@ class TMem; #define NSIDES 2 // Number of sides #define NREFCHAN 2 // Ref number for APDB -class EcalLaserAnalyzer : public edm::EDAnalyzer { +class EcalLaserAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalLaserAnalyzer(const edm::ParameterSet &iConfig); ~EcalLaserAnalyzer() override; @@ -62,37 +67,49 @@ class EcalLaserAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; bool _fitab; - double _alpha; - double _beta; - unsigned int _nevtmax; - double _noise; - double _chi2cut; - std::string _ecalPart; - bool _docorpn; - int _fedid; - bool _saveallevents; - double _qualpercent; - int _debug; + const double _alpha; + const double _beta; + const unsigned int _nevtmax; + const double _noise; + const double _chi2cut; + const std::string _ecalPart; + const bool _docorpn; + const int _fedid; + const bool _saveallevents; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TPNPulse *PNPulse; @@ -102,13 +119,8 @@ class EcalLaserAnalyzer : public edm::EDAnalyzer { bool doesABTreeExist; - std::string resdir_; - std::string pncorfile_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; + const std::string pncorfile_; // Output file names From ec6d1eb272d0dfa9d00a2393f28783f676beb7fd Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 26 Aug 2021 19:21:22 +0200 Subject: [PATCH 323/923] Modernise EcalLaserAnalyzer2. --- .../plugins/EcalLaserAnalyzer.cc | 1 - .../plugins/EcalLaserAnalyzer2.cc | 190 ++++++++---------- .../plugins/EcalLaserAnalyzer2.h | 86 ++++---- 3 files changed, 137 insertions(+), 140 deletions(-) diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc index 17f7a9767badb..a8d233d5770a3 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc @@ -20,7 +20,6 @@ #include #include -#include #include diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc index cd5a6ce560a3e..4b1aca7778e22 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc @@ -1,5 +1,6 @@ /* * \class EcalLaserAnalyzer2 + * * primary author: Julie Malcles - CEA/Saclay * author: Gautier Hamel De Monchenault - CEA/Saclay */ @@ -15,28 +16,18 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h" #include -#include -#include #include +#include #include -#include -#include #include -#include -#include - #include #include #include -#include #include #include -#include - -#include #include #include @@ -56,8 +47,15 @@ using namespace std; EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - - // framework parameters with default values + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), + // Framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -83,6 +81,9 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) _saveallevents(iConfig.getUntrackedParameter("saveAllEvents", false)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), + elecfile_(iConfig.getUntrackedParameter("elecFile")), + pncorfile_(iConfig.getUntrackedParameter("pnCorFile")), nCrys(NCRYSEB), nPNPerMod(NPNPERMOD), nMod(NMODEB), @@ -116,18 +117,11 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - elecfile_ = iConfig.getUntrackedParameter("elecFile"); - pncorfile_ = iConfig.getUntrackedParameter("pnCorFile"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization if (_ecalPart == "EB") { @@ -198,7 +192,7 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) EcalLaserAnalyzer2::~EcalLaserAnalyzer2() { //======================================================================== - // do anything here that needs to be done at desctruction time + // do anything here that needs to be done at destruction time // (e.g. close files, deallocate resources etc.) } @@ -267,7 +261,7 @@ void EcalLaserAnalyzer2::beginJob() { IsMatacqOK = getShapes(); if (!IsMatacqOK) { - cout << " ERROR! No matacq shape available: analysis aborted !" << endl; + edm::LogError("noshape") << " ERROR! No matacq shape available: analysis aborted !"; return; } @@ -285,11 +279,11 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } //retrieving crystal data from Event @@ -297,46 +291,37 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - cout << " Wrong ecalPart in cfg file " << endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file "; return; } // retrieving crystal PN diodes from Event - edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ==================================== // Decode Basic DCCHeader Information @@ -379,7 +364,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - cout << " new color found " << color << " " << colors.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << " new color found " << color << " " << colors.size(); } } @@ -417,7 +402,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - cout << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -437,7 +422,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) } if (pnGain != 1) - cout << "PN gain different from 1" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "PN gain different from 1"; // Calculate amplitude from pulse @@ -462,7 +447,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl); if (_debug == 1) - cout << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; } // =========================== @@ -483,7 +468,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EBDetId id_crystal(digiItr->id()); EBDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.ieta(); // global int phiG = id_crystal.iphi(); // global @@ -512,8 +497,8 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - cout << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -567,6 +552,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) Delta12->addEntry(APDPulse->getDelta(1, 2)); } } + } else if (EEDigi) { // Loop on crystals //=================== @@ -577,7 +563,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EEDetId id_crystal(digiItr->id()); EEDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.iy(); int phiG = id_crystal.ix(); @@ -610,14 +596,14 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - cout << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== if ((*digiItr).size() > 10) - cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -678,9 +664,9 @@ void EcalLaserAnalyzer2::endJob() { //======================================================================== if (!IsMatacqOK) { - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ WARNING! NO MATACQ +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ WARNING! NO MATACQ +=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; return; } @@ -712,7 +698,7 @@ void EcalLaserAnalyzer2::endJob() { stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); - cout << " No Laser Events " << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << " No Laser Events "; return; } @@ -751,13 +737,13 @@ void EcalLaserAnalyzer2::endJob() { // Analyze adc samples to get amplitudes //======================================= - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+"; if (!isGainOK) - cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; APDFile = new TFile(APDfile.c_str(), "RECREATE"); @@ -838,6 +824,7 @@ void EcalLaserAnalyzer2::endJob() { for (unsigned int iM = 0; iM < nMod; iM++) { unsigned int iMod = modules[iM] - 1; + for (unsigned int ich = 0; ich < nPNPerMod; ich++) { for (unsigned int icol = 0; icol < nCol; icol++) { PNFirstAnal[iMod][ich][icol] = new TPN(ich); @@ -911,8 +898,7 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - cout << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime << endl; - + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime; double pnmean; if (pn0 < 10 && pn1 > 10) { pnmean = pn1; @@ -922,7 +908,7 @@ void EcalLaserAnalyzer2::endJob() { pnmean = 0.5 * (pn0 + pn1); if (_debug >= 1) - cout << "-- debug test -- endJob -- pnMean:" << pnmean << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- pnMean:" << pnmean; // Fill PN stuff //=============== @@ -939,7 +925,7 @@ void EcalLaserAnalyzer2::endJob() { if (apdAmpl != 0.0) APDFirstAnal[iCry][iCol]->addEntry(apdAmpl, pnmean, pn0, pn1, apdTime); if (_debug >= 1) - cout << "-- debug test -- endJob -- filling APDTree" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- filling APDTree"; APDtrees[iCry]->Fill(); @@ -954,28 +940,28 @@ void EcalLaserAnalyzer2::endJob() { for (unsigned int ir = 0; ir < nRefChan; ir++) { if (_debug >= 1) - cout << "-- debug test -- ir:" << ir << " tt:" << towerID << " refmap:" << apdRefMap[ir][iMod + 1] - << " iCry:" << iCry << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- ir:" << ir << " tt:" << towerID << " refmap:" << apdRefMap[ir][iMod + 1] + << " iCry:" << iCry; if (apdRefMap[ir][iMod + 1] == iCry) { if (_debug >= 1) - cout << "-- debug test -- cut passed " << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- cut passed "; if (ir == 0) apdAmplA = apdAmpl; else if (ir == 1) apdAmplB = apdAmpl; if (_debug >= 1) - cout << "-- debug test -- apdAmplA=" << apdAmplA << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplA=" << apdAmplA; if (_debug >= 1) - cout << "-- debug test -- apdAmplB=" << apdAmplB << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplB=" << apdAmplB; if (_debug >= 1) - cout << "-- debug test -- color=" << color << ", event:" << event << ", ir:" << ir - << " tt-1:" << towerID - 1 << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- color=" << color << ", event:" << event << ", ir:" << ir + << " tt-1:" << towerID - 1; RefAPDtrees[ir][iMod + 1]->Fill(); if (_debug >= 1) - cout << "-- debug test -- tree filled" << event << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- tree filled" << event; } } } @@ -987,11 +973,10 @@ void EcalLaserAnalyzer2::endJob() { ADCFile->Close(); if (_debug == 1) - cout << "-- debug test -- endJob -- after apdAmpl Loop" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- after apdAmpl Loop"; // Remove temporary file //======================= - stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); @@ -1074,7 +1059,6 @@ void EcalLaserAnalyzer2::endJob() { // Build ref trees indexes //======================== - for (unsigned int imod = 0; imod < nMod; imod++) { int jmod = modules[imod]; if (RefAPDtrees[0][jmod]->GetEntries() != 0 && RefAPDtrees[1][jmod]->GetEntries() != 0) { @@ -1122,7 +1106,6 @@ void EcalLaserAnalyzer2::endJob() { APDFirstAnal[iCry][iCol]->getAPDoPN1().at(1)); APDAnal[iCry][iCol]->setTimeCut(APDFirstAnal[iCry][iCol]->getTime().at(0), APDFirstAnal[iCry][iCol]->getTime().at(1)); - APDAnal[iCry][iCol]->set2DAPDoAPD0Cut(lowcut, highcut); APDAnal[iCry][iCol]->set2DAPDoAPD1Cut(lowcut, highcut); } @@ -1144,7 +1127,7 @@ void EcalLaserAnalyzer2::endJob() { pnmean = 0.5 * (pn0 + pn1); // Get back color - //=============== + //================ unsigned int iCol = 0; for (unsigned int i = 0; i < nCol; i++) { @@ -1167,7 +1150,7 @@ void EcalLaserAnalyzer2::endJob() { //=================== if (_debug >= 1) - cout << "-- debug test -- LastLoop event:" << event << " apdAmpl:" << apdAmpl << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- LastLoop event:" << event << " apdAmpl:" << apdAmpl; apdAmplA = 0.0; apdAmplB = 0.0; @@ -1176,8 +1159,8 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug == 1) - cout << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event - << ", eventref:" << eventref << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event + << ", eventref:" << eventref; // Fill APD stuff //=============== @@ -1229,8 +1212,8 @@ void EcalLaserAnalyzer2::endJob() { flag = 0; if (_debug >= 1) - cout << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " << APDoPN[0] << " APDoAPDA[0] " - << APDoAPDA[0] << " flag " << flag << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " << APDoPN[0] << " APDoAPDA[0] " + << APDoAPDA[0] << " flag " << flag; restrees[iColor]->Fill(); } } @@ -1264,8 +1247,8 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - cout << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod - << " iColor:" << iColor << " ch:" << ch << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod + << " iColor:" << iColor << " ch:" << ch; // Fill PN results trees //======================== @@ -1277,7 +1260,6 @@ void EcalLaserAnalyzer2::endJob() { // Remove temporary files //======================== - if (!_saveallevents) { APDFile->Close(); stringstream del2; @@ -1287,6 +1269,7 @@ void EcalLaserAnalyzer2::endJob() { } else { APDFile->cd(); APDtrees[0]->Write(); + APDFile->Close(); resFile->cd(); } @@ -1301,8 +1284,8 @@ void EcalLaserAnalyzer2::endJob() { resFile->Close(); - cout << "\t+=+ .................................................. done +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } //======================================================================== @@ -1333,7 +1316,7 @@ bool EcalLaserAnalyzer2::getShapes() { laserShape->Scale(1.0 / y); } } else { - cout << " ERROR! Matacq shape file not found !" << endl; + edm::LogError("file_not_found") << " ERROR! Matacq shape file not found !"; } if (doesMatShapeExist) IsMatacqOK = true; @@ -1365,7 +1348,7 @@ bool EcalLaserAnalyzer2::getShapes() { } } else { - cout << " ERROR! Elec shape file not found !" << endl; + edm::LogError("file_not_found") << " ERROR! Elec shape file not found !"; } if (IsMatacqOK) { @@ -1380,7 +1363,7 @@ bool EcalLaserAnalyzer2::getShapes() { unsigned int nBins2 = int(elecShape->GetNbinsX()); if (nBins2 < nBins) { - cout << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins" << std::endl; + edm::LogError("cfg_error") << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins"; isSPRFine = false; } assert(nSamplesShapes == nBins2); @@ -1498,4 +1481,5 @@ void EcalLaserAnalyzer2::setGeomEE( idccID[channel] = dccID; iside[channel] = side; } + DEFINE_FWK_MODULE(EcalLaserAnalyzer2); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h index 55cdaa7d81ec1..ac202cc7f482e 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h @@ -1,7 +1,16 @@ // $Id: EcalLaserAnalyzer2.h #include -#include + +#include +#include + +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -40,7 +49,7 @@ class TMem; #define NREFCHAN 2 // Ref number for APDB #define NSAMPSHAPES 250 -class EcalLaserAnalyzer2 : public edm::EDAnalyzer { +class EcalLaserAnalyzer2 : public edm::one::EDAnalyzer<> { public: explicit EcalLaserAnalyzer2(const edm::ParameterSet &iConfig); ~EcalLaserAnalyzer2() override; @@ -58,35 +67,45 @@ class EcalLaserAnalyzer2 : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; - double _noise; - std::string _ecalPart; - bool _saveshapes; - bool _docorpn; - int _fedid; - bool _saveallevents; - double _qualpercent; - int _debug; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; + const double _noise; + const std::string _ecalPart; + const bool _saveshapes; + const bool _docorpn; + const int _fedid; + const bool _saveallevents; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TPNPulse *PNPulse; @@ -94,14 +113,9 @@ class EcalLaserAnalyzer2 : public edm::EDAnalyzer { TMom *Delta01; TMom *Delta12; - std::string resdir_; - std::string digiCollection_; - std::string elecfile_; - std::string pncorfile_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; + const std::string elecfile_; + const std::string pncorfile_; // Output file names From ecd916403103f501bc234f0f442ebe0e8da9b4d1 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 10:31:48 +0200 Subject: [PATCH 324/923] Modernise EcalPerEvtLaserAnalyzer. --- .../plugins/EcalPerEvtLaserAnalyzer.cc | 107 +++++++----------- .../plugins/EcalPerEvtLaserAnalyzer.h | 77 +++++++------ 2 files changed, 83 insertions(+), 101 deletions(-) diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc index 7feaa380bc004..0c031db93b6c7 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc @@ -11,12 +11,10 @@ #include "EcalPerEvtLaserAnalyzer.h" #include -#include #include #include #include -#include #include #include @@ -25,17 +23,9 @@ #include #include #include -#include -#include -#include - -#include #include #include -#include - -#include #include #include @@ -46,14 +36,19 @@ using namespace std; EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 3)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), _lastsample(iConfig.getUntrackedParameter("lastSample", 2)), - _samplemin(iConfig.getUntrackedParameter("sampleMin", 3)), - _samplemax(iConfig.getUntrackedParameter("sampleMax", 9)), _nsamplesPN(iConfig.getUntrackedParameter("nSamplesPN", 50)), _presamplePN(iConfig.getUntrackedParameter("nPresamplesPN", 6)), _firstsamplePN(iConfig.getUntrackedParameter("firstSamplePN", 7)), @@ -65,11 +60,10 @@ EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfi _tower(iConfig.getUntrackedParameter("tower", 1)), _channel(iConfig.getUntrackedParameter("channel", 1)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), + resdir_(iConfig.getUntrackedParameter("resDir")), + refalphabeta_(iConfig.getUntrackedParameter("refAlphaBeta")), nCrys(NCRYSEB), - nTT(NTTEB), - nSides(NSIDES), IsFileCreated(0), - nCh(0), runType(-1), runNum(0), dccID(-1), @@ -83,26 +77,18 @@ EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfi //======================================================================== { - //now do what ever initialization is needed - - resdir_ = iConfig.getUntrackedParameter("resDir"); - refalphabeta_ = iConfig.getUntrackedParameter("refAlphaBeta"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Define geometrical constants - + // if (_ecalPart == "EB") { nCrys = NCRYSEB; - nTT = NTTEB; } else { nCrys = NCRYSEE; - nTT = NTTEE; } } @@ -157,7 +143,6 @@ void EcalPerEvtLaserAnalyzer::beginJob() { ADCtrees->SetBranchAddress("pn1", &pn1); IsFileCreated = 0; - nCh = nCrys; } //======================================================================== @@ -169,11 +154,11 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } // retrieving crystal data from Event @@ -181,42 +166,34 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } // retrieving crystal PN diodes from Event edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ==================================== // Decode Basic DCCHeader Information @@ -285,7 +262,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - cout << " new color found " << color << " " << colors.size() << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << " new color found " << color << " " << colors.size(); } } @@ -391,7 +368,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup side = MEEBGeom::side(etaG, phiG); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); // int channelID=elecid_crystal.channelId()-1; // FIXME so far for endcap only @@ -479,7 +456,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int channelID = elecid_crystal.channelId() - 1; @@ -563,10 +540,10 @@ void EcalPerEvtLaserAnalyzer::endJob() { ADCtrees->Write(); - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ Analyzing laser data: getting per event +=+" << endl; - cout << "\t+=+ APD Amplitudes and ADC samples +=+" << endl; - cout << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ Analyzing laser data: getting per event +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ APD Amplitudes and ADC samples +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel; // Define temporary tree to save APD amplitudes @@ -739,8 +716,8 @@ void EcalPerEvtLaserAnalyzer::endJob() { del << "rm " << ADCfile; system(del.str().c_str()); - cout << "\t+=+ .................................................. done +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } DEFINE_FWK_MODULE(EcalPerEvtLaserAnalyzer); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h index 8828ad23a67ea..b661d5a0058e8 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h @@ -1,10 +1,18 @@ // $Id: EcalPerEvtLaserAnalyzer.h #include -#include -class TTree; +#include + +#include + +#include +#include +#include +#include + class TFile; +class TTree; // Define geometrical constants // NOT the same for "EB" and "EE" @@ -30,7 +38,7 @@ class TFile; #define NTTEE 33 // Number of EE Trigger Towers #define NPNEE 4 // Number of PN per EE supermodule -class EcalPerEvtLaserAnalyzer : public edm::EDAnalyzer { +class EcalPerEvtLaserAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalPerEvtLaserAnalyzer(const edm::ParameterSet &iConfig); ~EcalPerEvtLaserAnalyzer() override; @@ -44,54 +52,51 @@ class EcalPerEvtLaserAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; - unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _niter; - int _fedid; - unsigned int _tower; - unsigned int _channel; - std::string _ecalPart; - - std::string resdir_; - std::string refalphabeta_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const unsigned int _nsamples; + const unsigned int _presample; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _niter; + const int _fedid; + const unsigned int _tower; + const unsigned int _channel; + const std::string _ecalPart; + + const std::string resdir_; + const std::string refalphabeta_; // Output file names - std::string alphafile; std::string ADCfile; - std::string APDfile; std::string resfile; // Define geometrical constants // Default values correspond to "EB" geometry (1700 crystals) unsigned int nCrys; - unsigned int nTT; - unsigned int nSides; int IsFileCreated; - // Define number of channels (68 or 1700) for alpha and beta calculation - - unsigned int nCh; - // Identify run type int runType; From 3f58990567b4d16bfe4c87768a2c2b4218fdd6ab Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 11:04:16 +0200 Subject: [PATCH 325/923] Modernise EcalTestPulseAnalyzer. --- .../plugins/EcalLaserAnalyzer.h | 3 + .../plugins/EcalLaserAnalyzer2.h | 3 + .../plugins/EcalPerEvtLaserAnalyzer.h | 3 + .../plugins/EcalTestPulseAnalyzer.cc | 104 +++++++----------- .../plugins/EcalTestPulseAnalyzer.h | 72 +++++++----- 5 files changed, 95 insertions(+), 90 deletions(-) diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h index fee6e35d46253..5f17cbca450bd 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h @@ -1,3 +1,5 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h // $Id: EcalLaserAnalyzer.h #include @@ -244,3 +246,4 @@ class EcalLaserAnalyzer : public edm::one::EDAnalyzer<> { bool isGainOK; bool isTimingOK; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h index ac202cc7f482e..23b2320ed6d31 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h @@ -1,3 +1,5 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h // $Id: EcalLaserAnalyzer2.h #include @@ -257,3 +259,4 @@ class EcalLaserAnalyzer2 : public edm::one::EDAnalyzer<> { bool isGainOK; bool isTimingOK; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h index b661d5a0058e8..511edb95df466 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h @@ -1,3 +1,5 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h // $Id: EcalPerEvtLaserAnalyzer.h #include @@ -142,3 +144,4 @@ class EcalPerEvtLaserAnalyzer : public edm::one::EDAnalyzer<> { double apdTime; double pnAmpl; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc index 94f5dbf20a8fe..c5fa5c23ad55f 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc @@ -8,29 +8,20 @@ #include #include -using namespace std; #include "EcalTestPulseAnalyzer.h" #include -#include #include #include -#include #include #include -#include #include #include -#include -#include -#include - -#include -#include #include +#include #include #include @@ -45,9 +36,15 @@ using namespace std; EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values - _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 3)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -63,8 +60,8 @@ EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) _timeofmax(iConfig.getUntrackedParameter("timeOfMax", 4.5)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), _fedid(iConfig.getUntrackedParameter("fedID", -999)), + resdir_(iConfig.getUntrackedParameter("resDir")), nCrys(NCRYSEB), - nTT(NTTEB), nMod(NMODEB), nGainPN(NGAINPN), nGainAPD(NGAINAPD), @@ -89,25 +86,18 @@ EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - //now do what ever initialization is needed - - resdir_ = iConfig.getUntrackedParameter("resDir"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Define geometrical constants if (_ecalPart == "EB") { nCrys = NCRYSEB; - nTT = NTTEB; } else { nCrys = NCRYSEE; - nTT = NTTEE; } iZ = 1; @@ -209,56 +199,46 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& // Retrieve DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } - // retrieving crystal EB data from Event + // retrieving crystal data from Event edm::Handle pEBDigi; const EBDigiCollection* EBDigi = nullptr; - - // retrieving crystal EE data from Event edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } // Retrieve crystal PN diodes from Event edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_);; // ==================================== // Decode Basic DCCHeader Information @@ -338,7 +318,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& pnG[samId] = (*pnItr).sample(samId).gainId(); if (pnG[samId] != 1) - std::cout << "PN gain different from 1 for sample " << samId << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "PN gain different from 1 for sample " << samId; if (samId == 0) pngain = pnG[samId]; if (samId > 0) @@ -406,7 +386,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& side = MEEBGeom::side(etaG, phiG); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); towerID = elecid_crystal.towerId(); int strip = elecid_crystal.stripId(); @@ -522,7 +502,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); towerID = elecid_crystal.towerId(); channelID = elecid_crystal.channelId() - 1; @@ -652,16 +632,16 @@ void EcalTestPulseAnalyzer::endJob() { del << "rm " << rootfile; system(del.str().c_str()); - std::cout << " No TP Events " << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << " No TP Events "; return; } - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing test pulse data: getting APD, PN +=+" << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+ Analyzing test pulse data: getting APD, PN +=+"; // Create output ntuples: - //std::cout<< "TP Test Name File "<< resfile.c_str() << std::endl; + //edm::LogVerbatim("EcalTestPulseAnalyzer")<< "TP Test Name File "<< resfile.c_str(); resFile = new TFile(resfile.c_str(), "RECREATE"); @@ -810,8 +790,8 @@ void EcalTestPulseAnalyzer::endJob() { respntrees->Write(); resFile->Close(); - std::cout << "\t+=+ ...................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+ ...................................... done +=+"; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } DEFINE_FWK_MODULE(EcalTestPulseAnalyzer); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h index e21c2eee7ca2b..9e27a5e8ccb78 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h @@ -1,6 +1,17 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h #include -#include + +#include +#include + +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -17,22 +28,20 @@ class TTree; // 7 8 // // -// "EB" geometry + // "EB" geometry #define NCRYSEB 1700 // Number of crystals per EB supermodule -#define NTTEB 68 // Number of EB Trigger Towers #define NMODEB 9 // Number of EB submodules #define NPNPERMOD 2 // Number of PN per module // "EE" geometry #define NCRYSEE 830 // Number of crystals per EE supermodule -#define NTTEE 68 // Number of EE Trigger Towers #define NMODEE 21 // Number of EE submodules #define NGAINPN 2 // Number of gains #define NGAINAPD 4 // Number of gains -class EcalTestPulseAnalyzer : public edm::EDAnalyzer { +class EcalTestPulseAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalTestPulseAnalyzer(const edm::ParameterSet &iConfig); ~EcalTestPulseAnalyzer() override; @@ -44,30 +53,37 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; - unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _niter; - double _chi2max; - double _timeofmax; - std::string _ecalPart; - int _fedid; - - std::string resdir_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const unsigned int _nsamples; + const unsigned int _presample; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _samplemin; + const unsigned int _samplemax; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _niter; + const double _chi2max; + const double _timeofmax; + const std::string _ecalPart; + const int _fedid; + + const std::string resdir_; // Output file names @@ -78,7 +94,6 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { // Default values correspond to "EB" geometry (1700 crystals) unsigned int nCrys; - unsigned int nTT; unsigned int nMod; unsigned int nGainPN; unsigned int nGainAPD; @@ -148,3 +163,4 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { unsigned int firstChanMod[NMODEB]; unsigned int isFirstChanModFilled[NMODEB]; }; +#endif From 4468d4ddb2333707cdc2c3d5eaeaed0101558b51 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 11:58:16 +0200 Subject: [PATCH 326/923] Modernise EcalPedOffset. --- .../interface/EcalPedOffset.h | 32 ++++++++++++------- .../EcalPedestalOffsets/src/EcalPedOffset.cc | 28 ++++++++-------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h b/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h index 1d381dfcfcd48..d8800a0bf7756 100644 --- a/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h +++ b/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h @@ -1,5 +1,5 @@ -#ifndef EcalPedOffset_H -#define EcalPedOffset_H +#ifndef CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H +#define CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H /** * \file EcalPedOffset.h @@ -12,20 +12,20 @@ #include #include -#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/ParameterSet/interface/ParameterSet.h" +#include +#include +#include +#include + #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedResult.h" #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedValues.h" -class EBDigiCollection; -class EEDigiCollection; - -class EcalElectronicsMapping; - -class EcalPedOffset : public edm::EDAnalyzer { +class EcalPedOffset : public edm::one::EDAnalyzer { public: //! Constructor EcalPedOffset(const edm::ParameterSet &ps); @@ -39,6 +39,9 @@ class EcalPedOffset : public edm::EDAnalyzer { //! BeginRun void beginRun(edm::Run const &, edm::EventSetup const &eventSetup) override; + //! EndRun + void endRun(edm::Run const &, edm::EventSetup const &) override; + //! EndJob void endJob(void) override; @@ -58,9 +61,14 @@ class EcalPedOffset : public edm::EDAnalyzer { void readDACs(const edm::Handle &pDigis, const std::map &DACvalues); void readDACs(const edm::Handle &pDigis, const std::map &DACvalues); - edm::InputTag m_barrelDigiCollection; //!< secondary name given to collection of digis - edm::InputTag m_endcapDigiCollection; //!< secondary name given to collection of digis - edm::InputTag m_headerCollection; //!< name of module/plugin/producer making headers + const edm::InputTag m_barrelDigiCollection; //!< secondary name given to collection of digis + const edm::InputTag m_endcapDigiCollection; //!< secondary name given to collection of digis + const edm::InputTag m_headerCollection; //!< name of module/plugin/producer making headers + + const edm::EDGetTokenT m_rawDataToken; + const edm::EDGetTokenT m_ebDigiToken; + const edm::EDGetTokenT m_eeDigiToken; + const edm::ESGetToken m_mappingToken; std::string m_xmlFile; //!< name of the xml file to be saved diff --git a/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc b/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc index 398c70eafa0b2..318024986dcf4 100644 --- a/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc +++ b/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc @@ -22,14 +22,7 @@ #include "OnlineDB/EcalCondDB/interface/RunIOV.h" #include "OnlineDB/EcalCondDB/interface/RunTag.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" - #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" -#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" using namespace cms; using namespace edm; @@ -39,6 +32,10 @@ EcalPedOffset::EcalPedOffset(const ParameterSet ¶mSet) : m_barrelDigiCollection(paramSet.getParameter("EBdigiCollection")), m_endcapDigiCollection(paramSet.getParameter("EEdigiCollection")), m_headerCollection(paramSet.getParameter("headerCollection")), + m_rawDataToken(consumes(m_headerCollection)), + m_ebDigiToken(consumes(m_barrelDigiCollection)), + m_eeDigiToken(consumes(m_endcapDigiCollection)), + m_mappingToken(esConsumes()), m_xmlFile(paramSet.getParameter("xmlFile")), m_DACmin(paramSet.getUntrackedParameter("DACmin", 0)), m_DACmax(paramSet.getUntrackedParameter("DACmax", 256)), @@ -77,13 +74,18 @@ EcalPedOffset::~EcalPedOffset() { void EcalPedOffset::beginRun(Run const &, EventSetup const &eventSetup) { LogDebug("EcalPedOffset") << "entering beginRun..."; - edm::ESHandle handle; - eventSetup.get().get(handle); - ecalElectronicsMap_ = handle.product(); + // get the electronics map + const auto mappingHandle = eventSetup.getHandle(m_mappingToken); + ecalElectronicsMap_ = mappingHandle.product(); } // ----------------------------------------------------------------------------- +//! end the run +void EcalPedOffset::endRun(Run const &, EventSetup const &eventSetup) {} + +// ----------------------------------------------------------------------------- + //! perform the analysis void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { LogDebug("EcalPedOffset") << "entering analyze ..."; @@ -91,7 +93,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - event.getByLabel(m_headerCollection, DCCHeaders); + event.getByToken(m_rawDataToken, DCCHeaders); std::map DACvalues; @@ -112,7 +114,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the barrel digis // (one digi for each crystal) Handle barrelDigis; - event.getByLabel(m_barrelDigiCollection, barrelDigis); + event.getByToken(m_ebDigiToken, barrelDigis); if (!barrelDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << m_barrelDigiCollection << "; not reading barrel digis"; @@ -128,7 +130,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the endcap digis // (one digi for each crystal) Handle endcapDigis; - event.getByLabel(m_endcapDigiCollection, endcapDigis); + event.getByToken(m_eeDigiToken, endcapDigis); if (!endcapDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << m_endcapDigiCollection << "; not reading endcap digis"; From cf16d87d23c77239db2154276d4547835981437a Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 16:00:08 +0200 Subject: [PATCH 327/923] Modernise EcalDccWeightBuilder. --- .../interface/EcalDccWeightBuilder.h | 19 +-- .../EcalSRTools/src/EcalDccWeightBuilder.cc | 112 +++++++++--------- .../EcalSRTools/test/produceDccWeights.py | 5 +- 3 files changed, 69 insertions(+), 67 deletions(-) diff --git a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h index 028f3e718403c..a9a3bfbc8b23c 100644 --- a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h +++ b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h @@ -1,15 +1,16 @@ -/* - */ - -#ifndef ECALDCCWEIGHTBUILDER_CC -#define ECALDCCWEIGHTBUILDER_CC +#ifndef CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h +#define CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" @@ -23,7 +24,7 @@ class EcalElectronicsMapping; /** */ -class EcalDccWeightBuilder : public edm::EDAnalyzer { +class EcalDccWeightBuilder : public edm::one::EDAnalyzer<> { private: enum mode_t { WEIGHTS_FROM_CONFIG, COMPUTE_WEIGHTS }; @@ -122,6 +123,10 @@ class EcalDccWeightBuilder : public edm::EDAnalyzer { int dbVersion_; bool sqlMode_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken mappingToken_; + const edm::ESGetToken intercalibConstToken_; + edm::ESHandle geom_; EcalIntercalibConstantMap& calibMap_; diff --git a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc index 715971bd4f88b..de06c1de7a4f5 100644 --- a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc +++ b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc @@ -16,16 +16,10 @@ #include #include -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include #include "SimCalorimetry/EcalSimAlgos/interface/EcalSimParameterMap.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" #ifdef DB_WRITE_SUPPORT #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" @@ -59,6 +53,9 @@ EcalDccWeightBuilder::EcalDccWeightBuilder(edm::ParameterSet const& ps) dbTag_(ps.getParameter("dbTag")), dbVersion_(ps.getParameter("dbVersion")), sqlMode_(ps.getParameter("sqlMode")), + geometryToken_(esConsumes()), + mappingToken_(esConsumes()), + intercalibConstToken_(esConsumes()), calibMap_(emptyCalibMap_), ebShape_(consumesCollector()), eeShape_(consumesCollector()) { @@ -78,20 +75,17 @@ EcalDccWeightBuilder::EcalDccWeightBuilder(edm::ParameterSet const& ps) } void EcalDccWeightBuilder::analyze(const edm::Event& event, const edm::EventSetup& es) { - edm::ESHandle handle; - es.get().get(handle); - ecalElectronicsMap_ = handle.product(); + const auto mappingHandle = es.getHandle(mappingToken_); + ecalElectronicsMap_ = mappingHandle.product(); // Retrieval of intercalib constants if (dccWeightsWithIntercalib_) { - ESHandle hIntercalib; - es.get().get(hIntercalib); - const EcalIntercalibConstants* intercalib = hIntercalib.product(); - calibMap_ = intercalib->getMap(); + const auto& intercalibConst = es.getData(intercalibConstToken_); + calibMap_ = intercalibConst.getMap(); } //gets geometry - es.get().get(geom_); + geom_ = es.getHandle(geometryToken_); //computes the weights: computeAllWeights(dccWeightsWithIntercalib_, es); @@ -112,12 +106,12 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve EcalSimParameterMap parameterMap; const vector& ebDetIds = geom_->getValidDetIds(DetId::Ecal, EcalBarrel); - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "Number of EB det IDs: " << ebDetIds.size() << "\n"; const vector& eeDetIds = geom_->getValidDetIds(DetId::Ecal, EcalEndcap); - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "Number of EE det IDs: " << eeDetIds.size() << "\n"; vector detIds(ebDetIds.size() + eeDetIds.size()); @@ -140,12 +134,12 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve #if 0 //for debugging... - cout << __FILE__ << ":" << __LINE__ << ": "; + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if(it->subdetId()==EcalBarrel){ - cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " "; } else if(it->subdetId()==EcalEndcap){ - cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix() + edm::LogVerbatim("EcalDccWeightBuilder") << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; } else{ @@ -154,8 +148,8 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve << "Got a detId which is neither tagged as ECAL Barrel " << "not ECAL endcap while looping on ECAL cell detIds\n"; } - cout << " -> phase: " << phase << "\n"; - cout << " -> binOfMax: " << binOfMax << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << " -> phase: " << phase << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << " -> binOfMax: " << binOfMax << "\n"; #endif try { @@ -187,17 +181,17 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve unbiasWeights(w, &W); encodedWeights_[*it] = W; } catch (std::exception& e) { - cout << __FILE__ << ":" << __LINE__ << ": "; + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if (it->subdetId() == EcalBarrel) { - cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " "; } else if (it->subdetId() == EcalEndcap) { - cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() + edm::LogVerbatim("EcalDccWeightBuilder") << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; } else { - cout << "DetId " << (uint32_t)(*it); + edm::LogVerbatim("EcalDccWeightBuilder") << "DetId " << (uint32_t)(*it); } - cout << "phase: " << phase << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << "phase: " << phase << "\n"; throw; } } @@ -244,12 +238,12 @@ double EcalDccWeightBuilder::decodeWeight(int W) { return ((double)W) / weightSc template void EcalDccWeightBuilder::sort(const std::vector& a, std::vector& s, bool decreasingOrder) { - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "sort input array:" ; // for(unsigned i=0; i& a, std::vector& s, bo } } while (changed); - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "sorted list of indices:" ; // for(unsigned i=0; i < s.size(); ++i){ - // cout << "\t" << s[i]; + // edm::LogVerbatim("EcalDccWeightBuilder") << "\t" << s[i]; // } - // cout << "\n"; + // edm::LogVerbatim("EcalDccWeightBuilder") << "\n"; } void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vector* encodedWeights) { @@ -292,13 +286,13 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect wsum += W[i]; } - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "weights before bias correction: "; // for(unsigned i=0; i iw(nw); @@ -329,13 +323,13 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect i = 0; } - // cout << __FILE__ << ":" << __LINE__ << ": " + // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " // << "weights after bias correction: "; // for(unsigned i=0; iinsertConfigSet(&weight_info); int weight_id = weight_info.getId(); - cout << "WeightInfo inserted with ID " << weight_id << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "WeightInfo inserted with ID " << weight_id; vector datadel; datadel.reserve(encodedWeights_.size()); @@ -595,9 +589,9 @@ void EcalDccWeightBuilder::writeWeightToDB() { datadel.push_back(one_dat); } econn->insertConfigDataArraySet(datadel, &weight_info); - std::cout << " .. done insertion in DB " << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << " .. done insertion in DB "; delete econn; - cout << "closed DB connection ... done" << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "closed DB connection ... done"; } #endif //DB_WRITE_SUPPORT not defined @@ -617,22 +611,22 @@ void EcalDccWeightBuilder::dbId(const DetId& detId, int& fedId, int& smId, int& xtalId = (elecId.stripId() - 1) * stripLength + elecId.xtalId(); #if 0 - cout << __FILE__ << ":" << __LINE__ << ": FED ID " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": FED ID " << fedId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": SM logical ID " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": SM logical ID " << smId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": RU ID (TT or SC): " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": RU ID (TT or SC): " << ruId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": strip:" + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": strip:" << elecId.stripId() << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": xtal in strip: " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": xtal in strip: " << elecId.xtalId() << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": xtalId in RU: " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": xtalId in RU: " << xtalId << "\n"; #endif } diff --git a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py index 69d57d9e5786b..3483a236aa527 100644 --- a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py +++ b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py @@ -15,6 +15,9 @@ firstValid = cms.vuint32(1) ) +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") + # Conditions: # # a) Getting hardcoded conditions the same used for standard digitization: @@ -22,7 +25,7 @@ #process.EcalTrivialConditionRetriever.producedEcalIntercalibConstants = True # b) Getting conditions through frontier interface: process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -process.GlobalTag.globaltag = "CRAFT09_R_V4::All" +process.GlobalTag.globaltag = "113X_dataRun3_HLT_v3" # c) Getting conditions through oracle interface: #process.load("RecoLocalCalo.EcalRecProducers.getEcalConditions_orcoffint2r_cff") From 2c68e44e258c7acdb0baed6f427680b5d1a7d085 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 17:51:17 +0200 Subject: [PATCH 328/923] esConsumes migration EcalTPGDBCopy. --- .../EcalTPGTools/plugins/EcalTPGDBCopy.cc | 159 ++++++++---------- .../EcalTPGTools/plugins/EcalTPGDBCopy.h | 74 +++++++- 2 files changed, 138 insertions(+), 95 deletions(-) diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc index 836148ae531dc..7a9acc35ed156 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc @@ -1,57 +1,18 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h" -#include "CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" -#include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" -#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" - -#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h" - #include "EcalTPGDBCopy.h" #include EcalTPGDBCopy::EcalTPGDBCopy(const edm::ParameterSet& iConfig) : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + auto cc = consumesCollector(); std::string container; std::string tag; std::string record; @@ -62,6 +23,7 @@ EcalTPGDBCopy::EcalTPGDBCopy(const edm::ParameterSet& iConfig) record = i->getParameter("record"); m_cacheIDs.insert(std::make_pair(container, 0)); m_records.insert(std::make_pair(container, record)); + setConsumes(cc, container); } } @@ -80,7 +42,51 @@ void EcalTPGDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSet } } -bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +void EcalTPGDBCopy::setConsumes(edm::ConsumesCollector& cc, const std::string& container) { + if (container == "EcalTPGPedestals") { + pedestalsToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLinearizationConst") { + linearizationConstToken_ = cc.esConsumes(); + } else if (container == "EcalTPGSlidingWindow") { + slidingWindowToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainEBIdMap") { + fineGrainEBIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainStripEE") { + fineGrainStripEEToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainTowerEE") { + fineGrainTowerEEToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLutIdMap") { + lutIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGWeightIdMap") { + weightIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGWeightGroup") { + weightGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGOddWeightIdMap") { + oddWeightIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGOddWeightGroup") { + oddWeightGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGTPMode") { + tpModeToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLutGroup") { + lutGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainEBGroup") { + fineGrainEBGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGPhysicsConst") { + physicsConstToken_ = cc.esConsumes(); + } else if (container == "EcalTPGCrystalStatus") { + crystalStatusToken_ = cc.esConsumes(); + } else if (container == "EcalTPGTowerStatus") { + towerStatusToken_ = cc.esConsumes(); + } else if (container == "EcalTPGSpike") { + spikeToken_ = cc.esConsumes(); + } else if (container == "EcalTPGStripStatus") { + stripStatusToken_ = cc.esConsumes(); + } else { + throw cms::Exception("Unknown container"); + } +} + +bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "EcalTPGPedestals") { @@ -133,7 +139,7 @@ bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string cont } } -void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -142,148 +148,123 @@ void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string contai std::string recordName = m_records[container]; if (container == "EcalTPGPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(pedestalsToken_); const EcalTPGPedestals* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLinearizationConst") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(linearizationConstToken_); const EcalTPGLinearizationConst* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGSlidingWindow") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(slidingWindowToken_); const EcalTPGSlidingWindow* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainEBIdMapToken_); const EcalTPGFineGrainEBIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainStripEE") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainStripEEToken_); const EcalTPGFineGrainStripEE* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainTowerEE") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainTowerEEToken_); const EcalTPGFineGrainTowerEE* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLutIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(lutIdMapToken_); const EcalTPGLutIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGWeightIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(weightIdMapToken_); const EcalTPGWeightIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGWeightGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(weightGroupToken_); const EcalTPGWeightGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGOddWeightIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(oddWeightIdMapToken_); const EcalTPGOddWeightIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGOddWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGOddWeightGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(oddWeightGroupToken_); const EcalTPGOddWeightGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGOddWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTPMode") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(tpModeToken_); const EcalTPGTPMode* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGTPMode(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLutGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(lutGroupToken_); const EcalTPGLutGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); - + const auto handle = evtSetup.getHandle(fineGrainEBGroupToken_); const EcalTPGFineGrainEBGroup* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGPhysicsConst") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(physicsConstToken_); const EcalTPGPhysicsConst* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(crystalStatusToken_); const EcalTPGCrystalStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(towerStatusToken_); const EcalTPGTowerStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGSpike") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(spikeToken_); const EcalTPGSpike* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGStripStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(stripStatusToken_); const EcalTPGStripStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); - } - - else { + } else { throw cms::Exception("Unknown container"); } - std::cout << "EcalTPGDBCopy wrote " << recordName << std::endl; + edm::LogInfo("EcalTPGDBCopy") << "EcalTPGDBCopy wrote " << recordName; } diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h index 469cfd7266bc5..faa5bde5f72d5 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h @@ -1,11 +1,52 @@ -#ifndef ECALTPGDBCOPY_H -#define ECALTPGDBCOPY_H +#ifndef CalibCalorimetry_EcalTPGTools_EcalTPGDBCopy_h +#define CalibCalorimetry_EcalTPGTools_EcalTPGDBCopy_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/IOVSyncValue.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h" +#include "CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" +#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" + +#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h" + #include #include @@ -15,7 +56,7 @@ namespace edm { class EventSetup; } // namespace edm -class EcalTPGDBCopy : public edm::EDAnalyzer { +class EcalTPGDBCopy : public edm::one::EDAnalyzer<> { public: explicit EcalTPGDBCopy(const edm::ParameterSet& iConfig); ~EcalTPGDBCopy() override; @@ -23,12 +64,33 @@ class EcalTPGDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + void setConsumes(edm::ConsumesCollector& cc, const std::string& container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + + edm::ESGetToken pedestalsToken_; + edm::ESGetToken linearizationConstToken_; + edm::ESGetToken slidingWindowToken_; + edm::ESGetToken fineGrainEBIdMapToken_; + edm::ESGetToken fineGrainStripEEToken_; + edm::ESGetToken fineGrainTowerEEToken_; + edm::ESGetToken lutIdMapToken_; + edm::ESGetToken weightIdMapToken_; + edm::ESGetToken weightGroupToken_; + edm::ESGetToken oddWeightIdMapToken_; + edm::ESGetToken oddWeightGroupToken_; + edm::ESGetToken tpModeToken_; + edm::ESGetToken lutGroupToken_; + edm::ESGetToken fineGrainEBGroupToken_; + edm::ESGetToken physicsConstToken_; + edm::ESGetToken crystalStatusToken_; + edm::ESGetToken towerStatusToken_; + edm::ESGetToken spikeToken_; + edm::ESGetToken stripStatusToken_; }; #endif From 56ddfad5b7b95ab6d5ffc173e3af9c7b9b716508 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 18:12:26 +0200 Subject: [PATCH 329/923] esConsumes migration EcalLaserCondTools. --- .../interface/EcalLaserCondTools.h | 10 ++++++---- .../src/EcalLaserCondTools.cc | 15 +++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h index 767c91a27d448..9f179bfd709cf 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h @@ -1,16 +1,17 @@ -#ifndef EcaLaserCondTools_h -#define EcaLaserCondTools_h +#ifndef CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h +#define CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h /* * $Id: EcalLaserCondTools.h,v 1.2 2010/06/14 10:45:16 pgras Exp $ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" #include "DataFormats/DetId/interface/DetId.h" @@ -20,7 +21,7 @@ #include /** */ -class EcalLaserCondTools : public edm::EDAnalyzer { +class EcalLaserCondTools : public edm::one::EDAnalyzer<> { //static fields /** Number of extended laser monitoring regions @@ -83,6 +84,7 @@ class EcalLaserCondTools : public edm::EDAnalyzer { //fields private: + edm::ESGetToken laserAPDPNRatiosToken_; FILE* fout_; FILE* eventList_; std::string eventListFileName_; diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc index eb836e3c4a5f7..7a6c64d1f22de 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc @@ -7,12 +7,10 @@ #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.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 "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" @@ -36,6 +34,10 @@ EcalLaserCondTools::EcalLaserCondTools(const edm::ParameterSet& ps) toTime_(ps.getParameter("toTime")), minP_(ps.getParameter("transparencyMin")), maxP_(ps.getParameter("transparencyMax")) { + if (mode_ == "db_to_ascii_file") { + laserAPDPNRatiosToken_ = esConsumes(); + } + ferr_ = fopen("corr_errors.txt", "w"); fprintf(ferr_, "#t1\tdetid\tp1\tp2\tp3"); @@ -618,13 +620,10 @@ std::string EcalLaserCondTools::timeToString(time_t t) { } void EcalLaserCondTools::dbToAscii(const edm::EventSetup& es) { - edm::ESHandle hCorr; - es.get().get(hCorr); - - const EcalLaserAPDPNRatios* corr = hCorr.product(); + const auto& laserAPDPNRatios = es.getData(laserAPDPNRatiosToken_); - const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& p = corr->getLaserMap(); - const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& t = corr->getTimeMap(); + const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& p = laserAPDPNRatios.getLaserMap(); + const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& t = laserAPDPNRatios.getTimeMap(); if (t.size() != EcalLaserCondTools::nLmes) throw cms::Exception("LasCor") << "Unexpected number time parameter triplets\n"; From 7af274be52d22febca42cd4f1aa226618946d38f Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 19:14:52 +0200 Subject: [PATCH 330/923] esConsumes migration EcalTrivialObjectAnalyzer. --- .../interface/EcalTrivialObjectAnalyzer.h | 86 +++++- .../src/EcalTrivialObjectAnalyzer.cc | 244 ++++++------------ 2 files changed, 166 insertions(+), 164 deletions(-) diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h index e3308173f5691..e977a789cd7ba 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h @@ -1,18 +1,96 @@ +#ifndef CalibCalorimetry_EcalTrivialCondModules_EcalTrivialObjectAnalyzer_h +#define CalibCalorimetry_EcalTrivialCondModules_EcalTrivialObjectAnalyzer_h // // Created: 2 Mar 2006 // Shahram Rahatlou, University of Rome & INFN // -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -class EcalTrivialObjectAnalyzer : public edm::EDAnalyzer { +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" +#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" +#include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" +#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" +#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" + +class EcalTrivialObjectAnalyzer : public edm::one::EDAnalyzer<> { public: - explicit EcalTrivialObjectAnalyzer(edm::ParameterSet const& p) {} - explicit EcalTrivialObjectAnalyzer(int i) {} + explicit EcalTrivialObjectAnalyzer(edm::ParameterSet const& p); ~EcalTrivialObjectAnalyzer() override {} void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: + const edm::ESGetToken pedestalsToken_; + const edm::ESGetToken adcToGevConstantToken_; + const edm::ESGetToken weightXtalGroupsToken_; + const edm::ESGetToken gainRatiosToken_; + const edm::ESGetToken intercalibConstantsToken_; + const edm::ESGetToken intercalibErrorsToken_; + const edm::ESGetToken timeCalibConstantsToken_; + const edm::ESGetToken timeCalibErrorsToken_; + const edm::ESGetToken timeOffsetConstantToken_; + const edm::ESGetToken tbWeightsToken_; + const edm::ESGetToken clusterLocalContCorrToken_; + const edm::ESGetToken clusterCrackCorrToken_; + const edm::ESGetToken clusterEnergyCorrectionToken_; + const edm::ESGetToken clusterEnergyUncertaintyToken_; + const edm::ESGetToken clusterEnergyCorrectionObjectSpecificToken_; + const edm::ESGetToken laserAlphasToken_; + const edm::ESGetToken laserAPDPNRatiosRefToken_; + const edm::ESGetToken laserAPDPNRatiosToken_; + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken sampleMaskToken_; }; +#endif diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc index b1613f496bc7a..ad9c138f6c295 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc @@ -10,90 +10,51 @@ #include #include #include -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" - -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" - #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" - #include "CondFormats/EcalObjects/interface/EcalWeightSet.h" -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" -#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" -#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" - +#include "DataFormats/EcalDetId/interface/EBDetId.h" #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" -#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" #include "CLHEP/Matrix/Matrix.h" using namespace std; +EcalTrivialObjectAnalyzer::EcalTrivialObjectAnalyzer(edm::ParameterSet const& p) + : pedestalsToken_(esConsumes()), + adcToGevConstantToken_(esConsumes()), + weightXtalGroupsToken_(esConsumes()), + gainRatiosToken_(esConsumes()), + intercalibConstantsToken_(esConsumes()), + intercalibErrorsToken_(esConsumes()), + timeCalibConstantsToken_(esConsumes()), + timeCalibErrorsToken_(esConsumes()), + timeOffsetConstantToken_(esConsumes()), + tbWeightsToken_(esConsumes()), + clusterLocalContCorrToken_(esConsumes()), + clusterCrackCorrToken_(esConsumes()), + clusterEnergyCorrectionToken_(esConsumes()), + clusterEnergyUncertaintyToken_(esConsumes()), + clusterEnergyCorrectionObjectSpecificToken_(esConsumes()), + laserAlphasToken_(esConsumes()), + laserAPDPNRatiosRefToken_(esConsumes()), + laserAPDPNRatiosToken_(esConsumes()), + channelStatusToken_(esConsumes()), + sampleMaskToken_(esConsumes()) { +} + void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm::eventsetup; // Context is not used. edm::LogInfo(">>> EcalTrivialObjectAnalyzer: processing run ") << e.id().run() << " event: " << e.id().event(); - edm::ESHandle pPeds; - context.get().get(pPeds); - // ADC -> GeV Scale - edm::ESHandle pAgc; - context.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); - edm::LogInfo("Global ADC->GeV scale: EB ") << std::setprecision(6) << agc->getEBValue() + const auto& agc = context.getData(adcToGevConstantToken_); + edm::LogInfo("Global ADC->GeV scale: EB ") << std::setprecision(6) << agc.getEBValue() << " GeV/ADC count" " EE " - << std::setprecision(6) << agc->getEEValue() << " GeV/ADC count"; + << std::setprecision(6) << agc.getEEValue() << " GeV/ADC count"; // use a channel to fetch values from DB double r1 = (double)std::rand() / (double(RAND_MAX) + double(1)); @@ -104,9 +65,9 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet EBDetId ebid(ieta, iphi); //eta,phi edm::LogInfo("EcalTrivialObjectAnalyzer: using EBDetId: ") << ebid; - const EcalPedestals* myped = pPeds.product(); - EcalPedestals::const_iterator it = myped->find(ebid.rawId()); - if (it != myped->end()) { + const auto& myped = context.getData(pedestalsToken_); + EcalPedestals::const_iterator it = myped.find(ebid.rawId()); + if (it != myped.end()) { edm::LogInfo("EcalPedestal: ") << " mean_x1: " << std::setprecision(8) << (*it).mean_x1 << " rms_x1: " << (*it).rms_x1 << " mean_x6: " << (*it).mean_x6 << " rms_x6: " << (*it).rms_x6 << " mean_x12: " << (*it).mean_x12 @@ -116,13 +77,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // fetch map of groups of xtals - edm::ESHandle pGrp; - context.get().get(pGrp); - const EcalWeightXtalGroups* grp = pGrp.product(); + const auto& grp = context.getData(weightXtalGroupsToken_); - EcalXtalGroupsMap::const_iterator git = grp->getMap().find(ebid.rawId()); + EcalXtalGroupsMap::const_iterator git = grp.getMap().find(ebid.rawId()); EcalXtalGroupId gid; - if (git != grp->getMap().end()) { + if (git != grp.getMap().end()) { edm::LogInfo("XtalGroupId.id() = ") << std::setprecision(3) << (*git).id(); gid = (*git); } else { @@ -130,13 +89,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Gain Ratios - edm::ESHandle pRatio; - context.get().get(pRatio); - const EcalGainRatios* gr = pRatio.product(); + const auto& gr = context.getData(gainRatiosToken_); - EcalGainRatioMap::const_iterator grit = gr->getMap().find(ebid.rawId()); + EcalGainRatioMap::const_iterator grit = gr.getMap().find(ebid.rawId()); EcalMGPAGainRatio mgpa; - if (grit != gr->getMap().end()) { + if (grit != gr.getMap().end()) { mgpa = (*grit); edm::LogInfo("EcalMGPAGainRatio: ") << "gain 12/6 : " << std::setprecision(4) << mgpa.gain12Over6() @@ -146,13 +103,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Intercalib constants - edm::ESHandle pIcal; - context.get().get(pIcal); - const EcalIntercalibConstants* ical = pIcal.product(); + const auto& ical = context.getData(intercalibConstantsToken_); - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(ebid.rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(ebid.rawId()); EcalIntercalibConstant icalconst; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); edm::LogInfo("EcalIntercalibConstant: ") << std::setprecision(6) << icalconst; @@ -161,13 +116,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Intercalib errors - edm::ESHandle pIcalErr; - context.get().get(pIcalErr); - const EcalIntercalibErrors* icalErr = pIcalErr.product(); + const auto& icalErr = context.getData(intercalibErrorsToken_); - EcalIntercalibErrorMap::const_iterator icalitErr = icalErr->getMap().find(ebid.rawId()); + EcalIntercalibErrorMap::const_iterator icalitErr = icalErr.getMap().find(ebid.rawId()); EcalIntercalibError icalconstErr; - if (icalitErr != icalErr->getMap().end()) { + if (icalitErr != icalErr.getMap().end()) { icalconstErr = (*icalitErr); edm::LogInfo("EcalIntercalibError: ") << std::setprecision(6) << icalconstErr; @@ -177,13 +130,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet { // quick and dirty for cut and paste ;) it is a test program... // TimeCalib constants - edm::ESHandle pIcal; - context.get().get(pIcal); - const EcalTimeCalibConstants* ical = pIcal.product(); + const auto& ical = context.getData(timeCalibConstantsToken_); - EcalTimeCalibConstantMap::const_iterator icalit = ical->getMap().find(ebid.rawId()); + EcalTimeCalibConstantMap::const_iterator icalit = ical.getMap().find(ebid.rawId()); EcalTimeCalibConstant icalconst; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); edm::LogInfo("EcalTimeCalibConstant: ") << std::setprecision(6) << icalconst; @@ -192,13 +143,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // TimeCalib errors - edm::ESHandle pIcalErr; - context.get().get(pIcalErr); - const EcalTimeCalibErrors* icalErr = pIcalErr.product(); + const auto& icalErr = context.getData(timeCalibErrorsToken_); - EcalTimeCalibErrorMap::const_iterator icalitErr = icalErr->getMap().find(ebid.rawId()); + EcalTimeCalibErrorMap::const_iterator icalitErr = icalErr.getMap().find(ebid.rawId()); EcalTimeCalibError icalconstErr; - if (icalitErr != icalErr->getMap().end()) { + if (icalitErr != icalErr.getMap().end()) { icalconstErr = (*icalitErr); edm::LogInfo("EcalTimeCalibError: ") << std::setprecision(6) << icalconstErr; @@ -211,27 +160,23 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet //std::cout <<"Fetching TimeOffsetConstant from DB " << std::endl; // Time Offset constants - edm::ESHandle pTOff; - context.get().get(pTOff); - const EcalTimeOffsetConstant* TOff = pTOff.product(); + const auto& TOff = context.getData(timeOffsetConstantToken_); - edm::LogInfo("EcalTimeOffsetConstant: ") << " EB " << TOff->getEBValue() << " EE " << TOff->getEEValue(); + edm::LogInfo("EcalTimeOffsetConstant: ") << " EB " << TOff.getEBValue() << " EE " << TOff.getEEValue(); // fetch TB weights edm::LogInfo("Fetching EcalTBWeights from DB "); - edm::ESHandle pWgts; - context.get().get(pWgts); - const EcalTBWeights* wgts = pWgts.product(); - edm::LogInfo("EcalTBWeightMap.size(): ") << std::setprecision(3) << wgts->getMap().size(); + const auto& wgts = context.getData(tbWeightsToken_); + edm::LogInfo("EcalTBWeightMap.size(): ") << std::setprecision(3) << wgts.getMap().size(); // look up the correct weights for this xtal //EcalXtalGroupId gid( (*git) ); EcalTBWeights::EcalTDCId tdcid(1); edm::LogInfo("Lookup EcalWeightSet for groupid: ") << std::setprecision(3) << gid.id() << " and TDC id " << tdcid; - EcalTBWeights::EcalTBWeightMap::const_iterator wit = wgts->getMap().find(std::make_pair(gid, tdcid)); + EcalTBWeights::EcalTBWeightMap::const_iterator wit = wgts.getMap().find(std::make_pair(gid, tdcid)); EcalWeightSet wset; - if (wit != wgts->getMap().end()) { + if (wit != wgts.getMap().end()) { wset = wit->second; edm::LogInfo("check size of data members in EcalWeightSet"); //wit->second.print(std::cout); @@ -259,52 +204,41 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // cluster functions/corrections - edm::ESHandle pLocalCont; - context.get().get(pLocalCont); - const EcalClusterLocalContCorrParameters* paramLocalCont = pLocalCont.product(); + const auto& paramLocalCont = context.getData(clusterLocalContCorrToken_); edm::LogInfo("LocalContCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramLocalCont->params().begin(); - it != paramLocalCont->params().end(); + for (EcalFunctionParameters::const_iterator it = paramLocalCont.params().begin(); + it != paramLocalCont.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pCrack; - context.get().get(pCrack); - const EcalClusterCrackCorrParameters* paramCrack = pCrack.product(); + const auto& paramCrack = context.getData(clusterCrackCorrToken_); edm::LogInfo("CrackCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramCrack->params().begin(); it != paramCrack->params().end(); + for (EcalFunctionParameters::const_iterator it = paramCrack.params().begin(); it != paramCrack.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyCorrection; - context.get().get(pEnergyCorrection); - const EcalClusterEnergyCorrectionParameters* paramEnergyCorrection = pEnergyCorrection.product(); +const auto& paramEnergyCorrection = context.getData(clusterEnergyCorrectionToken_); edm::LogInfo("EnergyCorrectionParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyCorrection->params().begin(); - it != paramEnergyCorrection->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyCorrection.params().begin(); + it != paramEnergyCorrection.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyUncertainty; - context.get().get(pEnergyUncertainty); - const EcalClusterEnergyUncertaintyParameters* paramEnergyUncertainty = pEnergyUncertainty.product(); + const auto& paramEnergyUncertainty = context.getData(clusterEnergyUncertaintyToken_); edm::LogInfo("EnergyCorrectionParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyUncertainty->params().begin(); - it != paramEnergyUncertainty->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyUncertainty.params().begin(); + it != paramEnergyUncertainty.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyCorrectionObjectSpecific; - context.get().get(pEnergyCorrectionObjectSpecific); - const EcalClusterEnergyCorrectionObjectSpecificParameters* paramEnergyCorrectionObjectSpecific = - pEnergyCorrectionObjectSpecific.product(); + const auto& paramEnergyCorrectionObjectSpecific = context.getData(clusterEnergyCorrectionObjectSpecificToken_); edm::LogInfo("EnergyCorrectionObjectSpecificParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyCorrectionObjectSpecific->params().begin(); - it != paramEnergyCorrectionObjectSpecific->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyCorrectionObjectSpecific.params().begin(); + it != paramEnergyCorrectionObjectSpecific.params().end(); ++it) { // edm::LogInfo(" ") << *it; } @@ -313,26 +247,22 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet // laser correction // laser alphas - edm::ESHandle pAlpha; - context.get().get(pAlpha); - const EcalLaserAlphas* lalpha = pAlpha.product(); + const auto& lalpha = context.getData(laserAlphasToken_); EcalLaserAlphaMap::const_iterator lalphait; - lalphait = lalpha->getMap().find(ebid.rawId()); - if (lalphait != lalpha->getMap().end()) { + lalphait = lalpha.getMap().find(ebid.rawId()); + if (lalphait != lalpha.getMap().end()) { edm::LogInfo("EcalLaserAlpha: ") << std::setprecision(6) << (*lalphait); } else { edm::LogInfo("No laser alpha found for this xtal! something wrong with EcalLaserAlphas in your DB? "); } // laser apdpnref - edm::ESHandle pAPDPNRatiosRef; - context.get().get(pAPDPNRatiosRef); - const EcalLaserAPDPNRatiosRef* lref = pAPDPNRatiosRef.product(); + const auto& lref = context.getData(laserAPDPNRatiosRefToken_); EcalLaserAPDPNRatiosRef::const_iterator lrefit; - lrefit = lref->getMap().find(ebid.rawId()); - if (lrefit != lref->getMap().end()) { + lrefit = lref.getMap().find(ebid.rawId()); + if (lrefit != lref.getMap().end()) { // edm::LogInfo("EcalLaserAPDPNRatiosRef: ") // < pAPDPNRatios; - context.get().get(pAPDPNRatios); - const EcalLaserAPDPNRatios* lratio = pAPDPNRatios.product(); + const auto& lratio = context.getData(laserAPDPNRatiosToken_); EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap::const_iterator lratioit; - lratioit = lratio->getLaserMap().find(ebid.rawId()); + lratioit = lratio.getLaserMap().find(ebid.rawId()); EcalLaserAPDPNRatios::EcalLaserAPDPNpair lratioconst; - if (lratioit != lratio->getLaserMap().end()) { + if (lratioit != lratio.getLaserMap().end()) { lratioconst = (*lratioit); // edm::LogInfo("EcalLaserAPDPNRatios: ") @@ -366,20 +294,18 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet EcalLaserAPDPNRatios::EcalLaserTimeStamp ltimestamp; // EcalLaserAPDPNRatios::EcalLaserTimeStampMap::const_iterator ltimeit; for (int i = 1; i <= 92; i++) { - ltimestamp = lratio->getTimeMap()[i]; + ltimestamp = lratio.getTimeMap()[i]; // edm::LogInfo("i = ") << std::setprecision(6) << i // << ltimestamp.t1.value() << " " << ltimestamp.t2.value() << " : " ; } // edm::LogInfo("Tests finished."); // channel status - edm::ESHandle pChannelStatus; - context.get().get(pChannelStatus); - const EcalChannelStatus* ch_status = pChannelStatus.product(); + const auto& ch_status = context.getData(channelStatusToken_); EcalChannelStatusMap::const_iterator chit; - chit = ch_status->getMap().find(ebid.rawId()); - if (chit != ch_status->getMap().end()) { + chit = ch_status.getMap().find(ebid.rawId()); + if (chit != ch_status.getMap().end()) { EcalChannelStatusCode ch_code = (*chit); edm::LogInfo("EcalChannelStatus: ") << std::setprecision(6) << ch_code.getStatusCode(); } else { @@ -389,11 +315,9 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet // laser transparency correction // Mask to ignore sample - edm::ESHandle pSMask; - context.get().get(pSMask); - const EcalSampleMask* smask = pSMask.product(); - edm::LogInfo("Sample Mask EB ") << std::hex << smask->getEcalSampleMaskRecordEB() << " EE " << std::hex - << smask->getEcalSampleMaskRecordEE(); + const auto& smask = context.getData(sampleMaskToken_); + edm::LogInfo("Sample Mask EB ") << std::hex << smask.getEcalSampleMaskRecordEB() << " EE " << std::hex + << smask.getEcalSampleMaskRecordEE(); /* std::cout << "make CLHEP matrices from vector>" << std::endl; From 67d8effe18c38b96f1405ea6a59e0379f447f34f Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 30 Aug 2021 19:20:51 +0200 Subject: [PATCH 331/923] Apply code-checks and code-format. --- .../plugins/HcalRecHitRecalib.cc | 3 +- .../plugins/EcalABAnalyzer.cc | 4 +- .../plugins/EcalLaserAnalyzer.cc | 22 ++++++---- .../plugins/EcalLaserAnalyzer2.cc | 44 +++++++++++-------- .../plugins/EcalPerEvtLaserAnalyzer.cc | 18 +++++--- .../plugins/EcalTestPulseAnalyzer.cc | 3 +- .../EcalSRTools/src/EcalDccWeightBuilder.cc | 9 ++-- .../interface/EcalTrivialObjectAnalyzer.h | 13 ++++-- .../src/EcalTrivialObjectAnalyzer.cc | 11 ++--- 9 files changed, 74 insertions(+), 53 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc index 70c7a7279c3f1..f35e3a0e6090e 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc @@ -17,8 +17,7 @@ HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) RecalibHOHits_(iConfig.getParameter("RecalibHOHitCollection")), hcalfileinpath_(iConfig.getUntrackedParameter("fileNameHcal", "")), refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), - refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)) -{ + refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)) { // HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer"); // HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); // HFHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc index 411ee73ced9af..dca17f7b11474 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc @@ -230,8 +230,8 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { const EcalRawDataCollection* DCCHeader = nullptr; e.getByToken(rawDataToken_, pDCCHeader); if (!pDCCHeader.isValid()) { - edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str(); + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() + << " " << eventHeaderProducer_.c_str(); } else { DCCHeader = pDCCHeader.product(); } diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc index a8d233d5770a3..78f9ea713a32d 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc @@ -314,8 +314,8 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { const EcalRawDataCollection* DCCHeader = nullptr; e.getByToken(rawDataToken_, pDCCHeader); if (!pDCCHeader.isValid()) { - edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str(); + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() + << " " << eventHeaderProducer_.c_str(); } else { DCCHeader = pDCCHeader.product(); } @@ -431,7 +431,8 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -524,8 +525,9 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size(); + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -631,8 +633,9 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size(); + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -1212,8 +1215,9 @@ void EcalLaserAnalyzer::endJob() { } if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB - << ", event:" << event << ", eventref:" << eventref; + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event + << ", eventref:" << eventref; // Fill APD stuff //=============== diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc index 4b1aca7778e22..b3f78c55771c0 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc @@ -402,7 +402,8 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -447,7 +448,8 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; } // =========================== @@ -497,8 +499,9 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size(); + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -596,8 +599,9 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size(); + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -898,7 +902,8 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime; double pnmean; if (pn0 < 10 && pn1 > 10) { pnmean = pn1; @@ -940,8 +945,8 @@ void EcalLaserAnalyzer2::endJob() { for (unsigned int ir = 0; ir < nRefChan; ir++) { if (_debug >= 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- ir:" << ir << " tt:" << towerID << " refmap:" << apdRefMap[ir][iMod + 1] - << " iCry:" << iCry; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- ir:" << ir << " tt:" << towerID + << " refmap:" << apdRefMap[ir][iMod + 1] << " iCry:" << iCry; if (apdRefMap[ir][iMod + 1] == iCry) { if (_debug >= 1) @@ -955,8 +960,8 @@ void EcalLaserAnalyzer2::endJob() { if (_debug >= 1) edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplB=" << apdAmplB; if (_debug >= 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- color=" << color << ", event:" << event << ", ir:" << ir - << " tt-1:" << towerID - 1; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- color=" << color << ", event:" << event + << ", ir:" << ir << " tt-1:" << towerID - 1; RefAPDtrees[ir][iMod + 1]->Fill(); @@ -1159,8 +1164,9 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug == 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event - << ", eventref:" << eventref; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event + << ", eventref:" << eventref; // Fill APD stuff //=============== @@ -1212,8 +1218,8 @@ void EcalLaserAnalyzer2::endJob() { flag = 0; if (_debug >= 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " << APDoPN[0] << " APDoAPDA[0] " - << APDoAPDA[0] << " flag " << flag; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " + << APDoPN[0] << " APDoAPDA[0] " << APDoAPDA[0] << " flag " << flag; restrees[iColor]->Fill(); } } @@ -1247,8 +1253,9 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod - << " iColor:" << iColor << " ch:" << ch; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod + << " iColor:" << iColor << " ch:" << ch; // Fill PN results trees //======================== @@ -1363,7 +1370,8 @@ bool EcalLaserAnalyzer2::getShapes() { unsigned int nBins2 = int(elecShape->GetNbinsX()); if (nBins2 < nBins) { - edm::LogError("cfg_error") << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins"; + edm::LogError("cfg_error") + << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins"; isSPRFine = false; } assert(nSamplesShapes == nBins2); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc index 0c031db93b6c7..53654b6ad07f5 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc @@ -540,10 +540,14 @@ void EcalPerEvtLaserAnalyzer::endJob() { ADCtrees->Write(); - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ Analyzing laser data: getting per event +=+"; - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ APD Amplitudes and ADC samples +=+"; - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ Analyzing laser data: getting per event +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ APD Amplitudes and ADC samples +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel; // Define temporary tree to save APD amplitudes @@ -716,8 +720,10 @@ void EcalPerEvtLaserAnalyzer::endJob() { del << "rm " << ADCfile; system(del.str().c_str()); - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+ .................................................. done +=+"; - edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } DEFINE_FWK_MODULE(EcalPerEvtLaserAnalyzer); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc index c5fa5c23ad55f..2a6b03dce1946 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc @@ -238,7 +238,8 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& } // retrieving electronics mapping - const auto& TheMapping = c.getData(mappingToken_);; + const auto& TheMapping = c.getData(mappingToken_); + ; // ==================================== // Decode Basic DCCHeader Information diff --git a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc index de06c1de7a4f5..74cfba121b85c 100644 --- a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc +++ b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc @@ -183,11 +183,12 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve } catch (std::exception& e) { edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if (it->subdetId() == EcalBarrel) { - edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() - << " "; + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() + << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " "; } else if (it->subdetId() == EcalEndcap) { - edm::LogVerbatim("EcalDccWeightBuilder") << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() - << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; + edm::LogVerbatim("EcalDccWeightBuilder") + << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() + << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; } else { edm::LogVerbatim("EcalDccWeightBuilder") << "DetId " << (uint32_t)(*it); } diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h index e977a789cd7ba..cef90d783dc02 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h @@ -82,11 +82,16 @@ class EcalTrivialObjectAnalyzer : public edm::one::EDAnalyzer<> { const edm::ESGetToken timeCalibErrorsToken_; const edm::ESGetToken timeOffsetConstantToken_; const edm::ESGetToken tbWeightsToken_; - const edm::ESGetToken clusterLocalContCorrToken_; + const edm::ESGetToken + clusterLocalContCorrToken_; const edm::ESGetToken clusterCrackCorrToken_; - const edm::ESGetToken clusterEnergyCorrectionToken_; - const edm::ESGetToken clusterEnergyUncertaintyToken_; - const edm::ESGetToken clusterEnergyCorrectionObjectSpecificToken_; + const edm::ESGetToken + clusterEnergyCorrectionToken_; + const edm::ESGetToken + clusterEnergyUncertaintyToken_; + const edm::ESGetToken + clusterEnergyCorrectionObjectSpecificToken_; const edm::ESGetToken laserAlphasToken_; const edm::ESGetToken laserAPDPNRatiosRefToken_; const edm::ESGetToken laserAPDPNRatiosToken_; diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc index ad9c138f6c295..3b6b52ff96aae 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc @@ -41,8 +41,7 @@ EcalTrivialObjectAnalyzer::EcalTrivialObjectAnalyzer(edm::ParameterSet const& p) laserAPDPNRatiosRefToken_(esConsumes()), laserAPDPNRatiosToken_(esConsumes()), channelStatusToken_(esConsumes()), - sampleMaskToken_(esConsumes()) { -} + sampleMaskToken_(esConsumes()) {} void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm::eventsetup; @@ -206,20 +205,18 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet // cluster functions/corrections const auto& paramLocalCont = context.getData(clusterLocalContCorrToken_); edm::LogInfo("LocalContCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramLocalCont.params().begin(); - it != paramLocalCont.params().end(); + for (EcalFunctionParameters::const_iterator it = paramLocalCont.params().begin(); it != paramLocalCont.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; const auto& paramCrack = context.getData(clusterCrackCorrToken_); edm::LogInfo("CrackCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramCrack.params().begin(); it != paramCrack.params().end(); - ++it) { + for (EcalFunctionParameters::const_iterator it = paramCrack.params().begin(); it != paramCrack.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; -const auto& paramEnergyCorrection = context.getData(clusterEnergyCorrectionToken_); + const auto& paramEnergyCorrection = context.getData(clusterEnergyCorrectionToken_); edm::LogInfo("EnergyCorrectionParameters:"); for (EcalFunctionParameters::const_iterator it = paramEnergyCorrection.params().begin(); it != paramEnergyCorrection.params().end(); From a3a0aeb2a93dc6fe704691d26a3ec6732e49cddf Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 17:15:26 +0200 Subject: [PATCH 332/923] Code cleanup. --- .../interface/EcalRecHitRecalib.h | 4 +- .../interface/HcalRecHitRecalib.h | 6 +- .../plugins/EcalRecHitRecalib.cc | 10 +-- .../plugins/HcalRecHitRecalib.cc | 89 +++---------------- 4 files changed, 19 insertions(+), 90 deletions(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h index 58e2defd68990..7ea8d207decaa 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h @@ -50,8 +50,8 @@ class EcalRecHitRecalib : public edm::stream::EDProducer<> { const std::string ecalHitsProducer_; const std::string barrelHits_; const std::string endcapHits_; - const std::string RecalibBarrelHits_; - const std::string RecalibEndcapHits_; + const std::string recalibBarrelHits_; + const std::string recalibEndcapHits_; const double refactor_; const double refactor_mean_; diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h index ef15ec1a70621..963b370327575 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h @@ -47,9 +47,9 @@ class HcalRecHitRecalib : public edm::stream::EDProducer<> { const edm::EDGetTokenT tok_ho_; const edm::EDGetTokenT tok_hf_; const edm::ESGetToken topologyToken_; - const std::string RecalibHBHEHits_; - const std::string RecalibHFHits_; - const std::string RecalibHOHits_; + const std::string recalibHBHEHits_; + const std::string recalibHFHits_; + const std::string recalibHOHits_; std::string hcalfile_; const std::string hcalfileinpath_; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc index 9cfe61d6ed18e..79a8544967bb0 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/EcalRecHitRecalib.cc @@ -10,15 +10,15 @@ EcalRecHitRecalib::EcalRecHitRecalib(const edm::ParameterSet& iConfig) : ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), barrelHits_(iConfig.getParameter("barrelHitCollection")), endcapHits_(iConfig.getParameter("endcapHitCollection")), - RecalibBarrelHits_(iConfig.getParameter("RecalibBarrelHitCollection")), - RecalibEndcapHits_(iConfig.getParameter("RecalibEndcapHitCollection")), + recalibBarrelHits_(iConfig.getParameter("RecalibBarrelHitCollection")), + recalibEndcapHits_(iConfig.getParameter("RecalibEndcapHitCollection")), refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)), ebRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), eeRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, endcapHits_))), intercalibConstsToken_(esConsumes()), - barrelHitsToken_(produces(RecalibBarrelHits_)), - endcapHitsToken_(produces(RecalibEndcapHits_)) {} + barrelHitsToken_(produces(recalibBarrelHits_)), + endcapHitsToken_(produces(recalibEndcapHits_)) {} EcalRecHitRecalib::~EcalRecHitRecalib() {} @@ -64,7 +64,6 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu if (icalit != ical.getMap().end()) { icalconst = (*icalit); - // edm::LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; } else { edm::LogError("EcalRecHitRecalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) @@ -90,7 +89,6 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu if (icalit != ical.getMap().end()) { icalconst = (*icalit); - // edm:: LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EEDetId(ite->id()) << " " << icalconst ; } else { edm::LogError("EcalRecHitRecalib") << "No intercalib const found for xtal " << EEDetId(ite->id()) << "! something wrong with EcalIntercalibConstants in your DB? "; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc index f35e3a0e6090e..3db40e4805270 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc @@ -12,23 +12,16 @@ HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) tok_ho_(consumes(iConfig.getParameter("hoInput"))), tok_hf_(consumes(iConfig.getParameter("hfInput"))), topologyToken_(esConsumes()), - RecalibHBHEHits_(iConfig.getParameter("RecalibHBHEHitCollection")), - RecalibHFHits_(iConfig.getParameter("RecalibHFHitCollection")), - RecalibHOHits_(iConfig.getParameter("RecalibHOHitCollection")), + recalibHBHEHits_(iConfig.getParameter("RecalibHBHEHitCollection")), + recalibHFHits_(iConfig.getParameter("RecalibHFHitCollection")), + recalibHOHits_(iConfig.getParameter("RecalibHOHitCollection")), hcalfileinpath_(iConfig.getUntrackedParameter("fileNameHcal", "")), refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)) { - // HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer"); - // HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); - // HFHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); - // HBHEHits_ = iConfig.getParameter< std::string > ("HBHEHitCollection"); - // HFHits_ = iConfig.getParameter< std::string > ("HFHitCollection"); - // HOHits_ = iConfig.getParameter< std::string > ("HOHitCollection"); - //register your products - produces(RecalibHBHEHits_); - produces(RecalibHFHits_); - produces(RecalibHOHits_); + produces(recalibHBHEHits_); + produces(recalibHFHits_); + produces(recalibHOHits_); // here read them from xml (particular to HCAL) edm::FileInPath hcalfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + hcalfileinpath_); @@ -82,46 +75,16 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu HFRecHits = HFRecHitsHandle.product(); // get a ptr to the product } - // iEvent.getByLabel(HBHEHitsProducer_,HBHEHits_,HBHERecHitsHandle); - // HBHERecHits = HBHERecHitsHandle.product(); // get a ptr to the product - - // iEvent.getByLabel(HFHitsProducer_,HFHits_,HFRecHitsHandle); - // HFRecHits = HFRecHitsHandle.product(); // get a ptr to the product - - // iEvent.getByLabel(HOHitsProducer_,HOHits_,HORecHitsHandle); - // HORecHits = HORecHitsHandle.product(); // get a ptr to the product - //Create empty output collections auto RecalibHBHERecHitCollection = std::make_unique(); auto RecalibHFRecHitCollection = std::make_unique(); auto RecalibHORecHitCollection = std::make_unique(); - // Intercalib constants - // edm::ESHandle pIcal; - // iSetup.get().get(pIcal); - // const EcalIntercalibConstants* ical = pIcal.product(); - if (HBHERecHits) { - //loop on all EcalRecHits (barrel) HBHERecHitCollection::const_iterator itHBHE; for (itHBHE = HBHERecHits->begin(); itHBHE != HBHERecHits->end(); ++itHBHE) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - - float icalconst = (mapHcal_.get().find(itHBHE->id().rawId()))->second; // make the rechit with rescaled energy and put in the output collection - + float icalconst = (mapHcal_.get().find(itHBHE->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) HBHERecHit aHit(itHBHE->id(), itHBHE->energy() * icalconst, itHBHE->time()); @@ -131,25 +94,9 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } if (HFRecHits) { - //loop on all EcalRecHits (barrel) HFRecHitCollection::const_iterator itHF; for (itHF = HFRecHits->begin(); itHF != HFRecHits->end(); ++itHF) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - // make the rechit with rescaled energy and put in the output collection - float icalconst = (mapHcal_.get().find(itHF->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) @@ -160,25 +107,9 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } if (HORecHits) { - //loop on all EcalRecHits (barrel) HORecHitCollection::const_iterator itHO; for (itHO = HORecHits->begin(); itHO != HORecHits->end(); ++itHO) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - // make the rechit with rescaled energy and put in the output collection - float icalconst = (mapHcal_.get().find(itHO->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) @@ -189,7 +120,7 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } //Put Recalibrated rechit in the event - iEvent.put(std::move(RecalibHBHERecHitCollection), RecalibHBHEHits_); - iEvent.put(std::move(RecalibHFRecHitCollection), RecalibHFHits_); - iEvent.put(std::move(RecalibHORecHitCollection), RecalibHOHits_); + iEvent.put(std::move(RecalibHBHERecHitCollection), recalibHBHEHits_); + iEvent.put(std::move(RecalibHFRecHitCollection), recalibHFHits_); + iEvent.put(std::move(RecalibHORecHitCollection), recalibHOHits_); } From f449729cd14906e8cff9b4960a9c98638e80720d Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 17:29:03 +0200 Subject: [PATCH 333/923] Remove commented out code. --- .../interface/EcalDccWeightBuilder.h | 2 +- .../EcalSRTools/src/EcalDccWeightBuilder.cc | 40 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h index a9a3bfbc8b23c..b90a2407fb64b 100644 --- a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h +++ b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h @@ -144,4 +144,4 @@ class EcalDccWeightBuilder : public edm::one::EDAnalyzer<> { static const int nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1; }; -#endif //ECALDCCWEIGHTBUILDER_CC not defined +#endif //CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h not defined diff --git a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc index 74cfba121b85c..5c353e98836a3 100644 --- a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc +++ b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc @@ -105,15 +105,8 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve EcalSimParameterMap parameterMap; const vector& ebDetIds = geom_->getValidDetIds(DetId::Ecal, EcalBarrel); - - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "Number of EB det IDs: " << ebDetIds.size() << "\n"; - const vector& eeDetIds = geom_->getValidDetIds(DetId::Ecal, EcalEndcap); - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "Number of EE det IDs: " << eeDetIds.size() << "\n"; - vector detIds(ebDetIds.size() + eeDetIds.size()); copy(ebDetIds.begin(), ebDetIds.end(), detIds.begin()); copy(eeDetIds.begin(), eeDetIds.end(), detIds.begin() + ebDetIds.size()); @@ -239,13 +232,6 @@ double EcalDccWeightBuilder::decodeWeight(int W) { return ((double)W) / weightSc template void EcalDccWeightBuilder::sort(const std::vector& a, std::vector& s, bool decreasingOrder) { - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "sort input array:" ; - // for(unsigned i=0; i& a, std::vector& s, bo } } } while (changed); - - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "sorted list of indices:" ; - // for(unsigned i=0; i < s.size(); ++i){ - // edm::LogVerbatim("EcalDccWeightBuilder") << "\t" << s[i]; - // } - // edm::LogVerbatim("EcalDccWeightBuilder") << "\n"; } void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vector* encodedWeights) { @@ -287,14 +266,6 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect wsum += W[i]; } - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "weights before bias correction: "; - // for(unsigned i=0; i iw(nw); sort(dw, iw, true); @@ -324,14 +295,6 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect i = 0; } - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "weights after bias correction: "; - // for(unsigned i=0; iresize(nw); @@ -519,9 +482,6 @@ void EcalDccWeightBuilder::writeWeightToDB() { pr.readPassword(fileName, dbUser_, dbPassword_); } - // edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": " - // << "Password: " << dbPassword_ << "\n"; - econn = new EcalCondDBInterface(dbSid_, dbUser_, dbPassword_); edm::LogVerbatim("EcalDccWeightBuilder") << "Done."; } catch (runtime_error& e) { From 86497393fed0ee58adc583abbf6795d200ab95f4 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 31 Aug 2021 17:39:13 +0200 Subject: [PATCH 334/923] Update test config file. --- CalibCalorimetry/EcalSRTools/test/produceDccWeights.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py index 3483a236aa527..28fef346901d7 100644 --- a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py +++ b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py @@ -24,8 +24,9 @@ #process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetriever_cfi") #process.EcalTrivialConditionRetriever.producedEcalIntercalibConstants = True # b) Getting conditions through frontier interface: -process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -process.GlobalTag.globaltag = "113X_dataRun3_HLT_v3" +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') # c) Getting conditions through oracle interface: #process.load("RecoLocalCalo.EcalRecProducers.getEcalConditions_orcoffint2r_cff") From 5ee4bc15badbaa633286d3eeefe1fef6cbdcc030 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 15:21:15 +0200 Subject: [PATCH 335/923] Fix conflicts and code-format. --- .../CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc index c54c66263ed91..20dfb9bcaf1e9 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc @@ -58,7 +58,8 @@ void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::Ev edm::LogVerbatim("WriteEcalMiscalibConstants") << "Done"; } else { edm::LogVerbatim("WriteEcalMiscalibConstants") << "Old IOV"; - poolDbService->appendSinceTime(*Mcal, poolDbService->currentTime(), newTagRequest_); + poolDbService->appendSinceTime( + *Mcal, poolDbService->currentTime(), newTagRequest_); } } } From db7e557902f1c708f6ef20024eb8d52a04401099 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 2 Sep 2021 15:49:28 +0200 Subject: [PATCH 336/923] improve math in broken-line fit --- .../PixelTrackFitting/interface/BrokenLine.h | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h b/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h index 86fe6a278777c..3b29bf3f5442d 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h @@ -372,23 +372,21 @@ namespace brokenline { riemannFit::Vector2d dVec = hits.block(0, 0, 2, 1) + (-zInSZplane(0) + uVec(0)) * radii.block(0, 0, 2, 1); riemannFit::Vector2d eVec = hits.block(0, 1, 2, 1) + (-zInSZplane(1) + uVec(1)) * radii.block(0, 1, 2, 1); + auto eMinusd = eVec - dVec; + auto eMinusd2 = eMinusd.squaredNorm(); - circle_results.par << atan2((eVec - dVec)(1), (eVec - dVec)(0)), - -circle_results.qCharge * - (fast_fit(2) - sqrt(riemannFit::sqr(fast_fit(2)) - 0.25 * (eVec - dVec).squaredNorm())), + circle_results.par << atan2(eMinusd(1), eMinusd(0)), + circle_results.qCharge * (sqrt(riemannFit::sqr(fast_fit(2)) - 0.25 * eMinusd2) - fast_fit(2)), circle_results.qCharge * (1. / fast_fit(2) + uVec(n)); - assert(circle_results.qCharge * circle_results.par(1) <= 0); - - riemannFit::Vector2d eMinusd = eVec - dVec; - double tmp1 = eMinusd.squaredNorm(); - double tmp2 = sqrt(riemannFit::sqr(2 * fast_fit(2)) - tmp1); + auto tmp1 = 1. / eMinusd2; + auto tmp2 = 0.5 / sqrt(riemannFit::sqr(2. * fast_fit(2)) - eMinusd2); riemannFit::Matrix3d jacobian; - jacobian << (radii(1, 0) * eMinusd(0) - eMinusd(1) * radii(0, 0)) / tmp1, - (radii(1, 1) * eMinusd(0) - eMinusd(1) * radii(0, 1)) / tmp1, 0, - (circle_results.qCharge / 2) * (eMinusd(0) * radii(0, 0) + eMinusd(1) * radii(1, 0)) / tmp2, - (circle_results.qCharge / 2) * (eMinusd(0) * radii(0, 1) + eMinusd(1) * radii(1, 1)) / tmp2, 0, 0, 0, + jacobian << (radii(1, 0) * eMinusd(0) - eMinusd(1) * radii(0, 0)) * tmp1, + (radii(1, 1) * eMinusd(0) - eMinusd(1) * radii(0, 1)) * tmp1, 0, + circle_results.qCharge * (eMinusd(0) * radii(0, 0) + eMinusd(1) * radii(1, 0)) * tmp2, + circle_results.qCharge * (eMinusd(0) * radii(0, 1) + eMinusd(1) * radii(1, 1)) * tmp2, 0, 0, 0, circle_results.qCharge; circle_results.cov << iMat(0, 0), iMat(0, 1), iMat(0, n), iMat(1, 0), iMat(1, 1), iMat(1, n), iMat(n, 0), @@ -398,8 +396,7 @@ namespace brokenline { //...Translate in the system in which the first corrected hit is the origin, adding the m.s. correction... - auto eMinusDVec = eVec - dVec; - translateKarimaki(circle_results, 0.5 * eMinusDVec(0), 0.5 * eMinusDVec(1), jacobian); + translateKarimaki(circle_results, 0.5 * eMinusd(0), 0.5 * eMinusd(1), jacobian); circle_results.cov(0, 0) += (1 + riemannFit::sqr(slope)) * multScatt(sTotal(1) - sTotal(0), bField, fast_fit(2), 2, slope); @@ -420,8 +417,6 @@ namespace brokenline { (sTransverse(i + 1) - sTransverse(i - 1)) * uVec(n) / 2) / varBeta(i); } - - // assert(circle_results.chi2>=0); } /*! From ae5b6eb7f02433cb67f486bcd7f10c679fd72782 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 09:12:33 -0500 Subject: [PATCH 337/923] Add esConsumes to MuonToTrackingParticleAssociatorEDProducer --- .../MuonToTrackingParticleAssociatorEDProducer.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index 9ef9ff633ba46..ebbda9771a815 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -188,6 +188,8 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce TrackerHitAssociator::Config trackerHitAssociatorConfig_; TrackerMuonHitExtractor hitExtractor_; + const edm::ESGetToken tTopoToken_; + std::unique_ptr rpctruth_; std::unique_ptr gemtruth_; std::unique_ptr dttruth_; @@ -211,7 +213,8 @@ MuonToTrackingParticleAssociatorEDProducer::MuonToTrackingParticleAssociatorEDPr : config_(iConfig), helper_(iConfig), trackerHitAssociatorConfig_(iConfig, consumesCollector()), - hitExtractor_(iConfig, consumesCollector()) { + hitExtractor_(iConfig, consumesCollector()), + tTopoToken_(esConsumes()) { // register your products produces(); @@ -246,9 +249,7 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con hitExtractor_.init(iEvent, iSetup); // Retrieve tracker topology from geometry - edm::ESHandle tTopoHand; - iSetup.get().get(tTopoHand); - const TrackerTopology *tTopo = tTopoHand.product(); + const TrackerTopology *tTopo = &iSetup.getData(tTopoToken_); bool printRtS = true; From 25ca171880802f614ba104969e3ccff7b9c937ab Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 2 Sep 2021 16:13:42 +0200 Subject: [PATCH 338/923] remove one more duplicates --- .../PixelTrackFitting/interface/BrokenLine.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h b/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h index 3b29bf3f5442d..4b661bad26681 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/BrokenLine.h @@ -374,13 +374,13 @@ namespace brokenline { riemannFit::Vector2d eVec = hits.block(0, 1, 2, 1) + (-zInSZplane(1) + uVec(1)) * radii.block(0, 1, 2, 1); auto eMinusd = eVec - dVec; auto eMinusd2 = eMinusd.squaredNorm(); + auto tmp1 = 1. / eMinusd2; + auto tmp2 = sqrt(riemannFit::sqr(fast_fit(2)) - 0.25 * eMinusd2); - circle_results.par << atan2(eMinusd(1), eMinusd(0)), - circle_results.qCharge * (sqrt(riemannFit::sqr(fast_fit(2)) - 0.25 * eMinusd2) - fast_fit(2)), + circle_results.par << atan2(eMinusd(1), eMinusd(0)), circle_results.qCharge * (tmp2 - fast_fit(2)), circle_results.qCharge * (1. / fast_fit(2) + uVec(n)); - auto tmp1 = 1. / eMinusd2; - auto tmp2 = 0.5 / sqrt(riemannFit::sqr(2. * fast_fit(2)) - eMinusd2); + tmp2 = 1. / tmp2; riemannFit::Matrix3d jacobian; jacobian << (radii(1, 0) * eMinusd(0) - eMinusd(1) * radii(0, 0)) * tmp1, From 2c1a83167a17d9a96fc4ac873d578435de106966 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 2 Sep 2021 16:15:25 +0200 Subject: [PATCH 339/923] bug fix --- EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 9b653d246c930..04708735e343c 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -116,7 +116,7 @@ from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = cms.bool(False) ) +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = False ) # raw-to-digi task and sequence ctppsRawToDigiTask = cms.Task( From 72f88dd254d67694e828b6fa4b0f1aa3352988a5 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 16:27:26 +0200 Subject: [PATCH 340/923] Modernise EcalCosmicsHists. --- .../EcalTools/plugins/EcalCosmicsHists.cc | 104 +++++++++--------- .../EcalTools/plugins/EcalCosmicsHists.h | 51 ++++++--- 2 files changed, 88 insertions(+), 67 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc index 0ca644721df5d..d6626d6d7bf64 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc @@ -15,28 +15,16 @@ #include "DataFormats/DetId/interface/DetId.h" #include "Geometry/CaloTopology/interface/CaloTopology.h" #include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" - -#include -#include "TLine.h" using namespace cms; using namespace edm; @@ -61,6 +49,22 @@ EcalCosmicsHists::EcalCosmicsHists(const edm::ParameterSet& iConfig) endcapClusterCollection_(iConfig.getParameter("endcapClusterCollection")), l1GTReadoutRecTag_(iConfig.getUntrackedParameter("L1GlobalReadoutRecord", "gtDigis")), l1GMTReadoutRecTag_(iConfig.getUntrackedParameter("L1GlobalMuonReadoutRecord", "gtDigis")), + barrelClusterToken_(consumes(barrelClusterCollection_)), + endcapClusterToken_(consumes(endcapClusterCollection_)), + ebRecHitToken_(consumes(ecalRecHitCollectionEB_)), + eeRecHitToken_(consumes(ecalRecHitCollectionEE_)), + ecalRawDataToken_(consumes(ecalRawDataColl_)), + tracksToken_(consumes(edm::InputTag("cosmicMuons"))), + tracksBarrelToken_(consumes(edm::InputTag("cosmicMuonsBarrelOnly"))), + hbheRecHitToken_(consumes(edm::InputTag("hbhereco"))), + hfRecHitToken_(consumes(edm::InputTag("hfreco"))), + hoRecHitToken_(consumes(edm::InputTag("horeco"))), + l1MuGMTToken_(consumes(l1GMTReadoutRecTag_)), + l1GTReadoutToken_(consumes(l1GTReadoutRecTag_)), + gtRecordToken_(consumes(edm::InputTag("gtDigis"))), + ecalADCToGeVConstantToken_(esConsumes()), + l1MenuToken_(esConsumes()), + ecalMappingToken_(esConsumes()), runNum_(-1), histRangeMax_(iConfig.getUntrackedParameter("histogramMaxRange", 1.8)), histRangeMin_(iConfig.getUntrackedParameter("histogramMinRange", 0.0)), @@ -115,17 +119,11 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //LogDebug("EcalCosmicsHists")<< "Timestamp: " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value(); // check DB payload - edm::ESHandle pAgc; - iSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const auto& agc = iSetup.getData(ecalADCToGeVConstantToken_); if (naiveEvtNum_ <= 1) { - LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc->getEBValue() << " GeV/ADC count"; - LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc->getEEValue() << " GeV/ADC count"; + LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc.getEBValue() << " GeV/ADC count"; + LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc.getEEValue() << " GeV/ADC count"; } - //float adcEBconst = agc->getEBValue(); - //float adcEEconst = agc->getEEValue(); - - // //===================TIMESTAMP INFORMTION================================= // Code added to get the time in seconds @@ -136,14 +134,14 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //std::cout << "Event Time " << eventTime << " High " < hits; - iEvent.getByLabel(ecalRecHitCollectionEB_, hits); + iEvent.getByToken(ebRecHitToken_, hits); if (!(hits.isValid())) { LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEB_ << " not available"; return; } Handle hitsEE; - iEvent.getByLabel(ecalRecHitCollectionEE_, hitsEE); + iEvent.getByToken(eeRecHitToken_, hitsEE); if (!(hitsEE.isValid())) { LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEE_ << " not available"; return; } Handle DCCHeaders; - iEvent.getByLabel(ecalRawDataColl_, DCCHeaders); + iEvent.getByToken(ecalRawDataToken_, DCCHeaders); if (!DCCHeaders.isValid()) LogWarning("EcalCosmicsHists") << "DCC headers not available"; @@ -1007,7 +1005,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // get reco tracks edm::Handle recoTracks; - iEvent.getByLabel("cosmicMuons", recoTracks); + iEvent.getByToken(tracksToken_, recoTracks); if (recoTracks.isValid()) { // LogWarning("EcalCosmicsHists") << "... Valid TrackAssociator recoTracks !!! " << recoTracks.product()->size(); @@ -1176,7 +1174,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // Study on Tracks for High Energy events edm::Handle recoTracksBarrel; - iEvent.getByLabel("cosmicMuonsBarrelOnly", recoTracksBarrel); + iEvent.getByToken(tracksBarrelToken_, recoTracksBarrel); if (!recoTracksBarrel.isValid()) { //edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! " ; } else { @@ -1259,13 +1257,13 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //hcal rechits edm::Handle hbhe; - iEvent.getByLabel("hbhereco", hbhe); + iEvent.getByToken(hbheRecHitToken_, hbhe); edm::Handle hfrh; - iEvent.getByLabel("hfreco", hfrh); + iEvent.getByToken(hfRecHitToken_, hfrh); edm::Handle horh; - iEvent.getByLabel("horeco", horh); + iEvent.getByToken(hoRecHitToken_, horh); if (hbhe.isValid()) { // LogInfo("EcalCosmicHists") << "event " << ievt << " HBHE RecHits collection size " << hbhe->size(); @@ -1313,7 +1311,7 @@ std::vector EcalCosmicsHists::determineTriggers(const edm::Event& iEvent, // get the GMTReadoutCollection Handle gmtrc_handle; - iEvent.getByLabel(l1GMTReadoutRecTag_, gmtrc_handle); + iEvent.getByToken(l1MuGMTToken_, gmtrc_handle); L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product(); if (!(gmtrc_handle.isValid())) { LogWarning("EcalCosmicsHists") << "l1MuGMTReadoutCollection" @@ -1322,31 +1320,29 @@ std::vector EcalCosmicsHists::determineTriggers(const edm::Event& iEvent, } // get hold of L1GlobalReadoutRecord Handle L1GTRR; - iEvent.getByLabel(l1GTReadoutRecTag_, L1GTRR); + iEvent.getByToken(l1GTReadoutToken_, L1GTRR); //Ecal - edm::ESHandle menuRcd; - eventSetup.get().get(menuRcd); - const L1GtTriggerMenu* menu = menuRcd.product(); + const auto& menu = eventSetup.getData(l1MenuToken_); edm::Handle gtRecord; - iEvent.getByLabel(edm::InputTag("gtDigis"), gtRecord); + iEvent.getByToken(gtRecordToken_, gtRecord); // Get dWord after masking disabled bits const DecisionWord dWord = gtRecord->decisionWord(); - bool l1SingleEG1 = menu->gtAlgorithmResult("L1_SingleEG1", dWord); - bool l1SingleEG5 = menu->gtAlgorithmResult("L1_SingleEG5", dWord); - bool l1SingleEG8 = menu->gtAlgorithmResult("L1_SingleEG8", dWord); - bool l1SingleEG10 = menu->gtAlgorithmResult("L1_SingleEG10", dWord); - bool l1SingleEG12 = menu->gtAlgorithmResult("L1_SingleEG12", dWord); - bool l1SingleEG15 = menu->gtAlgorithmResult("L1_SingleEG15", dWord); - bool l1SingleEG20 = menu->gtAlgorithmResult("L1_SingleEG20", dWord); - bool l1SingleEG25 = menu->gtAlgorithmResult("L1_SingleEG25", dWord); - bool l1DoubleNoIsoEGBTBtight = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord); - bool l1DoubleNoIsoEGBTBloose = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord); - bool l1DoubleNoIsoEGTopBottom = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord); - bool l1DoubleNoIsoEGTopBottomCen = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord); - bool l1DoubleNoIsoEGTopBottomCen2 = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord); - bool l1DoubleNoIsoEGTopBottomCenVert = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord); + bool l1SingleEG1 = menu.gtAlgorithmResult("L1_SingleEG1", dWord); + bool l1SingleEG5 = menu.gtAlgorithmResult("L1_SingleEG5", dWord); + bool l1SingleEG8 = menu.gtAlgorithmResult("L1_SingleEG8", dWord); + bool l1SingleEG10 = menu.gtAlgorithmResult("L1_SingleEG10", dWord); + bool l1SingleEG12 = menu.gtAlgorithmResult("L1_SingleEG12", dWord); + bool l1SingleEG15 = menu.gtAlgorithmResult("L1_SingleEG15", dWord); + bool l1SingleEG20 = menu.gtAlgorithmResult("L1_SingleEG20", dWord); + bool l1SingleEG25 = menu.gtAlgorithmResult("L1_SingleEG25", dWord); + bool l1DoubleNoIsoEGBTBtight = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord); + bool l1DoubleNoIsoEGBTBloose = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord); + bool l1DoubleNoIsoEGTopBottom = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord); + bool l1DoubleNoIsoEGTopBottomCen = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord); + bool l1DoubleNoIsoEGTopBottomCen2 = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord); + bool l1DoubleNoIsoEGTopBottomCenVert = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord); l1Triggers[4] = l1SingleEG1 || l1SingleEG5 || l1SingleEG8 || l1SingleEG10 || l1SingleEG12 || l1SingleEG15 || l1SingleEG20 || l1SingleEG25 || l1DoubleNoIsoEGBTBtight || l1DoubleNoIsoEGBTBloose || @@ -1568,9 +1564,7 @@ void EcalCosmicsHists::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalCosmicsHists::beginRun(edm::Run const&, edm::EventSetup const& eventSetup) { - edm::ESHandle handle; - eventSetup.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &eventSetup.getData(ecalMappingToken_); //Here I will init some of the specific histograms int numBins = 200; //(int)round(histRangeMax_-histRangeMin_)+1; @@ -2755,6 +2749,8 @@ void EcalCosmicsHists::beginRun(edm::Run const&, edm::EventSetup const& eventSet new TH1F("NumActiveXtalsInClusterAllHist", "Number of active Xtals in Cluster EEP;NumXtals", 100, 0, 100); } +void EcalCosmicsHists::endRun(edm::Run const&, edm::EventSetup const& eventSetup) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalCosmicsHists::endJob() { using namespace std; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h index 08873493370a3..9fb9762eda4ee 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h @@ -20,19 +20,24 @@ #include #include #include -#include // 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 "FWCore/Framework/interface/ESHandle.h" + +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" +#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" @@ -41,6 +46,7 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" @@ -65,13 +71,14 @@ // class declaration // -class EcalCosmicsHists : public edm::EDAnalyzer { +class EcalCosmicsHists : public edm::one::EDAnalyzer { public: explicit EcalCosmicsHists(const edm::ParameterSet&); ~EcalCosmicsHists() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -88,21 +95,39 @@ class EcalCosmicsHists : public edm::EDAnalyzer { edm::InputTag l1GTReadoutRecTag_; edm::InputTag l1GMTReadoutRecTag_; + const edm::EDGetTokenT barrelClusterToken_; + const edm::EDGetTokenT endcapClusterToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ecalRawDataToken_; + const edm::EDGetTokenT tracksToken_; + const edm::EDGetTokenT tracksBarrelToken_; + const edm::EDGetTokenT hbheRecHitToken_; + const edm::EDGetTokenT hfRecHitToken_; + const edm::EDGetTokenT hoRecHitToken_; + const edm::EDGetTokenT l1MuGMTToken_; + const edm::EDGetTokenT l1GTReadoutToken_; + const edm::EDGetTokenT gtRecordToken_; + + const edm::ESGetToken ecalADCToGeVConstantToken_; + const edm::ESGetToken l1MenuToken_; + const edm::ESGetToken ecalMappingToken_; + int runNum_; - double histRangeMax_, histRangeMin_; - double minTimingAmpEB_; - double minTimingAmpEE_; - double minRecHitAmpEB_; - double minRecHitAmpEE_; - double minHighEnergy_; + const double histRangeMax_, histRangeMin_; + const double minTimingAmpEB_; + const double minTimingAmpEE_; + const double minRecHitAmpEB_; + const double minRecHitAmpEE_; + const double minHighEnergy_; double* ttEtaBins; double* modEtaBins; std::string fileName_; - bool runInFileName_; + const bool runInFileName_; - double startTime_, runTimeLength_; - int numTimingBins_; + const double startTime_, runTimeLength_; + const int numTimingBins_; std::map FEDsAndHists_; std::map FEDsAndE2Hists_; From 442995c2026fc34eff9b435c8f4808be2b04773a Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 16:49:11 +0200 Subject: [PATCH 341/923] Modernise EcalDigiDisplay. --- .../EcalTools/plugins/EcalDigiDisplay.cc | 63 +++++++++---------- .../EcalTools/plugins/EcalDigiDisplay.h | 19 ++++-- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc index d9ba84b8ba0ef..b8f5edb30ee1c 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc @@ -8,17 +8,11 @@ * */ -#include -#include -#include -#include #include #include "CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" -#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" @@ -26,17 +20,18 @@ #include #include -#include -#include //========================================================================== -EcalDigiDisplay::EcalDigiDisplay(const edm::ParameterSet& ps) { +EcalDigiDisplay::EcalDigiDisplay(const edm::ParameterSet& ps) + : ebDigiCollection_(ps.getParameter("ebDigiCollection")), + eeDigiCollection_(ps.getParameter("eeDigiCollection")), + digiProducer_(ps.getParameter("digiProducer")), + rawDataToken_(consumes(edm::InputTag(digiProducer_))), + ebDigiToken_(consumes(edm::InputTag(digiProducer_, ebDigiCollection_))), + eeDigiToken_(consumes(edm::InputTag(digiProducer_, eeDigiCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_))), + ecalMappingToken_(esConsumes()) { //========================================================================= - - ebDigiCollection_ = ps.getParameter("ebDigiCollection"); - eeDigiCollection_ = ps.getParameter("eeDigiCollection"); - digiProducer_ = ps.getParameter("digiProducer"); - requestedFeds_ = ps.getUntrackedParameter >("requestedFeds"); requestedEbs_ = ps.getUntrackedParameter >("requestedEbs"); @@ -175,11 +170,13 @@ void EcalDigiDisplay::beginRun(edm::Run const&, edm::EventSetup const& c) { //======================================================================== edm::LogInfo("EcalDigiDisplay") << "entering beginRun! "; - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +//======================================================================== +void EcalDigiDisplay::endRun(edm::Run const&, edm::EventSetup const& c) {} +//======================================================================== + //======================================================================== void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { //======================================================================== @@ -189,9 +186,8 @@ void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { //Get DCC headers edm::Handle dccHeader; - try { - e.getByLabel(digiProducer_, dccHeader); - } catch (cms::Exception& ex) { + e.getByToken(rawDataToken_, dccHeader); + if (!dccHeader.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "Can't get DCC Headers!"; } @@ -201,33 +197,30 @@ void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { bool pnDigisFound = false; // retrieving crystal data from Event edm::Handle eb_digis; - try { - e.getByLabel(digiProducer_, ebDigiCollection_, eb_digis); - if (!eb_digis->empty()) - ebDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(ebDigiToken_, eb_digis); + if (!eb_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "EB Digis were not found!"; } + if (!eb_digis->empty()) + ebDigisFound = true; // edm::Handle ee_digis; - try { - e.getByLabel(digiProducer_, eeDigiCollection_, ee_digis); - if (!ee_digis->empty()) - eeDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(eeDigiToken_, ee_digis); + if (!ee_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "EE Digis were not found!"; } + if (!ee_digis->empty()) + eeDigisFound = true; // retrieving crystal PN diodes from Event edm::Handle pn_digis; - try { - e.getByLabel(digiProducer_, pn_digis); - if (!pn_digis->empty()) - pnDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(pnDiodeDigiToken_, pn_digis); + if (!pn_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "PNs were not found!"; } + if (!pn_digis->empty()) + pnDigisFound = true; //============================= //Call for funcitons diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h index a7c98140496d2..d57eac7031873 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h @@ -5,19 +5,19 @@ #include #include -#include +#include #include #include -#include #include #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" // class declaration -class EcalDigiDisplay : public edm::EDAnalyzer { +class EcalDigiDisplay : public edm::one::EDAnalyzer { public: //Constractor EcalDigiDisplay(const edm::ParameterSet& ps); @@ -27,6 +27,7 @@ class EcalDigiDisplay : public edm::EDAnalyzer { private: void analyze(edm::Event const& e, edm::EventSetup const& c) override; void beginRun(edm::Run const&, edm::EventSetup const& c) override; + void endRun(edm::Run const&, edm::EventSetup const& c) override; void endJob() override; protected: @@ -36,9 +37,15 @@ class EcalDigiDisplay : public edm::EDAnalyzer { EcalFedMap* fedMap; - std::string ebDigiCollection_; - std::string eeDigiCollection_; - std::string digiProducer_; + const std::string ebDigiCollection_; + const std::string eeDigiCollection_; + const std::string digiProducer_; + + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken ecalMappingToken_; std::vector requestedFeds_; std::vector requestedEbs_; From d8179988d8375833e26c3de184d355e58bed5ddf Mon Sep 17 00:00:00 2001 From: Tim Cox Date: Thu, 2 Sep 2021 16:50:34 +0200 Subject: [PATCH 342/923] add extended range multiplicity plots --- DQMOffline/Muon/interface/CSCOfflineMonitor.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DQMOffline/Muon/interface/CSCOfflineMonitor.h b/DQMOffline/Muon/interface/CSCOfflineMonitor.h index 2a9ce2cd65e4c..72ae6ac6114b6 100644 --- a/DQMOffline/Muon/interface/CSCOfflineMonitor.h +++ b/DQMOffline/Muon/interface/CSCOfflineMonitor.h @@ -156,16 +156,19 @@ class CSCOfflineMonitor : public DQMEDAnalyzer { // Wire digis MonitorElement *hWirenGroupsTotal; + MonitorElement *hWirenGroupsTotalHi; std::vector hWireTBin; std::vector hWireNumber; // Strip Digis MonitorElement *hStripNFired; + MonitorElement *hStripNFiredHi; std::vector hStripNumber; std::vector hStripPed; // Rechits MonitorElement *hRHnrechits; + MonitorElement *hRHnrechitsHi; std::vector hRHGlobal; std::vector hRHSumQ; std::vector hRHTiming; From 826067b87ff7dc10b4cf05abfd8e5be37e311b6f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 09:50:35 -0500 Subject: [PATCH 343/923] Removed unnecessary use of EventSetup as function argument --- SimMuon/MCTruth/interface/GEMHitAssociator.h | 4 ++-- SimMuon/MCTruth/interface/RPCHitAssociator.h | 4 ++-- SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h | 2 +- .../plugins/MuonToTrackingParticleAssociatorEDProducer.cc | 6 +++--- SimMuon/MCTruth/src/GEMHitAssociator.cc | 8 +++----- SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 8 ++++---- SimMuon/MCTruth/src/RPCHitAssociator.cc | 8 +++----- SimMuon/MCTruth/src/TrackerMuonHitExtractor.cc | 2 +- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/SimMuon/MCTruth/interface/GEMHitAssociator.h b/SimMuon/MCTruth/interface/GEMHitAssociator.h index be538d721fdc2..349001880dd18 100644 --- a/SimMuon/MCTruth/interface/GEMHitAssociator.h +++ b/SimMuon/MCTruth/interface/GEMHitAssociator.h @@ -38,9 +38,9 @@ class GEMHitAssociator { // Constructor with configurable parameters GEMHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&ic); - GEMHitAssociator(const edm::Event &e, const edm::EventSetup &eventSetup, const edm::ParameterSet &conf); + GEMHitAssociator(const edm::Event &e, const edm::ParameterSet &conf); - void initEvent(const edm::Event &, const edm::EventSetup &); + void initEvent(const edm::Event &); // Destructor ~GEMHitAssociator() {} diff --git a/SimMuon/MCTruth/interface/RPCHitAssociator.h b/SimMuon/MCTruth/interface/RPCHitAssociator.h index f12eb9a67ee00..a62435e502730 100644 --- a/SimMuon/MCTruth/interface/RPCHitAssociator.h +++ b/SimMuon/MCTruth/interface/RPCHitAssociator.h @@ -36,9 +36,9 @@ class RPCHitAssociator { // Constructor with configurable parameters RPCHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&ic); - RPCHitAssociator(const edm::Event &e, const edm::EventSetup &eventSetup, const edm::ParameterSet &conf); + RPCHitAssociator(const edm::Event &e, const edm::ParameterSet &conf); - void initEvent(const edm::Event &, const edm::EventSetup &); + void initEvent(const edm::Event &); // Destructor ~RPCHitAssociator() {} diff --git a/SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h b/SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h index 4acf278b5009f..ed67ab42e2e2c 100644 --- a/SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h +++ b/SimMuon/MCTruth/interface/TrackerMuonHitExtractor.h @@ -21,7 +21,7 @@ class TrackerMuonHitExtractor { explicit TrackerMuonHitExtractor(const edm::ParameterSet &); ~TrackerMuonHitExtractor(); - void init(const edm::Event &, const edm::EventSetup &); + void init(const edm::Event &); std::vector getMuonHits(const reco::Muon &mu) const; private: diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index ebbda9771a815..5b58ba29fff96 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -246,7 +246,7 @@ MuonToTrackingParticleAssociatorEDProducer::~MuonToTrackingParticleAssociatorEDP void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { using namespace edm; - hitExtractor_.init(iEvent, iSetup); + hitExtractor_.init(iEvent); // Retrieve tracker topology from geometry const TrackerTopology *tTopo = &iSetup.getData(tTopoToken_); @@ -266,9 +266,9 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con printRtS = false; dttruth_ = std::make_unique(iEvent, iSetup, config_, printRtS); // RPC hit association - rpctruth_ = std::make_unique(iEvent, iSetup, config_); + rpctruth_ = std::make_unique(iEvent, config_); // GEM hit association - gemtruth_ = std::make_unique(iEvent, iSetup, config_); + gemtruth_ = std::make_unique(iEvent, config_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, trackertruth_.get(), csctruth_.get(), dttruth_.get(), rpctruth_.get(), gemtruth_.get(), {}}; diff --git a/SimMuon/MCTruth/src/GEMHitAssociator.cc b/SimMuon/MCTruth/src/GEMHitAssociator.cc index 248c7cb83a128..7f65c10e46e78 100644 --- a/SimMuon/MCTruth/src/GEMHitAssociator.cc +++ b/SimMuon/MCTruth/src/GEMHitAssociator.cc @@ -20,19 +20,17 @@ GEMHitAssociator::GEMHitAssociator(const edm::ParameterSet &conf, edm::ConsumesC GEMdigisimlinkToken_ = iC.consumes>(GEMdigisimlinkTag); } -GEMHitAssociator::GEMHitAssociator(const edm::Event &e, - const edm::EventSetup &eventSetup, - const edm::ParameterSet &conf) +GEMHitAssociator::GEMHitAssociator(const edm::Event &e, const edm::ParameterSet &conf) : GEMdigisimlinkTag(conf.getParameter("GEMdigisimlinkTag")), // CrossingFrame used or not ? crossingframe(conf.getParameter("crossingframe")), useGEMs_(conf.getParameter("useGEMs")), GEMsimhitsTag(conf.getParameter("GEMsimhitsTag")), GEMsimhitsXFTag(conf.getParameter("GEMsimhitsXFTag")) { - initEvent(e, eventSetup); + initEvent(e); } -void GEMHitAssociator::initEvent(const edm::Event &e, const edm::EventSetup &eventSetup) { +void GEMHitAssociator::initEvent(const edm::Event &e) { if (useGEMs_) { if (crossingframe) { edm::Handle> cf; diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index 73d9196e43d3e..b9e6d48d50fa6 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -175,9 +175,9 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( bool printRtS(true); DTHitAssociator dttruth(*e, *setup, conf_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(*e, *setup, conf_); + RPCHitAssociator rpctruth(*e, conf_); // GEM hit association - GEMHitAssociator gemtruth(*e, *setup, conf_); + GEMHitAssociator gemtruth(*e, conf_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; @@ -223,9 +223,9 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( bool printRtS = false; DTHitAssociator dttruth(*e, *setup, conf_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(*e, *setup, conf_); + RPCHitAssociator rpctruth(*e, conf_); // GEM hit association - GEMHitAssociator gemtruth(*e, *setup, conf_); + GEMHitAssociator gemtruth(*e, conf_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; diff --git a/SimMuon/MCTruth/src/RPCHitAssociator.cc b/SimMuon/MCTruth/src/RPCHitAssociator.cc index 115ba41d74147..fe2428d8383a0 100644 --- a/SimMuon/MCTruth/src/RPCHitAssociator.cc +++ b/SimMuon/MCTruth/src/RPCHitAssociator.cc @@ -19,18 +19,16 @@ RPCHitAssociator::RPCHitAssociator(const edm::ParameterSet &conf, edm::ConsumesC RPCdigisimlinkToken_ = iC.consumes>(RPCdigisimlinkTag); } -RPCHitAssociator::RPCHitAssociator(const edm::Event &e, - const edm::EventSetup &eventSetup, - const edm::ParameterSet &conf) +RPCHitAssociator::RPCHitAssociator(const edm::Event &e, const edm::ParameterSet &conf) : RPCdigisimlinkTag(conf.getParameter("RPCdigisimlinkTag")), // CrossingFrame used or not ? crossingframe(conf.getParameter("crossingframe")), RPCsimhitsTag(conf.getParameter("RPCsimhitsTag")), RPCsimhitsXFTag(conf.getParameter("RPCsimhitsXFTag")) { - initEvent(e, eventSetup); + initEvent(e); } -void RPCHitAssociator::initEvent(const edm::Event &e, const edm::EventSetup &eventSetup) +void RPCHitAssociator::initEvent(const edm::Event &e) { if (crossingframe) { diff --git a/SimMuon/MCTruth/src/TrackerMuonHitExtractor.cc b/SimMuon/MCTruth/src/TrackerMuonHitExtractor.cc index 49b8f287e3a4c..16d1424d48a3a 100644 --- a/SimMuon/MCTruth/src/TrackerMuonHitExtractor.cc +++ b/SimMuon/MCTruth/src/TrackerMuonHitExtractor.cc @@ -27,7 +27,7 @@ TrackerMuonHitExtractor::TrackerMuonHitExtractor(const edm::ParameterSet &parset TrackerMuonHitExtractor::~TrackerMuonHitExtractor() {} -void TrackerMuonHitExtractor::init(const edm::Event &iEvent, const edm::EventSetup &iSetup) { +void TrackerMuonHitExtractor::init(const edm::Event &iEvent) { iEvent.getByLabel(inputDTRecSegment4DCollection_, dtSegmentCollectionH_); iEvent.getByLabel(inputCSCSegmentCollection_, cscSegmentCollectionH_); From e8ce7f3b626af9f498231b952e3f4b1aa58799b8 Mon Sep 17 00:00:00 2001 From: Tim Cox Date: Thu, 2 Sep 2021 16:50:50 +0200 Subject: [PATCH 344/923] add extended range multiplicity plots + fix misfilled simple eff plotss --- DQMOffline/Muon/src/CSCOfflineMonitor.cc | 87 ++++++++++++------------ 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/DQMOffline/Muon/src/CSCOfflineMonitor.cc b/DQMOffline/Muon/src/CSCOfflineMonitor.cc index 46aefbec512c5..b37c0cf1d52e4 100644 --- a/DQMOffline/Muon/src/CSCOfflineMonitor.cc +++ b/DQMOffline/Muon/src/CSCOfflineMonitor.cc @@ -56,8 +56,13 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // wire digis ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/Digis"); + // For low multiplicities (e.g. low or no pileup) hWirenGroupsTotal = - ibooker.book1D("hWirenGroupsTotal", "Fired Wires per Event; # Wiregroups Fired", 500, -0.5, 499.5); + ibooker.book1D("hWirenGroupsTotal", "Fired Wires per Event; # Wiregroups Fired", 250, 0., 250.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hWirenGroupsTotalHi = + ibooker.book1D("hWirenGroupsTotalHi", "Fired Wires per Event; # Wiregroups Fired", 250, 0., 1000.); // i bin is 4 + hWireTBin.push_back(ibooker.book1D("hWireTBin_m42", "Wire TBin Fired (ME -4/2); Time Bin (25ns)", 17, -0.5, 16.5)); hWireTBin.push_back(ibooker.book1D("hWireTBin_m41", "Wire TBin Fired (ME -4/1); Time Bin (25ns)", 17, -0.5, 16.5)); hWireTBin.push_back(ibooker.book1D("hWireTBin_m32", "Wire TBin Fired (ME -3/2); Time Bin (25ns)", 17, -0.5, 16.5)); @@ -120,8 +125,14 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, ibooker.book1D("hWireNumber_p42", "Wiregroup Number Fired (ME +4/2); Wiregroup #", 113, -0.5, 112.5)); // strip digis - hStripNFired = - ibooker.book1D("hStripNFired", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 1000, -0.5, 999.5); + + // For low multiplicities (e.g. low or no pileup) + hStripNFired = ibooker.book1D( + "hStripNFired", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 400, 0., 400.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hStripNFiredHi = ibooker.book1D( + "hStripNFiredHi", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 500, 0., 2000.); // 1 bin is 4 + hStripNumber.push_back( ibooker.book1D("hStripNumber_m42", "Strip Number Fired (ME -4/2); Strip # Fired (above 13 ADC)", 81, -0.5, 80.5)); hStripNumber.push_back( @@ -210,7 +221,11 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // rechits ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/recHits"); - hRHnrechits = ibooker.book1D("hRHnrechits", "recHits per Event (all chambers); # of RecHits", 500, -0.50, 499.5); + // For low multiplicities (e.g. low or no pileup) + hRHnrechits = ibooker.book1D("hRHnrechits", "RecHits per Event; # of RecHits", 100, 0., 100.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hRHnrechitsHi = ibooker.book1D("hRHnrechitsHi", "RecHits per Event; # of RecHits", 250, 0., 1000.); // 1 bin is 4 + hRHGlobal.push_back(ibooker.book2D( "hRHGlobalp1", "recHit global X,Y station +1; Global X (cm); Global Y (cm)", 100, -800., 800., 100, -800., 800.)); hRHGlobal.push_back(ibooker.book2D( @@ -395,7 +410,8 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // segments ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/Segments"); - hSnSegments = ibooker.book1D("hSnSegments", "Number of Segments per Event; # of Segments", 26, -0.5, 25.5); + hSnSegments = ibooker.book1D("hSnSegments", "Segments per Event; # of Segments", 100, 0., 100.); // 1 bin is 1 + hSnhitsAll = ibooker.book1D("hSnhits", "N hits on Segments; # of hits", 8, -0.5, 7.5); hSnhits.push_back(ibooker.book1D("hSnhitsm42", "# of hits on Segments (ME -4/2); # of hits", 8, -0.5, 7.5)); hSnhits.push_back(ibooker.book1D("hSnhitsm41", "# of hits on Segments (ME -4/1); # of hits", 8, -0.5, 7.5)); @@ -1028,10 +1044,8 @@ void CSCOfflineMonitor::doWireDigis(edm::Handle wires) { } } // end wire loop - // this way you can zero suppress but still store info on # events with no digis - // Tim: I'm unhappy with that since it breaks hist statistics - // if (nWireGroupsTotal == 0) nWireGroupsTotal = -1; hWirenGroupsTotal->Fill(nWireGroupsTotal); + hWirenGroupsTotalHi->Fill(nWireGroupsTotal); } // ============================================== @@ -1066,11 +1080,9 @@ void CSCOfflineMonitor::doStripDigis(edm::Handle strips) } } // end strip loop - // this way you can zero suppress but still store info on # events with no digis - // Tim: I guess the above comment means 'zero suppress' because the hist range is from -0.5. - // But doing this means the hist statistics are broken. If the zero bin is high, just apply log scale? - // if (nStripsFired == 0) nStripsFired = -1; hStripNFired->Fill(nStripsFired); + hStripNFiredHi->Fill(nStripsFired); + // fill n per event } @@ -1191,6 +1203,7 @@ void CSCOfflineMonitor::doRecHits(edm::Handle recHits, // if (nRecHits == 0) nRecHits = -1; // I see no point in doing this hRHnrechits->Fill(nRecHits); + hRHnrechitsHi->Fill(nRecHits); } // ============================================== @@ -1313,7 +1326,6 @@ void CSCOfflineMonitor::doSegments(edm::Handle cscSegments } // end segment loop - // if (nSegments == 0) nSegments = -1; // I see no point in doing this hSnSegments->Fill(nSegments); } @@ -1607,11 +1619,16 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, NumberOfLayers++; } } - int bin = 0; - if (iS == 0) - bin = iR + 1 + (iE * 10); - else - bin = (iS + 1) * 2 + (iR + 1) + (iE * 10); + + // set bin = 1-10 for ME-42, ME-41,...ME-11B, ME-11A, + // 11-20 for ME+11A, ME+11B, ... ME+41, ME+42 + int bin = CSCDetId::iChamberType(iS + 1, iR + 1); // 1-10 for ME11A...ME42 + if (iE > 0) { // in this loop iE=1 is -z endcap + bin = 11 - bin; + } else { // in this loop iE=0 is +z endcap + bin += 10; + } + if (NumberOfLayers > 1) { //if(!(MultiSegments[iE][iS][iR][iC])){ if (AllSegments[iE][iS][iR][iC]) { @@ -1648,21 +1665,6 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, if (1 == seg_ME3[1]) theSeg.push_back(&theSegments[3]); - // Needed for plots - // at the end the chamber types will be numbered as 1 to 20 - // (ME-4./2, ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1, ME+4/2) - std::map chamberTypes; - chamberTypes["ME1/a"] = 0.5; - chamberTypes["ME1/b"] = 1.5; - chamberTypes["ME1/2"] = 2.5; - chamberTypes["ME1/3"] = 3.5; - chamberTypes["ME2/1"] = 4.5; - chamberTypes["ME2/2"] = 5.5; - chamberTypes["ME3/1"] = 6.5; - chamberTypes["ME3/2"] = 7.5; - chamberTypes["ME4/1"] = 8.5; - chamberTypes["ME4/2"] = 9.5; - if (!theSeg.empty()) { std::map extrapolatedPoint; std::map::iterator it; @@ -1728,18 +1730,15 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, ++nRHLayers; } } - //std::cout<<" nRHLayers = "<specs()->chamberTypeName()]; - if (cscchamberCenter.z() < 0) { - verticalScale = -verticalScale; - } - verticalScale += 10.5; + + // set verticalScale to 1-10 for ME-42...ME-11A, + // 11-20 for ME+11A...ME+42 + float verticalScale = + 9. + cscchamber->id().endcap() + (cscchamber->specs()->chamberType()) * (cscchamber->id().zendcap()); + hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()), verticalScale); if (nRHLayers > 1) { // this chamber contains a reliable signal - //chamberTypes[cscchamber->specs()->chamberTypeName()]; - // "intrinsic" efficiencies - //std::cout<<" verticalScale = "< -#include -#include using namespace edm; using namespace std; @@ -46,6 +44,13 @@ EcalDisplaysByEvent::EcalDisplaysByEvent(const edm::ParameterSet& iConfig) EBDigis_(iConfig.getParameter("EBDigiCollection")), EEDigis_(iConfig.getParameter("EEDigiCollection")), headerProducer_(iConfig.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebRecHitToken_(consumes(EBRecHitCollection_)), + eeRecHitToken_(consumes(EERecHitCollection_)), + ebDigiToken_(consumes(EBDigis_)), + eeDigiToken_(consumes(EEDigis_)), + ecalMappingToken_(esConsumes()), + topologyToken_(esConsumes()), runNum_(-1), side_(iConfig.getUntrackedParameter("side", 3)), threshold_(iConfig.getUntrackedParameter("amplitudeThreshold", 0.5)), @@ -102,17 +107,17 @@ EcalDisplaysByEvent::~EcalDisplaysByEvent() {} // ------------ method called once each job just before starting event loop ------------ void EcalDisplaysByEvent::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle handle; - c.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalDisplaysByEvent::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called to for each event ------------ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - iEvent.getByLabel(headerProducer_, DCCHeaders); + iEvent.getByToken(rawDataToken_, DCCHeaders); for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end(); ++headerItr) { @@ -138,14 +143,14 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons listEEChannels.clear(); //Get hits, digis, caloTopology from event/eventSetup + caloTopo_ = &iSetup.getData(topologyToken_); + Handle EBhits; Handle EEhits; - ESHandle caloTopo; - iSetup.get().get(caloTopo); - iEvent.getByLabel(EBRecHitCollection_, EBhits); - iEvent.getByLabel(EERecHitCollection_, EEhits); - iEvent.getByLabel(EBDigis_, EBdigisHandle); - iEvent.getByLabel(EEDigis_, EEdigisHandle); + iEvent.getByToken(ebRecHitToken_, EBhits); + iEvent.getByToken(eeRecHitToken_, EEhits); + iEvent.getByToken(ebDigiToken_, EBdigisHandle); + iEvent.getByToken(eeDigiToken_, EEdigisHandle); // Initialize histos for this event initEvtByEvtHists(naiveEvtNum_, ievt); @@ -160,9 +165,9 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons // Produce the digi graphs if (makeDigiGraphs_) { if (hasEBdigis) //if event has digis, it should have hits - selectHits(EBhits, ievt, caloTopo); + selectHits(EBhits, ievt); if (hasEEdigis) - selectHits(EEhits, ievt, caloTopo); + selectHits(EEhits, ievt); } // Produce the histos @@ -181,7 +186,7 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons deleteEvtByEvtHists(); } -void EcalDisplaysByEvent::selectHits(Handle hits, int ievt, ESHandle caloTopo) { +void EcalDisplaysByEvent::selectHits(Handle hits, int ievt) { for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr) { EcalRecHit hit = (*hitItr); DetId det = hit.id(); @@ -230,7 +235,7 @@ void EcalDisplaysByEvent::selectHits(Handle hits, int ievt can.Divide(side_, side_); TGraph* myGraph; - CaloNavigator cursor = CaloNavigator(det, caloTopo->getSubdetectorTopology(det)); + CaloNavigator cursor = CaloNavigator(det, caloTopo_->getSubdetectorTopology(det)); //Now put each graph in one by one for (int j = side_ / 2; j >= -side_ / 2; --j) { for (int i = -side_ / 2; i <= side_ / 2; ++i) { diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h index 6a1d576461622..f74effe3915ad 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h @@ -21,15 +21,15 @@ #include #include #include +#include // 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/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" @@ -59,13 +59,14 @@ // class declaration // -class EcalDisplaysByEvent : public edm::EDAnalyzer { +class EcalDisplaysByEvent : public edm::one::EDAnalyzer { public: explicit EcalDisplaysByEvent(const edm::ParameterSet&); ~EcalDisplaysByEvent() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -78,7 +79,7 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { TH2F* init2DEcalHist(std::string histTypeName, int subDet); TH3F* init3DEcalHist(std::string histTypeName, int dubDet); TCanvas* init2DEcalCanvas(std::string canvasName); - void selectHits(edm::Handle hits, int ievt, edm::ESHandle caloTopo); + void selectHits(edm::Handle hits, int ievt); TGraph* selectDigi(DetId det, int ievt); int getEEIndex(EcalElectronicsId elecId); void makeHistos(edm::Handle ebDigis); @@ -93,27 +94,36 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag EBRecHitCollection_; - edm::InputTag EERecHitCollection_; - edm::InputTag EBDigis_; - edm::InputTag EEDigis_; - edm::InputTag headerProducer_; + const edm::InputTag EBRecHitCollection_; + const edm::InputTag EERecHitCollection_; + const edm::InputTag EBDigis_; + const edm::InputTag EEDigis_; + const edm::InputTag headerProducer_; edm::Handle EBdigisHandle; edm::Handle EEdigisHandle; + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken topologyToken_; + int runNum_; - int side_; - double threshold_; - double minTimingAmp_; - bool makeDigiGraphs_; - bool makeTimingHistos_; - bool makeEnergyHistos_; - bool makeOccupancyHistos_; - double histRangeMin_; - double histRangeMax_; - double minTimingEnergyEB_; - double minTimingEnergyEE_; + const int side_; + const double threshold_; + const double minTimingAmp_; + const bool makeDigiGraphs_; + const bool makeTimingHistos_; + const bool makeEnergyHistos_; + const bool makeOccupancyHistos_; + const double histRangeMin_; + const double histRangeMax_; + const double minTimingEnergyEB_; + const double minTimingEnergyEE_; std::set listEBChannels; std::set listEEChannels; @@ -224,6 +234,7 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { TTree* histoCanvasNames_; EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; + const CaloTopology* caloTopo_; int naiveEvtNum_; }; From a2bfdc6dac224315a5718cc46b12a2a218409b42 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 17:29:38 +0200 Subject: [PATCH 346/923] Modernise EcalMipGraphs. --- .../EcalTools/plugins/EcalMipGraphs.cc | 37 +++++++++++-------- .../EcalTools/plugins/EcalMipGraphs.h | 35 ++++++++++++------ 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc index 2ea7ddf32a69f..4862cc266345a 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc @@ -20,8 +20,6 @@ #include "RecoCaloTools/Navigation/interface/CaloNavigator.h" #include "TCanvas.h" #include -#include -#include using namespace edm; using namespace std; @@ -45,6 +43,13 @@ EcalMipGraphs::EcalMipGraphs(const edm::ParameterSet& iConfig) EBDigis_(iConfig.getParameter("EBDigiCollection")), EEDigis_(iConfig.getParameter("EEDigiCollection")), headerProducer_(iConfig.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebRecHitToken_(consumes(EBRecHitCollection_)), + eeRecHitToken_(consumes(EERecHitCollection_)), + ebDigiToken_(consumes(EBDigis_)), + eeDigiToken_(consumes(EEDigis_)), + ecalMappingToken_(esConsumes()), + topologyToken_(esConsumes()), runNum_(-1), side_(iConfig.getUntrackedParameter("side", 3)), threshold_(iConfig.getUntrackedParameter("amplitudeThreshold", 12.0)), @@ -94,7 +99,7 @@ void EcalMipGraphs::analyze(edm::Event const& iEvent, edm::EventSetup const& iSe // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - iEvent.getByLabel(headerProducer_, DCCHeaders); + iEvent.getByToken(rawDataToken_, DCCHeaders); for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end(); ++headerItr) { @@ -114,21 +119,21 @@ void EcalMipGraphs::analyze(edm::Event const& iEvent, edm::EventSetup const& iSe //We only want the 3x3's for this event... listEBChannels.clear(); listEEChannels.clear(); + caloTopo_ = &iSetup.getData(topologyToken_); + Handle EBhits; Handle EEhits; - ESHandle caloTopo; - iSetup.get().get(caloTopo); - iEvent.getByLabel(EBRecHitCollection_, EBhits); - iEvent.getByLabel(EERecHitCollection_, EEhits); + iEvent.getByToken(ebRecHitToken_, EBhits); + iEvent.getByToken(eeRecHitToken_, EEhits); // Now, retrieve the crystal digi from the event - iEvent.getByLabel(EBDigis_, EBdigisHandle); - iEvent.getByLabel(EEDigis_, EEdigisHandle); + iEvent.getByToken(ebDigiToken_, EBdigisHandle); + iEvent.getByToken(eeDigiToken_, EEdigisHandle); //debug //LogWarning("EcalMipGraphs") << "event " << ievt << " EBhits collection size " << EBhits->size(); //LogWarning("EcalMipGraphs") << "event " << ievt << " EEhits collection size " << EEhits->size(); - selectHits(EBhits, ievt, caloTopo); - selectHits(EEhits, ievt, caloTopo); + selectHits(EBhits, ievt); + selectHits(EEhits, ievt); } TGraph* EcalMipGraphs::selectDigi(DetId thisDet, int ievt) { @@ -232,7 +237,7 @@ TGraph* EcalMipGraphs::selectDigi(DetId thisDet, int ievt) { return oneGraph; } -void EcalMipGraphs::selectHits(Handle hits, int ievt, ESHandle caloTopo) { +void EcalMipGraphs::selectHits(Handle hits, int ievt) { for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr) { EcalRecHit hit = (*hitItr); DetId det = hit.id(); @@ -281,7 +286,7 @@ void EcalMipGraphs::selectHits(Handle hits, int ievt, ESHa TGraph* myGraph; int canvasNum = 1; - CaloNavigator cursor = CaloNavigator(det, caloTopo->getSubdetectorTopology(det)); + CaloNavigator cursor = CaloNavigator(det, caloTopo_->getSubdetectorTopology(det)); //Now put each graph in one by one for (int j = side_ / 2; j >= -side_ / 2; --j) { for (int i = -side_ / 2; i <= side_ / 2; ++i) { @@ -328,11 +333,11 @@ void EcalMipGraphs::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalMipGraphs::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle handle; - c.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalMipGraphs::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalMipGraphs::endJob() { canvasNames_->Fill(); diff --git a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h index 52817c0bbc1e5..db0b049a629a5 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h @@ -21,15 +21,15 @@ #include #include #include +#include // 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/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" @@ -56,38 +56,48 @@ // class declaration // -class EcalMipGraphs : public edm::EDAnalyzer { +class EcalMipGraphs : public edm::one::EDAnalyzer { public: explicit EcalMipGraphs(const edm::ParameterSet&); ~EcalMipGraphs() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); std::string floatToString(float num); void writeGraphs(); void initHists(int); - void selectHits(edm::Handle hits, int ievt, edm::ESHandle caloTopo); + void selectHits(edm::Handle hits, int ievt); TGraph* selectDigi(DetId det, int ievt); int getEEIndex(EcalElectronicsId elecId); // ----------member data --------------------------- - edm::InputTag EBRecHitCollection_; - edm::InputTag EERecHitCollection_; - edm::InputTag EBDigis_; - edm::InputTag EEDigis_; - edm::InputTag headerProducer_; + const edm::InputTag EBRecHitCollection_; + const edm::InputTag EERecHitCollection_; + const edm::InputTag EBDigis_; + const edm::InputTag EEDigis_; + const edm::InputTag headerProducer_; edm::Handle EBdigisHandle; edm::Handle EEdigisHandle; + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken topologyToken_; + int runNum_; - int side_; - double threshold_; - double minTimingAmp_; + const int side_; + const double threshold_; + const double minTimingAmp_; std::set listEBChannels; std::set listEEChannels; @@ -114,6 +124,7 @@ class EcalMipGraphs : public edm::EDAnalyzer { TTree* canvasNames_; EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; + const CaloTopology* caloTopo_; int naiveEvtNum_; }; From 663a17d6300e3aa2a2b89a4c20e78c89d03b0e7c Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 17:39:06 +0200 Subject: [PATCH 347/923] Make the default configuration of the TriggerResultsFilter skip the current process --- HLTrigger/HLTfilters/plugins/TriggerResultsFilter.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/TriggerResultsFilter.cc b/HLTrigger/HLTfilters/plugins/TriggerResultsFilter.cc index 310c483661b71..483eda1b82710 100644 --- a/HLTrigger/HLTfilters/plugins/TriggerResultsFilter.cc +++ b/HLTrigger/HLTfilters/plugins/TriggerResultsFilter.cc @@ -42,11 +42,14 @@ TriggerResultsFilter::~TriggerResultsFilter() { delete m_expression; } void TriggerResultsFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; // # use HLTPathStatus results - desc.add("usePathStatus", false); - // # HLT results - set to empty to ignore HLT - desc.add("hltResults", edm::InputTag("TriggerResults")); + desc.add("usePathStatus", false) + ->setComment("Read the HLT results from the TriggerResults (false) or from the current job's PathStatus (true)."); + // # HLT results - set to empty to ignore HLT + desc.add("hltResults", edm::InputTag("TriggerResults", "", "@skipCurrentProcess")) + ->setComment("HLT TriggerResults. Leave empty to ignore the HLT results. Ignored when usePathStatus is true."); // # L1 uGT results - set to empty to ignore L1T - desc.add("l1tResults", edm::InputTag("hltGtStage2Digis")); + desc.add("l1tResults", edm::InputTag("hltGtStage2Digis")) + ->setComment("uGT digi collection. Leave empty to ignore the L1T results."); // # use initial L1 decision, before masks and prescales desc.add("l1tIgnoreMaskAndPrescale", false); // # OBSOLETE - these parameters are ignored, they are left only not to break old configurations From 6da6f5afc49bcd2cdbd77fb6eb3aa35e8989fc15 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 17:49:57 +0200 Subject: [PATCH 348/923] Fixes for python3 compatibility --- HLTrigger/HLTfilters/test/triggerResultsFilter.py | 2 +- HLTrigger/HLTfilters/test/triggerResultsFilter_producer.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HLTrigger/HLTfilters/test/triggerResultsFilter.py b/HLTrigger/HLTfilters/test/triggerResultsFilter.py index ac487849ef887..fa61b70a28453 100644 --- a/HLTrigger/HLTfilters/test/triggerResultsFilter.py +++ b/HLTrigger/HLTfilters/test/triggerResultsFilter.py @@ -179,6 +179,6 @@ # define an EndPath to analyze all other path results process.hltTrigReport = cms.EDAnalyzer( 'HLTrigReport', - HLTriggerResults = cms.InputTag( 'TriggerResults','','TEST' ) + HLTriggerResults = cms.InputTag( 'TriggerResults', '', 'TEST' ) ) process.HLTAnalyzerEndpath = cms.EndPath( process.hltTrigReport ) diff --git a/HLTrigger/HLTfilters/test/triggerResultsFilter_producer.py b/HLTrigger/HLTfilters/test/triggerResultsFilter_producer.py index 03b3b42bb431a..3d72515f89796 100644 --- a/HLTrigger/HLTfilters/test/triggerResultsFilter_producer.py +++ b/HLTrigger/HLTfilters/test/triggerResultsFilter_producer.py @@ -44,8 +44,8 @@ process.Path_1 = cms.Path(process.scale_1) process.Path_2 = cms.Path(process.scale_2) process.Path_3 = cms.Path(process.scale_3) -process.True = cms.Path(process.success) -process.False = cms.Path(process.fail) +process.AlwaysTrue = cms.Path(process.success) +process.AlwaysFalse = cms.Path(process.fail) process.L1_Path = cms.Path(process.success) # define and EndPath to analyze all other path results From cfca312218d1ef823e8cf372625578f904f005be Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 17:55:11 +0200 Subject: [PATCH 349/923] Modernise EcalPedHists. --- .../EcalTools/plugins/EcalPedHists.cc | 27 ++++++++++--------- .../EcalTools/plugins/EcalPedHists.h | 22 ++++++++++----- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc index eed22b89f5238..3e4f075287a5b 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc @@ -15,7 +15,11 @@ EcalPedHists::EcalPedHists(const edm::ParameterSet& ps) fileName_(ps.getUntrackedParameter("fileName", std::string("ecalPedDigiDump"))), barrelDigiCollection_(ps.getParameter("EBdigiCollection")), endcapDigiCollection_(ps.getParameter("EEdigiCollection")), - headerProducer_(ps.getParameter("headerProducer")) { + headerProducer_(ps.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebDigiToken_(consumes(barrelDigiCollection_)), + eeDigiToken_(consumes(endcapDigiCollection_)), + ecalMappingToken_(esConsumes()) { using namespace std; fedMap_ = new EcalFedMap(); @@ -103,11 +107,11 @@ EcalPedHists::EcalPedHists(const edm::ParameterSet& ps) EcalPedHists::~EcalPedHists() {} void EcalPedHists::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalPedHists::endRun(edm::Run const&, edm::EventSetup const& c) {} + void EcalPedHists::endJob(void) { using namespace std; if (inputIsOk_) { @@ -177,9 +181,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // loop over the headers, this is to detect missing FEDs if all are selected if (allFEDsSelected_) { edm::Handle DCCHeaders; - try { - e.getByLabel(headerProducer_, DCCHeaders); - } catch (std::exception& ex) { + e.getByToken(rawDataToken_, DCCHeaders); + if (!DCCHeaders.isValid()) { edm::LogError("EcalPedHists") << "Error! can't get the product " << headerProducer_; return; } @@ -206,9 +209,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // (one digi for each crystal) // TODO; SIC: fix this behavior Handle barrelDigis; - try { - e.getByLabel(barrelDigiCollection_, barrelDigis); - } catch (std::exception& ex) { + e.getByToken(ebDigiToken_, barrelDigis); + if (!barrelDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << barrelDigiCollection_; barrelDigisFound = false; } @@ -216,9 +218,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // (one digi for each crystal) // TODO; SIC: fix this behavior Handle endcapDigis; - try { - e.getByLabel(endcapDigiCollection_, endcapDigis); - } catch (std::exception& ex) { + e.getByToken(eeDigiToken_, endcapDigis); + if (!endcapDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << endcapDigiCollection_; endcapDigisFound = false; } diff --git a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h index dc1ee2a45f4c0..7b2dac77ec0cf 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalPedHists_h +#define CaloOnlineTools_EcalTools_EcalPedHists_h /** * Module which outputs a root file of ADC counts (all three gains) * of user-selected channels (defaults to channel 1) for @@ -8,11 +10,10 @@ * */ -#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/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" @@ -31,7 +32,7 @@ typedef std::map stringHistMap; -class EcalPedHists : public edm::EDAnalyzer { +class EcalPedHists : public edm::one::EDAnalyzer { public: EcalPedHists(const edm::ParameterSet& ps); ~EcalPedHists() override; @@ -39,6 +40,7 @@ class EcalPedHists : public edm::EDAnalyzer { protected: void analyze(const edm::Event& e, const edm::EventSetup& c) override; void beginRun(edm::Run const&, edm::EventSetup const& c) override; + void endRun(edm::Run const&, edm::EventSetup const& c) override; void endJob(void) override; private: @@ -52,9 +54,9 @@ class EcalPedHists : public edm::EDAnalyzer { bool allFEDsSelected_; bool histsFilled_; std::string fileName_; - edm::InputTag barrelDigiCollection_; - edm::InputTag endcapDigiCollection_; - edm::InputTag headerProducer_; + const edm::InputTag barrelDigiCollection_; + const edm::InputTag endcapDigiCollection_; + const edm::InputTag headerProducer_; std::vector listChannels_; std::vector listSamples_; std::vector listFEDs_; @@ -63,5 +65,13 @@ class EcalPedHists : public edm::EDAnalyzer { std::set theRealFedSet_; EcalFedMap* fedMap_; TFile* root_file_; + + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + const edm::ESGetToken ecalMappingToken_; + const EcalElectronicsMapping* ecalElectronicsMap_; }; + +#endif From a7873e608454d7a0091e76796a22e670e01cba65 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 11:06:57 -0500 Subject: [PATCH 350/923] moved Associators to be created on the stack --- ...nToTrackingParticleAssociatorEDProducer.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index 5b58ba29fff96..9318c4735d732 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -189,13 +189,8 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce TrackerMuonHitExtractor hitExtractor_; const edm::ESGetToken tTopoToken_; - - std::unique_ptr rpctruth_; - std::unique_ptr gemtruth_; - std::unique_ptr dttruth_; - std::unique_ptr csctruth_; - std::unique_ptr trackertruth_; std::unique_ptr diagnostics_; + }; // @@ -259,19 +254,19 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con // the resources own the memory. // Tracker hit association - trackertruth_ = std::make_unique(iEvent, trackerHitAssociatorConfig_); + TrackerHitAssociator trackertruth(iEvent, trackerHitAssociatorConfig_); // CSC hit association - csctruth_ = std::make_unique(iEvent, iSetup, config_); + CSCHitAssociator csctruth(iEvent, iSetup, config_); // DT hit association printRtS = false; - dttruth_ = std::make_unique(iEvent, iSetup, config_, printRtS); + DTHitAssociator dttruth(iEvent, iSetup, config_, printRtS); // RPC hit association - rpctruth_ = std::make_unique(iEvent, config_); + RPCHitAssociator rpctruth(iEvent, config_); // GEM hit association - gemtruth_ = std::make_unique(iEvent, config_); + GEMHitAssociator gemtruth(iEvent, config_); MuonAssociatorByHitsHelper::Resources resources = { - tTopo, trackertruth_.get(), csctruth_.get(), dttruth_.get(), rpctruth_.get(), gemtruth_.get(), {}}; + tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; if (diagnostics_) { diagnostics_->read(iEvent); From 10d17c7806dc16b01149478370da262def75e973 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 11:10:28 -0500 Subject: [PATCH 351/923] Use Config class with GEMHitAssociator --- SimMuon/MCTruth/interface/GEMHitAssociator.h | 41 +++++++++------- .../MCTruth/interface/MuonAssociatorByHits.h | 2 + ...nToTrackingParticleAssociatorEDProducer.cc | 6 +-- SimMuon/MCTruth/src/GEMHitAssociator.cc | 48 +++++++------------ SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 7 ++- 5 files changed, 49 insertions(+), 55 deletions(-) diff --git a/SimMuon/MCTruth/interface/GEMHitAssociator.h b/SimMuon/MCTruth/interface/GEMHitAssociator.h index 349001880dd18..c38f0408bf43e 100644 --- a/SimMuon/MCTruth/interface/GEMHitAssociator.h +++ b/SimMuon/MCTruth/interface/GEMHitAssociator.h @@ -32,34 +32,39 @@ class GEMHitAssociator { public: + class Config { + public: + Config(const edm::ParameterSet &, edm::ConsumesCollector ic); + + private: + friend class GEMHitAssociator; + + edm::InputTag GEMdigisimlinkTag; + edm::InputTag GEMsimhitsTag; + edm::InputTag GEMsimhitsXFTag; + + edm::EDGetTokenT> GEMsimhitsXFToken_; + edm::EDGetTokenT GEMsimhitsToken_; + edm::EDGetTokenT> GEMdigisimlinkToken_; + + bool crossingframe; + bool useGEMs_; + }; + typedef edm::DetSetVector DigiSimLinks; typedef edm::DetSet LayerLinks; typedef std::pair SimHitIdpr; // Constructor with configurable parameters - GEMHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&ic); - GEMHitAssociator(const edm::Event &e, const edm::ParameterSet &conf); - - void initEvent(const edm::Event &); - - // Destructor - ~GEMHitAssociator() {} + GEMHitAssociator(const edm::Event &e, const Config &config); std::vector associateRecHit(const GEMRecHit *gemrechit) const; private: - const DigiSimLinks *theDigiSimLinks; - edm::InputTag GEMdigisimlinkTag; - - bool crossingframe; - bool useGEMs_; - edm::InputTag GEMsimhitsTag; - edm::InputTag GEMsimhitsXFTag; - - edm::EDGetTokenT> GEMsimhitsXFToken_; - edm::EDGetTokenT GEMsimhitsToken_; - edm::EDGetTokenT> GEMdigisimlinkToken_; + void initEvent(const edm::Event &); + const Config &theConfig; + const DigiSimLinks *theDigiSimLinks; std::map _SimHitMap; }; diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h index 43fbd420844f9..5521dba71fcd5 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h @@ -15,6 +15,7 @@ #include "SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +#include "SimMuon/MCTruth/interface/GEMHitAssociator.h" #include @@ -76,6 +77,7 @@ class MuonAssociatorByHits { MuonAssociatorByHitsHelper helper_; edm::ParameterSet const conf_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; + GEMHitAssociator::Config gemHitAssociatorConfig_; std::unique_ptr diagnostics_; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index 9318c4735d732..d7fc10211d09b 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -187,10 +187,10 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce MuonAssociatorByHitsHelper helper_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; TrackerMuonHitExtractor hitExtractor_; + GEMHitAssociator::Config gemHitAssociatorConfig_; const edm::ESGetToken tTopoToken_; std::unique_ptr diagnostics_; - }; // @@ -209,13 +209,13 @@ MuonToTrackingParticleAssociatorEDProducer::MuonToTrackingParticleAssociatorEDPr helper_(iConfig), trackerHitAssociatorConfig_(iConfig, consumesCollector()), hitExtractor_(iConfig, consumesCollector()), + gemHitAssociatorConfig_(iConfig, consumesCollector()), tTopoToken_(esConsumes()) { // register your products produces(); // hack for consumes RPCHitAssociator rpctruth(iConfig, consumesCollector()); - GEMHitAssociator gemtruth(iConfig, consumesCollector()); DTHitAssociator dttruth(iConfig, consumesCollector()); CSCHitAssociator cscruth(iConfig, consumesCollector()); @@ -263,7 +263,7 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con // RPC hit association RPCHitAssociator rpctruth(iEvent, config_); // GEM hit association - GEMHitAssociator gemtruth(iEvent, config_); + GEMHitAssociator gemtruth(iEvent, gemHitAssociatorConfig_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; diff --git a/SimMuon/MCTruth/src/GEMHitAssociator.cc b/SimMuon/MCTruth/src/GEMHitAssociator.cc index 7f65c10e46e78..ec0f72d04a937 100644 --- a/SimMuon/MCTruth/src/GEMHitAssociator.cc +++ b/SimMuon/MCTruth/src/GEMHitAssociator.cc @@ -4,13 +4,13 @@ using namespace std; // Constructor -GEMHitAssociator::GEMHitAssociator(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) +GEMHitAssociator::Config::Config(const edm::ParameterSet &conf, edm::ConsumesCollector iC) : GEMdigisimlinkTag(conf.getParameter("GEMdigisimlinkTag")), // CrossingFrame used or not ? - crossingframe(conf.getParameter("crossingframe")), - useGEMs_(conf.getParameter("useGEMs")), GEMsimhitsTag(conf.getParameter("GEMsimhitsTag")), - GEMsimhitsXFTag(conf.getParameter("GEMsimhitsXFTag")) { + GEMsimhitsXFTag(conf.getParameter("GEMsimhitsXFTag")), + crossingframe(conf.getParameter("crossingframe")), + useGEMs_(conf.getParameter("useGEMs")) { if (crossingframe) { GEMsimhitsXFToken_ = iC.consumes>(GEMsimhitsXFTag); } else if (!GEMsimhitsTag.label().empty()) { @@ -20,24 +20,15 @@ GEMHitAssociator::GEMHitAssociator(const edm::ParameterSet &conf, edm::ConsumesC GEMdigisimlinkToken_ = iC.consumes>(GEMdigisimlinkTag); } -GEMHitAssociator::GEMHitAssociator(const edm::Event &e, const edm::ParameterSet &conf) - : GEMdigisimlinkTag(conf.getParameter("GEMdigisimlinkTag")), - // CrossingFrame used or not ? - crossingframe(conf.getParameter("crossingframe")), - useGEMs_(conf.getParameter("useGEMs")), - GEMsimhitsTag(conf.getParameter("GEMsimhitsTag")), - GEMsimhitsXFTag(conf.getParameter("GEMsimhitsXFTag")) { - initEvent(e); -} +GEMHitAssociator::GEMHitAssociator(const edm::Event &e, const Config &config) : theConfig(config) { initEvent(e); } void GEMHitAssociator::initEvent(const edm::Event &e) { - if (useGEMs_) { - if (crossingframe) { - edm::Handle> cf; - LogTrace("GEMHitAssociator") << "getting CrossingFrame collection - " << GEMsimhitsXFTag; - e.getByLabel(GEMsimhitsXFTag, cf); + if (theConfig.useGEMs_) { + if (theConfig.crossingframe) { + LogTrace("GEMHitAssociator") << "getting CrossingFrame collection - " << theConfig.GEMsimhitsXFTag; + CrossingFrame const &cf = e.get(theConfig.GEMsimhitsXFToken_); - std::unique_ptr> GEMsimhits(new MixCollection(cf.product())); + std::unique_ptr> GEMsimhits(new MixCollection(&cf)); LogTrace("GEMHitAssociator") << "... size = " << GEMsimhits->size(); // MixCollection & simHits = *hits; @@ -46,22 +37,19 @@ void GEMHitAssociator::initEvent(const edm::Event &e) { _SimHitMap[hitItr->detUnitId()].push_back(*hitItr); } - } else if (!GEMsimhitsTag.label().empty()) { - edm::Handle GEMsimhits; - LogTrace("GEMHitAssociator") << "getting PSimHit collection - " << GEMsimhitsTag; - e.getByLabel(GEMsimhitsTag, GEMsimhits); - LogTrace("GEMHitAssociator") << "... size = " << GEMsimhits->size(); + } else if (!theConfig.GEMsimhitsTag.label().empty()) { + LogTrace("GEMHitAssociator") << "getting PSimHit collection - " << theConfig.GEMsimhitsTag; + edm::PSimHitContainer const &GEMsimhits = e.get(theConfig.GEMsimhitsToken_); + LogTrace("GEMHitAssociator") << "... size = " << GEMsimhits.size(); // arrange the hits by detUnit - for (edm::PSimHitContainer::const_iterator hitItr = GEMsimhits->begin(); hitItr != GEMsimhits->end(); ++hitItr) { + for (edm::PSimHitContainer::const_iterator hitItr = GEMsimhits.begin(); hitItr != GEMsimhits.end(); ++hitItr) { _SimHitMap[hitItr->detUnitId()].push_back(*hitItr); } } - edm::Handle digiSimLinks; - LogTrace("GEMHitAssociator") << "getting GEM Strip DigiSimLink collection - " << GEMdigisimlinkTag; - e.getByLabel(GEMdigisimlinkTag, digiSimLinks); - theDigiSimLinks = digiSimLinks.product(); + LogTrace("GEMHitAssociator") << "getting GEM Strip DigiSimLink collection - " << theConfig.GEMdigisimlinkTag; + theDigiSimLinks = &e.get(theConfig.GEMdigisimlinkToken_); } } // end of constructor @@ -69,7 +57,7 @@ void GEMHitAssociator::initEvent(const edm::Event &e) { std::vector GEMHitAssociator::associateRecHit(const GEMRecHit *gemrechit) const { std::vector matched; - if (useGEMs_) { + if (theConfig.useGEMs_) { if (gemrechit) { GEMDetId gemDetId = gemrechit->gemId(); int fstrip = gemrechit->firstClusterStrip(); diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index b9e6d48d50fa6..41284281991c6 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -137,10 +137,9 @@ namespace muonAssociatorByHitsDiagnostics { } // namespace muonAssociatorByHitsDiagnostics MuonAssociatorByHits::MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) - : helper_(conf), conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)) { + : helper_(conf), conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)), gemHitAssociatorConfig_(conf, 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)); if (conf.getUntrackedParameter("dumpInputCollections")) { @@ -177,7 +176,7 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( // RPC hit association RPCHitAssociator rpctruth(*e, conf_); // GEM hit association - GEMHitAssociator gemtruth(*e, conf_); + GEMHitAssociator gemtruth(*e, gemHitAssociatorConfig_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; @@ -225,7 +224,7 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( // RPC hit association RPCHitAssociator rpctruth(*e, conf_); // GEM hit association - GEMHitAssociator gemtruth(*e, conf_); + GEMHitAssociator gemtruth(*e, gemHitAssociatorConfig_); MuonAssociatorByHitsHelper::Resources resources = { tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; From 586a38bb5a40f9c9a7f804a7649328758fdc43ed Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 18:35:37 +0200 Subject: [PATCH 352/923] Modernise EcalTPGAnalyzer. --- .../EcalTools/plugins/EcalTPGAnalyzer.cc | 83 +++++++------------ .../EcalTools/plugins/EcalTPGAnalyzer.h | 47 ++++++++--- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc index 680c25371e7b5..6c1d4515354a7 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc @@ -12,32 +12,9 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#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/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" -#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" -#include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" #include "EcalTPGAnalyzer.h" @@ -47,16 +24,24 @@ using namespace edm; class CaloSubdetectorGeometry; -EcalTPGAnalyzer::EcalTPGAnalyzer(const edm::ParameterSet& iConfig) { - tpCollection_ = iConfig.getParameter("TPCollection"); - tpEmulatorCollection_ = iConfig.getParameter("TPEmulatorCollection"); - digiCollectionEB_ = iConfig.getParameter("DigiCollectionEB"); - digiCollectionEE_ = iConfig.getParameter("DigiCollectionEE"); - gtRecordCollectionTag_ = iConfig.getParameter("GTRecordCollection"); - - allowTP_ = iConfig.getParameter("ReadTriggerPrimitives"); - useEE_ = iConfig.getParameter("UseEndCap"); - print_ = iConfig.getParameter("Print"); +EcalTPGAnalyzer::EcalTPGAnalyzer(const edm::ParameterSet& iConfig) + : tpCollection_(iConfig.getParameter("TPCollection")), + tpEmulatorCollection_(iConfig.getParameter("TPEmulatorCollection")), + digiCollectionEB_(iConfig.getParameter("DigiCollectionEB")), + digiCollectionEE_(iConfig.getParameter("DigiCollectionEE")), + gtRecordCollectionTag_(iConfig.getParameter("GTRecordCollection")), + l1GtReadoutRecordToken_(consumes(edm::InputTag(gtRecordCollectionTag_))), + tpToken_(consumes(tpCollection_)), + tpEmulToken_(consumes(tpEmulatorCollection_)), + ebDigiToken_(consumes(digiCollectionEB_)), + eeDigiToken_(consumes(digiCollectionEE_)), + eTTMapToken_(esConsumes()), + ebGeometryToken_(esConsumes(edm::ESInputTag("", "EcalBarrel"))), + eeGeometryToken_(esConsumes(edm::ESInputTag("", "EcalEndcap"))), + l1GtMaskToken_(esConsumes()), + allowTP_(iConfig.getParameter("ReadTriggerPrimitives")), + useEE_(iConfig.getParameter("UseEndCap")), + print_(iConfig.getParameter("Print")) { // file file_ = new TFile("ECALTPGtree.root", "RECREATE"); @@ -93,18 +78,13 @@ EcalTPGAnalyzer::~EcalTPGAnalyzer() { void EcalTPGAnalyzer::beginRun(edm::Run const&, edm::EventSetup const& evtSetup) { // geometry - ESHandle theGeometry; - ESHandle theEndcapGeometry_handle, theBarrelGeometry_handle; - - evtSetup.get().get(theGeometry); - evtSetup.get().get("EcalEndcap", theEndcapGeometry_handle); - evtSetup.get().get("EcalBarrel", theBarrelGeometry_handle); - - evtSetup.get().get(eTTmap_); - theEndcapGeometry_ = &(*theEndcapGeometry_handle); - theBarrelGeometry_ = &(*theBarrelGeometry_handle); + eTTmap_ = &evtSetup.getData(eTTMapToken_); + theBarrelGeometry_ = &evtSetup.getData(ebGeometryToken_); + theEndcapGeometry_ = &evtSetup.getData(eeGeometryToken_); } +void EcalTPGAnalyzer::endRun(edm::Run const&, edm::EventSetup const& evtSetup) {} + void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { using namespace edm; using namespace std; @@ -129,12 +109,11 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle gtRecord; - iEvent.getByLabel(edm::InputTag(gtRecordCollectionTag_), gtRecord); + iEvent.getByToken(l1GtReadoutRecordToken_, gtRecord); DecisionWord dWord = gtRecord->decisionWord(); // this will get the decision word *before* masking disabled bits - edm::ESHandle l1GtTmAlgo; - iSetup.get().get(l1GtTmAlgo); - std::vector triggerMaskAlgoTrig = l1GtTmAlgo.product()->gtTriggerMask(); + const auto& l1GtTmAlgo = iSetup.getData(l1GtMaskToken_); + std::vector triggerMaskAlgoTrig = l1GtTmAlgo.gtTriggerMask(); // apply masks on algo int iDaq = 0; @@ -156,7 +135,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle tp; - iEvent.getByLabel(tpCollection_, tp); + iEvent.getByToken(tpToken_, tp); if (print_) std::cout << "TP collection size=" << tp.product()->size() << std::endl; @@ -175,7 +154,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle tpEmul; - iEvent.getByLabel(tpEmulatorCollection_, tpEmul); + iEvent.getByToken(tpEmulToken_, tpEmul); if (print_) std::cout << "TPEmulator collection size=" << tpEmul.product()->size() << std::endl; @@ -194,7 +173,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i // Get EB xtal digi inputs edm::Handle digiEB; - iEvent.getByLabel(digiCollectionEB_, digiEB); + iEvent.getByToken(ebDigiToken_, digiEB); for (unsigned int i = 0; i < digiEB.product()->size(); i++) { const EBDataFrame& df = (*(digiEB.product()))[i]; @@ -208,11 +187,11 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i if (useEE_) { // Get EE xtal digi inputs edm::Handle digiEE; - iEvent.getByLabel(digiCollectionEE_, digiEE); + iEvent.getByToken(eeDigiToken_, digiEE); for (unsigned int i = 0; i < digiEE.product()->size(); i++) { const EEDataFrame& df = (*(digiEE.product()))[i]; const EEDetId& id = df.id(); - const EcalTrigTowerDetId towid = (*eTTmap_).towerOf(id); + const EcalTrigTowerDetId towid = eTTmap_->towerOf(id); itTT = mapTower.find(towid); if (itTT != mapTower.end()) (itTT->second).nbXtal_++; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h index 1944085121448..642046b318a9f 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h +#define CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h // -*- C++ -*- // // Class: EcalTPGAnalyzer @@ -5,13 +7,18 @@ // // Original Author: Pascal Paganini // -#include "FWCore/Framework/interface/ESHandle.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 "CondFormats/L1TObjects/interface/L1GtTriggerMask.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include #include #include @@ -32,12 +39,13 @@ class towerEner { } }; -class EcalTPGAnalyzer : public edm::EDAnalyzer { +class EcalTPGAnalyzer : public edm::one::EDAnalyzer { public: explicit EcalTPGAnalyzer(const edm::ParameterSet &); ~EcalTPGAnalyzer() override; void analyze(edm::Event const &, edm::EventSetup const &) override; void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &, edm::EventSetup const &) override; private: struct EcalTPGVariables { @@ -68,17 +76,30 @@ class EcalTPGAnalyzer : public edm::EDAnalyzer { TTree *tree_; EcalTPGVariables treeVariables_; - edm::InputTag tpCollection_; - edm::InputTag tpEmulatorCollection_; - edm::InputTag digiCollectionEB_; - edm::InputTag digiCollectionEE_; - std::string gtRecordCollectionTag_; + const edm::InputTag tpCollection_; + const edm::InputTag tpEmulatorCollection_; + const edm::InputTag digiCollectionEB_; + const edm::InputTag digiCollectionEE_; + const std::string gtRecordCollectionTag_; - bool allowTP_; - bool useEE_; - bool print_; + const edm::EDGetTokenT l1GtReadoutRecordToken_; + const edm::EDGetTokenT tpToken_; + const edm::EDGetTokenT tpEmulToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken eTTMapToken_; + const edm::ESGetToken ebGeometryToken_; + const edm::ESGetToken eeGeometryToken_; + const edm::ESGetToken l1GtMaskToken_; + + const bool allowTP_; + const bool useEE_; + const bool print_; - const CaloSubdetectorGeometry *theEndcapGeometry_; const CaloSubdetectorGeometry *theBarrelGeometry_; - edm::ESHandle eTTmap_; + const CaloSubdetectorGeometry *theEndcapGeometry_; + const EcalTrigTowerConstituentsMap *eTTmap_; }; + +#endif From f09fa756f3dd5b35b9d6a688bbe9f3afe0a0781e Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 11:39:10 -0500 Subject: [PATCH 353/923] Use Config class with RPCHitAssociator --- .../MCTruth/interface/MuonAssociatorByHits.h | 2 + SimMuon/MCTruth/interface/RPCHitAssociator.h | 38 +++++++++-------- ...nToTrackingParticleAssociatorEDProducer.cc | 5 ++- SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 11 +++-- SimMuon/MCTruth/src/RPCHitAssociator.cc | 41 +++++++------------ 5 files changed, 49 insertions(+), 48 deletions(-) diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h index 5521dba71fcd5..83bac7395a53f 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h @@ -16,6 +16,7 @@ #include "SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "SimMuon/MCTruth/interface/GEMHitAssociator.h" +#include "SimMuon/MCTruth/interface/RPCHitAssociator.h" #include @@ -78,6 +79,7 @@ class MuonAssociatorByHits { edm::ParameterSet const conf_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; GEMHitAssociator::Config gemHitAssociatorConfig_; + RPCHitAssociator::Config rpcHitAssociatorConfig_; std::unique_ptr diagnostics_; }; diff --git a/SimMuon/MCTruth/interface/RPCHitAssociator.h b/SimMuon/MCTruth/interface/RPCHitAssociator.h index a62435e502730..e0acf6aaac757 100644 --- a/SimMuon/MCTruth/interface/RPCHitAssociator.h +++ b/SimMuon/MCTruth/interface/RPCHitAssociator.h @@ -34,31 +34,37 @@ class RPCHitAssociator { typedef edm::DetSetVector RPCDigiSimLinks; typedef std::pair SimHitIdpr; - // Constructor with configurable parameters - RPCHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&ic); - RPCHitAssociator(const edm::Event &e, const edm::ParameterSet &conf); + class Config { + public: + Config(const edm::ParameterSet &, edm::ConsumesCollector ic); - void initEvent(const edm::Event &); + private: + friend class RPCHitAssociator; + + edm::InputTag RPCdigisimlinkTag; + + edm::InputTag RPCsimhitsTag; + edm::InputTag RPCsimhitsXFTag; + + edm::EDGetTokenT> RPCsimhitsXFToken_; + edm::EDGetTokenT RPCsimhitsToken_; + edm::EDGetTokenT> RPCdigisimlinkToken_; + + bool crossingframe; + }; - // Destructor - ~RPCHitAssociator() {} + // Constructor with configurable parameters + RPCHitAssociator(const edm::Event &e, const Config &conf); std::vector associateRecHit(const TrackingRecHit &hit) const; std::set findRPCDigiSimLink(uint32_t rpcDetId, int strip, int bx) const; // const PSimHit* linkToSimHit(RPCDigiSimLink link); private: - edm::Handle> _thelinkDigis; - edm::InputTag RPCdigisimlinkTag; - - bool crossingframe; - edm::InputTag RPCsimhitsTag; - edm::InputTag RPCsimhitsXFTag; - - edm::EDGetTokenT> RPCsimhitsXFToken_; - edm::EDGetTokenT RPCsimhitsToken_; - edm::EDGetTokenT> RPCdigisimlinkToken_; + void initEvent(const edm::Event &); + Config const &theConfig; + edm::Handle> _thelinkDigis; std::map _SimHitMap; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index d7fc10211d09b..041dc793608ea 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -188,6 +188,7 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce TrackerHitAssociator::Config trackerHitAssociatorConfig_; TrackerMuonHitExtractor hitExtractor_; GEMHitAssociator::Config gemHitAssociatorConfig_; + RPCHitAssociator::Config rpcHitAssociatorConfig_; const edm::ESGetToken tTopoToken_; std::unique_ptr diagnostics_; @@ -210,12 +211,12 @@ MuonToTrackingParticleAssociatorEDProducer::MuonToTrackingParticleAssociatorEDPr trackerHitAssociatorConfig_(iConfig, consumesCollector()), hitExtractor_(iConfig, consumesCollector()), gemHitAssociatorConfig_(iConfig, consumesCollector()), + rpcHitAssociatorConfig_(iConfig, consumesCollector()), tTopoToken_(esConsumes()) { // register your products produces(); // hack for consumes - RPCHitAssociator rpctruth(iConfig, consumesCollector()); DTHitAssociator dttruth(iConfig, consumesCollector()); CSCHitAssociator cscruth(iConfig, consumesCollector()); @@ -261,7 +262,7 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con printRtS = false; DTHitAssociator dttruth(iEvent, iSetup, config_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(iEvent, config_); + RPCHitAssociator rpctruth(iEvent, rpcHitAssociatorConfig_); // GEM hit association GEMHitAssociator gemtruth(iEvent, gemHitAssociatorConfig_); diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index 41284281991c6..0228462f65ca0 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -137,9 +137,12 @@ namespace muonAssociatorByHitsDiagnostics { } // namespace muonAssociatorByHitsDiagnostics MuonAssociatorByHits::MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) - : helper_(conf), conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)), gemHitAssociatorConfig_(conf, iC) { + : helper_(conf), + conf_(conf), + trackerHitAssociatorConfig_(conf, std::move(iC)), + gemHitAssociatorConfig_(conf, iC), + rpcHitAssociatorConfig_(conf, iC) { // hack for consumes - RPCHitAssociator rpctruth(conf, std::move(iC)); DTHitAssociator dttruth(conf, std::move(iC)); CSCHitAssociator muonTruth(conf, std::move(iC)); if (conf.getUntrackedParameter("dumpInputCollections")) { @@ -174,7 +177,7 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( bool printRtS(true); DTHitAssociator dttruth(*e, *setup, conf_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(*e, conf_); + RPCHitAssociator rpctruth(*e, rpcHitAssociatorConfig_); // GEM hit association GEMHitAssociator gemtruth(*e, gemHitAssociatorConfig_); @@ -222,7 +225,7 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( bool printRtS = false; DTHitAssociator dttruth(*e, *setup, conf_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(*e, conf_); + RPCHitAssociator rpctruth(*e, rpcHitAssociatorConfig_); // GEM hit association GEMHitAssociator gemtruth(*e, gemHitAssociatorConfig_); diff --git a/SimMuon/MCTruth/src/RPCHitAssociator.cc b/SimMuon/MCTruth/src/RPCHitAssociator.cc index fe2428d8383a0..6f0a07d0ffc93 100644 --- a/SimMuon/MCTruth/src/RPCHitAssociator.cc +++ b/SimMuon/MCTruth/src/RPCHitAssociator.cc @@ -4,12 +4,12 @@ using namespace std; // Constructor -RPCHitAssociator::RPCHitAssociator(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) +RPCHitAssociator::Config::Config(const edm::ParameterSet &conf, edm::ConsumesCollector iC) : RPCdigisimlinkTag(conf.getParameter("RPCdigisimlinkTag")), // CrossingFrame used or not ? - crossingframe(conf.getParameter("crossingframe")), RPCsimhitsTag(conf.getParameter("RPCsimhitsTag")), - RPCsimhitsXFTag(conf.getParameter("RPCsimhitsXFTag")) { + RPCsimhitsXFTag(conf.getParameter("RPCsimhitsXFTag")), + crossingframe(conf.getParameter("crossingframe")) { if (crossingframe) { RPCsimhitsXFToken_ = iC.consumes>(RPCsimhitsXFTag); } else if (!RPCsimhitsTag.label().empty()) { @@ -19,24 +19,16 @@ RPCHitAssociator::RPCHitAssociator(const edm::ParameterSet &conf, edm::ConsumesC RPCdigisimlinkToken_ = iC.consumes>(RPCdigisimlinkTag); } -RPCHitAssociator::RPCHitAssociator(const edm::Event &e, const edm::ParameterSet &conf) - : RPCdigisimlinkTag(conf.getParameter("RPCdigisimlinkTag")), - // CrossingFrame used or not ? - crossingframe(conf.getParameter("crossingframe")), - RPCsimhitsTag(conf.getParameter("RPCsimhitsTag")), - RPCsimhitsXFTag(conf.getParameter("RPCsimhitsXFTag")) { - initEvent(e); -} +RPCHitAssociator::RPCHitAssociator(const edm::Event &e, const Config &conf) : theConfig(conf) { initEvent(e); } void RPCHitAssociator::initEvent(const edm::Event &e) { - if (crossingframe) { - edm::Handle> cf; - LogTrace("RPCHitAssociator") << "getting CrossingFrame collection - " << RPCsimhitsXFTag; - e.getByLabel(RPCsimhitsXFTag, cf); + if (theConfig.crossingframe) { + LogTrace("RPCHitAssociator") << "getting CrossingFrame collection - " << theConfig.RPCsimhitsXFTag; + CrossingFrame const &cf = e.get(theConfig.RPCsimhitsXFToken_); - std::unique_ptr> RPCsimhits(new MixCollection(cf.product())); + std::unique_ptr> RPCsimhits(new MixCollection(&cf)); LogTrace("RPCHitAssociator") << "... size = " << RPCsimhits->size(); // MixCollection & simHits = *hits; @@ -45,22 +37,19 @@ void RPCHitAssociator::initEvent(const edm::Event &e) _SimHitMap[hitItr->detUnitId()].push_back(*hitItr); } - } else if (!RPCsimhitsTag.label().empty()) { - edm::Handle RPCsimhits; - LogTrace("RPCHitAssociator") << "getting PSimHit collection - " << RPCsimhitsTag; - e.getByLabel(RPCsimhitsTag, RPCsimhits); - LogTrace("RPCHitAssociator") << "... size = " << RPCsimhits->size(); + } else if (!theConfig.RPCsimhitsTag.label().empty()) { + LogTrace("RPCHitAssociator") << "getting PSimHit collection - " << theConfig.RPCsimhitsTag; + edm::PSimHitContainer const &RPCsimhits = e.get(theConfig.RPCsimhitsToken_); + LogTrace("RPCHitAssociator") << "... size = " << RPCsimhits.size(); // arrange the hits by detUnit - for (edm::PSimHitContainer::const_iterator hitItr = RPCsimhits->begin(); hitItr != RPCsimhits->end(); ++hitItr) { + for (edm::PSimHitContainer::const_iterator hitItr = RPCsimhits.begin(); hitItr != RPCsimhits.end(); ++hitItr) { _SimHitMap[hitItr->detUnitId()].push_back(*hitItr); } } - edm::Handle> thelinkDigis; - LogTrace("RPCHitAssociator") << "getting RPCDigiSimLink collection - " << RPCdigisimlinkTag; - e.getByLabel(RPCdigisimlinkTag, thelinkDigis); - _thelinkDigis = thelinkDigis; + LogTrace("RPCHitAssociator") << "getting RPCDigiSimLink collection - " << theConfig.RPCdigisimlinkTag; + _thelinkDigis = e.getHandle(theConfig.RPCdigisimlinkToken_); } // end of constructor From ebd98e111be795acba26df693115430a4de6436f Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 18:47:48 +0200 Subject: [PATCH 354/923] Modernise EcalURecHitHists. --- .../EcalTools/plugins/EcalURecHitHists.cc | 17 +++++++------ .../EcalTools/plugins/EcalURecHitHists.h | 24 ++++++++++++------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc index 77c847ec7eb72..333d6b260cfd3 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc @@ -34,8 +34,11 @@ using namespace std; // constructors and destructor // EcalURecHitHists::EcalURecHitHists(const edm::ParameterSet& iConfig) - : EBUncalibratedRecHitCollection_(iConfig.getParameter("EBUncalibratedRecHitCollection")), - EEUncalibratedRecHitCollection_(iConfig.getParameter("EEUncalibratedRecHitCollection")), + : ebUncalibratedRecHitCollection_(iConfig.getParameter("EBUncalibratedRecHitCollection")), + eeUncalibratedRecHitCollection_(iConfig.getParameter("EEUncalibratedRecHitCollection")), + ebUncalibRecHitsToken_(consumes(ebUncalibratedRecHitCollection_)), + eeUncalibRecHitsToken_(consumes(eeUncalibratedRecHitCollection_)), + ecalMappingToken_(esConsumes()), runNum_(-1), histRangeMax_(iConfig.getUntrackedParameter("histogramMaxRange", 200.0)), histRangeMin_(iConfig.getUntrackedParameter("histogramMinRange", -10.0)), @@ -83,10 +86,10 @@ void EcalURecHitHists::analyze(edm::Event const& iEvent, edm::EventSetup const& Handle EBhits; Handle EEhits; - iEvent.getByLabel(EBUncalibratedRecHitCollection_, EBhits); + iEvent.getByToken(ebUncalibRecHitsToken_, EBhits); LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EBhits->size(); - iEvent.getByLabel(EEUncalibratedRecHitCollection_, EEhits); + iEvent.getByToken(eeUncalibRecHitsToken_, EEhits); LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EEhits->size(); for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EBhits->begin(); hitItr != EBhits->end(); ++hitItr) { @@ -194,11 +197,11 @@ void EcalURecHitHists::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalURecHitHists::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalURecHitHists::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalURecHitHists::endJob() { using namespace std; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h index 48707e4c99df9..db3286f9b5bd5 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalURecHitHists_h +#define CaloOnlineTools_EcalTools_EcalURecHitHists_h // -*- C++ -*- // // Package: EcalURecHitHists @@ -24,20 +26,19 @@ // 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 "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" @@ -45,19 +46,19 @@ #include "TH1F.h" #include "TGraph.h" #include "TNtuple.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" // // class declaration // -class EcalURecHitHists : public edm::EDAnalyzer { +class EcalURecHitHists : public edm::one::EDAnalyzer { public: explicit EcalURecHitHists(const edm::ParameterSet&); ~EcalURecHitHists() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -65,10 +66,15 @@ class EcalURecHitHists : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag EBUncalibratedRecHitCollection_; - edm::InputTag EEUncalibratedRecHitCollection_; + const edm::InputTag ebUncalibratedRecHitCollection_; + const edm::InputTag eeUncalibratedRecHitCollection_; + + const edm::EDGetTokenT ebUncalibRecHitsToken_; + const edm::EDGetTokenT eeUncalibRecHitsToken_; + const edm::ESGetToken ecalMappingToken_; + int runNum_; - double histRangeMax_, histRangeMin_; + const double histRangeMax_, histRangeMin_; std::string fileName_; std::vector maskedChannels_; @@ -84,3 +90,5 @@ class EcalURecHitHists : public edm::EDAnalyzer { EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; }; + +#endif From 7f8aa9d5b915d03bc79a7089ccb26367e8f819d4 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Thu, 2 Sep 2021 18:51:55 +0200 Subject: [PATCH 355/923] Apply code-checks and code-format. --- CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc index 6c1d4515354a7..cd8082f0cbee7 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc @@ -42,7 +42,6 @@ EcalTPGAnalyzer::EcalTPGAnalyzer(const edm::ParameterSet& iConfig) allowTP_(iConfig.getParameter("ReadTriggerPrimitives")), useEE_(iConfig.getParameter("UseEndCap")), print_(iConfig.getParameter("Print")) { - // file file_ = new TFile("ECALTPGtree.root", "RECREATE"); file_->cd(); From 23ca37b8dd3ce287c391959ee9f1979d3607efa6 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 12:19:11 -0500 Subject: [PATCH 356/923] Use Config class with CSCHitAssociator Added esConsumes call and now uses get tokens. --- SimMuon/MCTruth/interface/CSCHitAssociator.h | 21 ++++++++++++---- .../MCTruth/interface/MuonAssociatorByHits.h | 2 ++ ...nToTrackingParticleAssociatorEDProducer.cc | 5 ++-- SimMuon/MCTruth/src/CSCHitAssociator.cc | 24 ++++++++----------- SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 8 +++---- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/SimMuon/MCTruth/interface/CSCHitAssociator.h b/SimMuon/MCTruth/interface/CSCHitAssociator.h index 6f940d8ff90d7..095f655c8d3fa 100644 --- a/SimMuon/MCTruth/interface/CSCHitAssociator.h +++ b/SimMuon/MCTruth/interface/CSCHitAssociator.h @@ -21,6 +21,8 @@ #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +class MuonGeometryRecord; + class CSCHitAssociator { public: typedef edm::DetSetVector DigiSimLinks; @@ -28,18 +30,27 @@ class CSCHitAssociator { typedef edm::DetSet LayerLinks; typedef std::pair SimHitIdpr; - CSCHitAssociator(const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &); - CSCHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&iC); + class Config { + public: + Config(const edm::ParameterSet &, edm::ConsumesCollector iC); - void initEvent(const edm::Event &, const edm::EventSetup &); + private: + friend class CSCHitAssociator; + const edm::InputTag linksTag_; + const edm::EDGetTokenT linksToken_; + const edm::ESGetToken geomToken_; + }; + + CSCHitAssociator(const edm::Event &, const edm::EventSetup &, const Config &); std::vector associateHitId(const TrackingRecHit &) const; std::vector associateCSCHitId(const CSCRecHit2D *) const; private: - const DigiSimLinks *theDigiSimLinks; + void initEvent(const edm::Event &, const edm::EventSetup &); - edm::InputTag linksTag; + const Config &theConfig; + const DigiSimLinks *theDigiSimLinks; const CSCGeometry *cscgeom; }; diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h index 83bac7395a53f..10a0be4f2597b 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h @@ -17,6 +17,7 @@ #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" #include "SimMuon/MCTruth/interface/GEMHitAssociator.h" #include "SimMuon/MCTruth/interface/RPCHitAssociator.h" +#include "SimMuon/MCTruth/interface/CSCHitAssociator.h" #include @@ -80,6 +81,7 @@ class MuonAssociatorByHits { TrackerHitAssociator::Config trackerHitAssociatorConfig_; GEMHitAssociator::Config gemHitAssociatorConfig_; RPCHitAssociator::Config rpcHitAssociatorConfig_; + CSCHitAssociator::Config cscHitAssociatorConfig_; std::unique_ptr diagnostics_; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index 041dc793608ea..b6675f82bce4a 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -189,6 +189,7 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce TrackerMuonHitExtractor hitExtractor_; GEMHitAssociator::Config gemHitAssociatorConfig_; RPCHitAssociator::Config rpcHitAssociatorConfig_; + CSCHitAssociator::Config cscHitAssociatorConfig_; const edm::ESGetToken tTopoToken_; std::unique_ptr diagnostics_; @@ -212,13 +213,13 @@ MuonToTrackingParticleAssociatorEDProducer::MuonToTrackingParticleAssociatorEDPr hitExtractor_(iConfig, consumesCollector()), gemHitAssociatorConfig_(iConfig, consumesCollector()), rpcHitAssociatorConfig_(iConfig, consumesCollector()), + cscHitAssociatorConfig_(iConfig, consumesCollector()), tTopoToken_(esConsumes()) { // register your products produces(); // hack for consumes DTHitAssociator dttruth(iConfig, consumesCollector()); - CSCHitAssociator cscruth(iConfig, consumesCollector()); edm::LogVerbatim("MuonToTrackingParticleAssociatorEDProducer") << "\n constructing MuonToTrackingParticleAssociatorEDProducer" @@ -257,7 +258,7 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con // Tracker hit association TrackerHitAssociator trackertruth(iEvent, trackerHitAssociatorConfig_); // CSC hit association - CSCHitAssociator csctruth(iEvent, iSetup, config_); + CSCHitAssociator csctruth(iEvent, iSetup, cscHitAssociatorConfig_); // DT hit association printRtS = false; DTHitAssociator dttruth(iEvent, iSetup, config_, printRtS); diff --git a/SimMuon/MCTruth/src/CSCHitAssociator.cc b/SimMuon/MCTruth/src/CSCHitAssociator.cc index 049095a7721fe..93cee589b8fd0 100644 --- a/SimMuon/MCTruth/src/CSCHitAssociator.cc +++ b/SimMuon/MCTruth/src/CSCHitAssociator.cc @@ -5,26 +5,22 @@ #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" #include "SimMuon/MCTruth/interface/CSCHitAssociator.h" -CSCHitAssociator::CSCHitAssociator(const edm::Event &event, const edm::EventSetup &setup, const edm::ParameterSet &conf) - : theDigiSimLinks(nullptr), linksTag(conf.getParameter("CSClinksTag")) { - initEvent(event, setup); -} +CSCHitAssociator::Config::Config(const edm::ParameterSet &conf, edm::ConsumesCollector iC) + : linksTag_(conf.getParameter("CSClinksTag")), + linksToken_(iC.consumes(linksTag_)), + geomToken_(iC.esConsumes()) {} -CSCHitAssociator::CSCHitAssociator(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) - : theDigiSimLinks(nullptr), linksTag(conf.getParameter("CSClinksTag")) { - iC.consumes(linksTag); +CSCHitAssociator::CSCHitAssociator(const edm::Event &event, const edm::EventSetup &setup, const Config &conf) + : theConfig(conf), theDigiSimLinks(nullptr) { + initEvent(event, setup); } void CSCHitAssociator::initEvent(const edm::Event &event, const edm::EventSetup &setup) { - edm::Handle digiSimLinks; - LogTrace("CSCHitAssociator") << "getting CSC Strip DigiSimLink collection - " << linksTag; - event.getByLabel(linksTag, digiSimLinks); - theDigiSimLinks = digiSimLinks.product(); + LogTrace("CSCHitAssociator") << "getting CSC Strip DigiSimLink collection - " << theConfig.linksTag_; + theDigiSimLinks = &event.get(theConfig.linksToken_); // get CSC Geometry to use CSCLayer methods - edm::ESHandle mugeom; - setup.get().get(mugeom); - cscgeom = &*mugeom; + cscgeom = &setup.getData(theConfig.geomToken_); } std::vector CSCHitAssociator::associateCSCHitId(const CSCRecHit2D *cscrechit) const { diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index 0228462f65ca0..13fe02e94dae4 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -141,10 +141,10 @@ MuonAssociatorByHits::MuonAssociatorByHits(const edm::ParameterSet &conf, edm::C conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)), gemHitAssociatorConfig_(conf, iC), - rpcHitAssociatorConfig_(conf, iC) { + rpcHitAssociatorConfig_(conf, iC), + cscHitAssociatorConfig_(conf, iC) { // hack for consumes DTHitAssociator dttruth(conf, std::move(iC)); - CSCHitAssociator muonTruth(conf, std::move(iC)); if (conf.getUntrackedParameter("dumpInputCollections")) { diagnostics_ = std::make_unique(conf, std::move(iC)); } @@ -172,7 +172,7 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( // Tracker hit association TrackerHitAssociator trackertruth(*e, trackerHitAssociatorConfig_); // CSC hit association - CSCHitAssociator csctruth(*e, *setup, conf_); + CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_); // DT hit association bool printRtS(true); DTHitAssociator dttruth(*e, *setup, conf_, printRtS); @@ -220,7 +220,7 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( // Tracker hit association TrackerHitAssociator trackertruth(*e, trackerHitAssociatorConfig_); // CSC hit association - CSCHitAssociator csctruth(*e, *setup, conf_); + CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_); // DT hit association bool printRtS = false; DTHitAssociator dttruth(*e, *setup, conf_, printRtS); From 981e10dad50adb9b4b40fba145d3dd09aead87aa Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 13:03:49 -0500 Subject: [PATCH 357/923] Use Config class with DTHitAssociator Added esConsumes call and now uses get tokens. --- SimMuon/MCTruth/interface/DTHitAssociator.h | 42 ++++--- .../MCTruth/interface/MuonAssociatorByHits.h | 3 +- ...nToTrackingParticleAssociatorEDProducer.cc | 7 +- SimMuon/MCTruth/src/DTHitAssociator.cc | 112 +++++++----------- SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 9 +- 5 files changed, 82 insertions(+), 91 deletions(-) diff --git a/SimMuon/MCTruth/interface/DTHitAssociator.h b/SimMuon/MCTruth/interface/DTHitAssociator.h index 1c6a728a1129f..6ae5012f7561f 100644 --- a/SimMuon/MCTruth/interface/DTHitAssociator.h +++ b/SimMuon/MCTruth/interface/DTHitAssociator.h @@ -28,12 +28,34 @@ class DTHitAssociator { typedef std::map> DigiMap; typedef std::map> LinksMap; - DTHitAssociator(const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &, bool printRtS); - DTHitAssociator(const edm::ParameterSet &, edm::ConsumesCollector &&iC); + class Config { + public: + Config(const edm::ParameterSet &, edm::ConsumesCollector iC); - void initEvent(const edm::Event &, const edm::EventSetup &); + private: + friend class DTHitAssociator; + + edm::InputTag DTsimhitsTag; + edm::InputTag DTsimhitsXFTag; + edm::InputTag DTdigiTag; + edm::InputTag DTdigisimlinkTag; + edm::InputTag DTrechitTag; + + edm::EDGetTokenT DTsimhitsToken; + edm::EDGetTokenT> DTsimhitsXFToken; + edm::EDGetTokenT DTdigiToken; + edm::EDGetTokenT DTdigisimlinkToken; + edm::EDGetTokenT DTrechitToken; + + edm::ESGetToken geomToken; - virtual ~DTHitAssociator() {} + bool dumpDT; + bool crossingframe; + bool links_exist; + bool associatorByWire; + }; + + DTHitAssociator(const edm::Event &, const edm::EventSetup &, const Config &, bool printRtS); std::vector associateHitId(const TrackingRecHit &hit) const; std::vector associateDTHitId(const DTRecHit1D *dtrechit) const; @@ -46,18 +68,10 @@ class DTHitAssociator { LinksMap mapOfLinks; private: - edm::InputTag DTsimhitsTag; - edm::InputTag DTsimhitsXFTag; - edm::InputTag DTdigiTag; - edm::InputTag DTdigisimlinkTag; - edm::InputTag DTrechitTag; - - bool dumpDT; - bool crossingframe; - bool links_exist; - bool associatorByWire; + void initEvent(const edm::Event &, const edm::EventSetup &); bool SimHitOK(const edm::ESHandle &, const PSimHit &); + Config const &config_; bool printRtS; }; diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h index 10a0be4f2597b..7a75308f68607 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h @@ -18,6 +18,7 @@ #include "SimMuon/MCTruth/interface/GEMHitAssociator.h" #include "SimMuon/MCTruth/interface/RPCHitAssociator.h" #include "SimMuon/MCTruth/interface/CSCHitAssociator.h" +#include "SimMuon/MCTruth/interface/DTHitAssociator.h" #include @@ -77,11 +78,11 @@ class MuonAssociatorByHits { private: MuonAssociatorByHitsHelper helper_; - edm::ParameterSet const conf_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; GEMHitAssociator::Config gemHitAssociatorConfig_; RPCHitAssociator::Config rpcHitAssociatorConfig_; CSCHitAssociator::Config cscHitAssociatorConfig_; + DTHitAssociator::Config dtHitAssociatorConfig_; std::unique_ptr diagnostics_; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index b6675f82bce4a..aff29e8b2ff52 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -190,6 +190,7 @@ class MuonToTrackingParticleAssociatorEDProducer : public edm::stream::EDProduce GEMHitAssociator::Config gemHitAssociatorConfig_; RPCHitAssociator::Config rpcHitAssociatorConfig_; CSCHitAssociator::Config cscHitAssociatorConfig_; + DTHitAssociator::Config dtHitAssociatorConfig_; const edm::ESGetToken tTopoToken_; std::unique_ptr diagnostics_; @@ -214,13 +215,11 @@ MuonToTrackingParticleAssociatorEDProducer::MuonToTrackingParticleAssociatorEDPr gemHitAssociatorConfig_(iConfig, consumesCollector()), rpcHitAssociatorConfig_(iConfig, consumesCollector()), cscHitAssociatorConfig_(iConfig, consumesCollector()), + dtHitAssociatorConfig_(iConfig, consumesCollector()), tTopoToken_(esConsumes()) { // register your products produces(); - // hack for consumes - DTHitAssociator dttruth(iConfig, consumesCollector()); - edm::LogVerbatim("MuonToTrackingParticleAssociatorEDProducer") << "\n constructing MuonToTrackingParticleAssociatorEDProducer" << "\n"; @@ -261,7 +260,7 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con CSCHitAssociator csctruth(iEvent, iSetup, cscHitAssociatorConfig_); // DT hit association printRtS = false; - DTHitAssociator dttruth(iEvent, iSetup, config_, printRtS); + DTHitAssociator dttruth(iEvent, iSetup, dtHitAssociatorConfig_, printRtS); // RPC hit association RPCHitAssociator rpctruth(iEvent, rpcHitAssociatorConfig_); // GEM hit association diff --git a/SimMuon/MCTruth/src/DTHitAssociator.cc b/SimMuon/MCTruth/src/DTHitAssociator.cc index d90f6da878693..f58062c08f70a 100644 --- a/SimMuon/MCTruth/src/DTHitAssociator.cc +++ b/SimMuon/MCTruth/src/DTHitAssociator.cc @@ -14,13 +14,13 @@ using namespace std; // Constructor -DTHitAssociator::DTHitAssociator(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) +DTHitAssociator::Config::Config(const edm::ParameterSet &conf, edm::ConsumesCollector iC) : DTsimhitsTag(conf.getParameter("DTsimhitsTag")), DTsimhitsXFTag(conf.getParameter("DTsimhitsXFTag")), DTdigiTag(conf.getParameter("DTdigiTag")), DTdigisimlinkTag(conf.getParameter("DTdigisimlinkTag")), DTrechitTag(conf.getParameter("DTrechitTag")), - + geomToken(iC.esConsumes()), // nice printout of DT hits dumpDT(conf.getParameter("dumpDT")), // CrossingFrame used or not ? @@ -29,43 +29,33 @@ DTHitAssociator::DTHitAssociator(const edm::ParameterSet &conf, edm::ConsumesCol links_exist(conf.getParameter("links_exist")), // associatorByWire links to a RecHit all the "valid" SimHits on the same // DT wire - associatorByWire(conf.getParameter("associatorByWire")), - - printRtS(true) { + associatorByWire(conf.getParameter("associatorByWire")) { if (crossingframe) { - iC.consumes>(DTsimhitsXFTag); + DTsimhitsXFToken = iC.consumes>(DTsimhitsXFTag); } else if (!DTsimhitsTag.label().empty()) { - iC.consumes(DTsimhitsTag); + DTsimhitsToken = iC.consumes(DTsimhitsTag); } - iC.consumes(DTdigiTag); - iC.consumes(DTdigisimlinkTag); + DTdigiToken = iC.consumes(DTdigiTag); + DTdigisimlinkToken = iC.consumes(DTdigisimlinkTag); - if (dumpDT && printRtS) { - iC.consumes(DTrechitTag); + if (dumpDT) { + DTrechitToken = iC.consumes(DTrechitTag); + } + + if (!links_exist && !associatorByWire) { + LogTrace("DTHitAssociator") << "*** WARNING in DTHitAssociator::DTHitAssociator: associatorByWire " + "reset to TRUE !" + << " \t (missing DTDigiSimLinkCollection ?)"; + associatorByWire = true; } } DTHitAssociator::DTHitAssociator(const edm::Event &iEvent, const edm::EventSetup &iSetup, - const edm::ParameterSet &conf, + const Config &conf, bool printRtS) : // input collection labels - DTsimhitsTag(conf.getParameter("DTsimhitsTag")), - DTsimhitsXFTag(conf.getParameter("DTsimhitsXFTag")), - DTdigiTag(conf.getParameter("DTdigiTag")), - DTdigisimlinkTag(conf.getParameter("DTdigisimlinkTag")), - DTrechitTag(conf.getParameter("DTrechitTag")), - - // nice printout of DT hits - dumpDT(conf.getParameter("dumpDT")), - // CrossingFrame used or not ? - crossingframe(conf.getParameter("crossingframe")), - // Event contain the DTDigiSimLink collection ? - links_exist(conf.getParameter("links_exist")), - // associatorByWire links to a RecHit all the "valid" SimHits on the same - // DT wire - associatorByWire(conf.getParameter("associatorByWire")), - + config_(conf), printRtS(true) { @@ -73,31 +63,23 @@ DTHitAssociator::DTHitAssociator(const edm::Event &iEvent, } void DTHitAssociator::initEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - LogTrace("DTHitAssociator") << "DTHitAssociator constructor: dumpDT = " << dumpDT - << ", crossingframe = " << crossingframe << ", links_exist = " << links_exist - << ", associatorByWire = " << associatorByWire; - - if (!links_exist && !associatorByWire) { - LogTrace("DTHitAssociator") << "*** WARNING in DTHitAssociator::DTHitAssociator: associatorByWire " - "reset to TRUE !" - << " \t (missing DTDigiSimLinkCollection ?)"; - associatorByWire = true; - } + LogTrace("DTHitAssociator") << "DTHitAssociator constructor: dumpDT = " << config_.dumpDT + << ", crossingframe = " << config_.crossingframe + << ", links_exist = " << config_.links_exist + << ", associatorByWire = " << config_.associatorByWire; // need DT Geometry to discard hits for which the drift time parametrisation // is not applicable - edm::ESHandle muonGeom; - iSetup.get().get(muonGeom); + edm::ESHandle muonGeom = iSetup.getHandle(config_.geomToken); // Get the DT SimHits from the event and map PSimHit by DTWireId mapOfSimHit.clear(); bool takeHit(true); - if (crossingframe) { - edm::Handle> xFrame; - LogTrace("DTHitAssociator") << "getting CrossingFrame collection - " << DTsimhitsXFTag; - iEvent.getByLabel(DTsimhitsXFTag, xFrame); - unique_ptr> DTsimhits(new MixCollection(xFrame.product())); + if (config_.crossingframe) { + LogTrace("DTHitAssociator") << "getting CrossingFrame collection - " << config_.DTsimhitsXFTag; + CrossingFrame const &xFrame = iEvent.get(config_.DTsimhitsXFToken); + unique_ptr> DTsimhits(new MixCollection(&xFrame)); LogTrace("DTHitAssociator") << "... size = " << DTsimhits->size(); MixCollection::MixItr isimhit; for (isimhit = DTsimhits->begin(); isimhit != DTsimhits->end(); isimhit++) { @@ -105,13 +87,12 @@ void DTHitAssociator::initEvent(const edm::Event &iEvent, const edm::EventSetup takeHit = SimHitOK(muonGeom, *isimhit); mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit)); } - } else if (!DTsimhitsTag.label().empty()) { - edm::Handle DTsimhits; - LogTrace("DTHitAssociator") << "getting PSimHit collection - " << DTsimhitsTag; - iEvent.getByLabel(DTsimhitsTag, DTsimhits); - LogTrace("DTHitAssociator") << "... size = " << DTsimhits->size(); + } else if (!config_.DTsimhitsTag.label().empty()) { + LogTrace("DTHitAssociator") << "getting PSimHit collection - " << config_.DTsimhitsTag; + edm::PSimHitContainer const &DTsimhits = iEvent.get(config_.DTsimhitsToken); + LogTrace("DTHitAssociator") << "... size = " << DTsimhits.size(); edm::PSimHitContainer::const_iterator isimhit; - for (isimhit = DTsimhits->begin(); isimhit != DTsimhits->end(); isimhit++) { + for (isimhit = DTsimhits.begin(); isimhit != DTsimhits.end(); isimhit++) { DTWireId wireid((*isimhit).detUnitId()); takeHit = SimHitOK(muonGeom, *isimhit); mapOfSimHit[wireid].push_back(make_pair(*isimhit, takeHit)); @@ -120,9 +101,8 @@ void DTHitAssociator::initEvent(const edm::Event &iEvent, const edm::EventSetup // Get the DT Digi collection from the event mapOfDigi.clear(); - edm::Handle digis; - LogTrace("DTHitAssociator") << "getting DTDigi collection - " << DTdigiTag; - iEvent.getByLabel(DTdigiTag, digis); + LogTrace("DTHitAssociator") << "getting DTDigi collection - " << config_.DTdigiTag; + edm::Handle digis = iEvent.getHandle(config_.DTdigiToken); if (digis.isValid()) { // Map DTDigi by DTWireId @@ -141,14 +121,13 @@ void DTHitAssociator::initEvent(const edm::Event &iEvent, const edm::EventSetup } mapOfLinks.clear(); - if (links_exist) { + if (config_.links_exist) { // Get the DT DigiSimLink collection from the event and map DTDigiSimLink by // DTWireId - edm::Handle digisimlinks; - LogTrace("DTHitAssociator") << "getting DTDigiSimLink collection - " << DTdigisimlinkTag; - iEvent.getByLabel(DTdigisimlinkTag, digisimlinks); + LogTrace("DTHitAssociator") << "getting DTDigiSimLink collection - " << config_.DTdigisimlinkTag; + DTDigiSimLinkCollection const &digisimlinks = iEvent.get(config_.DTdigisimlinkToken); - for (DTDigiSimLinkCollection::DigiRangeIterator detUnit = digisimlinks->begin(); detUnit != digisimlinks->end(); + for (DTDigiSimLinkCollection::DigiRangeIterator detUnit = digisimlinks.begin(); detUnit != digisimlinks.end(); ++detUnit) { const DTLayerId &layerid = (*detUnit).first; const DTDigiSimLinkCollection::Range &range = (*detUnit).second; @@ -161,17 +140,16 @@ void DTHitAssociator::initEvent(const edm::Event &iEvent, const edm::EventSetup } } - if (dumpDT && printRtS) { + if (config_.dumpDT && printRtS) { // Get the DT rechits from the event - edm::Handle DTrechits; - LogTrace("DTHitAssociator") << "getting DTRecHit1DPair collection - " << DTrechitTag; - iEvent.getByLabel(DTrechitTag, DTrechits); - LogTrace("DTHitAssociator") << "... size = " << DTrechits->size(); + LogTrace("DTHitAssociator") << "getting DTRecHit1DPair collection - " << config_.DTrechitTag; + DTRecHitCollection const &DTrechits = iEvent.get(config_.DTrechitToken); + LogTrace("DTHitAssociator") << "... size = " << DTrechits.size(); // map DTRecHit1DPair by DTWireId mapOfRecHit.clear(); DTRecHitCollection::const_iterator rechit; - for (rechit = DTrechits->begin(); rechit != DTrechits->end(); ++rechit) { + for (rechit = DTrechits.begin(); rechit != DTrechits.end(); ++rechit) { DTWireId wireid = (*rechit).wireId(); mapOfRecHit[wireid].push_back(*rechit); } @@ -291,7 +269,7 @@ std::vector DTHitAssociator::associateDTHitId(const DTWireId wireid = dtrechit->wireId(); - if (associatorByWire) { + if (config_.associatorByWire) { // matching based on DTWireId : take only "valid" SimHits on that wire auto found = mapOfSimHit.find(wireid); @@ -365,7 +343,7 @@ std::vector DTHitAssociator::associateHit(const TrackingRecHit &hit) co if (dtrechit) { DTWireId wireid = dtrechit->wireId(); - if (associatorByWire) { + if (config_.associatorByWire) { // matching based on DTWireId : take only "valid" SimHits on that wire auto found = mapOfSimHit.find(wireid); diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index 13fe02e94dae4..ef234b1b504eb 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -138,13 +138,12 @@ namespace muonAssociatorByHitsDiagnostics { MuonAssociatorByHits::MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC) : helper_(conf), - conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)), gemHitAssociatorConfig_(conf, iC), rpcHitAssociatorConfig_(conf, iC), - cscHitAssociatorConfig_(conf, iC) { + cscHitAssociatorConfig_(conf, iC), + dtHitAssociatorConfig_(conf, iC) { // hack for consumes - DTHitAssociator dttruth(conf, std::move(iC)); if (conf.getUntrackedParameter("dumpInputCollections")) { diagnostics_ = std::make_unique(conf, std::move(iC)); } @@ -175,7 +174,7 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_); // DT hit association bool printRtS(true); - DTHitAssociator dttruth(*e, *setup, conf_, printRtS); + DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS); // RPC hit association RPCHitAssociator rpctruth(*e, rpcHitAssociatorConfig_); // GEM hit association @@ -223,7 +222,7 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_); // DT hit association bool printRtS = false; - DTHitAssociator dttruth(*e, *setup, conf_, printRtS); + DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS); // RPC hit association RPCHitAssociator rpctruth(*e, rpcHitAssociatorConfig_); // GEM hit association From b77ed99f346790fd5cf357ee7cad97bd3767f899 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 13:15:33 -0500 Subject: [PATCH 358/923] Added esConsumes to SeedToTrackProducer --- SimMuon/MCTruth/plugins/SeedToTrackProducer.cc | 11 +++++------ SimMuon/MCTruth/plugins/SeedToTrackProducer.h | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc b/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc index cdfc291b54af0..530388132e9f1 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc @@ -26,7 +26,8 @@ // // constructors and destructor // -SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig) { +SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig) + : theMGFieldToken(esConsumes()), theTrackingGeometryToken(esConsumes()), theTopoToken(esConsumes()) { L2seedsTagT_ = consumes(iConfig.getParameter("L2seedsCollection")); L2seedsTagS_ = consumes>(iConfig.getParameter("L2seedsCollection")); @@ -58,12 +59,10 @@ void SeedToTrackProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe edm::Ref::key_type idx = 0; // magnetic fied and detector geometry - iSetup.get().get(theMGField); - iSetup.get().get(theTrackingGeometry); + theMGField = iSetup.getHandle(theMGFieldToken); + theTrackingGeometry = iSetup.getHandle(theTrackingGeometryToken); - edm::ESHandle httopo; - iSetup.get().get(httopo); - const TrackerTopology &ttopo = *httopo; + const TrackerTopology &ttopo = iSetup.getData(theTopoToken); // now read the L2 seeds collection : edm::Handle L2seedsCollection; diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h index e751e43c490aa..d734d0fe21570 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h @@ -62,6 +62,10 @@ class SeedToTrackProducer : public edm::one::EDProducer<> { edm::EDGetTokenT L2seedsTagT_; edm::EDGetTokenT> L2seedsTagS_; + const edm::ESGetToken theMGFieldToken; + const edm::ESGetToken theTrackingGeometryToken; + const edm::ESGetToken theTopoToken; + edm::ESHandle theMGField; edm::ESHandle theTrackingGeometry; }; From 4bd0f6ed1f9d1e12ddadab4c780eb2fa1399f881 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 13:25:25 -0500 Subject: [PATCH 359/923] Made SeedToTrackProducer a global module --- .../MCTruth/plugins/SeedToTrackProducer.cc | 26 +++++++------------ SimMuon/MCTruth/plugins/SeedToTrackProducer.h | 16 +++++------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc b/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc index 530388132e9f1..22e92ad92964b 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc @@ -36,14 +36,12 @@ SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig) produces(); } -SeedToTrackProducer::~SeedToTrackProducer() {} - // // member functions // // ------------ method called to produce the data ------------ -void SeedToTrackProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { +void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { using namespace edm; using namespace std; @@ -59,8 +57,8 @@ void SeedToTrackProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe edm::Ref::key_type idx = 0; // magnetic fied and detector geometry - theMGField = iSetup.getHandle(theMGFieldToken); - theTrackingGeometry = iSetup.getHandle(theTrackingGeometryToken); + auto const &mgField = iSetup.getData(theMGFieldToken); + auto const &trackingGeometry = iSetup.getData(theTrackingGeometryToken); const TrackerTopology &ttopo = iSetup.getData(theTopoToken); @@ -79,7 +77,7 @@ void SeedToTrackProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe // now loop on the seeds : for (unsigned int i = 0; i < L2seeds->size(); i++) { // get the kinematic extrapolation from the seed - TrajectoryStateOnSurface theTrajectory = seedTransientState(L2seeds->at(i)); + TrajectoryStateOnSurface theTrajectory = seedTransientState(L2seeds->at(i), mgField, trackingGeometry); float seedEta = theTrajectory.globalMomentum().eta(); float seedPhi = theTrajectory.globalMomentum().phi(); float seedPt = theTrajectory.globalMomentum().perp(); @@ -147,22 +145,16 @@ void SeedToTrackProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe iEvent.put(std::move(selectedTrackHits)); } -TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState(const TrajectorySeed &tmpSeed) { +TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState(const TrajectorySeed &tmpSeed, + const MagneticField &mgField, + const GlobalTrackingGeometry &trackingGeometry) const { PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState(); DetId tmpDetId(tmpTSOD.detId()); - const GeomDet *tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId); + const GeomDet *tmpGeomDet = trackingGeometry.idToDet(tmpDetId); TrajectoryStateOnSurface tmpTSOS = - trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMGField)); + trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &mgField); return tmpTSOS; } -// ------------ method called once each job just before starting event loop -// ------------ -void SeedToTrackProducer::beginJob() {} - -// ------------ method called once each job just after ending the event loop -// ------------ -void SeedToTrackProducer::endJob() {} - // define this as a plug-in DEFINE_FWK_MODULE(SeedToTrackProducer); diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h index d734d0fe21570..eda27d0128d8a 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h @@ -22,7 +22,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "MagneticField/Engine/interface/MagneticField.h" @@ -47,16 +47,15 @@ typedef math::Error<5>::type CovarianceMatrix; -class SeedToTrackProducer : public edm::one::EDProducer<> { +class SeedToTrackProducer : public edm::global::EDProducer<> { public: explicit SeedToTrackProducer(const edm::ParameterSet &); - ~SeedToTrackProducer() override; private: - void beginJob() override; - void produce(edm::Event &, const edm::EventSetup &) override; - void endJob() override; - virtual TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &); + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final; + TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &, + const MagneticField &, + const GlobalTrackingGeometry &) const; // ----------member data --------------------------- edm::EDGetTokenT L2seedsTagT_; @@ -65,7 +64,4 @@ class SeedToTrackProducer : public edm::one::EDProducer<> { const edm::ESGetToken theMGFieldToken; const edm::ESGetToken theTrackingGeometryToken; const edm::ESGetToken theTopoToken; - - edm::ESHandle theMGField; - edm::ESHandle theTrackingGeometry; }; From 8624ff327ff2fdf283c4f8a040a6bc7cc2dfbf63 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 2 Sep 2021 13:58:03 -0500 Subject: [PATCH 360/923] Add CSC TP efficiency producer in standard DQM sequence --- Validation/Configuration/python/postValidation_cff.py | 3 ++- .../MuonCSCDigis/src/CSCStubEfficiencyValidation.cc | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Validation/Configuration/python/postValidation_cff.py b/Validation/Configuration/python/postValidation_cff.py index d2ad7fbff750d..853d85f9c5fb2 100644 --- a/Validation/Configuration/python/postValidation_cff.py +++ b/Validation/Configuration/python/postValidation_cff.py @@ -3,6 +3,7 @@ from Validation.RecoMuon.PostProcessor_cff import * from Validation.RecoTrack.PostProcessorTracker_cfi import * from Validation.MuonIsolation.PostProcessor_cff import * +from Validation.MuonCSCDigis.PostProcessor_cff import * from Validation.CaloTowers.CaloTowersPostProcessor_cff import * from Validation.HcalHits.SimHitsPostProcessor_cff import * from Validation.HcalDigis.HcalDigisPostProcessor_cff import * @@ -43,6 +44,7 @@ + METPostProcessor + L1GenPostProcessor + bdHadronTrackPostProcessor + + MuonCSCDigisPostProcessors ) from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel @@ -66,7 +68,6 @@ from Validation.MuonGEMDigis.PostProcessor_cff import * from Validation.MuonGEMRecHits.PostProcessor_cff import * from Validation.MuonME0Validation.PostProcessor_cff import * -from Validation.MuonCSCDigis.PostProcessor_cff import * from Validation.HGCalValidation.HGCalPostProcessor_cff import * from Validation.MtdValidation.MtdPostProcessor_cff import * diff --git a/Validation/MuonCSCDigis/src/CSCStubEfficiencyValidation.cc b/Validation/MuonCSCDigis/src/CSCStubEfficiencyValidation.cc index 870bfbda2eeac..46b2c8e2d5bfe 100644 --- a/Validation/MuonCSCDigis/src/CSCStubEfficiencyValidation.cc +++ b/Validation/MuonCSCDigis/src/CSCStubEfficiencyValidation.cc @@ -48,6 +48,10 @@ void CSCStubEfficiencyValidation::bookHistograms(DQMStore::IBooker& iBooker) { etaCLCTDenom[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]); etaLCTDenom[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]); + etaALCTDenom[j]->getTH1()->SetMinimum(0); + etaCLCTDenom[j]->getTH1()->SetMinimum(0); + etaLCTDenom[j]->getTH1()->SetMinimum(0); + t1 = "ALCTEtaNum_" + cn; t2 = "CLCTEtaNum_" + cn; t3 = "LCTEtaNum_" + cn; @@ -55,6 +59,10 @@ void CSCStubEfficiencyValidation::bookHistograms(DQMStore::IBooker& iBooker) { etaALCTNum[j] = iBooker.book1D(t1, t1 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]); etaCLCTNum[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]); etaLCTNum[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]); + + etaALCTNum[j]->getTH1()->SetMinimum(0); + etaCLCTNum[j]->getTH1()->SetMinimum(0); + etaLCTNum[j]->getTH1()->SetMinimum(0); } } From f7ceada705848b7cfbecc6b859e271016dd1c879 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 2 Sep 2021 14:42:54 -0500 Subject: [PATCH 361/923] Accidentally flipped options --- .../CSCCommissioning/test/readFile_b904_Run3.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/IORawData/CSCCommissioning/test/readFile_b904_Run3.py b/IORawData/CSCCommissioning/test/readFile_b904_Run3.py index 5133d32c7a84f..f7bd2a6f431ac 100644 --- a/IORawData/CSCCommissioning/test/readFile_b904_Run3.py +++ b/IORawData/CSCCommissioning/test/readFile_b904_Run3.py @@ -60,18 +60,18 @@ FED846 = cms.untracked.vstring('RUI01'), RUI01 = cms.untracked.vstring(options.inputFiles[0]) ) -# Please note that after passing mapping check this chamber still would be recognized as production chamber -# ME+2/2/03, which is OK, because this is the same chamber type as ME42 hardware-wise. +# For B904 setup ME21 chamber, which corresponds to ME+2/1/03 VMECrate13 / DMBSlot2 RUI17 / FED838 in the production system mapping elif options.useB904ME21: FEDRUI = cms.PSet( - FED839 = cms.untracked.vstring('RUI18'), - RUI18 = cms.untracked.vstring(options.inputFiles[0]) + FED838 = cms.untracked.vstring('RUI16'), + RUI17 = cms.untracked.vstring(options.inputFiles[0]) ) -# For B904 setup ME21 chamber, which corresponds to ME+2/1/03 VMECrate13 / DMBSlot2 RUI17 / FED838 in the production system mapping +# Please note that after passing mapping check this chamber still would be recognized as production chamber +# ME+2/2/03, which is OK, because this is the same chamber type as ME42 hardware-wise. elif options.useB904ME234s2: FEDRUI = cms.PSet( - FED838 = cms.untracked.vstring('RUI16'), - RUI17 = cms.untracked.vstring(options.inputFiles[0]) + FED839 = cms.untracked.vstring('RUI18'), + RUI18 = cms.untracked.vstring(options.inputFiles[0]) ) ## default case else: From 47fe055ea896d27dceb90e6757426b0e69b51cc4 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 14:50:04 -0500 Subject: [PATCH 362/923] Moved cluster removal handling to KfTrackProducerBase TrackProducerBase had no code that actually used those member data. --- .../src/TrackProducerWithSCAssociation.cc | 7 ------- .../TrackProducer/interface/KfTrackProducerBase.h | 12 +++++++++++- .../TrackProducer/interface/TrackProducerBase.h | 11 +---------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc index 8d1c10f4943d5..c2c6c4780a582 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc @@ -70,13 +70,6 @@ TrackProducerWithSCAssociation::TrackProducerWithSCAssociation(const edm::Parame consumes(iConfig.getParameter("MeasurementTrackerEvent"))); setAlias(iConfig.getParameter("@module_label")); - if (iConfig.exists("clusterRemovalInfo")) { - edm::InputTag tag = iConfig.getParameter("clusterRemovalInfo"); - if (!(tag == edm::InputTag())) { - setClusterRemovalInfo(tag); - } - } - myname_ = iConfig.getParameter("ComponentName"); conversionTrackCandidateProducer_ = iConfig.getParameter("producer"); trackCSuperClusterAssociationCollection_ = iConfig.getParameter("trackCandidateSCAssociationCollection"); diff --git a/RecoTracker/TrackProducer/interface/KfTrackProducerBase.h b/RecoTracker/TrackProducer/interface/KfTrackProducerBase.h index 29eca451623f7..c2e25eb18787d 100644 --- a/RecoTracker/TrackProducer/interface/KfTrackProducerBase.h +++ b/RecoTracker/TrackProducer/interface/KfTrackProducerBase.h @@ -17,7 +17,7 @@ class KfTrackProducerBase : public TrackProducerBase { public: /// Constructor explicit KfTrackProducerBase(bool trajectoryInEvent, bool split) - : TrackProducerBase(trajectoryInEvent), useSplitting(split) {} + : TrackProducerBase(trajectoryInEvent), rekeyClusterRefs_(false), useSplitting(split) {} /// Put produced collections in the event virtual void putInEvt(edm::Event&, @@ -38,6 +38,16 @@ class KfTrackProducerBase : public TrackProducerBase { int BeforeOrAfter = 0); // void setSecondHitPattern(Trajectory* traj, reco::Track& track); +protected: + /// Sets the information on cluster removal, and turns it on + void setClusterRemovalInfo(const edm::InputTag& clusterRemovalInfo) { + rekeyClusterRefs_ = true; + clusterRemovalInfo_ = clusterRemovalInfo; + } + + bool rekeyClusterRefs_; + edm::InputTag clusterRemovalInfo_; + private: bool useSplitting; }; diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.h b/RecoTracker/TrackProducer/interface/TrackProducerBase.h index 8ea405ce1a855..6844214ce25f6 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.h +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.h @@ -45,7 +45,7 @@ class TrackProducerBase : public AlgoProductTraits { public: /// Constructor - TrackProducerBase(bool trajectoryInEvent = false) : trajectoryInEvent_(trajectoryInEvent), rekeyClusterRefs_(false) {} + TrackProducerBase(bool trajectoryInEvent = false) : trajectoryInEvent_(trajectoryInEvent) {} /// Destructor virtual ~TrackProducerBase() noexcept(false); @@ -85,12 +85,6 @@ class TrackProducerBase : public AlgoProductTraits { alias_ = alias; } - /// Sets the information on cluster removal, and turns it on - void setClusterRemovalInfo(const edm::InputTag& clusterRemovalInfo) { - rekeyClusterRefs_ = true; - clusterRemovalInfo_ = clusterRemovalInfo; - } - void setSecondHitPattern(Trajectory* traj, T& track, const Propagator* prop, @@ -110,9 +104,6 @@ class TrackProducerBase : public AlgoProductTraits { edm::EDGetTokenT bsSrc_; edm::EDGetTokenT mteSrc_; - bool rekeyClusterRefs_; - edm::InputTag clusterRemovalInfo_; - edm::ESHandle theSchool; }; From 129ca7789a6dcb00786cdf9fcf9e7b5a2021700e Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 15:42:28 -0500 Subject: [PATCH 363/923] Consolidate initialiation of TrackProducerBase --- .../src/TrackProducerWithSCAssociation.cc | 6 ++---- .../TrackProducer/interface/TrackProducerBase.h | 15 +++------------ .../TrackProducer/interface/TrackProducerBase.icc | 11 +++++++++++ .../TrackProducer/plugins/DAFTrackProducer.cc | 6 ++---- .../TrackProducer/plugins/GsfTrackProducer.cc | 6 ++---- .../TrackProducer/plugins/GsfTrackRefitter.cc | 6 ++---- .../TrackProducer/plugins/TrackProducer.cc | 6 ++---- .../TrackProducer/plugins/TrackRefitter.cc | 6 ++---- 8 files changed, 26 insertions(+), 36 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc index c2c6c4780a582..dc29fe1b6afc7 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc @@ -64,10 +64,8 @@ DEFINE_FWK_MODULE(TrackProducerWithSCAssociation); TrackProducerWithSCAssociation::TrackProducerWithSCAssociation(const edm::ParameterSet& iConfig) : TrackProducerBase(iConfig.getParameter("TrajectoryInEvent")), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); myname_ = iConfig.getParameter("ComponentName"); diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.h b/RecoTracker/TrackProducer/interface/TrackProducerBase.h index 6844214ce25f6..e69756b8d874c 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.h +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.h @@ -9,7 +9,7 @@ #include "AlgoProductTraits.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -67,17 +67,8 @@ class TrackProducerBase : public AlgoProductTraits { /// Method where the procduction take place. To be implemented in concrete classes virtual void produce(edm::Event&, const edm::EventSetup&) = 0; - /// Set parameter set - void setConf(const edm::ParameterSet& conf) { conf_ = conf; } - - /// set label of source collection - void setSrc(const edm::EDGetToken& src, - const edm::EDGetTokenT& bsSrc, - const edm::EDGetTokenT& mteSrc) { - src_ = src; - bsSrc_ = bsSrc; - mteSrc_ = mteSrc; - } + /// Call this method in inheriting class' constructor + void initTrackProducerBase(const edm::ParameterSet& conf, edm::ConsumesCollector cc, const edm::EDGetToken& src); /// set the aliases of produced collections void setAlias(std::string alias) { diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc index ba9124841a8c4..6566531b70139 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc @@ -37,6 +37,17 @@ template TrackProducerBase::~TrackProducerBase() noexcept(false) {} // member functions + +template +void TrackProducerBase::initTrackProducerBase(const edm::ParameterSet& conf, + edm::ConsumesCollector cc, + const edm::EDGetToken& src) { + conf_ = conf; + src_ = src; + bsSrc_ = cc.consumes(conf.getParameter("beamSpot")); + mteSrc_ = cc.consumes(conf.getParameter("MeasurementTrackerEvent")); +} + // ------------ method called to produce the data ------------ template diff --git a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.cc b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.cc index d075a278e8def..98c667e0a33c3 100644 --- a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.cc @@ -19,10 +19,8 @@ DAFTrackProducer::DAFTrackProducer(const edm::ParameterSet& iConfig) : KfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), false), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); srcTT_ = consumes(iConfig.getParameter("src")); setAlias(iConfig.getParameter("@module_label")); diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc index 8234bcb52f13c..7c0ba38c93a18 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc @@ -27,10 +27,8 @@ GsfTrackProducer::GsfTrackProducer(const edm::ParameterSet& iConfig) : GsfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); // string a = alias_; // a.erase(a.size()-6,a.size()); diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc index c64b048132817..c09ba52f272bd 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc @@ -19,10 +19,8 @@ GsfTrackRefitter::GsfTrackRefitter(const edm::ParameterSet& iConfig) : GsfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes>(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes>(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); std::string constraint_str = iConfig.getParameter("constraint"); diff --git a/RecoTracker/TrackProducer/plugins/TrackProducer.cc b/RecoTracker/TrackProducer/plugins/TrackProducer.cc index 084968f584738..4f19c34e70055 100644 --- a/RecoTracker/TrackProducer/plugins/TrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/TrackProducer.cc @@ -19,10 +19,8 @@ TrackProducer::TrackProducer(const edm::ParameterSet& iConfig) : KfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); if (iConfig.exists("clusterRemovalInfo")) { diff --git a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc index f8419c063e973..68f9d9c739aec 100644 --- a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc +++ b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc @@ -17,10 +17,8 @@ TrackRefitter::TrackRefitter(const edm::ParameterSet &iConfig) : KfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), theAlgo(iConfig) { - setConf(iConfig); - setSrc(consumes>(iConfig.getParameter("src")), - consumes(iConfig.getParameter("beamSpot")), - consumes(iConfig.getParameter("MeasurementTrackerEvent"))); + initTrackProducerBase( + iConfig, consumesCollector(), consumes>(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); std::string constraint_str = iConfig.getParameter("constraint"); edm::InputTag trkconstrcoll = iConfig.getParameter("srcConstr"); From 5b1ddf37c83700c32f97c763e466ab6b7fd88a51 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 2 Sep 2021 22:43:39 +0200 Subject: [PATCH 364/923] Rearrange the files properly in the plugins directory and define the python scripts from the code in Calibration/HcalIsolatedTrackReco --- .../interface/ECALRegFEDSelector.h | 47 --------- .../EcalIsolatedParticleCandidateProducer.h | 47 --------- .../interface/IPTCorrector.h | 34 ------- .../IsolatedEcalPixelTrackCandidateProducer.h | 48 ---------- .../IsolatedPixelTrackCandidateL1TProducer.h | 95 ------------------- .../IsolatedPixelTrackCandidateProducer.h | 92 ------------------ .../interface/SiStripRegFEDSelector.h | 40 -------- .../interface/SubdetFEDSelector.h | 41 -------- .../{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/ECALRegFEDSelector.cc | 57 ++++++++++- .../EcalIsolatedParticleCandidateProducer.cc | 65 +++++++++++-- .../HITRegionalPixelSeedGenerator.cc} | 10 +- .../{src => plugins}/IPTCorrector.cc | 43 ++++++++- ...IsolatedEcalPixelTrackCandidateProducer.cc | 51 +++++++++- .../IsolatedPixelTrackCandidateL1TProducer.cc | 91 +++++++++++++++++- .../IsolatedPixelTrackCandidateProducer.cc | 88 ++++++++++++++++- .../{src => plugins}/SiStripRegFEDSelector.cc | 47 ++++++++- .../{src => plugins}/SubdetFEDSelector.cc | 55 +++++++++-- .../python/ecalFED_cfi.py | 9 -- .../python/ecalIsolPartProd_cfi.py | 14 --- .../python/stripFED_cfi.py | 9 -- .../python/subdetFED_cfi.py | 13 --- .../HcalIsolatedTrackReco/src/SealModule.cc | 24 ----- 23 files changed, 470 insertions(+), 554 deletions(-) delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h rename Calibration/HcalIsolatedTrackReco/{ => plugins}/BuildFile.xml (89%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/ECALRegFEDSelector.cc (62%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/EcalIsolatedParticleCandidateProducer.cc (73%) rename Calibration/HcalIsolatedTrackReco/{src/HITRegionalPixelSeedGenerator.h => plugins/HITRegionalPixelSeedGenerator.cc} (95%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IPTCorrector.cc (74%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedEcalPixelTrackCandidateProducer.cc (82%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedPixelTrackCandidateL1TProducer.cc (81%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedPixelTrackCandidateProducer.cc (79%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/SiStripRegFEDSelector.cc (71%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/SubdetFEDSelector.cc (77%) delete mode 100644 Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/src/SealModule.cc diff --git a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h deleted file mode 100644 index 1fc7d9c814723..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef Calibration_ECALRegFEDSelector_h -#define Calibration_ECALRegFEDSelector_h - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" - -#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" - -class ECALRegFEDSelector : public edm::EDProducer { -public: - ECALRegFEDSelector(const edm::ParameterSet&); - ~ECALRegFEDSelector() override; - std::unique_ptr ec_mapping; - - double delta_; - bool fedSaved[1200]; - - edm::EDGetTokenT tok_raw_; - edm::EDGetTokenT tok_seed_; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h deleted file mode 100644 index b198b840e9cb5..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef Calibration_EcalIsolatedParticleCandidateProducer_h -#define Calibration_EcalIsolatedParticleCandidateProducer_h - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -// -// class decleration -// - -class EcalIsolatedParticleCandidateProducer : public edm::global::EDProducer<> { -public: - explicit EcalIsolatedParticleCandidateProducer(const edm::ParameterSet&); - ~EcalIsolatedParticleCandidateProducer() override; - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - void beginJob() override; - void endJob() override; - - double InConeSize_; - double OutConeSize_; - double hitCountEthr_; - double hitEthr_; - - edm::EDGetTokenT tok_l1tau_; - edm::EDGetTokenT tok_hlt_; - edm::EDGetTokenT tok_EB_; - edm::EDGetTokenT tok_EE_; - - edm::ESGetToken tok_geom_; - - // ----------member data --------------------------- -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h deleted file mode 100644 index 085724281d47d..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef Calibration_IPTCorrector_h -#define Calibration_IPTCorrector_h - -/* \class IsolatedPixelTrackCandidateProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -class IPTCorrector : public edm::global::EDProducer<> { -public: - IPTCorrector(const edm::ParameterSet& ps); - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; - -private: - const edm::EDGetTokenT tok_cor_; - const edm::EDGetTokenT tok_uncor_; - const double assocCone_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h deleted file mode 100644 index 1a0a0068f02ad..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef Calibration_IsolatedEcalPixelTrackCandidateProducer_h -#define Calibration_IsolatedEcalPixelTrackCandidateProducer_h - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -// -// class decleration -// - -class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<> { -public: - explicit IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet&); - ~IsolatedEcalPixelTrackCandidateProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - - const edm::EDGetTokenT tok_ee; - const edm::EDGetTokenT tok_eb; - const edm::EDGetTokenT tok_trigcand; - const edm::ESGetToken tok_geom_; - const double coneSizeEta0_; - const double coneSizeEta1_; - const double hitCountEthrEB_; - const double hitEthrEB_; - const double fachitCountEE_; - const double hitEthrEE0_; - const double hitEthrEE1_; - const double hitEthrEE2_; - const double hitEthrEE3_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h deleted file mode 100644 index b2903ea6db1f9..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef Calibration_IsolatedPixelTrackCandidateL1TProducer_h -#define Calibration_IsolatedPixelTrackCandidateL1TProducer_h - -/* \class IsolatedPixelTrackCandidateL1TProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/DetId/interface/DetId.h" - -//#include "DataFormats/Common/interface/Provenance.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/Common/interface/TriggerResults.h" -// L1Extra -#include "DataFormats/L1Trigger/interface/L1EmParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -// l1t -#include "DataFormats/L1Trigger/interface/Jet.h" -#include "DataFormats/L1Trigger/interface/Tau.h" -/// -//vertices -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" -//#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> { -public: - IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& ps); - ~IsolatedPixelTrackCandidateL1TProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void produce(edm::Event& evt, const edm::EventSetup& es) override; - - double getDistInCM(double eta1, double phi1, double eta2, double phi2); - std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); - -private: - struct seedAtEC { - seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} - unsigned int index; - bool ok; - double eta, phi; - }; - - const edm::EDGetTokenT tok_hlt_; - const edm::EDGetTokenT tok_l1_; - const edm::EDGetTokenT tok_vert_; - const std::vector > toks_pix_; - const edm::ESGetToken tok_bFieldH_; - const edm::ESGetToken tok_geom_; - - const std::string bfield_; - const double prelimCone_; - const double pixelIsolationConeSizeAtEC_; - const double vtxCutSeed_; - const double vtxCutIsol_; - const double tauAssocCone_; - const double tauUnbiasCone_; - const double minPTrackValue_; - const double maxPForIsolationValue_; - const double ebEtaBoundary_; - - // these are read from the EventSetup, cannot be const - double rEB_; - double zEE_; - double bfVal_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h deleted file mode 100644 index 905e1daf16c80..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef Calibration_IsolatedPixelTrackCandidateProducer_h -#define Calibration_IsolatedPixelTrackCandidateProducer_h - -/* \class IsolatedPixelTrackCandidateProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/DetId/interface/DetId.h" - -//#include "DataFormats/Common/interface/Provenance.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/Common/interface/TriggerResults.h" -// L1Extra -#include "DataFormats/L1Trigger/interface/L1EmParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -/// -//vertices -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" -//#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { -public: - IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& ps); - ~IsolatedPixelTrackCandidateProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void produce(edm::Event& evt, const edm::EventSetup& es) override; - - double getDistInCM(double eta1, double phi1, double eta2, double phi2); - std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); - -private: - struct seedAtEC { - seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} - unsigned int index; - bool ok; - double eta, phi; - }; - - const edm::EDGetTokenT tok_hlt_; - const edm::EDGetTokenT tok_l1_; - const edm::EDGetTokenT tok_vert_; - const std::vector > toks_pix_; - const edm::ESGetToken tok_bFieldH_; - const edm::ESGetToken tok_geom_; - - const std::string bfield_; - const double prelimCone_; - const double pixelIsolationConeSizeAtEC_; - const double vtxCutSeed_; - const double vtxCutIsol_; - const double tauAssocCone_; - const double tauUnbiasCone_; - const double minPTrackValue_; - const double maxPForIsolationValue_; - const double ebEtaBoundary_; - - // these are read from the EventSetup, cannot be const - double rEB_; - double zEE_; - double bfVal_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h deleted file mode 100644 index c8073dc5888b8..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef Calibration_SiStripRegFEDSelector_h -#define Calibration_SiStripRegFEDSelector_h - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" - -class SiStripRegFEDSelector : public edm::EDProducer { -public: - SiStripRegFEDSelector(const edm::ParameterSet&); - ~SiStripRegFEDSelector() override; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - const edm::EDGetTokenT tok_seed_; - const edm::EDGetTokenT tok_raw_; - const edm::ESGetToken tok_strip_; - const double delta_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h deleted file mode 100644 index 5e817320eed3b..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef Calibration_SubdetFEDSelector_h -#define Calibration_SubdetFEDSelector_h - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" - -class SubdetFEDSelector : public edm::EDProducer { -public: - SubdetFEDSelector(const edm::ParameterSet&); - ~SubdetFEDSelector() override; - - bool getEcal_; - bool getHcal_; - bool getStrip_; - bool getPixel_; - bool getMuon_; - bool getTrigger_; - - edm::EDGetTokenT tok_raw_; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - // ----------member data --------------------------- -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/BuildFile.xml b/Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml similarity index 89% rename from Calibration/HcalIsolatedTrackReco/BuildFile.xml rename to Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml index cb6fa4600d9ba..5721f4ebf639a 100644 --- a/Calibration/HcalIsolatedTrackReco/BuildFile.xml +++ b/Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml @@ -22,4 +22,6 @@ - + + + diff --git a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc similarity index 62% rename from Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc index 4960d213d7c22..2743571469a7d 100644 --- a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc @@ -1,10 +1,48 @@ - -#include "Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h" -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" +#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/Math/interface/RectangularEtaPhiRegion.h" +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" + +class ECALRegFEDSelector : public edm::EDProducer { +public: + ECALRegFEDSelector(const edm::ParameterSet&); + ~ECALRegFEDSelector() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override {} + + std::unique_ptr ec_mapping; + + double delta_; + bool fedSaved[1200]; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_seed_; +}; + ECALRegFEDSelector::ECALRegFEDSelector(const edm::ParameterSet& iConfig) { tok_seed_ = consumes(iConfig.getParameter("regSeedLabel")); delta_ = iConfig.getParameter("delta"); @@ -95,6 +133,15 @@ void ECALRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSet iEvent.put(std::move(fedList)); } -void ECALRegFEDSelector::beginJob() {} +void ECALRegFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("regSeedLabel", edm::InputTag("hltPixelIsolTrackFilter")); + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("delta", 1.0); + descriptions.add("ecalFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -void ECALRegFEDSelector::endJob() {} +DEFINE_FWK_MODULE(ECALRegFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc similarity index 73% rename from Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc index f0d8fbad689d5..d91ad8b00e36d 100644 --- a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc @@ -22,17 +22,57 @@ // user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.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/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/DetId/interface/DetId.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" -#include "Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +// +// class decleration +// + +class EcalIsolatedParticleCandidateProducer : public edm::global::EDProducer<> { +public: + explicit EcalIsolatedParticleCandidateProducer(const edm::ParameterSet&); + ~EcalIsolatedParticleCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void beginJob() override {} + void endJob() override {} + + double InConeSize_; + double OutConeSize_; + double hitCountEthr_; + double hitEthr_; + + edm::EDGetTokenT tok_l1tau_; + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + + edm::ESGetToken tok_geom_; + + // ----------member data --------------------------- +}; + EcalIsolatedParticleCandidateProducer::EcalIsolatedParticleCandidateProducer(const edm::ParameterSet& conf) { InConeSize_ = conf.getParameter("EcalInnerConeSize"); OutConeSize_ = conf.getParameter("EcalOuterConeSize"); @@ -199,8 +239,21 @@ void EcalIsolatedParticleCandidateProducer::produce(edm::StreamID, #endif iEvent.put(std::move(iptcCollection)); } -// ------------ method called once each job just before starting event loop ------------ -void EcalIsolatedParticleCandidateProducer::beginJob() {} -// ------------ method called once each job just after ending the event loop ------------ -void EcalIsolatedParticleCandidateProducer::endJob() {} +void EcalIsolatedParticleCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("ECHitEnergyThreshold", 0.05); + desc.add("L1eTauJetsSource", edm::InputTag("l1extraParticles","Tau")); + desc.add("L1GTSeedLabel", edm::InputTag("l1sIsolTrack")); + desc.add("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit","EcalRecHitsEB")); + desc.add("EErecHitCollectionLabel", edm::InputTag("ecalRecHit","EcalRecHitsEE")); + desc.add("ECHitCountEnergyThreshold", 0.5); + desc.add("EcalInnerConeSize", 0.3); + desc.add("EcalOuterConeSize", 0.7); + descriptions.add("ecalIsolPartProd", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(EcalIsolatedParticleCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc similarity index 95% rename from Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h rename to Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc index b5ac83018ab28..ae37869de477a 100644 --- a/Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h +++ b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc @@ -1,6 +1,3 @@ -#ifndef HITRegionalPixelSeedGenerator_h -#define HITRegionalPixelSeedGenerator_h - // // Class: HITRegionalPixelSeedGenerator @@ -206,4 +203,9 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { edm::EDGetTokenT token_l1jet; }; -#endif +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" +# +DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, HITRegionalPixelSeedGenerator, "HITRegionalPixelSeedGenerator"); diff --git a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc b/Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc similarity index 74% rename from Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc index 662815bb4ea80..9634fd860c38e 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc @@ -1,22 +1,50 @@ +/* \class IsolatedPixelTrackCorrector + * + * + */ + #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/TrackReco/interface/Track.h" + // Framework -#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.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/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" // -#include "DataFormats/Common/interface/TriggerResults.h" /// // Math #include "Math/GenVector/VectorUtil.h" #include "Math/GenVector/PxPyPzE4D.h" -#include "DataFormats/Math/interface/deltaR.h" + +class IPTCorrector : public edm::global::EDProducer<> { +public: + IPTCorrector(const edm::ParameterSet& ps); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + +private: + const edm::EDGetTokenT tok_cor_; + const edm::EDGetTokenT tok_uncor_; + const double assocCone_; +}; IPTCorrector::IPTCorrector(const edm::ParameterSet& config) : tok_cor_(consumes(config.getParameter("corTracksLabel"))), @@ -88,3 +116,8 @@ void IPTCorrector::produce(edm::StreamID, edm::Event& theEvent, edm::EventSetup // put the product in the event theEvent.put(std::move(trackCollection)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IPTCorrector); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc similarity index 82% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc index c2268e29c5d7e..ec7389e62cef7 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc @@ -22,17 +22,55 @@ #include // user include files - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +// +// class decleration +// + +class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<> { +public: + explicit IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet&); + ~IsolatedEcalPixelTrackCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + + const edm::EDGetTokenT tok_ee; + const edm::EDGetTokenT tok_eb; + const edm::EDGetTokenT tok_trigcand; + const edm::ESGetToken tok_geom_; + const double coneSizeEta0_; + const double coneSizeEta1_; + const double hitCountEthrEB_; + const double hitEthrEB_; + const double fachitCountEE_; + const double hitEthrEE0_; + const double hitEthrEE1_; + const double hitEthrEE2_; + const double hitEthrEE3_; +}; + IsolatedEcalPixelTrackCandidateProducer::IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet& conf) : tok_ee(consumes(conf.getParameter("EERecHitSource"))), tok_eb(consumes(conf.getParameter("EBRecHitSource"))), @@ -180,3 +218,8 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, #endif iEvent.put(std::move(iptcCollection)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedEcalPixelTrackCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc similarity index 81% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc index bd265461722ef..b6f37d5967ff4 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc @@ -1,14 +1,43 @@ +/* \class IsolatedPixelTrackCandidateL1TProducer + * + * + */ + #include #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" -// Framework #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/Common/interface/TriggerResults.h" +// L1Extra +#include "DataFormats/L1Trigger/interface/L1EmParticle.h" +#include "DataFormats/L1Trigger/interface/L1JetParticle.h" +// l1t +#include "DataFormats/L1Trigger/interface/Jet.h" +#include "DataFormats/L1Trigger/interface/Tau.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +//vertices +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" + +// Framework +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.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/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" @@ -20,14 +49,64 @@ //magF #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" //for ECAL geometry +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" //#define EDM_ML_DEBUG + +class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> { +public: + IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& ps); + ~IsolatedPixelTrackCandidateL1TProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + double getDistInCM(double eta1, double phi1, double eta2, double phi2); + std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); + +private: + struct seedAtEC { + seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} + unsigned int index; + bool ok; + double eta, phi; + }; + + const edm::EDGetTokenT tok_hlt_; + const edm::EDGetTokenT tok_l1_; + const edm::EDGetTokenT tok_vert_; + const std::vector > toks_pix_; + const edm::ESGetToken tok_bFieldH_; + const edm::ESGetToken tok_geom_; + + const std::string bfield_; + const double prelimCone_; + const double pixelIsolationConeSizeAtEC_; + const double vtxCutSeed_; + const double vtxCutIsol_; + const double tauAssocCone_; + const double tauUnbiasCone_; + const double minPTrackValue_; + const double maxPForIsolationValue_; + const double ebEtaBoundary_; + + // these are read from the EventSetup, cannot be const + double rEB_; + double zEE_; + double bfVal_; +}; + IsolatedPixelTrackCandidateL1TProducer::IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& config) : tok_hlt_(consumes(config.getParameter("L1GTSeedLabel"))), tok_l1_(consumes(config.getParameter("L1eTauJetsSource"))), @@ -368,3 +447,7 @@ std::pair IsolatedPixelTrackCandidateL1TProducer::GetEtaPhiAtEca std::pair retVal(etaEC, phiEC); return retVal; } +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateL1TProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc similarity index 79% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc index b160c03ccf954..d5daf4b19a099 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc @@ -1,14 +1,42 @@ +/* \class IsolatedPixelTrackCandidateProducer + * + * + */ + #include #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/L1Trigger/interface/L1JetParticle.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/Common/interface/TriggerResults.h" +// L1Extra +#include "DataFormats/L1Trigger/interface/L1EmParticle.h" +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" +//vertices +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" // Framework -#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.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/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" @@ -20,14 +48,63 @@ //magF #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" //for ECAL geometry #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { +public: + IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& ps); + ~IsolatedPixelTrackCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + double getDistInCM(double eta1, double phi1, double eta2, double phi2); + std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); + +private: + struct seedAtEC { + seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} + unsigned int index; + bool ok; + double eta, phi; + }; + + const edm::EDGetTokenT tok_hlt_; + const edm::EDGetTokenT tok_l1_; + const edm::EDGetTokenT tok_vert_; + const std::vector > toks_pix_; + const edm::ESGetToken tok_bFieldH_; + const edm::ESGetToken tok_geom_; + + const std::string bfield_; + const double prelimCone_; + const double pixelIsolationConeSizeAtEC_; + const double vtxCutSeed_; + const double vtxCutIsol_; + const double tauAssocCone_; + const double tauUnbiasCone_; + const double minPTrackValue_; + const double maxPForIsolationValue_; + const double ebEtaBoundary_; + + // these are read from the EventSetup, cannot be const + double rEB_; + double zEE_; + double bfVal_; +}; + IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& config) : tok_hlt_(consumes(config.getParameter("L1GTSeedLabel"))), tok_l1_(consumes(config.getParameter("L1eTauJetsSource"))), @@ -325,3 +402,8 @@ std::pair IsolatedPixelTrackCandidateProducer::GetEtaPhiAtEcal( std::pair retVal(etaEC, phiEC); return retVal; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc similarity index 71% rename from Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc index 55f915c08637f..3dd543c0e83b8 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc @@ -1,9 +1,41 @@ +// system include files +#include -#include "Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h" +// user include files +#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +class SiStripRegFEDSelector : public edm::EDProducer { +public: + SiStripRegFEDSelector(const edm::ParameterSet&); + ~SiStripRegFEDSelector() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override {} + + const edm::EDGetTokenT tok_seed_; + const edm::EDGetTokenT tok_raw_; + const edm::ESGetToken tok_strip_; + const double delta_; +}; SiStripRegFEDSelector::SiStripRegFEDSelector(const edm::ParameterSet& iConfig) : tok_seed_(consumes(iConfig.getParameter("regSeedLabel"))), @@ -120,6 +152,15 @@ void SiStripRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& i iEvent.put(std::move(producedData)); } -void SiStripRegFEDSelector::beginJob() {} +void SiStripRegFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("regSeedLabel", edm::InputTag("hltIsolPixelTrackFilter")); + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("delta", 1.0); + descriptions.add("stripFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -void SiStripRegFEDSelector::endJob() {} +DEFINE_FWK_MODULE(SiStripRegFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc similarity index 77% rename from Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc index 2c297312d6945..f1904a9401b91 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc @@ -1,5 +1,37 @@ - -#include "Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h" +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" + +#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" + +class SubdetFEDSelector : public edm::EDProducer { +public: + SubdetFEDSelector(const edm::ParameterSet&); + ~SubdetFEDSelector() override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override {} + + // ----------member data --------------------------- + bool getEcal_; + bool getHcal_; + bool getStrip_; + bool getPixel_; + bool getMuon_; + bool getTrigger_; + + edm::EDGetTokenT tok_raw_; +}; SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) { getEcal_ = iConfig.getParameter("getECAL"); @@ -171,8 +203,19 @@ void SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetu iEvent.put(std::move(producedData)); } -// ------------ method called once each job just before starting event loop ------------ -void SubdetFEDSelector::beginJob() {} +void SubdetFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("getSiPixel", true); + desc.add("getHCAL", true); + desc.add("getECAL", false); + desc.add("getMuon", false); + desc.add("getTrigger", true); + desc.add("getSiStrip", false); + descriptions.add("subdetFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -// ------------ method called once each job just after ending the event loop ------------ -void SubdetFEDSelector::endJob() {} +DEFINE_FWK_MODULE(SubdetFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py deleted file mode 100644 index 0ab6f02a26f33..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -ecalFED = cms.EDProducer("ECALRegFEDSelector", - regSeedLabel = cms.InputTag("hltPixelIsolTrackFilter"), - rawInputLabel = cms.InputTag("rawDataCollector"), - delta = cms.double(1.0) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py b/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py deleted file mode 100644 index e218cb7f8d245..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py +++ /dev/null @@ -1,14 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -ecalIsolPartProd = cms.EDProducer("EcalIsolatedParticleCandidateProducer", - ECHitEnergyThreshold = cms.double(0.05), - L1eTauJetsSource = cms.InputTag("l1extraParticles","Tau"), - L1GTSeedLabel = cms.InputTag("l1sIsolTrack"), - EBrecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - ECHitCountEnergyThreshold = cms.double(0.5), - EcalInnerConeSize = cms.double(0.3), - EcalOuterConeSize = cms.double(0.7), - EErecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEE") -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py deleted file mode 100644 index 4ae59c5a924bb..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -stripFED = cms.EDProducer("SiStripRegFEDSelector", - regSeedLabel = cms.InputTag("hltIsolPixelTrackFilter"), - rawInputLabel = cms.InputTag("rawDataCollector"), - delta = cms.double(1.0) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py deleted file mode 100644 index c88c735118fb5..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -subdetFED = cms.EDProducer("SubdetFEDSelector", - rawInputLabel = cms.InputTag("rawDataCollector"), - getSiPixel = cms.bool(True), - getHCAL = cms.bool(True), - getECAL = cms.bool(False), - getMuon = cms.bool(False), - getTrigger = cms.bool(True), - getSiStrip = cms.bool(False) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/src/SealModule.cc b/Calibration/HcalIsolatedTrackReco/src/SealModule.cc deleted file mode 100644 index cc0f9cb28b225..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/src/SealModule.cc +++ /dev/null @@ -1,24 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h" -#include "Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h" -#include "Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h" -#include "HITRegionalPixelSeedGenerator.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h" - -DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, HITRegionalPixelSeedGenerator, "HITRegionalPixelSeedGenerator"); -// -DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateProducer); -DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateL1TProducer); -DEFINE_FWK_MODULE(IsolatedEcalPixelTrackCandidateProducer); -DEFINE_FWK_MODULE(EcalIsolatedParticleCandidateProducer); -DEFINE_FWK_MODULE(SiStripRegFEDSelector); -DEFINE_FWK_MODULE(ECALRegFEDSelector); -DEFINE_FWK_MODULE(SubdetFEDSelector); -DEFINE_FWK_MODULE(IPTCorrector); From 5e8959db269674834e9a3b656265e726a3a32881 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 2 Sep 2021 22:55:05 +0200 Subject: [PATCH 365/923] Code check --- .../plugins/EcalIsolatedParticleCandidateProducer.cc | 6 +++--- .../plugins/IsolatedPixelTrackCandidateL1TProducer.cc | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc index d91ad8b00e36d..3496de76ed56f 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc @@ -243,10 +243,10 @@ void EcalIsolatedParticleCandidateProducer::produce(edm::StreamID, void EcalIsolatedParticleCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("ECHitEnergyThreshold", 0.05); - desc.add("L1eTauJetsSource", edm::InputTag("l1extraParticles","Tau")); + desc.add("L1eTauJetsSource", edm::InputTag("l1extraParticles", "Tau")); desc.add("L1GTSeedLabel", edm::InputTag("l1sIsolTrack")); - desc.add("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit","EcalRecHitsEB")); - desc.add("EErecHitCollectionLabel", edm::InputTag("ecalRecHit","EcalRecHitsEE")); + desc.add("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); + desc.add("EErecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE")); desc.add("ECHitCountEnergyThreshold", 0.5); desc.add("EcalInnerConeSize", 0.3); desc.add("EcalOuterConeSize", 0.7); diff --git a/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc index b6f37d5967ff4..e8d05998c2c80 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc @@ -61,7 +61,6 @@ //#define EDM_ML_DEBUG - class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> { public: IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& ps); From 48460c49ea827d577c0d157f895974f745780405 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Thu, 2 Sep 2021 22:56:13 +0200 Subject: [PATCH 366/923] Partial esConsumes migration for TrajectorySeedProducer Excludes migration related to MultipleScatteringParametrisation and PixelRecoUtilities because Matti is working on that separately. --- .../Tracking/interface/SeedFinderSelector.h | 21 ++++---- .../plugins/TrajectorySeedProducer.cc | 14 +++-- .../Tracking/src/SeedFinderSelector.cc | 22 ++++---- .../plugins/TSGFromOrderedHits.cc | 4 +- .../plugins/TSGFromOrderedHits.h | 3 +- .../TrackerSeedGenerator/plugins/TSGSmart.cc | 7 +-- .../TrackerSeedGenerator/plugins/TSGSmart.h | 1 + .../LowPtClusterShapeSeedComparitor.h | 20 ++++--- .../plugins/ClusterShapeSeedComparitor.cc | 20 ++++--- .../src/LowPtClusterShapeSeedComparitor.cc | 22 ++++---- .../plugins/PixelTripletLargeTipGenerator.cc | 20 +++---- .../plugins/PixelTripletLargeTipGenerator.h | 8 ++- .../interface/CosmicSeedCreator.h | 11 ++-- .../src/CosmicSeedCreator.cc | 10 ++-- ...ultiHitGeneratorFromPairAndLayersFactory.h | 4 +- .../TkSeedGenerator/interface/SeedCreator.h | 1 - .../interface/SeedCreatorFactory.h | 4 +- .../SeedCreatorFromRegionHitsEDProducerT.h | 2 +- .../plugins/CombinedMultiHitGenerator.cc | 2 +- .../plugins/MultiHitFromChi2EDProducer.cc | 2 +- .../plugins/MultiHitGeneratorFromChi2.cc | 34 ++++++------ .../plugins/MultiHitGeneratorFromChi2.h | 15 +++++- .../plugins/SeedFromConsecutiveHitsCreator.cc | 53 ++++++++++--------- .../plugins/SeedFromConsecutiveHitsCreator.h | 36 ++++++------- ...dFromConsecutiveHitsStraightLineCreator.cc | 2 +- ...edFromConsecutiveHitsStraightLineCreator.h | 4 +- ...edFromConsecutiveHitsTripletOnlyCreator.cc | 12 ++--- ...eedFromConsecutiveHitsTripletOnlyCreator.h | 4 +- .../SeedGeneratorFromProtoTracksEDProducer.cc | 15 +++--- .../SeedGeneratorFromProtoTracksEDProducer.h | 6 ++- .../SeedGeneratorFromRegionHitsEDProducer.cc | 2 +- 31 files changed, 200 insertions(+), 181 deletions(-) diff --git a/FastSimulation/Tracking/interface/SeedFinderSelector.h b/FastSimulation/Tracking/interface/SeedFinderSelector.h index 77e21b4ab799e..2b472ba8ab492 100644 --- a/FastSimulation/Tracking/interface/SeedFinderSelector.h +++ b/FastSimulation/Tracking/interface/SeedFinderSelector.h @@ -6,32 +6,29 @@ #include #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "TrackingTools/TransientTrackingRecHit/interface/SeedingLayerSetsHits.h" +#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" class TrackingRegion; class FastTrackerRecHit; class MultiHitGeneratorFromPairAndLayers; class HitTripletGeneratorFromPairAndLayers; -class MeasurementTracker; class CAHitTripletGenerator; class CAHitQuadrupletGenerator; -namespace edm { - class Event; - class EventSetup; - class ParameterSet; - class ConsumesCollector; -} // namespace edm - class SeedFinderSelector { public: - SeedFinderSelector(const edm::ParameterSet& cfg, edm::ConsumesCollector&& consumesCollector); + SeedFinderSelector(const edm::ParameterSet&, edm::ConsumesCollector&&); ~SeedFinderSelector(); - void initEvent(const edm::Event& ev, const edm::EventSetup& es); + void initEvent(const edm::Event&, const edm::EventSetup&); void setTrackingRegion(const TrackingRegion* trackingRegion) { trackingRegion_ = trackingRegion; } @@ -46,12 +43,14 @@ class SeedFinderSelector { const edm::EventSetup* eventSetup_; const MeasurementTracker* measurementTracker_; const std::string measurementTrackerLabel_; + const edm::ESGetToken measurementTrackerESToken_; + const edm::ESGetToken trackerTopologyESToken_; + const TrackerTopology* trackerTopology_ = nullptr; std::unique_ptr CAHitTriplGenerator_; std::unique_ptr CAHitQuadGenerator_; std::unique_ptr seedingLayers_; std::unique_ptr seedingLayer; std::vector layerPairs_; - edm::ESHandle trackerTopology; std::vector seedingLayerIds; }; diff --git a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc index 82ad2b52231f4..98091eec00090 100644 --- a/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc +++ b/FastSimulation/Tracking/plugins/TrajectorySeedProducer.cc @@ -27,7 +27,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/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -63,6 +62,7 @@ class TrajectorySeedProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT recHitCombinationsToken; edm::EDGetTokenT> hitMasksToken; edm::EDGetTokenT> trackingRegionToken; + const edm::ESGetToken trackerTopologyESToken_; // other data members unsigned int nHitsPerSeed_; @@ -78,13 +78,13 @@ class TrajectorySeedProducer : public edm::stream::EDProducer<> { public: TrajectorySeedProducer(const edm::ParameterSet& conf); - void produce(edm::Event& e, const edm::EventSetup& es) override; + void produce(edm::Event&, const edm::EventSetup&) override; }; template class SeedingTree; template class SeedingNode; -TrajectorySeedProducer::TrajectorySeedProducer(const edm::ParameterSet& conf) { +TrajectorySeedProducer::TrajectorySeedProducer(const edm::ParameterSet& conf) : trackerTopologyESToken_(esConsumes()) { // products produces(); @@ -133,14 +133,12 @@ TrajectorySeedProducer::TrajectorySeedProducer(const edm::ParameterSet& conf) { // seed creator const edm::ParameterSet& seedCreatorPSet = conf.getParameter("SeedCreatorPSet"); std::string seedCreatorName = seedCreatorPSet.getParameter("ComponentName"); - seedCreator = SeedCreatorFactory::get()->create(seedCreatorName, seedCreatorPSet); + seedCreator = SeedCreatorFactory::get()->create(seedCreatorName, seedCreatorPSet, consumesCollector()); } void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) { // services - edm::ESHandle trackerTopology; - - es.get().get(trackerTopology); + auto const& trackerTopology = es.getData(trackerTopologyESToken_); // input data edm::Handle recHitCombinations; @@ -166,7 +164,7 @@ void TrajectorySeedProducer::produce(edm::Event& e, const edm::EventSetup& es) { } // instantiate the seed finder - SeedFinder seedFinder(_seedingTree, *trackerTopology.product()); + SeedFinder seedFinder(_seedingTree, trackerTopology); if (seedFinderSelector) { seedFinderSelector->initEvent(e, es); seedFinder.addHitSelector(seedFinderSelector.get(), nHitsPerSeed_); diff --git a/FastSimulation/Tracking/src/SeedFinderSelector.cc b/FastSimulation/Tracking/src/SeedFinderSelector.cc index 9983f4e62bc15..7c8fd002a87e0 100644 --- a/FastSimulation/Tracking/src/SeedFinderSelector.cc +++ b/FastSimulation/Tracking/src/SeedFinderSelector.cc @@ -1,17 +1,16 @@ #include "FastSimulation/Tracking/interface/SeedFinderSelector.h" // framework +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" // track reco -#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h" #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h" -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h" #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayersFactory.h" #include "RecoPixelVertexing/PixelTriplets/interface/CAHitTripletGenerator.h" @@ -25,7 +24,9 @@ SeedFinderSelector::SeedFinderSelector(const edm::ParameterSet &cfg, edm::Consum : trackingRegion_(nullptr), eventSetup_(nullptr), measurementTracker_(nullptr), - measurementTrackerLabel_(cfg.getParameter("measurementTracker")) { + measurementTrackerLabel_(cfg.getParameter("measurementTracker")), + measurementTrackerESToken_(consumesCollector.esConsumes(edm::ESInputTag("", measurementTrackerLabel_))), + trackerTopologyESToken_(consumesCollector.esConsumes()) { if (cfg.exists("pixelTripletGeneratorFactory")) { const edm::ParameterSet &tripletConfig = cfg.getParameter("pixelTripletGeneratorFactory"); pixelTripletGenerator_ = HitTripletGeneratorFromPairAndLayersFactory::get()->create( @@ -35,7 +36,7 @@ SeedFinderSelector::SeedFinderSelector(const edm::ParameterSet &cfg, edm::Consum if (cfg.exists("MultiHitGeneratorFactory")) { const edm::ParameterSet &tripletConfig = cfg.getParameter("MultiHitGeneratorFactory"); multiHitGenerator_ = MultiHitGeneratorFromPairAndLayersFactory::get()->create( - tripletConfig.getParameter("ComponentName"), tripletConfig); + tripletConfig.getParameter("ComponentName"), tripletConfig, consumesCollector); } if (cfg.exists("CAHitTripletGeneratorFactory")) { @@ -77,10 +78,8 @@ SeedFinderSelector::~SeedFinderSelector() { ; } void SeedFinderSelector::initEvent(const edm::Event &ev, const edm::EventSetup &es) { eventSetup_ = &es; - edm::ESHandle measurementTrackerHandle; - es.get().get(measurementTrackerLabel_, measurementTrackerHandle); - es.get().get(trackerTopology); - measurementTracker_ = &(*measurementTrackerHandle); + measurementTracker_ = &es.getData(measurementTrackerESToken_); + trackerTopology_ = &es.getData(trackerTopologyESToken_); if (multiHitGenerator_) { multiHitGenerator_->initES(es); @@ -320,7 +319,6 @@ bool SeedFinderSelector::pass(const std::vector &hits //new for Phase1 SeedingLayerSetsBuilder::SeedingLayerId SeedFinderSelector::Layer_tuple(const FastTrackerRecHit *hit) const { - const TrackerTopology *const tTopo = trackerTopology.product(); GeomDetEnumerators::SubDetector subdet = GeomDetEnumerators::invalidDet; TrackerDetSide side = TrackerDetSide::Barrel; int idLayer = 0; @@ -328,11 +326,11 @@ SeedingLayerSetsBuilder::SeedingLayerId SeedFinderSelector::Layer_tuple(const Fa if ((hit->det()->geographicalId()).subdetId() == PixelSubdetector::PixelBarrel) { subdet = GeomDetEnumerators::PixelBarrel; side = TrackerDetSide::Barrel; - idLayer = tTopo->pxbLayer(hit->det()->geographicalId()); + idLayer = trackerTopology_->pxbLayer(hit->det()->geographicalId()); } else if ((hit->det()->geographicalId()).subdetId() == PixelSubdetector::PixelEndcap) { subdet = GeomDetEnumerators::PixelEndcap; - idLayer = tTopo->pxfDisk(hit->det()->geographicalId()); - if (tTopo->pxfSide(hit->det()->geographicalId()) == 1) { + idLayer = trackerTopology_->pxfDisk(hit->det()->geographicalId()); + if (trackerTopology_->pxfSide(hit->det()->geographicalId()) == 1) { side = TrackerDetSide::NegEndcap; } else { side = TrackerDetSide::PosEndcap; diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.cc b/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.cc index 546eed680313b..433f231d88245 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.cc +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.cc @@ -1,5 +1,7 @@ #include "TSGFromOrderedHits.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h" #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h" @@ -19,7 +21,7 @@ TSGFromOrderedHits::TSGFromOrderedHits(const edm::ParameterSet &pset, edm::Consu theGenerator = std::make_unique( OrderedHitsGeneratorFactory::get()->create(hitsfactoryName, hitsfactoryPSet, iC), nullptr, - SeedCreatorFactory::get()->create(seedCreatorType, seedCreatorPSet)); + SeedCreatorFactory::get()->create(seedCreatorType, seedCreatorPSet, edm::ConsumesCollector(iC))); } TSGFromOrderedHits::~TSGFromOrderedHits() = default; diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.h b/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.h index 97c2408c0dc4b..d425f61c028f0 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.h +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGFromOrderedHits.h @@ -2,9 +2,8 @@ #define RecoMuon_TrackerSeedGenerator_TSGFromOrderedHits_H #include "RecoMuon/TrackerSeedGenerator/interface/TrackerSeedGenerator.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "DataFormats/Provenance/interface/RunID.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" class SeedGeneratorFromRegionHits; class TrackingRegion; diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.cc b/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.cc index 7f332da710fce..e24899bd51da7 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.cc +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.cc @@ -1,5 +1,6 @@ #include "RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h" #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h" @@ -20,7 +21,7 @@ TSGSmart::TSGSmart(const edm::ParameterSet &pset, edm::ConsumesCollector &iC) { thePairGenerator = std::make_unique( OrderedHitsGeneratorFactory::get()->create(pairhitsfactoryName, pairhitsfactoryPSet, iC), nullptr, - SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)); + SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet, edm::ConsumesCollector(iC))); edm::ParameterSet TripletPSet = pset.getParameter("PixelTripletGeneratorSet"); edm::ParameterSet triplethitsfactoryPSet = TripletPSet.getParameter("OrderedHitsFactoryPSet"); @@ -29,7 +30,7 @@ TSGSmart::TSGSmart(const edm::ParameterSet &pset, edm::ConsumesCollector &iC) { theTripletGenerator = std::make_unique( OrderedHitsGeneratorFactory::get()->create(triplethitsfactoryName, triplethitsfactoryPSet, iC), nullptr, - SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)); + SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet, edm::ConsumesCollector(iC))); edm::ParameterSet MixedPSet = pset.getParameter("MixedGeneratorSet"); edm::ParameterSet mixedhitsfactoryPSet = MixedPSet.getParameter("OrderedHitsFactoryPSet"); @@ -38,7 +39,7 @@ TSGSmart::TSGSmart(const edm::ParameterSet &pset, edm::ConsumesCollector &iC) { theMixedGenerator = std::make_unique( OrderedHitsGeneratorFactory::get()->create(mixedhitsfactoryName, mixedhitsfactoryPSet, iC), nullptr, - SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)); + SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet, edm::ConsumesCollector(iC))); } TSGSmart::~TSGSmart() = default; diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.h b/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.h index 6bef6f2b5d5a9..81e10c82e5c87 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.h +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGSmart.h @@ -2,6 +2,7 @@ #define RecoMuon_TrackerSeedGenerator_TSGSmart_H #include "RecoMuon/TrackerSeedGenerator/interface/TrackerSeedGenerator.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" class SeedGeneratorFromRegionHits; diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/LowPtClusterShapeSeedComparitor.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/LowPtClusterShapeSeedComparitor.h index 18b6d4fae92c5..c65b147f139f7 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/LowPtClusterShapeSeedComparitor.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/LowPtClusterShapeSeedComparitor.h @@ -2,18 +2,15 @@ #define _LowPtClusterShapeSeedComparitor_h_ #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/SiPixelCluster/interface/SiPixelClusterShapeCache.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" - -class TrackerTopology; - -namespace edm { - class ParameterSet; - class EventSetup; -} // namespace edm +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" class LowPtClusterShapeSeedComparitor : public SeedComparitor { public: @@ -31,12 +28,13 @@ class LowPtClusterShapeSeedComparitor : public SeedComparitor { } private: - /// something - edm::ESHandle theShapeFilter; - edm::ESHandle theTTopo; edm::EDGetTokenT thePixelClusterShapeCacheToken; edm::Handle thePixelClusterShapeCache; std::string theShapeFilterLabel_; + const edm::ESGetToken clusterShapeHitFilterESToken_; + const edm::ESGetToken trackerTopologyESToken_; + const ClusterShapeHitFilter *clusterShapeHitFilter_ = nullptr; + const TrackerTopology *trackerTopology_ = nullptr; }; #endif diff --git a/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeSeedComparitor.cc b/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeSeedComparitor.cc index fde0427fe0a7f..5ff902c855e40 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeSeedComparitor.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeSeedComparitor.cc @@ -7,7 +7,6 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" @@ -15,6 +14,8 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/Utilities/interface/ESInputTag.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/SiPixelCluster/interface/SiPixelClusterShapeCache.h" #include @@ -37,7 +38,8 @@ class PixelClusterShapeSeedComparitor : public SeedComparitor { bool compatibleHit(const TrackingRecHit &hit, const GlobalVector &direction) const; std::string filterName_; - edm::ESHandle filterHandle_; + const edm::ESGetToken clusterShapeHitFilterESToken_; + const ClusterShapeHitFilter *clusterShapeHitFilter_; edm::EDGetTokenT pixelClusterShapeCacheToken_; const SiPixelClusterShapeCache *pixelClusterShapeCache_; const bool filterAtHelixStage_; @@ -47,6 +49,7 @@ class PixelClusterShapeSeedComparitor : public SeedComparitor { PixelClusterShapeSeedComparitor::PixelClusterShapeSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC) : filterName_(cfg.getParameter("ClusterShapeHitFilterName")), + clusterShapeHitFilterESToken_(iC.esConsumes(edm::ESInputTag("", filterName_))), pixelClusterShapeCache_(nullptr), filterAtHelixStage_(cfg.getParameter("FilterAtHelixStage")), filterPixelHits_(cfg.getParameter("FilterPixelHits")), @@ -60,7 +63,7 @@ PixelClusterShapeSeedComparitor::PixelClusterShapeSeedComparitor(const edm::Para PixelClusterShapeSeedComparitor::~PixelClusterShapeSeedComparitor() {} void PixelClusterShapeSeedComparitor::init(const edm::Event &ev, const edm::EventSetup &es) { - es.get().get(filterName_, filterHandle_); + clusterShapeHitFilter_ = &es.getData(clusterShapeHitFilterESToken_); if (filterPixelHits_) { edm::Handle hcache; ev.getByToken(pixelClusterShapeCacheToken_, hcache); @@ -125,7 +128,7 @@ bool PixelClusterShapeSeedComparitor::compatibleHit(const TrackingRecHit &hit, c if (pixhit == nullptr) throw cms::Exception("LogicError", "Found a valid hit on the pixel detector which is not a SiPixelRecHit\n"); //printf("Cheching hi hit on detid %10d, local direction is x = %9.6f, y = %9.6f, z = %9.6f\n", hit.geographicalId().rawId(), direction.x(), direction.y(), direction.z()); - return filterHandle_->isCompatible(*pixhit, direction, *pixelClusterShapeCache_); + return clusterShapeHitFilter_->isCompatible(*pixhit, direction, *pixelClusterShapeCache_); } else { if (!filterStripHits_) return true; @@ -133,16 +136,17 @@ bool PixelClusterShapeSeedComparitor::compatibleHit(const TrackingRecHit &hit, c if (tid == typeid(SiStripMatchedRecHit2D)) { const SiStripMatchedRecHit2D *matchedHit = dynamic_cast(&hit); assert(matchedHit != nullptr); - return (filterHandle_->isCompatible(DetId(matchedHit->monoId()), matchedHit->monoCluster(), direction) && - filterHandle_->isCompatible(DetId(matchedHit->stereoId()), matchedHit->stereoCluster(), direction)); + return ( + clusterShapeHitFilter_->isCompatible(DetId(matchedHit->monoId()), matchedHit->monoCluster(), direction) && + clusterShapeHitFilter_->isCompatible(DetId(matchedHit->stereoId()), matchedHit->stereoCluster(), direction)); } else if (tid == typeid(SiStripRecHit2D)) { const SiStripRecHit2D *recHit = dynamic_cast(&hit); assert(recHit != nullptr); - return filterHandle_->isCompatible(*recHit, direction); + return clusterShapeHitFilter_->isCompatible(*recHit, direction); } else if (tid == typeid(ProjectedSiStripRecHit2D)) { const ProjectedSiStripRecHit2D *precHit = dynamic_cast(&hit); assert(precHit != nullptr); - return filterHandle_->isCompatible(precHit->originalHit(), direction); + return clusterShapeHitFilter_->isCompatible(precHit->originalHit(), direction); } else { //printf("Questo e' un %s, che ci fo?\n", tid.name()); return true; diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/LowPtClusterShapeSeedComparitor.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/LowPtClusterShapeSeedComparitor.cc index 271faefb7c89b..4d94e060da5bb 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/LowPtClusterShapeSeedComparitor.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/LowPtClusterShapeSeedComparitor.cc @@ -3,21 +3,17 @@ #include "DataFormats/GeometryVector/interface/Basic2DVector.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "FWCore/Framework/interface/ConsumesCollector.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 "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" +#include "FWCore/Utilities/interface/ESInputTag.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/HitInfo.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/LowPtClusterShapeSeedComparitor.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/CircleFromThreePoints.h" -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" namespace { @@ -84,13 +80,14 @@ LowPtClusterShapeSeedComparitor::LowPtClusterShapeSeedComparitor(const edm::Para edm::ConsumesCollector& iC) : thePixelClusterShapeCacheToken( iC.consumes(ps.getParameter("clusterShapeCacheSrc"))), - theShapeFilterLabel_(ps.getParameter("clusterShapeHitFilter")) {} + theShapeFilterLabel_(ps.getParameter("clusterShapeHitFilter")), + clusterShapeHitFilterESToken_(iC.esConsumes(edm::ESInputTag("", theShapeFilterLabel_))), + trackerTopologyESToken_(iC.esConsumes()) {} /*****************************************************************************/ void LowPtClusterShapeSeedComparitor::init(const edm::Event& e, const edm::EventSetup& es) { - es.get().get(theShapeFilterLabel_, theShapeFilter); - es.get().get(theTTopo); - + clusterShapeHitFilter_ = &es.getData(clusterShapeHitFilterESToken_); + trackerTopology_ = &es.getData(trackerTopologyESToken_); e.getByToken(thePixelClusterShapeCacheToken, thePixelClusterShapeCache); } @@ -99,8 +96,7 @@ bool LowPtClusterShapeSeedComparitor::compatible(const SeedingHitSet& hits) cons { assert(hits.size() == 3); - const ClusterShapeHitFilter* filter = theShapeFilter.product(); - if (filter == nullptr) + if (clusterShapeHitFilter_ == nullptr) throw cms::Exception("LogicError") << "LowPtClusterShapeSeedComparitor: init(EventSetup) method was not called"; // Get global positions @@ -138,9 +134,9 @@ bool LowPtClusterShapeSeedComparitor::compatible(const SeedingHitSet& hits) cons LogDebug("LowPtClusterShapeSeedComparitor") << "about to compute compatibility." << "hit ptr: " << pixelRecHit << "global direction:" << globalDirs[i]; - if (!filter->isCompatible(*pixelRecHit, globalDirs[i], *thePixelClusterShapeCache)) { + if (!clusterShapeHitFilter_->isCompatible(*pixelRecHit, globalDirs[i], *thePixelClusterShapeCache)) { LogTrace("LowPtClusterShapeSeedComparitor") - << " clusShape is not compatible" << HitInfo::getInfo(*hits[i]->hit(), theTTopo.product()); + << " clusShape is not compatible" << HitInfo::getInfo(*hits[i]->hit(), trackerTopology_); ok = false; break; diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc index 608dc5a7e3c7a..875779a629f5a 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.cc @@ -1,15 +1,14 @@ #include "RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.h" #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h" #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitCorrection.h" #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h" @@ -51,7 +50,8 @@ PixelTripletLargeTipGenerator::PixelTripletLargeTipGenerator(const edm::Paramete extraHitRPhitolerance(cfg.getParameter("extraHitRPhitolerance")), useMScat(cfg.getParameter("useMultScattering")), useBend(cfg.getParameter("useBending")), - dphi(useFixedPreFiltering ? cfg.getParameter("phiPreFiltering") : 0) {} + dphi(useFixedPreFiltering ? cfg.getParameter("phiPreFiltering") : 0), + trackerTopologyESToken_(iC.esConsumes()) {} PixelTripletLargeTipGenerator::~PixelTripletLargeTipGenerator() {} @@ -130,13 +130,7 @@ void PixelTripletLargeTipGenerator::hitTriplets(const TrackingRegion& region, const std::vector& thirdLayerDetLayer, const int nThirdLayers, std::vector* tripletLastLayerIndex) { - edm::ESHandle tracker; - es.get().get(tracker); - - //Retrieve tracker topology from geometry - edm::ESHandle tTopoHand; - es.get().get(tTopoHand); - const TrackerTopology* tTopo = tTopoHand.product(); + const TrackerTopology* tTopo = &es.getData(trackerTopologyESToken_); auto outSeq = doublets.detLayer(HitDoublets::outer)->seqNum(); diff --git a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h index b1950806bfb76..5a790a43514f3 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/PixelTripletLargeTipGenerator.h @@ -8,8 +8,10 @@ */ #include "CombinedHitTripletGenerator.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h" #include @@ -68,5 +70,7 @@ class PixelTripletLargeTipGenerator : public HitTripletGeneratorFromPairAndLayer const bool useMScat; const bool useBend; const float dphi; + + const edm::ESGetToken trackerTopologyESToken_; }; #endif diff --git a/RecoTracker/SpecialSeedGenerators/interface/CosmicSeedCreator.h b/RecoTracker/SpecialSeedGenerators/interface/CosmicSeedCreator.h index 6ca14c230aae7..82c05ac4dae9e 100644 --- a/RecoTracker/SpecialSeedGenerators/interface/CosmicSeedCreator.h +++ b/RecoTracker/SpecialSeedGenerators/interface/CosmicSeedCreator.h @@ -3,13 +3,14 @@ #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "MagneticField/Engine/interface/MagneticField.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" +#include "FWCore/Utilities/interface/ESGetToken.h" class CosmicSeedCreator final : public SeedCreator { public: - CosmicSeedCreator(const edm::ParameterSet &extra) { maxseeds_ = extra.getParameter("maxseeds"); } + CosmicSeedCreator(const edm::ParameterSet &extra, edm::ConsumesCollector &&); ~CosmicSeedCreator() override {} @@ -23,7 +24,9 @@ class CosmicSeedCreator final : public SeedCreator { private: const TrackingRegion *region = nullptr; const SeedComparitor *filter = nullptr; - edm::ESHandle bfield; + const MagneticField *bfield = nullptr; + + const edm::ESGetToken magneticFieldESToken_; unsigned int maxseeds_; }; diff --git a/RecoTracker/SpecialSeedGenerators/src/CosmicSeedCreator.cc b/RecoTracker/SpecialSeedGenerators/src/CosmicSeedCreator.cc index 645f02c6e600e..2f48e42eae437 100644 --- a/RecoTracker/SpecialSeedGenerators/src/CosmicSeedCreator.cc +++ b/RecoTracker/SpecialSeedGenerators/src/CosmicSeedCreator.cc @@ -1,11 +1,12 @@ #include "RecoTracker/SpecialSeedGenerators/interface/CosmicSeedCreator.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" namespace { template @@ -14,11 +15,14 @@ namespace { } } // namespace +CosmicSeedCreator::CosmicSeedCreator(const edm::ParameterSet& extra, edm::ConsumesCollector&& iC) + : magneticFieldESToken_(iC.esConsumes()), maxseeds_(extra.getParameter("maxseeds")) {} + void CosmicSeedCreator::init(const TrackingRegion& iregion, const edm::EventSetup& es, const SeedComparitor* ifilter) { region = &iregion; filter = ifilter; // mag field - es.get().get(bfield); + bfield = &es.getData(magneticFieldESToken_); } void CosmicSeedCreator::makeSeed(TrajectorySeedCollection& seedCollection, const SeedingHitSet& ordered) { @@ -110,7 +114,7 @@ void CosmicSeedCreator::makeSeed(TrajectorySeedCollection& seedCollection, const //fixme, what hit do you want to use ? FreeTrajectoryState freeState( - GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, &*bfield), + GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, bfield), CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity())); LogDebug("CosmicSeedCreator") << "Position freeState: " << usedHit->globalPosition() << "\nCharge: " << charge diff --git a/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h b/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h index 0d855bbcda02d..2226da5470b73 100644 --- a/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h +++ b/RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayersFactory.h @@ -2,13 +2,15 @@ #define MultiHitGeneratorFromPairAndLayersFactory_H #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/PluginManager/interface/PluginFactory.h" namespace edm { class ParameterSet; } -typedef edmplugin::PluginFactory +typedef edmplugin::PluginFactory MultiHitGeneratorFromPairAndLayersFactory; #endif diff --git a/RecoTracker/TkSeedGenerator/interface/SeedCreator.h b/RecoTracker/TkSeedGenerator/interface/SeedCreator.h index 41d7d71900e3f..f8997752bc564 100644 --- a/RecoTracker/TkSeedGenerator/interface/SeedCreator.h +++ b/RecoTracker/TkSeedGenerator/interface/SeedCreator.h @@ -8,7 +8,6 @@ class SeedingHitSet; class SeedComparitor; namespace edm { - class Event; class EventSetup; } // namespace edm diff --git a/RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h index b1d60e19e73ae..e2978d8a29935 100644 --- a/RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h +++ b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFactory.h @@ -3,11 +3,11 @@ #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h" #include "FWCore/PluginManager/interface/PluginFactory.h" - +#include "FWCore/Framework/interface/ConsumesCollector.h" namespace edm { class ParameterSet; } -typedef edmplugin::PluginFactory SeedCreatorFactory; +typedef edmplugin::PluginFactory SeedCreatorFactory; #endif diff --git a/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h index 7021be2e774a6..97a19e8c55799 100644 --- a/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h +++ b/RecoTracker/TkSeedGenerator/interface/SeedCreatorFromRegionHitsEDProducerT.h @@ -37,7 +37,7 @@ template SeedCreatorFromRegionHitsEDProducerT::SeedCreatorFromRegionHitsEDProducerT( const edm::ParameterSet& iConfig) : seedingHitSetsToken_(consumes(iConfig.getParameter("seedingHitSets"))), - seedCreator_(iConfig) { + seedCreator_(iConfig, consumesCollector()) { edm::ConsumesCollector iC = consumesCollector(); edm::ParameterSet comparitorPSet = iConfig.getParameter("SeedComparitorPSet"); std::string comparitorName = comparitorPSet.getParameter("ComponentName"); diff --git a/RecoTracker/TkSeedGenerator/plugins/CombinedMultiHitGenerator.cc b/RecoTracker/TkSeedGenerator/plugins/CombinedMultiHitGenerator.cc index 5b6208dfd2add..37c59a2907b84 100644 --- a/RecoTracker/TkSeedGenerator/plugins/CombinedMultiHitGenerator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/CombinedMultiHitGenerator.cc @@ -12,7 +12,7 @@ CombinedMultiHitGenerator::CombinedMultiHitGenerator(const edm::ParameterSet& cf : theSeedingLayerToken(iC.consumes(cfg.getParameter("SeedingLayers"))) { edm::ParameterSet generatorPSet = cfg.getParameter("GeneratorPSet"); std::string generatorName = generatorPSet.getParameter("ComponentName"); - theGenerator = MultiHitGeneratorFromPairAndLayersFactory::get()->create(generatorName, generatorPSet); + theGenerator = MultiHitGeneratorFromPairAndLayersFactory::get()->create(generatorName, generatorPSet, iC); theGenerator->init(std::make_unique(0, 1, &theLayerCache), &theLayerCache); } diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc index ddd217370219c..69cb5dc6ae325 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitFromChi2EDProducer.cc @@ -33,7 +33,7 @@ class MultiHitFromChi2EDProducer : public edm::stream::EDProducer<> { MultiHitFromChi2EDProducer::MultiHitFromChi2EDProducer(const edm::ParameterSet& iConfig) : doubletToken_(consumes(iConfig.getParameter("doublets"))), - generator_(iConfig) { + generator_(iConfig, consumesCollector()) { produces(); produces >(); } diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc index 94198728f1eb7..4648b0286e9c3 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.cc @@ -3,7 +3,6 @@ #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromCircle.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" @@ -15,7 +14,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/RZLine.h" #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h" @@ -25,9 +23,6 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" #include "DataFormats/SiStripDetId/interface/SiStripDetId.h" -#include "MagneticField/Engine/interface/MagneticField.h" - -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "DataFormats/Math/interface/normalizedPhi.h" @@ -51,7 +46,7 @@ namespace { }; } // namespace -MultiHitGeneratorFromChi2::MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg) +MultiHitGeneratorFromChi2::MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) : MultiHitGeneratorFromPairAndLayers(cfg), useFixedPreFiltering(cfg.getParameter("useFixedPreFiltering")), extraHitRZtolerance( @@ -98,6 +93,16 @@ MultiHitGeneratorFromChi2::MultiHitGeneratorFromChi2(const edm::ParameterSet& cf filter = nullptr; bfield = nullptr; nomField = -1.; + + if (useSimpleMF_) { + magneticFieldESToken_ = iC.esConsumes(edm::ESInputTag("", mfName_)); + } else { + magneticFieldESToken_ = iC.esConsumes(); + } + if (refitHits) { + clusterShapeHitFilterESToken_ = iC.esConsumes(edm::ESInputTag("", filterName_)); + transientTrackingRecHitBuilderESToken_ = iC.esConsumes(edm::ESInputTag("", builderName_)); + } } MultiHitGeneratorFromChi2::~MultiHitGeneratorFromChi2() {} @@ -133,23 +138,14 @@ void MultiHitGeneratorFromChi2::fillDescriptions(edm::ParameterSetDescription& d } void MultiHitGeneratorFromChi2::initES(const edm::EventSetup& es) { - edm::ESHandle bfield_h; - if (useSimpleMF_) - es.get().get(mfName_, bfield_h); - else - es.get().get(bfield_h); - bfield = bfield_h.product(); + bfield = &es.getData(magneticFieldESToken_); nomField = bfield->nominalValue(); ufield.set(nomField); // more than enough (never actually used) if (refitHits) { - edm::ESHandle filterHandle_; - es.get().get(filterName_, filterHandle_); - filter = filterHandle_.product(); - - edm::ESHandle builderH; - es.get().get(builderName_, builderH); - builder = (TkTransientTrackingRecHitBuilder const*)(builderH.product()); + filter = &es.getData(clusterShapeHitFilterESToken_); + auto const& builderRef = es.getData(transientTrackingRecHitBuilderESToken_); + builder = (TkTransientTrackingRecHitBuilder const*)(&builderRef); cloner = (*builder).cloner(); } } diff --git a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h index 484d9d3d8c6f8..0745265712ccd 100644 --- a/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h +++ b/RecoTracker/TkSeedGenerator/plugins/MultiHitGeneratorFromChi2.h @@ -10,15 +10,22 @@ #include "RecoTracker/TkSeedGenerator/interface/MultiHitGenerator.h" #include "CombinedMultiHitGenerator.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "RecoTracker/TkSeedGenerator/interface/MultiHitGeneratorFromPairAndLayers.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "MagneticField/UniformEngine/interface/UniformMagneticField.h" #include @@ -30,7 +37,9 @@ class dso_hidden MultiHitGeneratorFromChi2 final : public MultiHitGeneratorFromP typedef CombinedMultiHitGenerator::LayerCacheType LayerCacheType; public: - MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg); + MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) + : MultiHitGeneratorFromChi2(cfg, iC) {} + MultiHitGeneratorFromChi2(const edm::ParameterSet& cfg, edm::ConsumesCollector&); ~MultiHitGeneratorFromChi2() override; @@ -119,5 +128,9 @@ class dso_hidden MultiHitGeneratorFromChi2 final : public MultiHitGeneratorFromP std::string mfName_; std::vector detIdsToDebug; + + edm::ESGetToken magneticFieldESToken_; + edm::ESGetToken clusterShapeHitFilterESToken_; + edm::ESGetToken transientTrackingRecHitBuilderESToken_; }; #endif diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc index ac8444a2021d0..d7bb7c4f7ae3e 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.cc @@ -3,13 +3,11 @@ #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h" #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/ESInputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" @@ -25,6 +23,20 @@ namespace { } // namespace +SeedFromConsecutiveHitsCreator::SeedFromConsecutiveHitsCreator(const edm::ParameterSet& cfg, + edm::ConsumesCollector&& iC) + : thePropagatorLabel(cfg.getParameter("propagator")), + theBOFFMomentum(cfg.getParameter("SeedMomentumForBOFF")), + theOriginTransverseErrorMultiplier(cfg.getParameter("OriginTransverseErrorMultiplier")), + theMinOneOverPtError(cfg.getParameter("MinOneOverPtError")), + TTRHBuilder(cfg.getParameter("TTRHBuilder")), + mfName_(cfg.getParameter("magneticField")), + forceKinematicWithRegionDirection_(cfg.getParameter("forceKinematicWithRegionDirection")), + trackerGeometryESToken_(iC.esConsumes()), + propagatorESToken_(iC.esConsumes(edm::ESInputTag("", thePropagatorLabel))), + magneticFieldESToken_(iC.esConsumes(edm::ESInputTag("", mfName_))), + transientTrackingRecHitBuilderESToken_(iC.esConsumes(edm::ESInputTag("", TTRHBuilder))) {} + SeedFromConsecutiveHitsCreator::~SeedFromConsecutiveHitsCreator() {} void SeedFromConsecutiveHitsCreator::fillDescriptions(edm::ParameterSetDescription& desc) { @@ -42,20 +54,15 @@ void SeedFromConsecutiveHitsCreator::init(const TrackingRegion& iregion, const SeedComparitor* ifilter) { region = &iregion; filter = ifilter; - // get tracker - es.get().get(tracker); - // get propagator - es.get().get(thePropagatorLabel, propagatorHandle); - // mag field - es.get().get(mfName_, bfield); - // edm::ESInputTag mfESInputTag(mfName_); - // es.get().get(mfESInputTag, bfield); - nomField = bfield->nominalValue(); + trackerGeometry_ = &es.getData(trackerGeometryESToken_); + propagator_ = &es.getData(propagatorESToken_); + magneticField_ = &es.getData(magneticFieldESToken_); + nomField = magneticField_->nominalValue(); isBOFF = (0 == nomField); - edm::ESHandle builderH; - es.get().get(TTRHBuilder, builderH); - auto builder = (TkTransientTrackingRecHitBuilder const*)(builderH.product()); + TransientTrackingRecHitBuilder const* transientTrackingRecHitBuilder = + &es.getData(transientTrackingRecHitBuilderESToken_); + auto builder = (TkTransientTrackingRecHitBuilder const*)(transientTrackingRecHitBuilder); cloner = (*builder).cloner(); } @@ -111,18 +118,18 @@ bool SeedFromConsecutiveHitsCreator::initialKinematic(GlobalTrajectoryParameters const GlobalPoint& vertexPos = region->origin(); - FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &*bfield); + FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, magneticField_); if (helix.isValid()) { kine = helix.stateAtVertex(); } else { GlobalVector initMomentum(tth2->globalPosition() - vertexPos); initMomentum *= (100.f / initMomentum.perp()); - kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield); + kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, magneticField_); } if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) { - kine = - GlobalTrajectoryParameters(kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &*bfield); + kine = GlobalTrajectoryParameters( + kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_); } return (filter ? filter->compatible(hits, kine, helix) : true); } @@ -152,8 +159,6 @@ CurvilinearTrajectoryError SeedFromConsecutiveHitsCreator::initialError(float si void SeedFromConsecutiveHitsCreator::buildSeed(TrajectorySeedCollection& seedCollection, const SeedingHitSet& hits, const FreeTrajectoryState& fts) const { - const Propagator* propagator = &(*propagatorHandle); - // get updator KFUpdator updator; @@ -166,8 +171,8 @@ void SeedFromConsecutiveHitsCreator::buildSeed(TrajectorySeedCollection& seedCol for (unsigned int iHit = 0; iHit < hits.size(); iHit++) { hit = hits[iHit]->hit(); TrajectoryStateOnSurface state = - (iHit == 0) ? propagator->propagate(fts, tracker->idToDet(hit->geographicalId())->surface()) - : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface()); + (iHit == 0) ? propagator_->propagate(fts, trackerGeometry_->idToDet(hit->geographicalId())->surface()) + : propagator_->propagate(updatedState, trackerGeometry_->idToDet(hit->geographicalId())->surface()); if (!state.isValid()) return; diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h index 3d22523f3feb8..ab4cd69c6cf7a 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsCreator.h @@ -5,34 +5,27 @@ #include "RecoTracker/TkSeedGenerator/interface/SeedCreator.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "MagneticField/Engine/interface/MagneticField.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "TrackingTools/GeomPropagators/interface/Propagator.h" +#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h" -namespace edm { - class ParameterSetDescription; -} class FreeTrajectoryState; class dso_hidden SeedFromConsecutiveHitsCreator : public SeedCreator { public: - SeedFromConsecutiveHitsCreator(const edm::ParameterSet &cfg) - : thePropagatorLabel(cfg.getParameter("propagator")), - theBOFFMomentum(cfg.getParameter("SeedMomentumForBOFF")), - theOriginTransverseErrorMultiplier(cfg.getParameter("OriginTransverseErrorMultiplier")), - theMinOneOverPtError(cfg.getParameter("MinOneOverPtError")), - TTRHBuilder(cfg.getParameter("TTRHBuilder")), - mfName_(cfg.getParameter("magneticField")), - forceKinematicWithRegionDirection_(cfg.getParameter("forceKinematicWithRegionDirection")) {} - - //dtor + SeedFromConsecutiveHitsCreator(const edm::ParameterSet &, edm::ConsumesCollector &&); + ~SeedFromConsecutiveHitsCreator() override; static void fillDescriptions(edm::ParameterSetDescription &desc); @@ -67,9 +60,9 @@ class dso_hidden SeedFromConsecutiveHitsCreator : public SeedCreator { const TrackingRegion *region = nullptr; const SeedComparitor *filter = nullptr; - edm::ESHandle tracker; - edm::ESHandle propagatorHandle; - edm::ESHandle bfield; + TrackerGeometry const *trackerGeometry_; + Propagator const *propagator_; + MagneticField const *magneticField_; float nomField; bool isBOFF = false; std::string TTRHBuilder; @@ -77,5 +70,10 @@ class dso_hidden SeedFromConsecutiveHitsCreator : public SeedCreator { bool forceKinematicWithRegionDirection_; TkClonerImpl cloner; + + const edm::ESGetToken trackerGeometryESToken_; + const edm::ESGetToken propagatorESToken_; + const edm::ESGetToken magneticFieldESToken_; + const edm::ESGetToken transientTrackingRecHitBuilderESToken_; }; #endif diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.cc b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.cc index f50c8bf7f3e4b..cc28931261539 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.cc @@ -14,7 +14,7 @@ bool SeedFromConsecutiveHitsStraightLineCreator::initialKinematic(GlobalTrajecto double rescale = 1000. / initMomentum.perp(); initMomentum *= rescale; // set to approximately infinite momentum TrackCharge q = 1; // irrelevant, since infinite momentum - kine = GlobalTrajectoryParameters(vertexPos, initMomentum, q, &*bfield); + kine = GlobalTrajectoryParameters(vertexPos, initMomentum, q, magneticField_); return true; } diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.h b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.h index 769f5258032bb..a8362950acc65 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.h @@ -2,13 +2,15 @@ #define RecoTracker_TkSeedGenerator_SeedFromConsecutiveHitsStraightLineCreator_H #include "FWCore/Utilities/interface/Visibility.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "SeedFromConsecutiveHitsCreator.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" class FreeTrajectoryState; class dso_hidden SeedFromConsecutiveHitsStraightLineCreator final : public SeedFromConsecutiveHitsCreator { public: - SeedFromConsecutiveHitsStraightLineCreator(const edm::ParameterSet& cfg) : SeedFromConsecutiveHitsCreator(cfg) {} + SeedFromConsecutiveHitsStraightLineCreator(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) + : SeedFromConsecutiveHitsCreator(cfg, std::move(iC)) {} ~SeedFromConsecutiveHitsStraightLineCreator() override {} diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.cc b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.cc index ac043ae3cf92c..6839d209725f8 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.cc @@ -24,30 +24,30 @@ bool SeedFromConsecutiveHitsTripletOnlyCreator::initialKinematic(GlobalTrajector tth2->globalPosition(), tth1->globalPosition(), nomField, - &*bfield, + magneticField_, tth1->globalPosition()); kine = helix.stateAtVertex(); if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) { kine = GlobalTrajectoryParameters( - kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &*bfield); + kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_); } return (filter ? filter->compatible(hits, kine, helix) : true); } const GlobalPoint& vertexPos = region->origin(); - FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &*bfield); + FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, magneticField_); if (helix.isValid()) { kine = helix.stateAtVertex(); } else { GlobalVector initMomentum(tth2->globalPosition() - vertexPos); initMomentum *= (100. / initMomentum.perp()); - kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, &*bfield); + kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, magneticField_); } if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) { - kine = - GlobalTrajectoryParameters(kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &*bfield); + kine = GlobalTrajectoryParameters( + kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_); } return (filter ? filter->compatible(hits, kine, helix) : true); } diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h index 5277922498049..3c135a1b843ec 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsTripletOnlyCreator.h @@ -2,11 +2,13 @@ #define RecoTracker_TkSeedGenerator_SeedFromConsecutiveHitsTripletOnlyCreator_H #include "FWCore/Utilities/interface/Visibility.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "SeedFromConsecutiveHitsCreator.h" class dso_hidden SeedFromConsecutiveHitsTripletOnlyCreator final : public SeedFromConsecutiveHitsCreator { public: - SeedFromConsecutiveHitsTripletOnlyCreator(const edm::ParameterSet& cfg) : SeedFromConsecutiveHitsCreator(cfg) {} + SeedFromConsecutiveHitsTripletOnlyCreator(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC) + : SeedFromConsecutiveHitsCreator(cfg, std::move(iC)) {} static void fillDescriptions(edm::ParameterSetDescription& desc) { SeedFromConsecutiveHitsCreator::fillDescriptions(desc); diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.cc index b2c47f7afeca0..7872fc6423894 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.cc @@ -10,14 +10,15 @@ #include "RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" -#include "SeedFromConsecutiveHitsCreator.h" #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h" #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -64,8 +65,7 @@ void SeedGeneratorFromProtoTracksEDProducer::fillDescriptions(edm::Configuration } SeedGeneratorFromProtoTracksEDProducer::SeedGeneratorFromProtoTracksEDProducer(const ParameterSet& cfg) - : theConfig(cfg), - originHalfLength(cfg.getParameter("originHalfLength")), + : originHalfLength(cfg.getParameter("originHalfLength")), originRadius(cfg.getParameter("originRadius")), useProtoTrackKinematics(cfg.getParameter("useProtoTrackKinematics")), useEventsWithNoVertex(cfg.getParameter("useEventsWithNoVertex")), @@ -74,7 +74,8 @@ SeedGeneratorFromProtoTracksEDProducer::SeedGeneratorFromProtoTracksEDProducer(c includeFourthHit_(cfg.getParameter("includeFourthHit")), theInputCollectionTag(consumes(cfg.getParameter("InputCollection"))), theInputVertexCollectionTag( - consumes(cfg.getParameter("InputVertexCollection"))) { + consumes(cfg.getParameter("InputVertexCollection"))), + seedCreator_(cfg.getParameter("SeedCreatorPSet"), consumesCollector()) { produces(); } @@ -143,10 +144,8 @@ void SeedGeneratorFromProtoTracksEDProducer::produce(edm::Event& ev, const edm:: sqrt(proto.momentum().x() * proto.momentum().x() + proto.momentum().y() * proto.momentum().y()); GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2); - edm::ParameterSet seedCreatorPSet = theConfig.getParameter("SeedCreatorPSet"); - SeedFromConsecutiveHitsCreator seedCreator(seedCreatorPSet); - seedCreator.init(region, es, nullptr); - seedCreator.makeSeed( + seedCreator_.init(region, es, nullptr); + seedCreator_.makeSeed( *result, SeedingHitSet(hits[0], hits[1], diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.h b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.h index 67999ee453a1c..04bd083573956 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.h +++ b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromProtoTracksEDProducer.h @@ -3,9 +3,11 @@ #include "FWCore/Utilities/interface/Visibility.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "SeedFromConsecutiveHitsCreator.h" + +#include namespace edm { class Event; @@ -20,7 +22,6 @@ class dso_hidden SeedGeneratorFromProtoTracksEDProducer : public edm::stream::ED static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - const edm::ParameterSet theConfig; const double originHalfLength; const double originRadius; const bool useProtoTrackKinematics; @@ -30,5 +31,6 @@ class dso_hidden SeedGeneratorFromProtoTracksEDProducer : public edm::stream::ED const bool includeFourthHit_; const edm::EDGetTokenT theInputCollectionTag; const edm::EDGetTokenT theInputVertexCollectionTag; + SeedFromConsecutiveHitsCreator seedCreator_; }; #endif diff --git a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromRegionHitsEDProducer.cc b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromRegionHitsEDProducer.cc index cfa46abdb5cf7..245bdc2b4216c 100644 --- a/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromRegionHitsEDProducer.cc +++ b/RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromRegionHitsEDProducer.cc @@ -51,7 +51,7 @@ SeedGeneratorFromRegionHitsEDProducer::SeedGeneratorFromRegionHitsEDProducer(con theGenerator = std::make_unique( OrderedHitsGeneratorFactory::get()->create(hitsfactoryName, hitsfactoryPSet, iC), std::move(aComparitor), - SeedCreatorFactory::get()->create(creatorName, creatorPSet)); + SeedCreatorFactory::get()->create(creatorName, creatorPSet, consumesCollector())); produces(); } From 1ba8a5d545312b1324b80daa325753472231950d Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Sep 2021 16:19:57 -0500 Subject: [PATCH 367/923] Use esConsumes in TrackProducerBase --- .../interface/TrackProducerBase.h | 16 ++++ .../interface/TrackProducerBase.icc | 83 ++++++++++++------- 2 files changed, 67 insertions(+), 32 deletions(-) diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.h b/RecoTracker/TrackProducer/interface/TrackProducerBase.h index e69756b8d874c..e12423ad4d117 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.h +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.h @@ -18,6 +18,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" +#include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" @@ -34,6 +35,12 @@ class TrackerGeometry; class TrajectoryFitter; class TransientTrackingRecHitBuilder; class NavigationSchool; +class TrackerDigiGeometryRecord; +class IdealMagneticFieldRecord; +class TransientRecHitRecord; +class TrackingComponentsRecord; +class NavigationSchoolRecord; +class CkfComponentsRecord; template class TrackProducerBase : public AlgoProductTraits { @@ -95,7 +102,16 @@ class TrackProducerBase : public AlgoProductTraits { edm::EDGetTokenT bsSrc_; edm::EDGetTokenT mteSrc_; + edm::ESGetToken trackGeomSrc_; + edm::ESGetToken mfSrc_; + edm::ESGetToken fitterSrc_; + edm::ESGetToken propagatorSrc_; + edm::ESGetToken builderSrc_; + edm::ESGetToken measTkSrc_; + edm::ESGetToken schoolSrc_; + edm::ESHandle theSchool; + bool useSchool_ = false; }; #include "RecoTracker/TrackProducer/interface/TrackProducerBase.icc" diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc index 6566531b70139..1da9d8c514d13 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc @@ -46,6 +46,48 @@ void TrackProducerBase::initTrackProducerBase(const edm::ParameterSet& conf, src_ = src; bsSrc_ = cc.consumes(conf.getParameter("beamSpot")); mteSrc_ = cc.consumes(conf.getParameter("MeasurementTrackerEvent")); + + trackGeomSrc_ = cc.esConsumes(); + + // 2014/02/11 mia: + // we should get rid of the boolean parameter useSimpleMF, + // and use only a string magneticField [instead of SimpleMagneticField] + // or better an edm::ESInputTag (at the moment HLT does not handle ESInputTag) + bool useSimpleMF = false; + if (conf_.exists("useSimpleMF")) + useSimpleMF = conf_.getParameter("useSimpleMF"); + std::string mfName = ""; + if (useSimpleMF) { + mfName = conf_.getParameter("SimpleMagneticField"); + } + mfSrc_ = cc.esConsumes(edm::ESInputTag("", mfName)); + + std::string fitterName = conf_.getParameter("Fitter"); + fitterSrc_ = cc.esConsumes(edm::ESInputTag("", fitterName)); + + std::string propagatorName = conf_.getParameter("Propagator"); + propagatorSrc_ = cc.esConsumes(edm::ESInputTag("", propagatorName)); + + std::string builderName = conf_.getParameter("TTRHBuilder"); + builderSrc_ = cc.esConsumes(edm::ESInputTag("", builderName)); + + // + // get also the measurementTracker and the NavigationSchool + // (they are necessary to fill in the secondary hit patterns) + // + + std::string theNavigationSchool = ""; + if (conf_.exists("NavigationSchool")) + theNavigationSchool = conf_.getParameter("NavigationSchool"); + else + edm::LogWarning("TrackProducerBase") + << " NavigationSchool parameter not set. secondary hit pattern will not be filled."; + if (!theNavigationSchool.empty()) { + useSchool_ = true; + schoolSrc_ = cc.esConsumes(edm::ESInputTag("", theNavigationSchool)); + std::string measTkName = conf_.getParameter("MeasurementTracker"); + measTkSrc_ = cc.esConsumes(edm::ESInputTag("", measTkName)); + } } // ------------ method called to produce the data ------------ @@ -63,68 +105,45 @@ void TrackProducerBase::getFromES(const edm::EventSetup& setup, // LogDebug("TrackProducer") << "get geometry" << "\n"; - setup.get().get(theG); + theG = setup.getHandle(trackGeomSrc_); // //get magnetic field // LogDebug("TrackProducer") << "get magnetic field" << "\n"; - // 2014/02/11 mia: - // we should get rid of the boolean parameter useSimpleMF, - // and use only a string magneticField [instead of SimpleMagneticField] - // or better an edm::ESInputTag (at the moment HLT does not handle ESInputTag) - bool useSimpleMF = false; - if (conf_.exists("useSimpleMF")) - useSimpleMF = conf_.getParameter("useSimpleMF"); - std::string mfName = ""; - if (useSimpleMF) { - mfName = conf_.getParameter("SimpleMagneticField"); - } - setup.get().get(mfName, theMF); - // edm::ESInputTag mfESInputTag(mfName); - // setup.get().get(mfESInputTag, theMF); + theMF = setup.getHandle(mfSrc_); // // get the fitter from the ES // LogDebug("TrackProducer") << "get the fitter from the ES" << "\n"; - std::string fitterName = conf_.getParameter("Fitter"); - setup.get().get(fitterName, theFitter); + theFitter = setup.getHandle(fitterSrc_); // // get also the propagator // LogDebug("TrackProducer") << "get also the propagator" << "\n"; - std::string propagatorName = conf_.getParameter("Propagator"); - setup.get().get(propagatorName, thePropagator); + thePropagator = setup.getHandle(propagatorSrc_); // // get the builder // LogDebug("TrackProducer") << "get also the TransientTrackingRecHitBuilder" << "\n"; - std::string builderName = conf_.getParameter("TTRHBuilder"); - setup.get().get(builderName, theBuilder); + theBuilder = setup.getHandle(builderSrc_); // // get also the measurementTracker and the NavigationSchool // (they are necessary to fill in the secondary hit patterns) // - LogDebug("TrackProducer") << "get a navigation school"; - std::string theNavigationSchool = ""; - if (conf_.exists("NavigationSchool")) - theNavigationSchool = conf_.getParameter("NavigationSchool"); - else - edm::LogWarning("TrackProducerBase") - << " NavigationSchool parameter not set. secondary hit pattern will not be filled."; - if (!theNavigationSchool.empty()) { - setup.get().get(theNavigationSchool, theSchool); + if (useSchool_) { + LogDebug("TrackProducer") << "get a navigation school"; + theSchool = setup.getHandle(schoolSrc_); LogDebug("TrackProducer") << "get also the measTk" << "\n"; - std::string measTkName = conf_.getParameter("MeasurementTracker"); - setup.get().get(measTkName, theMeasTk); + theMeasTk = setup.getHandle(measTkSrc_); } else { theSchool = edm::ESHandle(); //put an invalid handle theMeasTk = edm::ESHandle(); //put an invalid handle From 0758643de8f0e3843755ef9d956a24d9d47d61e4 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 2 Sep 2021 23:47:17 +0200 Subject: [PATCH 368/923] Add a comment as suggested by Carl --- Configuration/Geometry/python/GeometryDDDSimDB_cff.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py index 06d6ab32f408f..cfdc361714b58 100644 --- a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py +++ b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py @@ -4,6 +4,10 @@ # Geometry master configuration # # Ideal geometry, needed for simulation +# +# Strictly xpeaking muonOffsetESProducer_cff is not needed; +# added for consistency with the DD4Hep version +# from GeometryReaders.XMLIdealGeometryESSource.cmsGeometryDB_cff import * from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * from Geometry.TrackerNumberingBuilder.trackerNumberingGeometryDB_cfi import * From b9eb87d23ae9b4fd653d9b54a72707dcea027aa5 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Fri, 3 Sep 2021 00:11:50 +0200 Subject: [PATCH 369/923] reformat + clang-format --- .../PPSAlignmentConfigurationESSource.cc | 111 +++++++++--------- .../interface/PPSAlignmentConfigurationRcd.h | 3 +- .../interface/PPSAlignmentConfiguration.h | 40 +++---- .../src/PPSAlignmentConfiguration.cc | 65 +++++----- .../RetrievePPSAlignmentConfiguration.cc | 11 +- .../CTPPS/plugins/WritePPSAlignmentConfig.cc | 10 +- 6 files changed, 125 insertions(+), 115 deletions(-) diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc index 4af9a8b9279cd..3ea6fc4c7739a 100644 --- a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc @@ -34,20 +34,20 @@ class PPSAlignmentConfigurationESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { public: - PPSAlignmentConfigurationESSource(const edm::ParameterSet &iConfig); + PPSAlignmentConfigurationESSource(const edm::ParameterSet& iConfig); - std::unique_ptr produce(const PPSAlignmentConfigurationRcd &); - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + std::unique_ptr produce(const PPSAlignmentConfigurationRcd&); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc); - TDirectory *findDirectoryWithName(TDirectory *dir, std::string searchName); - std::vector buildVectorFromDirectory(TDirectory *dir, - const PPSAlignmentConfiguration::RPConfig &rpd); + int fitProfile(TProfile* p, double x_mean, double x_rms, double& sl, double& sl_unc); + TDirectory* findDirectoryWithName(TDirectory* dir, std::string searchName); + std::vector buildVectorFromDirectory( + TDirectory* dir, const PPSAlignmentConfiguration::RPConfig& rpd); - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, - const edm::IOVSyncValue &iosv, - edm::ValidityInterval &oValidity) override; + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey& key, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) override; bool debug; @@ -87,11 +87,11 @@ class PPSAlignmentConfigurationESSource : public edm::ESProducer, public edm::Ev //--------------------------------------------------------------------------------------------- -PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm::ParameterSet &iConfig) { +PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm::ParameterSet& iConfig) { label = iConfig.getParameter("label"); debug = iConfig.getParameter("debug"); - TFile *debugFile = nullptr; + TFile* debugFile = nullptr; if (debug) { debugFile = new TFile(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate"); } @@ -107,16 +107,16 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: sectorConfig56.rp_F_.position_ = "F"; for (std::string sectorName : {"sector_45", "sector_56"}) { - const auto &sps = iConfig.getParameter(sectorName); - PPSAlignmentConfiguration::SectorConfig *sc; + const auto& sps = iConfig.getParameter(sectorName); + PPSAlignmentConfiguration::SectorConfig* sc; if (sectorName == "sector_45") sc = §orConfig45; else sc = §orConfig56; for (std::string rpName : {"rp_N", "rp_F"}) { - const auto &rpps = sps.getParameter(rpName); - PPSAlignmentConfiguration::RPConfig *rc; + const auto& rpps = sps.getParameter(rpName); + PPSAlignmentConfiguration::RPConfig* rc; if (rpName == "rp_N") rc = &sc->rp_N_; else @@ -162,7 +162,7 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; - std::map rpConfigs = { + std::map rpConfigs = { {sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, @@ -179,9 +179,9 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: maxRPTracksSize = iConfig.getParameter("max_RP_tracks_size"); n_si = iConfig.getParameter("n_si"); - const auto &c_axo = iConfig.getParameter("x_alignment_meth_o"); - for (const auto &p : rpTags) { - const auto &ps = c_axo.getParameter(p.second); + const auto& c_axo = iConfig.getParameter("x_alignment_meth_o"); + for (const auto& p : rpTags) { + const auto& ps = c_axo.getParameter(p.second); alignment_x_meth_o_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; } fitProfileMinBinEntries = c_axo.getParameter("fit_profile_min_bin_entries"); @@ -189,26 +189,26 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: methOGraphMinN = c_axo.getParameter("meth_o_graph_min_N"); methOUncFitRange = c_axo.getParameter("meth_o_unc_fit_range"); - const auto &c_m = iConfig.getParameter("matching"); - const auto &referenceDataset = c_m.getParameter("reference_dataset"); + const auto& c_m = iConfig.getParameter("matching"); + const auto& referenceDataset = c_m.getParameter("reference_dataset"); // constructing vectors with reference data if (!referenceDataset.empty()) { - TFile *f_ref = TFile::Open(referenceDataset.c_str()); + TFile* f_ref = TFile::Open(referenceDataset.c_str()); if (!f_ref->IsOpen()) { edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset; } else { - TDirectory *ad_ref = findDirectoryWithName((TDirectory *)f_ref, sectorConfig45.name_); + TDirectory* ad_ref = findDirectoryWithName((TDirectory*)f_ref, sectorConfig45.name_); if (ad_ref == nullptr) { edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset; } else { edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath(); - for (const auto &p : rpTags) { + for (const auto& p : rpTags) { if (debug) gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref"); - auto *d_ref = (TDirectory *)ad_ref->Get( + auto* d_ref = (TDirectory*)ad_ref->Get( (sectorNames[p.first] + "/near_far/x slices, " + rpConfigs[p.first]->position_).c_str()); if (d_ref == nullptr) { edm::LogWarning("PPS") << "[ESSource] could not load d_ref"; @@ -221,29 +221,29 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: delete f_ref; } - for (const auto &p : rpTags) { - const auto &ps = c_m.getParameter(p.second); + for (const auto& p : rpTags) { + const auto& ps = c_m.getParameter(p.second); matchingShiftRanges[p.first] = {ps.getParameter("sh_min"), ps.getParameter("sh_max")}; } - const auto &c_axr = iConfig.getParameter("x_alignment_relative"); - for (const auto &p : rpTags) { + const auto& c_axr = iConfig.getParameter("x_alignment_relative"); + for (const auto& p : rpTags) { if (p.second.back() == 'N') { // only near RPs - const auto &ps = c_axr.getParameter(p.second); + const auto& ps = c_axr.getParameter(p.second); alignment_x_relative_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; } } nearFarMinEntries = c_axr.getParameter("near_far_min_entries"); - const auto &c_ay = iConfig.getParameter("y_alignment"); - for (const auto &p : rpTags) { - const auto &ps = c_ay.getParameter(p.second); + const auto& c_ay = iConfig.getParameter("y_alignment"); + for (const auto& p : rpTags) { + const auto& ps = c_ay.getParameter(p.second); alignment_y_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; } modeGraphMinN = c_ay.getParameter("mode_graph_min_N"); multSelProjYMinEntries = c_ay.getParameter("mult_sel_proj_y_min_entries"); - const auto &bps = iConfig.getParameter("binning"); + const auto& bps = iConfig.getParameter("binning"); binning.bin_size_x_ = bps.getParameter("bin_size_x"); binning.n_bins_x_ = bps.getParameter("n_bins_x"); binning.pixel_x_offset_ = bps.getParameter("pixel_x_offset"); @@ -271,7 +271,8 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: //--------------------------------------------------------------------------------------------- -std::unique_ptr PPSAlignmentConfigurationESSource::produce(const PPSAlignmentConfigurationRcd &) { +std::unique_ptr PPSAlignmentConfigurationESSource::produce( + const PPSAlignmentConfigurationRcd&) { auto p = std::make_unique(); p->setSectorConfig45(sectorConfig45); @@ -316,7 +317,7 @@ std::unique_ptr PPSAlignmentConfigurationESSource::pr //--------------------------------------------------------------------------------------------- // most default values come from 2018 period -void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { +void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("debug", false); @@ -580,7 +581,7 @@ void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescr //--------------------------------------------------------------------------------------------- // Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). -int PPSAlignmentConfigurationESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { +int PPSAlignmentConfigurationESSource::fitProfile(TProfile* p, double x_mean, double x_rms, double& sl, double& sl_unc) { unsigned int n_reasonable = 0; for (int bi = 1; bi <= p->GetNbinsX(); bi++) { if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { @@ -596,7 +597,7 @@ int PPSAlignmentConfigurationESSource::fitProfile(TProfile *p, double x_mean, do double x_min = x_mean - x_rms, x_max = x_mean + x_rms; - TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); + TF1* ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); ff_pol1->SetParameter(0., 0.); p->Fit(ff_pol1, "Q", "", x_min, x_max); @@ -611,23 +612,23 @@ int PPSAlignmentConfigurationESSource::fitProfile(TProfile *p, double x_mean, do // Performs a breadth first search on dir. If found, returns the directory with object // named searchName inside. Otherwise, returns nullptr. -TDirectory *PPSAlignmentConfigurationESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { +TDirectory* PPSAlignmentConfigurationESSource::findDirectoryWithName(TDirectory* dir, std::string searchName) { TIter next(dir->GetListOfKeys()); - std::queue dirQueue; - TObject *o; + std::queue dirQueue; + TObject* o; while ((o = next())) { - TKey *k = (TKey *)o; + TKey* k = (TKey*)o; std::string name = k->GetName(); if (name == searchName) return dir; - if (((TSystemFile *)k)->IsDirectory()) - dirQueue.push((TDirectory *)k->ReadObj()); + if (((TSystemFile*)k)->IsDirectory()) + dirQueue.push((TDirectory*)k->ReadObj()); } while (!dirQueue.empty()) { - TDirectory *resultDir = findDirectoryWithName(dirQueue.front(), searchName); + TDirectory* resultDir = findDirectoryWithName(dirQueue.front(), searchName); dirQueue.pop(); if (resultDir != nullptr) return resultDir; @@ -640,23 +641,23 @@ TDirectory *PPSAlignmentConfigurationESSource::findDirectoryWithName(TDirectory // Builds vector of PointErrors instances from slice plots in dir. std::vector PPSAlignmentConfigurationESSource::buildVectorFromDirectory( - TDirectory *dir, const PPSAlignmentConfiguration::RPConfig &rpd) { + TDirectory* dir, const PPSAlignmentConfiguration::RPConfig& rpd) { std::vector pv; TIter next(dir->GetListOfKeys()); - TObject *o; + TObject* o; while ((o = next())) { - TKey *k = (TKey *)o; + TKey* k = (TKey*)o; std::string name = k->GetName(); size_t d = name.find('-'); const double x_min = std::stod(name.substr(0, d)); const double x_max = std::stod(name.substr(d + 1)); - TDirectory *d_slice = (TDirectory *)k->ReadObj(); + TDirectory* d_slice = (TDirectory*)k->ReadObj(); - TH1D *h_y = (TH1D *)d_slice->Get("h_y"); - TProfile *p_y_diffFN_vs_y = (TProfile *)d_slice->Get("p_y_diffFN_vs_y"); + TH1D* h_y = (TH1D*)d_slice->Get("h_y"); + TProfile* p_y_diffFN_vs_y = (TProfile*)d_slice->Get("p_y_diffFN_vs_y"); double y_cen = h_y->GetMean(); double y_width = h_y->GetRMS(); @@ -680,9 +681,9 @@ std::vector PPSAlignmentConfigurationESS //--------------------------------------------------------------------------------------------- -void PPSAlignmentConfigurationESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, - const edm::IOVSyncValue &iosv, - edm::ValidityInterval &oValidity) { +void PPSAlignmentConfigurationESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& key, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) { edm::LogInfo("PPS") << ">> PPSAlignmentConfigurationESSource::setIntervalFor(" << key.name() << ")\n" << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); diff --git a/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h index 0cea1cc246488..159b1873f7e00 100644 --- a/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h +++ b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h @@ -9,6 +9,7 @@ #include "FWCore/Framework/interface/EventSetupRecordImplementation.h" -class PPSAlignmentConfigurationRcd : public edm::eventsetup::EventSetupRecordImplementation {}; +class PPSAlignmentConfigurationRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; #endif diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h index 3d1ab028440a6..f5ac52d169da6 100644 --- a/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h @@ -83,8 +83,8 @@ class PPSAlignmentConfiguration { }; // Getters - const SectorConfig §orConfig45() const; - const SectorConfig §orConfig56() const; + const SectorConfig& sectorConfig45() const; + const SectorConfig& sectorConfig56() const; double x_ali_sh_step() const; @@ -97,27 +97,27 @@ class PPSAlignmentConfiguration { double maxRPTracksSize() const; double n_si() const; - const std::map> &matchingReferencePoints() const; - const std::map &matchingShiftRanges() const; + const std::map>& matchingReferencePoints() const; + const std::map& matchingShiftRanges() const; - const std::map &alignment_x_meth_o_ranges() const; + const std::map& alignment_x_meth_o_ranges() const; unsigned int fitProfileMinBinEntries() const; unsigned int fitProfileMinNReasonable() const; unsigned int methOGraphMinN() const; double methOUncFitRange() const; - const std::map &alignment_x_relative_ranges() const; + const std::map& alignment_x_relative_ranges() const; unsigned int nearFarMinEntries() const; - const std::map &alignment_y_ranges() const; + const std::map& alignment_y_ranges() const; unsigned int modeGraphMinN() const; unsigned int multSelProjYMinEntries() const; - const Binning &binning() const; + const Binning& binning() const; // Setters - void setSectorConfig45(SectorConfig §orConfig45); - void setSectorConfig56(SectorConfig §orConfig56); + void setSectorConfig45(SectorConfig& sectorConfig45); + void setSectorConfig56(SectorConfig& sectorConfig56); void setX_ali_sh_step(double x_ali_sh_step); @@ -130,26 +130,26 @@ class PPSAlignmentConfiguration { void setMaxRPTracksSize(unsigned int maxRPTracksSize); void setN_si(double n_si); - void setMatchingReferencePoints(std::map> &matchingReferencePoints); - void setMatchingShiftRanges(std::map &matchingShiftRanges); + void setMatchingReferencePoints(std::map>& matchingReferencePoints); + void setMatchingShiftRanges(std::map& matchingShiftRanges); - void setAlignment_x_meth_o_ranges(std::map &alignment_x_meth_o_ranges); + void setAlignment_x_meth_o_ranges(std::map& alignment_x_meth_o_ranges); void setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries); void setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable); void setMethOGraphMinN(unsigned int methOGraphMinN); void setMethOUncFitRange(double methOUncFitRange); - void setAlignment_x_relative_ranges(std::map &alignment_x_relative_ranges); + void setAlignment_x_relative_ranges(std::map& alignment_x_relative_ranges); void setNearFarMinEntries(unsigned int nearFarMinEntries); - void setAlignment_y_ranges(std::map &alignment_y_ranges); + void setAlignment_y_ranges(std::map& alignment_y_ranges); void setModeGraphMinN(unsigned int modeGraphMinN); void setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries); - void setBinning(Binning &binning); + void setBinning(Binning& binning); // << operator - friend std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c); + friend std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c); private: SectorConfig sectorConfig45_, sectorConfig56_; @@ -186,8 +186,8 @@ class PPSAlignmentConfiguration { COND_SERIALIZABLE; }; -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::RPConfig &rc); -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::SectorConfig &sc); -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Binning &b); +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc); +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::SectorConfig& sc); +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binning& b); #endif diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc index 96e4232925032..757cbde15105c 100644 --- a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc @@ -12,8 +12,12 @@ // -------------------------------- PPSAlignmentConfiguration getters -------------------------------- -const PPSAlignmentConfiguration::SectorConfig &PPSAlignmentConfiguration::sectorConfig45() const { return sectorConfig45_; } -const PPSAlignmentConfiguration::SectorConfig &PPSAlignmentConfiguration::sectorConfig56() const { return sectorConfig56_; } +const PPSAlignmentConfiguration::SectorConfig& PPSAlignmentConfiguration::sectorConfig45() const { + return sectorConfig45_; +} +const PPSAlignmentConfiguration::SectorConfig& PPSAlignmentConfiguration::sectorConfig56() const { + return sectorConfig56_; +} double PPSAlignmentConfiguration::x_ali_sh_step() const { return x_ali_sh_step_; } @@ -26,15 +30,17 @@ double PPSAlignmentConfiguration::minRPTracksSize() const { return minRPTracksSi double PPSAlignmentConfiguration::maxRPTracksSize() const { return maxRPTracksSize_; } double PPSAlignmentConfiguration::n_si() const { return n_si_; } -const std::map> - &PPSAlignmentConfiguration::matchingReferencePoints() const { +const std::map>& +PPSAlignmentConfiguration::matchingReferencePoints() const { return matchingReferencePoints_; } -const std::map &PPSAlignmentConfiguration::matchingShiftRanges() const { +const std::map& +PPSAlignmentConfiguration::matchingShiftRanges() const { return matchingShiftRanges_; } -const std::map &PPSAlignmentConfiguration::alignment_x_meth_o_ranges() const { +const std::map& +PPSAlignmentConfiguration::alignment_x_meth_o_ranges() const { return alignment_x_meth_o_ranges_; } unsigned int PPSAlignmentConfiguration::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; } @@ -42,26 +48,27 @@ unsigned int PPSAlignmentConfiguration::fitProfileMinNReasonable() const { retur unsigned int PPSAlignmentConfiguration::methOGraphMinN() const { return methOGraphMinN_; } double PPSAlignmentConfiguration::methOUncFitRange() const { return methOUncFitRange_; } -const std::map &PPSAlignmentConfiguration::alignment_x_relative_ranges() - const { +const std::map& +PPSAlignmentConfiguration::alignment_x_relative_ranges() const { return alignment_x_relative_ranges_; } unsigned int PPSAlignmentConfiguration::nearFarMinEntries() const { return nearFarMinEntries_; } -const std::map &PPSAlignmentConfiguration::alignment_y_ranges() const { +const std::map& PPSAlignmentConfiguration::alignment_y_ranges() + const { return alignment_y_ranges_; } unsigned int PPSAlignmentConfiguration::modeGraphMinN() const { return modeGraphMinN_; } unsigned int PPSAlignmentConfiguration::multSelProjYMinEntries() const { return multSelProjYMinEntries_; } -const PPSAlignmentConfiguration::Binning &PPSAlignmentConfiguration::binning() const { return binning_; } +const PPSAlignmentConfiguration::Binning& PPSAlignmentConfiguration::binning() const { return binning_; } // -------------------------------- PPSAlignmentConfiguration setters -------------------------------- -void PPSAlignmentConfiguration::setSectorConfig45(PPSAlignmentConfiguration::SectorConfig §orConfig45) { +void PPSAlignmentConfiguration::setSectorConfig45(PPSAlignmentConfiguration::SectorConfig& sectorConfig45) { sectorConfig45_ = sectorConfig45; } -void PPSAlignmentConfiguration::setSectorConfig56(PPSAlignmentConfiguration::SectorConfig §orConfig56) { +void PPSAlignmentConfiguration::setSectorConfig56(PPSAlignmentConfiguration::SectorConfig& sectorConfig56) { sectorConfig56_ = sectorConfig56; } @@ -79,16 +86,16 @@ void PPSAlignmentConfiguration::setMaxRPTracksSize(unsigned int maxRPTracksSize) void PPSAlignmentConfiguration::setN_si(double n_si) { n_si_ = n_si; } void PPSAlignmentConfiguration::setMatchingReferencePoints( - std::map> &matchingReferencePoints) { + std::map>& matchingReferencePoints) { matchingReferencePoints_ = matchingReferencePoints; } void PPSAlignmentConfiguration::setMatchingShiftRanges( - std::map &matchingShiftRanges) { + std::map& matchingShiftRanges) { matchingShiftRanges_ = matchingShiftRanges; } void PPSAlignmentConfiguration::setAlignment_x_meth_o_ranges( - std::map &alignment_x_meth_o_ranges) { + std::map& alignment_x_meth_o_ranges) { alignment_x_meth_o_ranges_ = alignment_x_meth_o_ranges; } void PPSAlignmentConfiguration::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) { @@ -101,7 +108,7 @@ void PPSAlignmentConfiguration::setMethOGraphMinN(unsigned int methOGraphMinN) { void PPSAlignmentConfiguration::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; } void PPSAlignmentConfiguration::setAlignment_x_relative_ranges( - std::map &alignment_x_relative_ranges) { + std::map& alignment_x_relative_ranges) { alignment_x_relative_ranges_ = alignment_x_relative_ranges; } void PPSAlignmentConfiguration::setNearFarMinEntries(unsigned int nearFarMinEntries) { @@ -109,7 +116,7 @@ void PPSAlignmentConfiguration::setNearFarMinEntries(unsigned int nearFarMinEntr } void PPSAlignmentConfiguration::setAlignment_y_ranges( - std::map &alignment_y_ranges) { + std::map& alignment_y_ranges) { alignment_y_ranges_ = alignment_y_ranges; } void PPSAlignmentConfiguration::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; } @@ -117,11 +124,11 @@ void PPSAlignmentConfiguration::setMultSelProjYMinEntries(unsigned int multSelPr multSelProjYMinEntries_ = multSelProjYMinEntries; } -void PPSAlignmentConfiguration::setBinning(PPSAlignmentConfiguration::Binning &binning) { binning_ = binning; } +void PPSAlignmentConfiguration::setBinning(PPSAlignmentConfiguration::Binning& binning) { binning_ = binning; } // -------------------------------- << operators -------------------------------- -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::RPConfig &rc) { +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc) { os << std::fixed << std::setprecision(3); os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n"; os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n"; @@ -134,7 +141,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::RPCo return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::SectorConfig &sc) { +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::SectorConfig& sc) { os << std::fixed << std::setprecision(3); os << sc.name_ << ":\n"; os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n"; @@ -148,7 +155,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Sect return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Binning &b) { +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binning& b) { os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n"; os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n"; os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_ << "\n"; @@ -165,7 +172,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration::Binn return os; } -std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c) { +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c) { os << "* " << c.sectorConfig45_ << "\n\n"; os << "* " << c.sectorConfig56_ << "\n\n"; @@ -193,15 +200,15 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c) { os << "* matching\n" << std::setprecision(3); os << " shift ranges:\n"; - for (const auto &p : c.matchingShiftRanges_) + for (const auto& p : c.matchingShiftRanges_) os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ << ", sh_max = " << p.second.x_max_ << "\n"; os << " reference points:\n"; - for (const auto &pm : c.matchingReferencePoints_) { + for (const auto& pm : c.matchingReferencePoints_) { os << " " << std::setw(3) << pm.first << ": "; for (unsigned int i = 0; i < pm.second.size(); i++) { - const auto &p = pm.second[i]; + const auto& p = pm.second[i]; if (i % 5 == 0 && i > 0) os << "\n "; os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), "; @@ -211,7 +218,7 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c) { os << "\n" << "* alignment_x_meth_o\n"; - for (const auto &p : c.alignment_x_meth_o_ranges_) + for (const auto& p : c.alignment_x_meth_o_ranges_) os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ << ", sh_max = " << p.second.x_max_ << "\n"; os << " fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n"; @@ -221,16 +228,16 @@ std::ostream &operator<<(std::ostream &os, const PPSAlignmentConfiguration &c) { os << "\n" << "* alignment_x_relative\n"; - for (const auto &p : c.alignment_x_relative_ranges_) + for (const auto& p : c.alignment_x_relative_ranges_) if (rpTags[p.first][2] == '1') { // only near RPs os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ - << ", sh_max = " << p.second.x_max_ << "\n"; + << ", sh_max = " << p.second.x_max_ << "\n"; } os << " near_far_min_entries = " << c.nearFarMinEntries_ << "\n"; os << "\n" << "* alignment_y\n"; - for (const auto &p : c.alignment_y_ranges_) + for (const auto& p : c.alignment_y_ranges_) os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ << ", sh_max = " << p.second.x_max_ << "\n"; os << " mode_graph_min_N = " << c.modeGraphMinN_ << "\n"; diff --git a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc index 069f9b6701992..823fe93efbc97 100644 --- a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc +++ b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc @@ -21,19 +21,20 @@ class RetrievePPSAlignmentConfiguration : public edm::one::EDAnalyzer<> { public: - explicit RetrievePPSAlignmentConfiguration(const edm::ParameterSet &); + explicit RetrievePPSAlignmentConfiguration(const edm::ParameterSet&); private: - void analyze(const edm::Event &, const edm::EventSetup &) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; edm::ESGetToken esToken_; }; -RetrievePPSAlignmentConfiguration::RetrievePPSAlignmentConfiguration(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} +RetrievePPSAlignmentConfiguration::RetrievePPSAlignmentConfiguration(const edm::ParameterSet& iConfig) + : esToken_(esConsumes()) {} -void RetrievePPSAlignmentConfiguration::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { +void RetrievePPSAlignmentConfiguration::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // get the data - const auto &ppsAlignmentConfiguration = iSetup.getData(esToken_); + const auto& ppsAlignmentConfiguration = iSetup.getData(esToken_); edm::LogInfo("PPS") << ppsAlignmentConfiguration; } diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc index 84437bd4e3728..bef365aec7d57 100644 --- a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc @@ -22,21 +22,21 @@ class WritePPSAlignmentConfig : public edm::one::EDAnalyzer<> { public: - explicit WritePPSAlignmentConfig(const edm::ParameterSet &); + explicit WritePPSAlignmentConfig(const edm::ParameterSet&); private: - void analyze(const edm::Event &, const edm::EventSetup &) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; edm::ESGetToken esToken_; }; -WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet &iConfig) +WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet& iConfig) : esToken_(esConsumes( edm::ESInputTag("", iConfig.getParameter("label")))) {} -void WritePPSAlignmentConfig::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { +void WritePPSAlignmentConfig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // get the data - const auto &ppsAlignmentConfig = iSetup.getData(esToken_); + const auto& ppsAlignmentConfig = iSetup.getData(esToken_); // store the data in a DB object edm::Service poolDbService; From 7f4a4d91b8cec9f38c5f937ed2eaf7af92f01644 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 3 Sep 2021 07:10:23 +0200 Subject: [PATCH 370/923] [DBG] Fixed compilation errors --- Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc index c67a36cab4b87..8762f9ad223f6 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc @@ -810,9 +810,8 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet } if (accept) { #ifdef EDM_ML_DEBUG - for (unsigned int i = 0; i < hcal_ieta_.size(); ++i) - edm::LogVerbatim("HBHEMuon") << "[" << i << "] ieta/iphi for entry to " - << "HCAL has value of " << hcal_ieta_[i] << ":" << hcal_iphi_[i]; + edm::LogVerbatim("HBHEMuon") << "ieta/iphi for entry to " + << "HCAL has value of " << hcal_ieta_ << ":" << hcal_iphi_; #endif for (unsigned int k = 0; k < muon_is_good.size(); ++k) { muon_is_good_ = muon_is_good[k]; From 0ee497e6682a1a2316b7cc4a4481691e16b90c03 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 10:10:23 +0200 Subject: [PATCH 371/923] Remove some commented out code. --- .../EcalTools/plugins/EcalCosmicsHists.cc | 17 ++++++----------- .../EcalTools/plugins/EcalMipGraphs.cc | 3 --- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc index d6626d6d7bf64..6a32a881142ee 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc @@ -660,7 +660,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // << " ) " << std::endl; if (!EEDetId::validDetId(ix, iy, iz)) { - LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!" << endl; + LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!"; return; } @@ -1008,7 +1008,6 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& iEvent.getByToken(tracksToken_, recoTracks); if (recoTracks.isValid()) { - // LogWarning("EcalCosmicsHists") << "... Valid TrackAssociator recoTracks !!! " << recoTracks.product()->size(); std::map > trackDetIdMap; int tracks = 0; for (reco::TrackCollection::const_iterator recoTrack = recoTracks->begin(); recoTrack != recoTracks->end(); @@ -1169,16 +1168,15 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& numberofCosmicsWTrackHist_->Fill(numSeeds); } } else { - // LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!"; + LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!"; } // Study on Tracks for High Energy events edm::Handle recoTracksBarrel; iEvent.getByToken(tracksBarrelToken_, recoTracksBarrel); if (!recoTracksBarrel.isValid()) { - //edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! " ; + edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! "; } else { - //edm::LogWarning("EcalCosmicsHists") << "Number of barrel reco tracks found in the event: " << recoTracksBarrel->size() ; HighEnergy_numRecoTrackBarrel->Fill(recoTracksBarrel->size()); for (reco::TrackCollection::const_iterator recoTrack = recoTracksBarrel->begin(); recoTrack != recoTracksBarrel->end(); @@ -1266,7 +1264,6 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& iEvent.getByToken(hoRecHitToken_, horh); if (hbhe.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HBHE RecHits collection size " << hbhe->size(); const HBHERecHitCollection hbheHit = *(hbhe.product()); for (HBHERecHitCollection::const_iterator hhit = hbheHit.begin(); hhit != hbheHit.end(); hhit++) { // if (hhit->energy() > 0.6){ @@ -1274,21 +1271,19 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // } } } else { - // LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! "; } if (hfrh.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HF RecHits collection size " << hfrh->size(); const HFRecHitCollection hfHit = *(hfrh.product()); for (HFRecHitCollection::const_iterator hhit = hfHit.begin(); hhit != hfHit.end(); hhit++) { hcalEnergy_HF_->Fill(hhit->energy()); } } else { - // LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! "; } if (horh.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HO RecHits collection size " << horh->size(); const HORecHitCollection hoHit = *(horh.product()); for (HORecHitCollection::const_iterator hhit = hoHit.begin(); hhit != hoHit.end(); hhit++) { // if (hhit->energy() > 0.6){ @@ -1296,7 +1291,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // } } } else { - // LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! "; } // *** end of HCAL code *** // diff --git a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc index 4862cc266345a..c44c811496e2c 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc @@ -128,9 +128,6 @@ void EcalMipGraphs::analyze(edm::Event const& iEvent, edm::EventSetup const& iSe // Now, retrieve the crystal digi from the event iEvent.getByToken(ebDigiToken_, EBdigisHandle); iEvent.getByToken(eeDigiToken_, EEdigisHandle); - //debug - //LogWarning("EcalMipGraphs") << "event " << ievt << " EBhits collection size " << EBhits->size(); - //LogWarning("EcalMipGraphs") << "event " << ievt << " EEhits collection size " << EEhits->size(); selectHits(EBhits, ievt); selectHits(EEhits, ievt); From 1fd28c0f7a3021a9c08c64c745b5dcf8c882d184 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Fri, 3 Sep 2021 10:58:11 +0200 Subject: [PATCH 372/923] disable JME Nano workflows --- .../PyReleaseValidation/python/relval_2017.py | 11 ++++++----- .../PyReleaseValidation/python/relval_pileup.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_2017.py b/Configuration/PyReleaseValidation/python/relval_2017.py index 440b8d120f04a..0c65ccc7fd102 100644 --- a/Configuration/PyReleaseValidation/python/relval_2017.py +++ b/Configuration/PyReleaseValidation/python/relval_2017.py @@ -16,18 +16,19 @@ # 2017 (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # (ZMM, TTbar, ZEE, MinBias, TTbar PU, ZEE PU, TTbar design) # (TTbar trackingOnly, trackingRun2, trackingOnlyRun2, trackingLowPU, pixelTrackingOnly) -# (TTbar PU with JME NanoAOD) +# (TTbar PU with JME NanoAOD, disable for now due to Run-3 Nano-Prompt preparation) # 2018 (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # 2018 (ZMM, TTbar, ZEE, MinBias, TTbar PU, ZEE PU, TTbar design) # (TTbar trackingOnly, pixelTrackingOnly) # (HE collapse: TTbar, TTbar PU, TTbar design) # (ParkingBPH: TTbar) -# (TTbar PU with JME NanoAOD) +# (TTbar PU with JME NanoAOD, disable for now due to Run-3 Nano-Prompt preparation) # (Patatrack pixel-only: ZMM - on CPU: quadruplets, triplets) # (Patatrack pixel-only: TTbar - on CPU: quadruplets, triplets) # (Patatrack ECAL-only: TTbar - on CPU) # (Patatrack HCAL-only: TTbar - on CPU) -# 2021 (DD4HEP: TTbar, ZMM) +# 2021 (DD4HEP XML: TTbar, ZMM) +# (DD4HEP DB: TTbar) # (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # (ZMM, TTbar, ZEE, MinBias, TTbar PU, TTbar PU premix, ZEE PU, TTbar design, GluGluTo2Jets, GluGluTo2Jets PU) # (TTbar trackingOnly, pixelTrackingOnly, trackingMkFit, trackdnn) @@ -43,13 +44,13 @@ numWFIB = [10001.0,10002.0,10003.0,10004.0,10005.0,10006.0,10007.0,10008.0,10009.0,10059.0,10071.0, 10042.0,10024.0,10025.0,10026.0,10023.0,10224.0,10225.0,10424.0, 10024.1,10024.2,10024.3,10024.4,10024.5, - 10224.15, + #10224.15, 10801.0,10802.0,10803.0,10804.0,10805.0,10806.0,10807.0,10808.0,10809.0,10859.0,10871.0, 10842.0,10824.0,10825.0,10826.0,10823.0,11024.0,11025.0,11224.0, 10824.1,10824.5, 10824.6,11024.6,11224.6, 10824.8, - 11024.15, + #11024.15, 10842.501,10842.505, 10824.501,10824.505, 10824.511, diff --git a/Configuration/PyReleaseValidation/python/relval_pileup.py b/Configuration/PyReleaseValidation/python/relval_pileup.py index 8f2fd8794c9d9..55b30ebadced3 100644 --- a/Configuration/PyReleaseValidation/python/relval_pileup.py +++ b/Configuration/PyReleaseValidation/python/relval_pileup.py @@ -39,7 +39,7 @@ workflows[25202]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] workflows[25202.1]=['',['TTbar_13','DIGIUP15APVSimu_PU25','RECOUP15_PU25','HARVESTUP15_PU25']] workflows[25202.2]=['',['TTbar_13','DIGIUP15APVSimu_PU25','RECOUP15_PU25_HIPM','HARVESTUP15_PU25']] -workflows[25202.15]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15MC_PU25_JME']] +#workflows[25202.15]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15MC_PU25_JME']] #JME NanoAOD, disable until Nano-Run3 prompt dev is done workflows[25203]=['',['H125GGgluonfusion_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] workflows[25204]=['',['QQH1352T_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25']] workflows[25205]=['',['ZTT_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] From 20537f266f777a69c9f054a1be51f6df4bb27ec2 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 3 Sep 2021 11:14:26 +0200 Subject: [PATCH 373/923] adding test config --- .../test/test_pixels_only_cfg_eraRun3_562.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py diff --git a/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py b/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py new file mode 100644 index 0000000000000..d718caed4da45 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py @@ -0,0 +1,82 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras + +#process = cms.Process("CTPPSRawToDigiTestPixelsOnly",eras.Run2_2017) +process = cms.Process("CTPPSRawToDigiTestPixelsOnly",eras.Run3) +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( threshold = cms.untracked.string('DEBUG') ) +) + +# raw data source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( +# 'file:/afs/cern.ch/user/f/fabferro/WORKSPACE/public/Unpacking/CMSSW_11_3_0/src/IORawData/SiPixelInputSources/test/PixelAlive_1463_548.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/PixelAlive_562_RAW.root' + ), +labelRawDataLikeMC = cms.untracked.bool(False), # for testing H8 data +duplicateCheckMode = cms.untracked.string("checkEachFile") +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +#process.load("CalibPPS.ESProducers.CTPPSPixelDAQMappingESSourceXML_cfi") + +#ctppsPixelDAQMappingESSourceXML = cms.ESSource("CTPPSPixelDAQMappingESSourceXML", +# verbosity = cms.untracked.uint32(2), +# subSystem= cms.untracked.string("RPix"), +# configuration = cms.VPSet( + # example configuration block: +# cms.PSet( +# validityRange = cms.EventRange("1:min - 999999999:max"), +# mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/rpix_tests_2021.xml"), +# maskFileNames = cms.vstring("CondFormats/PPSObjects/xml/rpix_channel_mask_220_far.xml") +# ) +# ) +# +#) + +# raw-to-digi conversion +process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") +process.ctppsPixelDigis.inputLabel = cms.InputTag("source") + + + + + +#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +#from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + + +process.load("CondCore.CondDB.CondDB_cfi") +# input database (in this case the local sqlite file) +process.CondDB.connect = 'sqlite_file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/CTPPSPixel_DAQMapping_AnalysisMask.db' + +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + DumpStat=cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('CTPPSPixelDAQMappingRcd'), + tag = cms.string("PixelDAQMapping") + )), +) + +process.p = cms.Path( + process.ctppsPixelDigis +# process.ctppsRawToDigi +) + +# output configuration +process.output = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("file:./_digi_PixelAlive_562.root"), + outputCommands = cms.untracked.vstring( + 'keep *' + ) +) + +process.outpath = cms.EndPath(process.output) From 6e8ead20a070e83a838156d613330a3da564c44f Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Fri, 3 Sep 2021 14:02:24 +0200 Subject: [PATCH 374/923] add runType check --- CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc index 034065c1caef0..88197f28b7d9e 100644 --- a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc @@ -24,6 +24,7 @@ #include "CondFormats/PPSObjects/interface/PPSPixelTopology.h" #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" +#include "FWCore/Utilities/interface/Exception.h" #include @@ -81,6 +82,10 @@ PPSPixelTopologyESSource::PPSPixelTopologyESSource(const edm::ParameterSet& iCon dead_edge_width_(0.), active_edge_sigma_(0.), phys_active_edge_dist_(0.) { + // validate input + if (runType_ != "Run2" && runType_ != "Run3") + throw cms::Exception("PPS") << runType_ << " is not valid runType."; + setPPSPixelTopology(iConfig); setWhatProduced(this); findingRecord(); From 9d473bd47217597bb8b5c7ef7fccd2a3e8f1845b Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Fri, 3 Sep 2021 14:09:48 +0200 Subject: [PATCH 375/923] fix check position --- CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc index 88197f28b7d9e..00a98f1279cc0 100644 --- a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc @@ -82,11 +82,12 @@ PPSPixelTopologyESSource::PPSPixelTopologyESSource(const edm::ParameterSet& iCon dead_edge_width_(0.), active_edge_sigma_(0.), phys_active_edge_dist_(0.) { + setPPSPixelTopology(iConfig); + // validate input if (runType_ != "Run2" && runType_ != "Run3") throw cms::Exception("PPS") << runType_ << " is not valid runType."; - setPPSPixelTopology(iConfig); setWhatProduced(this); findingRecord(); } From 642b656d8d17d87a502e4941c6d9e32e698d4f29 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 3 Sep 2021 15:59:34 +0200 Subject: [PATCH 376/923] Take care of static analyzer tests --- .../HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc | 4 ++-- .../plugins/HITRegionalPixelSeedGenerator.cc | 4 ++-- .../plugins/SiStripRegFEDSelector.cc | 8 ++++---- .../HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc index 2743571469a7d..52d120d5547d5 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc @@ -3,7 +3,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -22,7 +22,7 @@ #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" -class ECALRegFEDSelector : public edm::EDProducer { +class ECALRegFEDSelector : public edm::one::EDProducer<> { public: ECALRegFEDSelector(const edm::ParameterSet&); ~ECALRegFEDSelector() override; diff --git a/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc index ae37869de477a..466fff465e964 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc @@ -167,9 +167,9 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { edm::Handle vertices; e.getByToken(token_vertex, vertices); const reco::VertexCollection vertCollection = *(vertices.product()); - reco::VertexCollection::const_iterator ci = vertCollection.begin(); if (!vertCollection.empty()) { - originz = ci->z(); +// reco::VertexCollection::const_iterator ci = vertCollection.begin(); +// originz = ci->z(); } else { deltaZVertex = 15.; } diff --git a/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc index 3dd543c0e83b8..bfe6f0905e202 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc @@ -13,13 +13,13 @@ #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -class SiStripRegFEDSelector : public edm::EDProducer { +class SiStripRegFEDSelector : public edm::global::EDProducer<> { public: SiStripRegFEDSelector(const edm::ParameterSet&); ~SiStripRegFEDSelector() override; @@ -28,7 +28,7 @@ class SiStripRegFEDSelector : public edm::EDProducer { private: void beginJob() override {} - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; void endJob() override {} const edm::EDGetTokenT tok_seed_; @@ -47,7 +47,7 @@ SiStripRegFEDSelector::SiStripRegFEDSelector(const edm::ParameterSet& iConfig) SiStripRegFEDSelector::~SiStripRegFEDSelector() {} -void SiStripRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void SiStripRegFEDSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { auto producedData = std::make_unique(); edm::Handle trigSeedTrks; diff --git a/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc index f1904a9401b91..6765186ffec15 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc @@ -1,6 +1,6 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -11,7 +11,7 @@ #include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" -class SubdetFEDSelector : public edm::EDProducer { +class SubdetFEDSelector : public edm::global::EDProducer<> { public: SubdetFEDSelector(const edm::ParameterSet&); ~SubdetFEDSelector() override; @@ -19,7 +19,7 @@ class SubdetFEDSelector : public edm::EDProducer { private: void beginJob() override {} - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; void endJob() override {} // ----------member data --------------------------- @@ -48,7 +48,7 @@ SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) { SubdetFEDSelector::~SubdetFEDSelector() {} -void SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void SubdetFEDSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { auto producedData = std::make_unique(); edm::Handle rawIn; From 17a0b9c65dd333e0581b530a14bf8b25ad8b800a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 3 Sep 2021 16:15:26 +0200 Subject: [PATCH 377/923] Code check --- .../plugins/HITRegionalPixelSeedGenerator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc index 466fff465e964..663795d2470d7 100644 --- a/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc @@ -168,8 +168,8 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { e.getByToken(token_vertex, vertices); const reco::VertexCollection vertCollection = *(vertices.product()); if (!vertCollection.empty()) { -// reco::VertexCollection::const_iterator ci = vertCollection.begin(); -// originz = ci->z(); + // reco::VertexCollection::const_iterator ci = vertCollection.begin(); + // originz = ci->z(); } else { deltaZVertex = 15.; } From 690cef88b4ce8c3e6ae2ab0ecfd9fe4f6d8a40f5 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 10:08:32 -0500 Subject: [PATCH 378/923] Have MuonToTrackingParticleAssociatorByHitsImpl own memory Now owns all the Associators. --- ...nToTrackingParticleAssociatorByHitsImpl.cc | 14 ++++++++- ...onToTrackingParticleAssociatorByHitsImpl.h | 11 +++++++ ...nToTrackingParticleAssociatorEDProducer.cc | 30 +++++++++---------- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc index 5a4b7b5b0a8af..a46d45485bf61 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc @@ -29,9 +29,21 @@ // MuonToTrackingParticleAssociatorByHitsImpl::MuonToTrackingParticleAssociatorByHitsImpl( TrackerMuonHitExtractor const &iHitExtractor, + std::unique_ptr iTracker, + std::unique_ptr iCSC, + std::unique_ptr iDT, + std::unique_ptr iRPC, + std::unique_ptr iGEM, MuonAssociatorByHitsHelper::Resources const &iResources, MuonAssociatorByHitsHelper const *iHelper) - : m_hitExtractor(&iHitExtractor), m_resources(iResources), m_helper(iHelper) {} + : m_hitExtractor(&iHitExtractor), + m_tracker(std::move(iTracker)), + m_csc(std::move(iCSC)), + m_dt(std::move(iDT)), + m_rpc(std::move(iRPC)), + m_gem(std::move(iGEM)), + m_resources(iResources), + m_helper(iHelper) {} // // member functions diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h index cd8f5c6d252f5..9d2e3a2026a64 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h @@ -21,6 +21,7 @@ // // system include files +#include // user include files #include "SimDataFormats/Associations/interface/MuonToTrackingParticleAssociatorBaseImpl.h" @@ -32,6 +33,11 @@ class TrackerMuonHitExtractor; class MuonToTrackingParticleAssociatorByHitsImpl : public reco::MuonToTrackingParticleAssociatorBaseImpl { public: MuonToTrackingParticleAssociatorByHitsImpl(TrackerMuonHitExtractor const &iHitExtractor, + std::unique_ptr iTracker, + std::unique_ptr iCSC, + std::unique_ptr iDT, + std::unique_ptr iRPC, + std::unique_ptr iGEM, MuonAssociatorByHitsHelper::Resources const &iResources, MuonAssociatorByHitsHelper const *iHelper); @@ -61,6 +67,11 @@ class MuonToTrackingParticleAssociatorByHitsImpl : public reco::MuonToTrackingPa private: // ---------- member data -------------------------------- TrackerMuonHitExtractor const *m_hitExtractor; + std::unique_ptr m_tracker; + std::unique_ptr m_csc; + std::unique_ptr m_dt; + std::unique_ptr m_rpc; + std::unique_ptr m_gem; MuonAssociatorByHitsHelper::Resources m_resources; MuonAssociatorByHitsHelper const *m_helper; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index aff29e8b2ff52..3d60f273c3109 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -249,25 +249,20 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con bool printRtS = true; - // NOTE: This assumes that produce will not be called until the edm::Event - // used in the previous call - // has been deleted. This is true for now. In the future, we may have to have - // the resources own the memory. - // Tracker hit association - TrackerHitAssociator trackertruth(iEvent, trackerHitAssociatorConfig_); + auto trackertruth = std::make_unique(iEvent, trackerHitAssociatorConfig_); // CSC hit association - CSCHitAssociator csctruth(iEvent, iSetup, cscHitAssociatorConfig_); + auto csctruth = std::make_unique(iEvent, iSetup, cscHitAssociatorConfig_); // DT hit association printRtS = false; - DTHitAssociator dttruth(iEvent, iSetup, dtHitAssociatorConfig_, printRtS); + auto dttruth = std::make_unique(iEvent, iSetup, dtHitAssociatorConfig_, printRtS); // RPC hit association - RPCHitAssociator rpctruth(iEvent, rpcHitAssociatorConfig_); + auto rpctruth = std::make_unique(iEvent, rpcHitAssociatorConfig_); // GEM hit association - GEMHitAssociator gemtruth(iEvent, gemHitAssociatorConfig_); + auto gemtruth = std::make_unique(iEvent, gemHitAssociatorConfig_); MuonAssociatorByHitsHelper::Resources resources = { - tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}}; + tTopo, trackertruth.get(), csctruth.get(), dttruth.get(), rpctruth.get(), gemtruth.get(), {}}; if (diagnostics_) { diagnostics_->read(iEvent); @@ -276,10 +271,15 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con }; } - std::unique_ptr impl{ - new MuonToTrackingParticleAssociatorByHitsImpl(hitExtractor_, resources, &helper_)}; - std::unique_ptr toPut( - new reco::MuonToTrackingParticleAssociator(std::move(impl))); + auto impl = std::make_unique(hitExtractor_, + std::move(trackertruth), + std::move(csctruth), + std::move(dttruth), + std::move(rpctruth), + std::move(gemtruth), + resources, + &helper_); + auto toPut = std::make_unique(std::move(impl)); iEvent.put(std::move(toPut)); } From 72eb238eb4b2a1445d967806e2159423953c7a17 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 3 Sep 2021 17:18:20 +0200 Subject: [PATCH 379/923] [GCC11] Fix compilation warning for CommonTools --- CommonTools/Utils/test/testDynArray.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CommonTools/Utils/test/testDynArray.cpp b/CommonTools/Utils/test/testDynArray.cpp index 25d415933a2ef..a5cac2d427c82 100644 --- a/CommonTools/Utils/test/testDynArray.cpp +++ b/CommonTools/Utils/test/testDynArray.cpp @@ -16,7 +16,9 @@ struct A { int main(int s, char **) { using T = A; - unsigned n = 4 * s; + unsigned n = 4; + if (s > 1) + n = 4 * s; // alignas(alignof(T)) unsigned char a_storage[sizeof(T)*n]; // DynArray a(a_storage,n); From ef4a587aea53aa0ffa256bcb503dbc01d4f5b8ea Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 3 Sep 2021 17:20:21 +0200 Subject: [PATCH 380/923] [GCC11] Fix compilation warning for FW/ToyIntProducers --- FWCore/Framework/test/stubs/ToyIntProducers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FWCore/Framework/test/stubs/ToyIntProducers.cc b/FWCore/Framework/test/stubs/ToyIntProducers.cc index db3ead0e8f3f6..12b8602403e53 100644 --- a/FWCore/Framework/test/stubs/ToyIntProducers.cc +++ b/FWCore/Framework/test/stubs/ToyIntProducers.cc @@ -457,7 +457,7 @@ namespace edmtest { } // EventSetup is not used. - for (auto const tv : tokenValues_) { + for (auto const& tv : tokenValues_) { e.emplace(tv.token, tv.value); } } From 1c696b2c2d1fb7410c50c71b692faae6f2cd4b7d Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 10:36:10 -0500 Subject: [PATCH 381/923] Added explicit esConsumes calls to modules --- RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc | 10 ++++++---- RecoTracker/TrackProducer/plugins/TrackProducer.cc | 8 ++++---- RecoTracker/TrackProducer/plugins/TrackProducer.h | 1 + RecoTracker/TrackProducer/plugins/TrackRefitter.cc | 8 ++++---- RecoTracker/TrackProducer/plugins/TrackRefitter.h | 2 ++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc index 7c0ba38c93a18..457f6af4998cd 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc @@ -21,12 +21,15 @@ class GsfTrackProducer : public GsfTrackProducerBase, public edm::stream::EDProd private: TrackProducerAlgorithm theAlgo; + + const edm::ESGetToken theTopoToken; }; GsfTrackProducer::GsfTrackProducer(const edm::ParameterSet& iConfig) : GsfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), - theAlgo(iConfig) { + theAlgo(iConfig), + theTopoToken(esConsumes()) { initTrackProducerBase( iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); @@ -63,8 +66,7 @@ void GsfTrackProducer::produce(edm::Event& theEvent, const edm::EventSetup& setu edm::ESHandle theBuilder; getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder); - edm::ESHandle httopo; - setup.get().get(httopo); + TrackerTopology const& ttopo = setup.getData(theTopoToken); // //declare and get TrackColection to be retrieved from the event @@ -107,7 +109,7 @@ void GsfTrackProducer::produce(edm::Event& theEvent, const edm::EventSetup& setu algoResults, theBuilder.product(), bs, - httopo.product()); + &ttopo); LogDebug("GsfTrackProducer") << "end" << "\n"; } diff --git a/RecoTracker/TrackProducer/plugins/TrackProducer.cc b/RecoTracker/TrackProducer/plugins/TrackProducer.cc index 4f19c34e70055..2b31cb49f6741 100644 --- a/RecoTracker/TrackProducer/plugins/TrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/TrackProducer.cc @@ -18,7 +18,8 @@ TrackProducer::TrackProducer(const edm::ParameterSet& iConfig) : KfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), - theAlgo(iConfig) { + theAlgo(iConfig), + theTTopoToken(esConsumes()) { initTrackProducerBase( iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); @@ -61,8 +62,7 @@ void TrackProducer::produce(edm::Event& theEvent, const edm::EventSetup& setup) edm::ESHandle theBuilder; getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder); - edm::ESHandle httopo; - setup.get().get(httopo); + TrackerTopology const& ttopo = setup.getData(theTTopoToken); // //declare and get TrackColection to be retrieved from the event @@ -105,7 +105,7 @@ void TrackProducer::produce(edm::Event& theEvent, const edm::EventSetup& setup) outputIndecesInputColl, algoResults, theBuilder.product(), - httopo.product()); + &ttopo); LogDebug("TrackProducer") << "end" << "\n"; } diff --git a/RecoTracker/TrackProducer/plugins/TrackProducer.h b/RecoTracker/TrackProducer/plugins/TrackProducer.h index 59871005d4c65..8ba9c174e8c9e 100644 --- a/RecoTracker/TrackProducer/plugins/TrackProducer.h +++ b/RecoTracker/TrackProducer/plugins/TrackProducer.h @@ -34,6 +34,7 @@ class TrackProducer : public KfTrackProducerBase, public edm::stream::EDProducer private: TrackProducerAlgorithm theAlgo; + edm::ESGetToken theTTopoToken; }; #endif diff --git a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc index 68f9d9c739aec..b916ce316d2fc 100644 --- a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc +++ b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc @@ -16,7 +16,8 @@ TrackRefitter::TrackRefitter(const edm::ParameterSet &iConfig) : KfTrackProducerBase(iConfig.getParameter("TrajectoryInEvent"), iConfig.getParameter("useHitsSplitting")), - theAlgo(iConfig) { + theAlgo(iConfig), + ttopoToken_(esConsumes()) { initTrackProducerBase( iConfig, consumesCollector(), consumes>(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); @@ -73,8 +74,7 @@ void TrackRefitter::produce(edm::Event &theEvent, const edm::EventSetup &setup) edm::ESHandle theBuilder; getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder); - edm::ESHandle httopo; - setup.get().get(httopo); + TrackerTopology const &ttopo = setup.getData(ttopoToken_); // //declare and get TrackCollection to be retrieved from the event @@ -226,7 +226,7 @@ void TrackRefitter::produce(edm::Event &theEvent, const edm::EventSetup &setup) outputIndecesInputColl, algoResults, theBuilder.product(), - httopo.product()); + &ttopo); LogDebug("TrackRefitter") << "end" << "\n"; } diff --git a/RecoTracker/TrackProducer/plugins/TrackRefitter.h b/RecoTracker/TrackProducer/plugins/TrackRefitter.h index d59f3ff4ad408..b68803834febd 100644 --- a/RecoTracker/TrackProducer/plugins/TrackRefitter.h +++ b/RecoTracker/TrackProducer/plugins/TrackRefitter.h @@ -24,6 +24,8 @@ class TrackRefitter : public KfTrackProducerBase, public edm::stream::EDProducer enum Constraint { none, momentum, vertex, trackParameters }; Constraint constraint_; edm::EDGetToken trkconstrcoll_; + + const edm::ESGetToken ttopoToken_; }; #endif From b8905e0af392600f13da02fc4594496142e27ba0 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 10:49:40 -0500 Subject: [PATCH 382/923] Moved Associators into Impl class --- .../interface/MuonAssociatorByHitsHelper.h | 15 ++++++++ ...nToTrackingParticleAssociatorByHitsImpl.cc | 27 +++++++------- ...onToTrackingParticleAssociatorByHitsImpl.h | 34 ++++++++++-------- ...nToTrackingParticleAssociatorEDProducer.cc | 35 ++++++------------- 4 files changed, 61 insertions(+), 50 deletions(-) diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h b/SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h index af995e35a7a55..9fc64695d228a 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h @@ -36,6 +36,21 @@ class MuonAssociatorByHitsHelper { MuonAssociatorByHitsHelper(const edm::ParameterSet &conf); struct Resources { + Resources(TrackerTopology const *tTopo, + TrackerHitAssociator const *trackerHitAssoc, + CSCHitAssociator const *cscHitAssoc, + DTHitAssociator const *dtHitAssoc, + RPCHitAssociator const *rpcHitAssoc, + GEMHitAssociator const *gemHitAssoc, + std::function diagnostics) + : tTopo_(tTopo), + trackerHitAssoc_(trackerHitAssoc), + cscHitAssoc_(cscHitAssoc), + dtHitAssoc_(dtHitAssoc), + rpcHitAssoc_(rpcHitAssoc), + gemHitAssoc_(gemHitAssoc), + diagnostics_(diagnostics) {} + TrackerTopology const *tTopo_; TrackerHitAssociator const *trackerHitAssoc_; CSCHitAssociator const *cscHitAssoc_; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc index a46d45485bf61..f30c2a9f8dc30 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.cc @@ -29,20 +29,23 @@ // MuonToTrackingParticleAssociatorByHitsImpl::MuonToTrackingParticleAssociatorByHitsImpl( TrackerMuonHitExtractor const &iHitExtractor, - std::unique_ptr iTracker, - std::unique_ptr iCSC, - std::unique_ptr iDT, - std::unique_ptr iRPC, - std::unique_ptr iGEM, - MuonAssociatorByHitsHelper::Resources const &iResources, + TrackerHitAssociator::Config const &iTracker, + CSCHitAssociator::Config const &iCSC, + DTHitAssociator::Config const &iDT, + RPCHitAssociator::Config const &iRPC, + GEMHitAssociator::Config const &iGEM, + edm::Event const &iEvent, + edm::EventSetup const &iSetup, + const TrackerTopology *iTopo, + std::function iDiagnostics, MuonAssociatorByHitsHelper const *iHelper) : m_hitExtractor(&iHitExtractor), - m_tracker(std::move(iTracker)), - m_csc(std::move(iCSC)), - m_dt(std::move(iDT)), - m_rpc(std::move(iRPC)), - m_gem(std::move(iGEM)), - m_resources(iResources), + m_tracker(iEvent, iTracker), + m_csc(iEvent, iSetup, iCSC), + m_dt(iEvent, iSetup, iDT, true), + m_rpc(iEvent, iRPC), + m_gem(iEvent, iGEM), + m_resources(iTopo, &m_tracker, &m_csc, &m_dt, &m_rpc, &m_gem, iDiagnostics), m_helper(iHelper) {} // diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h index 9d2e3a2026a64..409b83dc72913 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorByHitsImpl.h @@ -21,7 +21,7 @@ // // system include files -#include +#include // user include files #include "SimDataFormats/Associations/interface/MuonToTrackingParticleAssociatorBaseImpl.h" @@ -32,14 +32,20 @@ class TrackerMuonHitExtractor; class MuonToTrackingParticleAssociatorByHitsImpl : public reco::MuonToTrackingParticleAssociatorBaseImpl { public: - MuonToTrackingParticleAssociatorByHitsImpl(TrackerMuonHitExtractor const &iHitExtractor, - std::unique_ptr iTracker, - std::unique_ptr iCSC, - std::unique_ptr iDT, - std::unique_ptr iRPC, - std::unique_ptr iGEM, - MuonAssociatorByHitsHelper::Resources const &iResources, - MuonAssociatorByHitsHelper const *iHelper); + using TrackHitsCollection = MuonAssociatorByHitsHelper::TrackHitsCollection; + + MuonToTrackingParticleAssociatorByHitsImpl( + TrackerMuonHitExtractor const &iHitExtractor, + TrackerHitAssociator::Config const &iTracker, + CSCHitAssociator::Config const &iCSC, + DTHitAssociator::Config const &iDT, + RPCHitAssociator::Config const &iRPC, + GEMHitAssociator::Config const &iGEM, + edm::Event const &iEvent, + edm::EventSetup const &iSetup, + const TrackerTopology *iTopo, + std::function, + MuonAssociatorByHitsHelper const *iHelper); MuonToTrackingParticleAssociatorByHitsImpl(const MuonToTrackingParticleAssociatorByHitsImpl &) = delete; // stop default @@ -67,11 +73,11 @@ class MuonToTrackingParticleAssociatorByHitsImpl : public reco::MuonToTrackingPa private: // ---------- member data -------------------------------- TrackerMuonHitExtractor const *m_hitExtractor; - std::unique_ptr m_tracker; - std::unique_ptr m_csc; - std::unique_ptr m_dt; - std::unique_ptr m_rpc; - std::unique_ptr m_gem; + TrackerHitAssociator const m_tracker; + CSCHitAssociator const m_csc; + DTHitAssociator const m_dt; + RPCHitAssociator const m_rpc; + GEMHitAssociator const m_gem; MuonAssociatorByHitsHelper::Resources m_resources; MuonAssociatorByHitsHelper const *m_helper; }; diff --git a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc index 3d60f273c3109..b39e612fb86f3 100644 --- a/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc +++ b/SimMuon/MCTruth/plugins/MuonToTrackingParticleAssociatorEDProducer.cc @@ -247,37 +247,24 @@ void MuonToTrackingParticleAssociatorEDProducer::produce(edm::Event &iEvent, con // Retrieve tracker topology from geometry const TrackerTopology *tTopo = &iSetup.getData(tTopoToken_); - bool printRtS = true; - - // Tracker hit association - auto trackertruth = std::make_unique(iEvent, trackerHitAssociatorConfig_); - // CSC hit association - auto csctruth = std::make_unique(iEvent, iSetup, cscHitAssociatorConfig_); - // DT hit association - printRtS = false; - auto dttruth = std::make_unique(iEvent, iSetup, dtHitAssociatorConfig_, printRtS); - // RPC hit association - auto rpctruth = std::make_unique(iEvent, rpcHitAssociatorConfig_); - // GEM hit association - auto gemtruth = std::make_unique(iEvent, gemHitAssociatorConfig_); - - MuonAssociatorByHitsHelper::Resources resources = { - tTopo, trackertruth.get(), csctruth.get(), dttruth.get(), rpctruth.get(), gemtruth.get(), {}}; - + std::function diagnostics; if (diagnostics_) { diagnostics_->read(iEvent); - resources.diagnostics_ = [this](const TrackHitsCollection &hC, const TrackingParticleCollection &pC) { + diagnostics = [this](const TrackHitsCollection &hC, const TrackingParticleCollection &pC) { diagnostics_->dump(hC, pC); }; } auto impl = std::make_unique(hitExtractor_, - std::move(trackertruth), - std::move(csctruth), - std::move(dttruth), - std::move(rpctruth), - std::move(gemtruth), - resources, + trackerHitAssociatorConfig_, + cscHitAssociatorConfig_, + dtHitAssociatorConfig_, + rpcHitAssociatorConfig_, + gemHitAssociatorConfig_, + iEvent, + iSetup, + tTopo, + diagnostics, &helper_); auto toPut = std::make_unique(std::move(impl)); iEvent.put(std::move(toPut)); From 65d2302f0b2080178bd87dd43b513644f65c6a14 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 3 Sep 2021 17:56:30 +0200 Subject: [PATCH 383/923] [GCC11] Fix compilation warning for EcalMatacqDigi --- DataFormats/EcalDigi/interface/EcalMatacqDigi.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h index b7cbc3949cf01..6233c8e807b11 100644 --- a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h +++ b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h @@ -29,7 +29,7 @@ class EcalMatacqDigi { public: /** Default constructor. */ - EcalMatacqDigi() : chId_(-1), ts_(0.), tTrigS_(999.), version_(-1) { init(); } + EcalMatacqDigi() : chId_(-1), freq(0), ts_(0.), tTrigS_(999.), version_(-1) { init(); } /** Constructor * @param samples adc time samples @@ -43,7 +43,7 @@ class EcalMatacqDigi { const double& ts, const short& version = -1, const double& tTrig = 999.) - : chId_(chId), data_(samples), ts_(ts), tTrigS_(tTrig), version_(version) { + : chId_(chId), data_(samples), freq(0), ts_(ts), tTrigS_(tTrig), version_(version) { init(); }; @@ -270,6 +270,7 @@ class EcalMatacqDigi { * @param value new value */ void laserPower(int value) { laserPower_ = value; } +#endif void init() { #if (ECAL_MATACQ_DIGI_VERS >= 2) @@ -285,11 +286,11 @@ class EcalMatacqDigi { emtcPhase_ = -1; attenuation_dB_ = -1; laserPower_ = -1; + tv_sec_ = 0; + tv_usec_ = 0; #endif } -#endif - private: /** Electronic channel id */ From 5dd46f5a996c508101851c2b009b39280259c804 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 3 Sep 2021 17:58:28 +0200 Subject: [PATCH 384/923] Add a few collection for carrying out AlCaReco studies --- .../interface/HcalHBHEMuonVariables.h | 76 +++++++++++++++++++ .../interface/HcalIsoTrkCalibVariables.h | 47 ++++++++++++ .../interface/HcalIsoTrkEventVariables.h | 29 +++++++ DataFormats/HcalCalibObjects/src/classes.h | 4 +- .../HcalCalibObjects/src/classes_def.xml | 15 ++++ 5 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h create mode 100644 DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h create mode 100644 DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h diff --git a/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h new file mode 100644 index 0000000000000..384515e3e9277 --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h @@ -0,0 +1,76 @@ +#ifndef DataFormatsHcalCalibObjectsHcalHBHEMuonVariables_h +#define DataFormatsHcalCalibObjectsHcalHBHEMuonVariables_h +#include +#include + +class HcalHBHEMuonVariables { + +public: + HcalHBHEMuonVariables() { clear(); } + + void clear() { + muonGood_ = muonGlobal_ = muonTracker_ = muonTight_ = muonMedium_ = false; + ptGlob_ = etaGlob_ = phiGlob_ = energyMuon_ = pMuon_ = 0; + muonTrkKink_ = muonChi2LocalPosition_ = muonSegComp_ = 0; + trackerLayer_ = numPixelLayers_ = tightPixelHits_; + innerTrack_ = outerTrack_ = globalTrack_= false; + chiTracker_ = dxyTracker_ = dzTracker_ = 0; + innerTrackPt_ = innerTrackEta_ = innerTrackEhi_ = 0; + outerTrackHits_ = outerTrackRHits_ = 0; + outerTrackPt_ = outerTrackEta_ = outerTrackPhi_ = outerTrackChi_ = 0; + globalMuonHits_ = matchedStat_ = 0; + globalTrackPt_ = globalTrackEta_ = globalTrackPhi_ = chiGlobal_ = 0; + tightValidFraction_ = tightLongPara_ = tightTransImpara_ = 0; + isolationR04_ = isolationR03_ = 0; + ecalDetId_ = 0; + ecalEnergy_ = ecal3x3Energy_ = 0; + hcalDetId_ = ehcalDetId_ = 0; + matchedId_ = hcalHot_= false; + hcalIeta_ = hcalIphi_ = 0; + hcalEnergy_ = hoEnergy_ = hcal1x1Energy_ = 0; + hcalDepthEnergy_.clear(); + hcalDepthActiveLength_.clear(); + hcalDepthEnergyHot_.clear(); + hcalDepthActiveLengthHot_.clear(); + hcalDepthChargeHot_.clear(); + hcalDepthChargeHotBG_.clear(); + hcalDepthEnergyCorr_.clear(); + hcalDepthEnergyHotCorr_.clear(); + hcalDepthMatch_.clear(); + hcalDepthMatchHot_.clear(); + hcalActiveLength_ = hcalActiveLengthHot_ = 0; + allTriggers_.clear(); + hltResults_.clear(); + } + + bool muonGood_, muonGlobal_, muonTracker_, muonTight_, muonMedium_; + float ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_; + float muonTrkKink_, muonChi2LocalPosition_, muonSegComp_; + int trackerLayer_, numPixelLayers_, tightPixelHits_; + bool innerTrack_, outerTrack_, globalTrack_; + float chiTracker_, dxyTracker_, dzTracker_; + float innerTrackPt_, innerTrackEta_, innerTrackEhi_; + int outerTrackHits_, outerTrackRHits_; + float outerTrackPt_, outerTrackEta_, outerTrackPhi_, outerTrackChi_; + int globalMuonHits_, matchedStat_; + float globalTrackPt_, globalTrackEta_, globalTrackPhi_, chiGlobal_; + float tightValidFraction_, tightLongPara_, tightTransImpara_; + float isolationR04_, isolationR03_; + unsigned int ecalDetId_; + float ecalEnergy_, ecal3x3Energy_; + unsigned int hcalDetId_, ehcalDetId_; + bool matchedId_, hcalHot_; + int hcalIeta_, hcalIphi_; + float hcalEnergy_, hoEnergy_, hcal1x1Energy_; + std::vector hcalDepthEnergy_, hcalDepthActiveLength_; + std::vector hcalDepthEnergyHot_, hcalDepthActiveLengthHot_; + std::vector hcalDepthChargeHot_, hcalDepthChargeHotBG_; + std::vector hcalDepthEnergyCorr_, hcalDepthEnergyHotCorr_; + std::vector hcalDepthMatch_, hcalDepthMatchHot_; + float hcalActiveLength_, hcalActiveLengthHot_; + std::vector allTriggers_; + std::vector hltResults_; +}; + +typedef std::vector HcalHBHEMuonVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h new file mode 100644 index 0000000000000..88fef4400452f --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h @@ -0,0 +1,47 @@ +#ifndef DataFormatsHcalCalibObjectsHcalIsoTrkCalibVariables_h +#define DataFormatsHcalCalibObjectsHcalIsoTrkCalibVariables_h +#include +#include + +class HcalIsoTrkCalibVariables { + +public: + HcalIsoTrkCalibVariables() { clear(); } + + void clear() { + eventWeight_ = rhoh_ = 0; + nVtx_ = goodPV_ = nTrk_ = 0; + trgbits_.clear(); + mindR1_ = l1pt_ = l1eta_ = l1phi_ = 0; + mindR2_ = l3pt_ = l3eta_ = l3phi_ = 0; + p_ = pt_= phi_ = gentrackP_ = 0; + ieta_ = iphi_ = 0; + eMipDR_.clear(); + eHcal_ = eHcal10_ = eHcal30_ = 0; + emaxNearP_ = eAnnular_ = hmaxNearP_ = hAnnular_ = 0; + selectTk_ = qltyFlag_ = qltyMissFlag_ = qltyPVFlag_ = false; + detIds_.clear(); + hitEnergies_.clear(); + detIds1_.clear(); + hitEnergies1_.clear(); + detIds3_.clear(); + hitEnergies3_.clear(); + }; + + double eventWeight_, rhoh_; + int goodPV_, nVtx_, nTrk_; + std::vector trgbits_; + double mindR1_, l1pt_, l1eta_, l1phi_; + double mindR2_, l3pt_, l3eta_, l3phi_; + double p_, pt_, phi_, gentrackP_; + int ieta_, iphi_; + std::vector eMipDR_; + double eHcal_, eHcal10_, eHcal30_; + double emaxNearP_, eAnnular_, hmaxNearP_, hAnnular_; + bool selectTk_, qltyFlag_, qltyMissFlag_, qltyPVFlag_; + std::vector detIds_, detIds1_, detIds3_; + std::vector hitEnergies_, hitEnergies1_, hitEnergies3_; +}; + +typedef std::vector HcalIsoTrkCalibVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h new file mode 100644 index 0000000000000..f994f9ae5041b --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h @@ -0,0 +1,29 @@ +#ifndef DataFormatsHcalCalibObjectsHcalIsoTrkEventVariables_h +#define DataFormatsHcalCalibObjectsHcalIsoTrkEventVariables_h +#include +#include + +class HcalIsoTrkEventVariables { + +public: + HcalIsoTrkEventVariables() { clear(); } + + void clear() { + allvertex_ = 0; + tracks_ = tracksProp_ = tracksSaved_ = tracksLoose_ = tracksTight_ = 0; + l1Bit_ = trigPass_ = trigPassSel_ = false; + hltbits_.clear(); + ietaAll_.clear(); + ietaGood_.clear(); + trackType_.clear(); + }; + + int allvertex_, tracks_, tracksProp_, tracksSaved_; + int tracksLoose_, tracksTight_; + bool l1Bit_, trigPass_, trigPassSel_; + std::vector ietaAll_, ietaGood_, trackType_; + std::vector hltbits_; +}; + +typedef std::vector HcalIsoTrkEventVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/src/classes.h b/DataFormats/HcalCalibObjects/src/classes.h index 943be3caafd82..875004e6e635e 100644 --- a/DataFormats/HcalCalibObjects/src/classes.h +++ b/DataFormats/HcalCalibObjects/src/classes.h @@ -1,3 +1,5 @@ #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" -// #include "DataFormats/HOCalibHit/interface/HOCalibVariableCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h" #include "DataFormats/Common/interface/Wrapper.h" diff --git a/DataFormats/HcalCalibObjects/src/classes_def.xml b/DataFormats/HcalCalibObjects/src/classes_def.xml index 135e27786a254..1b24c79775e89 100644 --- a/DataFormats/HcalCalibObjects/src/classes_def.xml +++ b/DataFormats/HcalCalibObjects/src/classes_def.xml @@ -4,4 +4,19 @@ + + + + + + + + + + + + + + + From beac0038bb2292e79e94cf6cc1d3b11233b286d8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 11:00:44 -0500 Subject: [PATCH 385/923] Added esConsumes to TrackProducerWithSCAssociation explicitly --- .../src/TrackProducerWithSCAssociation.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc index dc29fe1b6afc7..d39b6c46b855a 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc @@ -42,6 +42,7 @@ class TrackProducerWithSCAssociation : public TrackProducerBase, pu edm::EDGetTokenT assoc_token; edm::OrphanHandle rTracks_; edm::EDGetTokenT measurementTrkToken_; + const edm::ESGetToken ttopoToken_; bool myTrajectoryInEvent_; bool validTrackCandidateSCAssociationInput_; @@ -63,7 +64,9 @@ class TrackProducerWithSCAssociation : public TrackProducerBase, pu DEFINE_FWK_MODULE(TrackProducerWithSCAssociation); TrackProducerWithSCAssociation::TrackProducerWithSCAssociation(const edm::ParameterSet& iConfig) - : TrackProducerBase(iConfig.getParameter("TrajectoryInEvent")), theAlgo(iConfig) { + : TrackProducerBase(iConfig.getParameter("TrajectoryInEvent")), + theAlgo(iConfig), + ttopoToken_(esConsumes()) { initTrackProducerBase( iConfig, consumesCollector(), consumes(iConfig.getParameter("src"))); setAlias(iConfig.getParameter("@module_label")); @@ -116,9 +119,7 @@ void TrackProducerWithSCAssociation::produce(edm::Event& theEvent, const edm::Ev edm::ESHandle theMeasTk; getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder); - edm::ESHandle httopo; - setup.get().get(httopo); - const TrackerTopology* ttopo = httopo.product(); + const TrackerTopology* ttopo = &setup.getData(ttopoToken_); // //declare and get TrackColection to be retrieved from the event From e63f1d190ff6c003c3b2dd1ef6ff9c38cb7d84ed Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 3 Sep 2021 18:07:32 +0200 Subject: [PATCH 386/923] Code check --- .../interface/HcalHBHEMuonVariables.h | 25 +++++++++---------- .../interface/HcalIsoTrkCalibVariables.h | 7 +++--- .../interface/HcalIsoTrkEventVariables.h | 3 +-- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h index 384515e3e9277..8315c307d8a66 100644 --- a/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h +++ b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h @@ -4,16 +4,15 @@ #include class HcalHBHEMuonVariables { - public: HcalHBHEMuonVariables() { clear(); } void clear() { - muonGood_ = muonGlobal_ = muonTracker_ = muonTight_ = muonMedium_ = false; + muonGood_ = muonGlobal_ = muonTracker_ = muonTight_ = muonMedium_ = false; ptGlob_ = etaGlob_ = phiGlob_ = energyMuon_ = pMuon_ = 0; - muonTrkKink_ = muonChi2LocalPosition_ = muonSegComp_ = 0; + muonTrkKink_ = muonChi2LocalPosition_ = muonSegComp_ = 0; trackerLayer_ = numPixelLayers_ = tightPixelHits_; - innerTrack_ = outerTrack_ = globalTrack_= false; + innerTrack_ = outerTrack_ = globalTrack_ = false; chiTracker_ = dxyTracker_ = dzTracker_ = 0; innerTrackPt_ = innerTrackEta_ = innerTrackEhi_ = 0; outerTrackHits_ = outerTrackRHits_ = 0; @@ -22,23 +21,23 @@ class HcalHBHEMuonVariables { globalTrackPt_ = globalTrackEta_ = globalTrackPhi_ = chiGlobal_ = 0; tightValidFraction_ = tightLongPara_ = tightTransImpara_ = 0; isolationR04_ = isolationR03_ = 0; - ecalDetId_ = 0; + ecalDetId_ = 0; ecalEnergy_ = ecal3x3Energy_ = 0; hcalDetId_ = ehcalDetId_ = 0; - matchedId_ = hcalHot_= false; + matchedId_ = hcalHot_ = false; hcalIeta_ = hcalIphi_ = 0; hcalEnergy_ = hoEnergy_ = hcal1x1Energy_ = 0; hcalDepthEnergy_.clear(); hcalDepthActiveLength_.clear(); - hcalDepthEnergyHot_.clear(); + hcalDepthEnergyHot_.clear(); hcalDepthActiveLengthHot_.clear(); - hcalDepthChargeHot_.clear(); + hcalDepthChargeHot_.clear(); hcalDepthChargeHotBG_.clear(); - hcalDepthEnergyCorr_.clear(); + hcalDepthEnergyCorr_.clear(); hcalDepthEnergyHotCorr_.clear(); - hcalDepthMatch_.clear(); + hcalDepthMatch_.clear(); hcalDepthMatchHot_.clear(); - hcalActiveLength_ = hcalActiveLengthHot_ = 0; + hcalActiveLength_ = hcalActiveLengthHot_ = 0; allTriggers_.clear(); hltResults_.clear(); } @@ -56,7 +55,7 @@ class HcalHBHEMuonVariables { float globalTrackPt_, globalTrackEta_, globalTrackPhi_, chiGlobal_; float tightValidFraction_, tightLongPara_, tightTransImpara_; float isolationR04_, isolationR03_; - unsigned int ecalDetId_; + unsigned int ecalDetId_; float ecalEnergy_, ecal3x3Energy_; unsigned int hcalDetId_, ehcalDetId_; bool matchedId_, hcalHot_; @@ -67,7 +66,7 @@ class HcalHBHEMuonVariables { std::vector hcalDepthChargeHot_, hcalDepthChargeHotBG_; std::vector hcalDepthEnergyCorr_, hcalDepthEnergyHotCorr_; std::vector hcalDepthMatch_, hcalDepthMatchHot_; - float hcalActiveLength_, hcalActiveLengthHot_; + float hcalActiveLength_, hcalActiveLengthHot_; std::vector allTriggers_; std::vector hltResults_; }; diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h index 88fef4400452f..86f55909273d4 100644 --- a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h @@ -4,20 +4,19 @@ #include class HcalIsoTrkCalibVariables { - public: HcalIsoTrkCalibVariables() { clear(); } - + void clear() { eventWeight_ = rhoh_ = 0; nVtx_ = goodPV_ = nTrk_ = 0; trgbits_.clear(); mindR1_ = l1pt_ = l1eta_ = l1phi_ = 0; mindR2_ = l3pt_ = l3eta_ = l3phi_ = 0; - p_ = pt_= phi_ = gentrackP_ = 0; + p_ = pt_ = phi_ = gentrackP_ = 0; ieta_ = iphi_ = 0; eMipDR_.clear(); - eHcal_ = eHcal10_ = eHcal30_ = 0; + eHcal_ = eHcal10_ = eHcal30_ = 0; emaxNearP_ = eAnnular_ = hmaxNearP_ = hAnnular_ = 0; selectTk_ = qltyFlag_ = qltyMissFlag_ = qltyPVFlag_ = false; detIds_.clear(); diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h index f994f9ae5041b..45ebd0366b174 100644 --- a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h @@ -4,10 +4,9 @@ #include class HcalIsoTrkEventVariables { - public: HcalIsoTrkEventVariables() { clear(); } - + void clear() { allvertex_ = 0; tracks_ = tracksProp_ = tracksSaved_ = tracksLoose_ = tracksTight_ = 0; From 45bf17527b0b389f644574c2f25146a86b5dbff3 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 16:01:17 +0200 Subject: [PATCH 387/923] esConsumes migration of ESDBCopy. --- CondTools/Ecal/interface/ESDBCopy.h | 32 ++++++++-- CondTools/Ecal/src/ESDBCopy.cc | 94 ++++++++++------------------- 2 files changed, 59 insertions(+), 67 deletions(-) diff --git a/CondTools/Ecal/interface/ESDBCopy.h b/CondTools/Ecal/interface/ESDBCopy.h index c658aa62effca..c4cac2c5dd824 100644 --- a/CondTools/Ecal/interface/ESDBCopy.h +++ b/CondTools/Ecal/interface/ESDBCopy.h @@ -1,9 +1,22 @@ -#ifndef ESDBCOPY_H -#define ESDBCOPY_H +#ifndef CondTools_Ecal_ESDBCopy_h +#define CondTools_Ecal_ESDBCopy_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" +#include "CondFormats/ESObjects/interface/ESPedestals.h" +#include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" +#include "CondFormats/ESObjects/interface/ESADCToGeVConstant.h" +#include "CondFormats/DataRecord/interface/ESADCToGeVConstantRcd.h" +#include "CondFormats/ESObjects/interface/ESChannelStatus.h" +#include "CondFormats/DataRecord/interface/ESChannelStatusRcd.h" +#include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/ESIntercalibConstantsRcd.h" +#include "CondFormats/ESObjects/interface/ESWeightStripGroups.h" +#include "CondFormats/DataRecord/interface/ESWeightStripGroupsRcd.h" +#include "CondFormats/ESObjects/interface/ESTBWeights.h" +#include "CondFormats/DataRecord/interface/ESTBWeightsRcd.h" + #include "FWCore/Framework/interface/IOVSyncValue.h" #include @@ -15,7 +28,7 @@ namespace edm { class EventSetup; } // namespace edm -class ESDBCopy : public edm::EDAnalyzer { +class ESDBCopy : public edm::one::EDAnalyzer<> { public: explicit ESDBCopy(const edm::ParameterSet& iConfig); ~ESDBCopy() override; @@ -23,12 +36,19 @@ class ESDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + + const edm::ESGetToken esPedestalsToken_; + const edm::ESGetToken esADCToGeVConstantToken_; + const edm::ESGetToken esChannelStatusToken_; + const edm::ESGetToken esIntercalibConstantsToken_; + const edm::ESGetToken esWeightStripGroupsToken_; + const edm::ESGetToken esTBWeightsToken_; }; #endif diff --git a/CondTools/Ecal/src/ESDBCopy.cc b/CondTools/Ecal/src/ESDBCopy.cc index 360c833f2b1e0..b3fbfa4a9c5c1 100644 --- a/CondTools/Ecal/src/ESDBCopy.cc +++ b/CondTools/Ecal/src/ESDBCopy.cc @@ -3,56 +3,44 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondTools/Ecal/interface/ESDBCopy.h" -#include "CondFormats/ESObjects/interface/ESPedestals.h" -#include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" -#include "CondFormats/ESObjects/interface/ESADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/ESADCToGeVConstantRcd.h" -#include "CondFormats/ESObjects/interface/ESChannelStatus.h" -#include "CondFormats/DataRecord/interface/ESChannelStatusRcd.h" -#include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/ESIntercalibConstantsRcd.h" -#include "CondFormats/ESObjects/interface/ESWeightStripGroups.h" -#include "CondFormats/DataRecord/interface/ESWeightStripGroupsRcd.h" -#include "CondFormats/ESObjects/interface/ESTBWeights.h" -#include "CondFormats/DataRecord/interface/ESTBWeightsRcd.h" - #include ESDBCopy::ESDBCopy(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + : m_timetype(iConfig.getParameter("timetype")), + m_cacheIDs(), + m_records(), + esPedestalsToken_(esConsumes()), + esADCToGeVConstantToken_(esConsumes()), + esChannelStatusToken_(esConsumes()), + esIntercalibConstantsToken_(esConsumes()), + esWeightStripGroupsToken_(esConsumes()), + esTBWeightsToken_(esConsumes()) { std::string container; - std::string tag; std::string record; typedef std::vector Parameters; Parameters toCopy = iConfig.getParameter("toCopy"); - for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (const auto& iparam : toCopy) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } } ESDBCopy::~ESDBCopy() {} void ESDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - if (shouldCopy(evtSetup, container)) { - copyToDB(evtSetup, container); + for (const auto& irec : m_records) { + if (shouldCopy(evtSetup, irec.first)) { + copyToDB(evtSetup, irec.first); } } } -bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "ESPedestals") { cacheID = evtSetup.get().cacheIdentifier(); @@ -66,9 +54,7 @@ bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container cacheID = evtSetup.get().cacheIdentifier(); } else if (container == "ESChannelStatus") { cacheID = evtSetup.get().cacheIdentifier(); - } - - else { + } else { throw cms::Exception("Unknown container"); } @@ -80,7 +66,7 @@ bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container } } -void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -89,52 +75,38 @@ void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) std::string recordName = m_records[container]; if (container == "ESPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESPedestals* obj = handle.product(); - std::cout << "ped pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esPedestalsToken_); + edm::LogInfo("ESDBCopy") << "ped pointer is: " << obj; dbOutput->createNewIOV( new ESPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESADCToGeVConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESADCToGeVConstant* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; - + const auto* obj = &evtSetup.getData(esADCToGeVConstantToken_); + edm::LogInfo("ESDBCopy") << "adc pointer is: " << obj; dbOutput->createNewIOV( new ESADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESChannelStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; - + const auto* obj = &evtSetup.getData(esChannelStatusToken_); + edm::LogInfo("ESDBCopy") << "channel status pointer is: " << obj; dbOutput->createNewIOV( new ESChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESIntercalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESIntercalibConstants* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esIntercalibConstantsToken_); + edm::LogInfo("ESDBCopy") << "inter pointer is: " << obj; dbOutput->createNewIOV( new ESIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESWeightStripGroups") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESWeightStripGroups* obj = handle.product(); - std::cout << "weight pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esWeightStripGroupsToken_); + edm::LogInfo("ESDBCopy") << "weight pointer is: " << obj; dbOutput->createNewIOV( new ESWeightStripGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESTBWeights") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESTBWeights* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esTBWeightsToken_); + edm::LogInfo("ESDBCopy") << "tbweight pointer is: " << obj; dbOutput->createNewIOV( new ESTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); @@ -142,5 +114,5 @@ void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) throw cms::Exception("Unknown container"); } - std::cout << "ESDBCopy wrote " << recordName << std::endl; + edm::LogInfo("ESDBCopy") << "ESDBCopy wrote " << recordName; } From cb60159ae1114f4fff441922cda60067168ddb1c Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 17:07:09 +0200 Subject: [PATCH 388/923] esConsumes migration EcalClusterPUCleaningTools. --- .../interface/EcalClusterPUCleaningTools.h | 24 ++++++---- .../src/EcalClusterPUCleaningTools.cc | 46 +++++++++---------- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterPUCleaningTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterPUCleaningTools.h index ac88d45d558a5..773c0ba37b7d3 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterPUCleaningTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterPUCleaningTools.h @@ -12,28 +12,34 @@ */ #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -#include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" class CaloGeometry; class EcalClusterPUCleaningTools { public: - EcalClusterPUCleaningTools(const edm::Event &ev, - const edm::EventSetup &es, + EcalClusterPUCleaningTools(edm::ConsumesCollector &cc, const edm::InputTag &redEBRecHits, const edm::InputTag &redEERecHits); ~EcalClusterPUCleaningTools(); - reco::SuperCluster CleanedSuperCluster(float xi, const reco::SuperCluster &cluster, const edm::Event &ev); + reco::SuperCluster CleanedSuperCluster(float xi, + const reco::SuperCluster &cluster, + const edm::Event &ev, + const edm::EventSetup &es); private: - void getGeometry(const edm::EventSetup &es); - void getEBRecHits(const edm::Event &ev, const edm::InputTag &redEBRecHits); - void getEERecHits(const edm::Event &ev, const edm::InputTag &redEERecHits); + void getEBRecHits(const edm::Event &ev); + void getEERecHits(const edm::Event &ev); + + const edm::EDGetTokenT pEBRecHitsToken_; + const edm::EDGetTokenT pEERecHitsToken_; + const edm::ESGetToken geometryToken_; - const CaloGeometry *geometry_; const EcalRecHitCollection *ebRecHits_; const EcalRecHitCollection *eeRecHits_; }; diff --git a/RecoEcal/EgammaCoreTools/src/EcalClusterPUCleaningTools.cc b/RecoEcal/EgammaCoreTools/src/EcalClusterPUCleaningTools.cc index 3e8cfee1cc1e0..0cfb16737b18a 100644 --- a/RecoEcal/EgammaCoreTools/src/EcalClusterPUCleaningTools.cc +++ b/RecoEcal/EgammaCoreTools/src/EcalClusterPUCleaningTools.cc @@ -1,8 +1,7 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterPUCleaningTools.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/CaloTopology.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" @@ -11,39 +10,37 @@ #include "RecoEcal/EgammaCoreTools/interface/SuperClusterShapeAlgo.h" -EcalClusterPUCleaningTools::EcalClusterPUCleaningTools(const edm::Event &ev, - const edm::EventSetup &es, +EcalClusterPUCleaningTools::EcalClusterPUCleaningTools(edm::ConsumesCollector &cc, const edm::InputTag &redEBRecHits, - const edm::InputTag &redEERecHits) { - getGeometry(es); - getEBRecHits(ev, redEBRecHits); - getEERecHits(ev, redEERecHits); -} + const edm::InputTag &redEERecHits) + : pEBRecHitsToken_(cc.consumes(redEBRecHits)), + pEERecHitsToken_(cc.consumes(redEERecHits)), + geometryToken_(cc.esConsumes()) {} EcalClusterPUCleaningTools::~EcalClusterPUCleaningTools() {} -void EcalClusterPUCleaningTools::getGeometry(const edm::EventSetup &es) { - edm::ESHandle pGeometry; - es.get().get(pGeometry); - geometry_ = pGeometry.product(); -} - -void EcalClusterPUCleaningTools::getEBRecHits(const edm::Event &ev, const edm::InputTag &redEBRecHits) { +void EcalClusterPUCleaningTools::getEBRecHits(const edm::Event &ev) { edm::Handle pEBRecHits; - ev.getByLabel(redEBRecHits, pEBRecHits); + ev.getByToken(pEBRecHitsToken_, pEBRecHits); ebRecHits_ = pEBRecHits.product(); } -void EcalClusterPUCleaningTools::getEERecHits(const edm::Event &ev, const edm::InputTag &redEERecHits) { +void EcalClusterPUCleaningTools::getEERecHits(const edm::Event &ev) { edm::Handle pEERecHits; - ev.getByLabel(redEERecHits, pEERecHits); + ev.getByToken(pEERecHitsToken_, pEERecHits); eeRecHits_ = pEERecHits.product(); } reco::SuperCluster EcalClusterPUCleaningTools::CleanedSuperCluster(float xi, const reco::SuperCluster &scluster, - const edm::Event &ev) { - //std::cout << "\nEcalClusterPUCleaningTools::CleanedSuperCluster called, this will give you back a cleaned supercluster" << std::endl; + const edm::Event &ev, + const edm::EventSetup &es) { + // get the geometry + const auto &geometry = es.getData(geometryToken_); + + // get the RecHits + getEBRecHits(ev); + getEERecHits(ev); // seed basic cluster of initial SC: this will remain in the cleaned SC, by construction const reco::CaloClusterPtr &seed = scluster.seed(); @@ -97,19 +94,20 @@ reco::SuperCluster EcalClusterPUCleaningTools::CleanedSuperCluster(float xi, // construct cluster shape to compute ieta and iphi covariances of the SC const CaloSubdetectorGeometry *geometry_p = nullptr; if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalBarrel) { - geometry_p = geometry_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); SuperClusterShapeAlgo SCShape(ebRecHits_, geometry_p); SCShape.Calculate_Covariances(suCltmp); phiWidth = SCShape.phiWidth(); etaWidth = SCShape.etaWidth(); } else if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalEndcap) { - geometry_p = geometry_->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); + geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); SuperClusterShapeAlgo SCShape(eeRecHits_, geometry_p); SCShape.Calculate_Covariances(suCltmp); phiWidth = SCShape.phiWidth(); etaWidth = SCShape.etaWidth(); } else { - std::cout << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out " << std::endl; + edm::LogError("SeedError") + << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out"; assert(-1); } From 749a951474271422ca0df6dee8b2681b657871bb Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 17:36:14 +0200 Subject: [PATCH 389/923] Remove unused ECAL geometry from EcalClusterIsoCalculator. --- .../interface/EcalClusterIsoCalculator.h | 5 ----- RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc | 12 +----------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h b/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h index 12f4c76784056..b3080c9994752 100644 --- a/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h +++ b/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h @@ -3,7 +3,6 @@ #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" @@ -11,9 +10,6 @@ #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" - class EcalClusterIsoCalculator { public: EcalClusterIsoCalculator(const edm::Event &iEvent, @@ -29,7 +25,6 @@ class EcalClusterIsoCalculator { private: const reco::BasicClusterCollection *fEBclusters_; const reco::BasicClusterCollection *fEEclusters_; - const CaloGeometry *geometry_; }; #endif diff --git a/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc b/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc index 31f1bdf6892b9..782cbb350da24 100644 --- a/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc +++ b/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc @@ -4,12 +4,10 @@ #include "RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" - #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Math/interface/Vector3D.h" using namespace edm; @@ -29,13 +27,6 @@ EcalClusterIsoCalculator::EcalClusterIsoCalculator(const edm::Event &iEvent, fEEclusters_ = pEEclusters.product(); else fEEclusters_ = nullptr; - - ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - if (geometryHandle.isValid()) - geometry_ = geometryHandle.product(); - else - geometry_ = nullptr; } double EcalClusterIsoCalculator::getEcalClusterIso(const reco::SuperClusterRef cluster, @@ -73,7 +64,6 @@ double EcalClusterIsoCalculator::getEcalClusterIso(const reco::SuperClusterRef c for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) { const BasicCluster *clu = &(*iclu); - const GlobalPoint clusPoint(clu->x(), clu->y(), clu->z()); math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z()); double eta = ClusPoint.eta(); From b4d84e25c6de53c33a1b90f74ffe3c5d99e347e5 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 18:05:20 +0200 Subject: [PATCH 390/923] Modernise EcalSimple2007H4TBAnalyzer. --- .../interface/EcalSimple2007H4TBAnalyzer.h | 41 ++++--- .../src/EcalSimple2007H4TBAnalyzer.cc | 113 ++++++------------ 2 files changed, 64 insertions(+), 90 deletions(-) diff --git a/RecoTBCalo/EcalSimpleTBAnalysis/interface/EcalSimple2007H4TBAnalyzer.h b/RecoTBCalo/EcalSimpleTBAnalysis/interface/EcalSimple2007H4TBAnalyzer.h index 56464cc2e5c96..0e747d09d099d 100644 --- a/RecoTBCalo/EcalSimpleTBAnalysis/interface/EcalSimple2007H4TBAnalyzer.h +++ b/RecoTBCalo/EcalSimpleTBAnalysis/interface/EcalSimple2007H4TBAnalyzer.h @@ -16,48 +16,59 @@ // 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/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRecInfo.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCRecInfo.h" +#include "TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include -//#include "TTree.h" #include "TH1.h" #include "TGraph.h" #include "TH2.h" #include #include -//#include -class EcalSimple2007H4TBAnalyzer : public edm::EDAnalyzer { +class EcalSimple2007H4TBAnalyzer : public edm::one::EDAnalyzer { public: explicit EcalSimple2007H4TBAnalyzer(const edm::ParameterSet&); ~EcalSimple2007H4TBAnalyzer() override; void analyze(edm::Event const&, edm::EventSetup const&) override; void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void endJob() override; private: - std::string rootfile_; - std::string digiCollection_; - std::string digiProducer_; - std::string hitCollection_; - std::string hitProducer_; - std::string hodoRecInfoCollection_; - std::string hodoRecInfoProducer_; - std::string tdcRecInfoCollection_; - std::string tdcRecInfoProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string rootfile_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string hitCollection_; + const std::string hitProducer_; + const std::string hodoRecInfoCollection_; + const std::string hodoRecInfoProducer_; + const std::string tdcRecInfoCollection_; + const std::string tdcRecInfoProducer_; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + + const edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT eeUncalibratedRecHitToken_; + const edm::EDGetTokenT tbHodoscopeRecInfoToken_; + const edm::EDGetTokenT tbTDCRecInfoToken_; + const edm::EDGetTokenT tbEventHeaderToken_; + const edm::ESGetToken geometryToken_; // Amplitude vs TDC offset TH2F* h_ampltdc; diff --git a/RecoTBCalo/EcalSimpleTBAnalysis/src/EcalSimple2007H4TBAnalyzer.cc b/RecoTBCalo/EcalSimpleTBAnalysis/src/EcalSimple2007H4TBAnalyzer.cc index 5a438af10d447..6f08715de7377 100644 --- a/RecoTBCalo/EcalSimpleTBAnalysis/src/EcalSimple2007H4TBAnalyzer.cc +++ b/RecoTBCalo/EcalSimpleTBAnalysis/src/EcalSimple2007H4TBAnalyzer.cc @@ -10,29 +10,16 @@ // #include "RecoTBCalo/EcalSimpleTBAnalysis/interface/EcalSimple2007H4TBAnalyzer.h" -#include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRecInfo.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCRecInfo.h" -#include "TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "Geometry/CaloGeometry/interface/TruncatedPyramid.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" //#include #include "TFile.h" -#include "TH1.h" -#include "TH2.h" #include "TF1.h" -#include -#include -#include // // constants, enums and typedefs // @@ -47,24 +34,30 @@ //======================================================================== EcalSimple2007H4TBAnalyzer::EcalSimple2007H4TBAnalyzer(const edm::ParameterSet& iConfig) - : xtalInBeam_(0) + : rootfile_(iConfig.getUntrackedParameter("rootfile", "ecalSimpleTBanalysis.root")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + hitCollection_(iConfig.getParameter("hitCollection")), + hitProducer_(iConfig.getParameter("hitProducer")), + hodoRecInfoCollection_(iConfig.getParameter("hodoRecInfoCollection")), + hodoRecInfoProducer_(iConfig.getParameter("hodoRecInfoProducer")), + tdcRecInfoCollection_(iConfig.getParameter("tdcRecInfoCollection")), + tdcRecInfoProducer_(iConfig.getParameter("tdcRecInfoProducer")), + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + eeDigiToken_(consumes<>(edm::InputTag(digiProducer_, digiCollection_))), + eeUncalibratedRecHitToken_(consumes<>(edm::InputTag(hitProducer_, hitCollection_))), + tbHodoscopeRecInfoToken_(consumes<>(edm::InputTag(hodoRecInfoProducer_, hodoRecInfoCollection_))), + tbTDCRecInfoToken_(consumes<>(edm::InputTag(tdcRecInfoProducer_, tdcRecInfoCollection_))), + tbEventHeaderToken_(consumes<>(edm::InputTag(eventHeaderProducer_))), + geometryToken_(esConsumes()), + xtalInBeam_(0) //======================================================================== { //now do what ever initialization is needed - rootfile_ = iConfig.getUntrackedParameter("rootfile", "ecalSimpleTBanalysis.root"); - digiCollection_ = iConfig.getParameter("digiCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - hitCollection_ = iConfig.getParameter("hitCollection"); - hitProducer_ = iConfig.getParameter("hitProducer"); - hodoRecInfoCollection_ = iConfig.getParameter("hodoRecInfoCollection"); - hodoRecInfoProducer_ = iConfig.getParameter("hodoRecInfoProducer"); - tdcRecInfoCollection_ = iConfig.getParameter("tdcRecInfoCollection"); - tdcRecInfoProducer_ = iConfig.getParameter("tdcRecInfoProducer"); - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); - - std::cout << "EcalSimple2007H4TBAnalyzer: fetching hitCollection: " << hitCollection_.c_str() << " produced by " - << hitProducer_.c_str() << std::endl; + edm::LogVerbatim("EcalSimple2007H4TBAnalyzer") + << "EcalSimple2007H4TBAnalyzer: fetching hitCollection: " << hitCollection_.c_str() << " produced by " + << hitProducer_.c_str(); } //======================================================================== @@ -99,14 +92,7 @@ EcalSimple2007H4TBAnalyzer::~EcalSimple2007H4TBAnalyzer() void EcalSimple2007H4TBAnalyzer::beginRun(edm::Run const&, edm::EventSetup const& iSetup) { //======================================================================== - edm::ESHandle pG; - iSetup.get().get(pG); - - theTBGeometry_ = pG.product(); - // const std::vector& validIds=theTBGeometry_->getValidDetIds(DetId::Ecal,EcalEndcap); - // std::cout << "Found " << validIds.size() << " channels in the geometry" << std::endl; - // for (unsigned int i=0;i pdigis; const EEDigiCollection* digis = nullptr; - //std::cout << "EcalSimple2007H4TBAnalyzer::analyze getting product with label: " << digiProducer_.c_str()<< " prodname: " << digiCollection_.c_str() << endl; - iEvent.getByLabel(digiProducer_, digiCollection_, pdigis); + iEvent.getByToken(eeDigiToken_, pdigis); if (pdigis.isValid()) { digis = pdigis.product(); // get a ptr to the product - //iEvent.getByLabel( hitProducer_, phits); } else { edm::LogError("EcalSimple2007H4TBAnalyzerError") << "Error! can't get the product " << digiCollection_; } @@ -238,19 +226,16 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet // fetch the digis and compute signal amplitude Handle phits; const EEUncalibratedRecHitCollection* hits = nullptr; - //std::cout << "EcalSimple2007H4TBAnalyzer::analyze getting product with label: " << digiProducer_.c_str()<< " prodname: " << digiCollection_.c_str() << endl; - iEvent.getByLabel(hitProducer_, hitCollection_, phits); + iEvent.getByToken(eeUncalibratedRecHitToken_, phits); if (phits.isValid()) { hits = phits.product(); // get a ptr to the product - //iEvent.getByLabel( hitProducer_, phits); } else { edm::LogError("EcalSimple2007H4TBAnalyzerError") << "Error! can't get the product " << hitCollection_; } Handle pHodo; const EcalTBHodoscopeRecInfo* recHodo = nullptr; - //std::cout << "EcalSimple2007H4TBAnalyzer::analyze getting product with label: " << digiProducer_.c_str()<< " prodname: " << digiCollection_.c_str() << endl; - iEvent.getByLabel(hodoRecInfoProducer_, hodoRecInfoCollection_, pHodo); + iEvent.getByToken(tbHodoscopeRecInfoToken_, pHodo); if (pHodo.isValid()) { recHodo = pHodo.product(); // get a ptr to the product } else { @@ -259,8 +244,7 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet Handle pTDC; const EcalTBTDCRecInfo* recTDC = nullptr; - //std::cout << "EcalSimple2007H4TBAnalyzer::analyze getting product with label: " << digiProducer_.c_str()<< " prodname: " << digiCollection_.c_str() << endl; - iEvent.getByLabel(tdcRecInfoProducer_, tdcRecInfoCollection_, pTDC); + iEvent.getByToken(tbTDCRecInfoToken_, pTDC); if (pTDC.isValid()) { recTDC = pTDC.product(); // get a ptr to the product } else { @@ -269,8 +253,7 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet Handle pEventHeader; const EcalTBEventHeader* evtHeader = nullptr; - //std::cout << "EcalSimple2007H4TBAnalyzer::analyze getting product with label: " << digiProducer_.c_str()<< " prodname: " << digiCollection_.c_str() << endl; - iEvent.getByLabel(eventHeaderProducer_, pEventHeader); + iEvent.getByToken(tbEventHeaderToken_, pEventHeader); if (pEventHeader.isValid()) { evtHeader = pEventHeader.product(); // get a ptr to the product } else { @@ -278,27 +261,22 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet } if (!hits) { - // std::cout << "1" << std::endl; return; } if (!recTDC) { - // std::cout << "2" << std::endl; return; } if (!recHodo) { - // std::cout << "3" << std::endl; return; } if (!evtHeader) { - // std::cout << "4" << std::endl; return; } if (hits->empty()) { - // std::cout << "5" << std::endl; return; } @@ -306,27 +284,13 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet if (evtHeader->tableIsMoving()) h_tableIsMoving->Fill(evtHeader->eventNumber()); - // std::cout << "event " << evtHeader->eventNumber() - // << "\trun number " << evtHeader->runNumber() - // << "\tburst number " << evtHeader->burstNumber() - // << "\tbeginLV1A " << evtHeader->begBurstLV1A() - // << "\tendLV1A " << evtHeader->endBurstLV1A() - // << "\ttime " << evtHeader->date() - // << "\thas errors " << int(evtHeader->syncError()) - // << std::endl; - - // std::cout << "scaler"; - // for (int iscaler=0;iscaler < 36;iscaler++) - // std::cout << "\t#" << iscaler << " " << evtHeader->scaler(iscaler); - // std::cout<Fill(evtHeader->S6ADC()); if (xtalInBeamTmp.null()) { xtalInBeamTmp = EBDetId(1, evtHeader->crystalInBeam(), EBDetId::SMCRYSTALMODE); xtalInBeam_ = EEDetId(35 - ((xtalInBeamTmp.ic() - 1) % 20), int(int(xtalInBeamTmp.ic()) / int(20)) + 51, -1); - std::cout << "Xtal In Beam is " << xtalInBeam_.ic() << xtalInBeam_ << std::endl; + edm::LogVerbatim("EcalSimple2007H4TBAnalyzer") << "Xtal In Beam is " << xtalInBeam_.ic() << xtalInBeam_; for (unsigned int icry = 0; icry < 25; icry++) { unsigned int row = icry / 5; unsigned int column = icry % 5; @@ -341,8 +305,9 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet auto cell = theTBGeometry_->getGeometry(Xtals5x5[icry]); if (!cell) continue; - std::cout << "** Xtal in the matrix **** row " << row << ", column " << column << ", xtal " << Xtals5x5[icry] - << " Position " << cell->getPosition(0.) << std::endl; + edm::LogVerbatim("EcalSimple2007H4TBAnalyzer") + << "** Xtal in the matrix **** row " << row << ", column " << column << ", xtal " << Xtals5x5[icry] + << " Position " << cell->getPosition(0.); } } } else if (xtalInBeamTmp != @@ -351,7 +316,7 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet //Avoid moving table events if (evtHeader->tableIsMoving()) { - std::cout << "Table is moving" << std::endl; + edm::LogVerbatim("EcalSimple2007H4TBAnalyzer") << "Table is moving"; return; } @@ -365,7 +330,7 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet } } if (maxHitId == EEDetId(0)) { - std::cout << "No maxHit found" << std::endl; + edm::LogVerbatim("EcalSimple2007H4TBAnalyzer") << "No maxHit found"; return; } @@ -383,12 +348,10 @@ void EcalSimple2007H4TBAnalyzer::analyze(edm::Event const& iEvent, edm::EventSet for (int sample = 0; sample < myDigi.size(); ++sample) { double analogSample = myDigi.sample(sample).adc(); samples_save[sample] = analogSample; - // std::cout << analogSample << " "; if (eMax < analogSample) { eMax = analogSample; } } - // std::cout << std::endl; } for (int i = 0; i < 10; ++i) From 35b5e9b18a061685b0d834e6f9bb2ea044091e01 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 18:34:48 +0200 Subject: [PATCH 391/923] Modernise EcalTBWeightUncalibRecHitProducer. --- .../EcalTBWeightUncalibRecHitProducer.h | 44 +++--- .../src/EcalTBWeightUncalibRecHitProducer.cc | 125 ++++++------------ 2 files changed, 68 insertions(+), 101 deletions(-) diff --git a/RecoTBCalo/EcalTBRecProducers/interface/EcalTBWeightUncalibRecHitProducer.h b/RecoTBCalo/EcalTBRecProducers/interface/EcalTBWeightUncalibRecHitProducer.h index d68714a5b0aab..7de74a301d27e 100644 --- a/RecoTBCalo/EcalTBRecProducers/interface/EcalTBWeightUncalibRecHitProducer.h +++ b/RecoTBCalo/EcalTBRecProducers/interface/EcalTBWeightUncalibRecHitProducer.h @@ -1,22 +1,31 @@ #ifndef RecoTBCalo_EcalTBRecProducers_EcalTBWeightUncalibRecHitProducer_HH #define RecoTBCalo_EcalTBRecProducers_EcalTBWeightUncalibRecHitProducer_HH -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRecWeightsAlgo.h" +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDigi/interface/EBDataFrame.h" #include "DataFormats/EcalDigi/interface/EEDataFrame.h" #include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCRecInfo.h" +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" #include "CondFormats/EcalObjects/interface/EcalWeight.h" +#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" +#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" // forward declaration -class EcalTBWeightUncalibRecHitProducer : public edm::EDProducer { +class EcalTBWeightUncalibRecHitProducer : public edm::stream::EDProducer<> { public: typedef std::vector EcalRecoAmplitudes; explicit EcalTBWeightUncalibRecHitProducer(const edm::ParameterSet& ps); @@ -24,15 +33,23 @@ class EcalTBWeightUncalibRecHitProducer : public edm::EDProducer { void produce(edm::Event& evt, const edm::EventSetup& es) override; private: - edm::InputTag EBdigiCollection_; // secondary name given to collection of digis - edm::InputTag EEdigiCollection_; // secondary name given to collection of digis - edm::InputTag tdcRecInfoCollection_; // secondary name given to collection of digis + const edm::InputTag ebDigiCollection_; + const edm::InputTag eeDigiCollection_; + const edm::InputTag tdcRecInfoCollection_; - std::string EBhitCollection_; // secondary name to be given to collection of hit - std::string EEhitCollection_; // secondary name to be given to collection of hit + const std::string ebHitCollection_; // secondary name to be given to collection of hit + const std::string eeHitCollection_; // secondary name to be given to collection of hit - EcalUncalibRecHitRecWeightsAlgo EBalgo_; - EcalUncalibRecHitRecWeightsAlgo EEalgo_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT tbTDCRecInfoToken_; + const edm::ESGetToken weightXtalGroupsToken_; + const edm::ESGetToken gainRatiosToken_; + const edm::ESGetToken tbWeightsToken_; + const edm::ESGetToken pedestalsToken_; + + EcalUncalibRecHitRecWeightsAlgo ebAlgo_; + EcalUncalibRecHitRecWeightsAlgo eeAlgo_; const EEShape testbeamEEShape; const EBShape testbeamEBShape; @@ -40,14 +57,9 @@ class EcalTBWeightUncalibRecHitProducer : public edm::EDProducer { /* HepMatrix makeMatrixFromVectors(const std::vector< std::vector >& vecvec); */ /* HepMatrix makeDummySymMatrix(int size); */ - int nbTimeBin_; + const int nbTimeBin_; //use 2004 convention for the TDC - bool use2004OffsetConvention_; - - /* int nMaxPrintout_; // max # of printouts */ - /* int counter_; // internal verbosity counter */ - - // bool counterExceeded() const { return ( (counter_>nMaxPrintout_) || (counter_<0) ) ; } + const bool use2004OffsetConvention_; }; #endif diff --git a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc index b83400d4156d2..6719b89ef40e2 100644 --- a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc +++ b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc @@ -9,36 +9,22 @@ * */ #include "RecoTBCalo/EcalTBRecProducers/interface/EcalTBWeightUncalibRecHitProducer.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDigi/interface/EcalMGPASample.h" #include "DataFormats/Common/interface/Handle.h" -#include -#include #include -#include "FWCore/Framework/interface/ESHandle.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" - #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" #include "CondFormats/EcalObjects/interface/EcalWeight.h" #include "CondFormats/EcalObjects/interface/EcalWeightSet.h" -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" -#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" @@ -46,18 +32,24 @@ #define DEBUG EcalTBWeightUncalibRecHitProducer::EcalTBWeightUncalibRecHitProducer(const edm::ParameterSet& ps) - : testbeamEEShape(), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(consumesCollector())//EEShape(consumesCollector()) are used - testbeamEBShape() // use default constructor if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) -{ - EBdigiCollection_ = ps.getParameter("EBdigiCollection"); - EEdigiCollection_ = ps.getParameter("EEdigiCollection"); - tdcRecInfoCollection_ = ps.getParameter("tdcRecInfoCollection"); - EBhitCollection_ = ps.getParameter("EBhitCollection"); - EEhitCollection_ = ps.getParameter("EEhitCollection"); - nbTimeBin_ = ps.getParameter("nbTimeBin"); - use2004OffsetConvention_ = ps.getUntrackedParameter("use2004OffsetConvention", false); - produces(EBhitCollection_); - produces(EEhitCollection_); + : ebDigiCollection_(ps.getParameter("EBdigiCollection")), + eeDigiCollection_(ps.getParameter("EEdigiCollection")), + tdcRecInfoCollection_(ps.getParameter("tdcRecInfoCollection")), + ebHitCollection_(ps.getParameter("EBhitCollection")), + eeHitCollection_(ps.getParameter("EEhitCollection")), + ebDigiToken_(consumes(ebDigiCollection_)), + eeDigiToken_(consumes(eeDigiCollection_)), + tbTDCRecInfoToken_(consumes(tdcRecInfoCollection_)), + weightXtalGroupsToken_(esConsumes()), + gainRatiosToken_(esConsumes()), + tbWeightsToken_(esConsumes()), + pedestalsToken_(esConsumes()), + testbeamEEShape(), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(consumesCollector())//EEShape(consumesCollector()) are used + testbeamEBShape(), // use default constructor if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) + nbTimeBin_(ps.getParameter("nbTimeBin")), + use2004OffsetConvention_(ps.getUntrackedParameter("use2004OffsetConvention", false)) { + produces(ebHitCollection_); + produces(eeHitCollection_); } EcalTBWeightUncalibRecHitProducer::~EcalTBWeightUncalibRecHitProducer() {} @@ -67,11 +59,10 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even Handle pEBDigis; const EBDigiCollection* EBdigis = nullptr; - if (!EBdigiCollection_.label().empty() || !EBdigiCollection_.instance().empty()) { - // evt.getByLabel( digiProducer_, EBdigiCollection_, pEBDigis); - evt.getByLabel(EBdigiCollection_, pEBDigis); + if (!ebDigiCollection_.label().empty() || !ebDigiCollection_.instance().empty()) { + evt.getByToken(ebDigiToken_, pEBDigis); if (!pEBDigis.isValid()) { - edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << EBdigiCollection_; + edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << ebDigiCollection_; } else { EBdigis = pEBDigis.product(); // get a ptr to the produc #ifdef DEBUG @@ -82,17 +73,14 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even Handle pEEDigis; const EEDigiCollection* EEdigis = nullptr; - - if (!EEdigiCollection_.label().empty() || !EEdigiCollection_.instance().empty()) { - // evt.getByLabel( digiProducer_, EEdigiCollection_, pEEDigis); - evt.getByLabel(EEdigiCollection_, pEEDigis); + if (!eeDigiCollection_.label().empty() || !eeDigiCollection_.instance().empty()) { + evt.getByToken(eeDigiToken_, pEEDigis); if (!pEEDigis.isValid()) { - edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << EEdigiCollection_; + edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << eeDigiCollection_; } else { EEdigis = pEEDigis.product(); // get a ptr to the produc #ifdef DEBUG LogDebug("EcalUncalibRecHitInfo") << "total # EEdigis: " << EEdigis->size(); - // std::cout << "total # EEdigis: " << EEdigis->size() << std::endl; #endif } } @@ -102,55 +90,36 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even Handle pRecTDC; const EcalTBTDCRecInfo* recTDC = nullptr; - - // evt.getByLabel( digiProducer_, EBdigiCollection_, pEBDigis); - evt.getByLabel(tdcRecInfoCollection_, pRecTDC); + evt.getByToken(tbTDCRecInfoToken_, pRecTDC); if (pRecTDC.isValid()) { recTDC = pRecTDC.product(); // get a ptr to the product } // fetch map of groups of xtals - edm::ESHandle pGrp; - es.get().get(pGrp); - const EcalWeightXtalGroups* grp = pGrp.product(); - if (!grp) - return; + const auto& grp = es.getData(weightXtalGroupsToken_); - const EcalXtalGroupsMap& grpMap = grp->getMap(); + const EcalXtalGroupsMap& grpMap = grp.getMap(); // Gain Ratios - edm::ESHandle pRatio; - es.get().get(pRatio); - const EcalGainRatioMap& gainMap = pRatio.product()->getMap(); // map of gain ratios + const EcalGainRatioMap& gainMap = es.getData(gainRatiosToken_).getMap(); // map of gain ratios // fetch TB weights #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "Fetching EcalTBWeights from DB "; - // std::cout <<"Fetching EcalTBWeights from DB " ; #endif - edm::ESHandle pWgts; - es.get().get(pWgts); - const EcalTBWeights* wgts = pWgts.product(); - - if (!wgts) - return; + const auto& wgts = es.getData(tbWeightsToken_); #ifdef DEBUG - LogDebug("EcalUncalibRecHitDebug") << "EcalTBWeightMap.size(): " << std::setprecision(3) << wgts->getMap().size(); - // std::cout << "EcalTBWeightMap.size(): " << std::setprecision(3) << wgts->getMap().size() ; + LogDebug("EcalUncalibRecHitDebug") << "EcalTBWeightMap.size(): " << std::setprecision(3) << wgts.getMap().size(); #endif // fetch the pedestals from the cond DB via EventSetup #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "fetching pedestals...."; - // std::cout << "fetching pedestals...."; #endif - edm::ESHandle pedHandle; - es.get().get(pedHandle); - const EcalPedestalsMap& pedMap = pedHandle.product()->getMap(); // map of pedestals + const EcalPedestalsMap& pedMap = es.getData(pedestalsToken_).getMap(); // map of pedestals #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "done."; - // std::cout << "done." ; #endif // collection of reco'ed ampltudes to put in the event @@ -178,8 +147,6 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even for (unsigned int idig = 0; idig < EBdigis->size(); ++idig) { EBDataFrame itdg = (*EBdigis)[idig]; - // counter_++; // verbosity counter - // find pedestals for this channel #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << EBDetId(itdg.id()); @@ -268,8 +235,8 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even } //check TDC // now lookup the correct weights in the map - wit = wgts->getMap().find(std::make_pair(gid, tdcid)); - if (wit == wgts->getMap().end()) { // no weights found for this group ID + wit = wgts.getMap().find(std::make_pair(gid, tdcid)); + if (wit == wgts.getMap().end()) { // no weights found for this group ID edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: " << gid.id() << " and EcalTDCId: " << tdcid << "\n skipping digi with id: " << EBDetId(itdg.id()); @@ -299,8 +266,7 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even // chi2mat[0]=&mat3; // chi2mat[1]=&mat4; - EcalUncalibratedRecHit aHit = EBalgo_.makeRecHit(itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEBShape); - //EBalgo_.makeRecHit(itdg, pedVec, gainRatios, weights, chi2mat); + EcalUncalibratedRecHit aHit = ebAlgo_.makeRecHit(itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEBShape); EBuncalibRechits->push_back(aHit); #ifdef DEBUG if (aHit.amplitude() > 0.) { @@ -311,18 +277,15 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even } } // put the collection of reconstructed hits in the event - evt.put(std::move(EBuncalibRechits), EBhitCollection_); + evt.put(std::move(EBuncalibRechits), ebHitCollection_); if (EEdigis) { for (unsigned int idig = 0; idig < EEdigis->size(); ++idig) { EEDataFrame itdg = (*EEdigis)[idig]; - // counter_++; // verbosity counter - // find pedestals for this channel #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << EEDetId(itdg.id()); - // std::cout << "looking up pedestal for crystal: " << EEDetId(itdg.id()) ; #endif pedIter = pedMap.find(itdg.id().rawId()); if (pedIter == pedMap.end()) { @@ -344,7 +307,6 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even // find gain ratios #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << EEDetId(itdg.id()); - // std::cout << "looking up gainRatios for crystal: " << EEDetId(itdg.id()) ; #endif gainIter = gainMap.find(itdg.id().rawId()); if (gainIter == gainMap.end()) { @@ -409,8 +371,8 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even } //check TDC // now lookup the correct weights in the map - wit = wgts->getMap().find(std::make_pair(gid, tdcid)); - if (wit == wgts->getMap().end()) { // no weights found for this group ID + wit = wgts.getMap().find(std::make_pair(gid, tdcid)); + if (wit == wgts.getMap().end()) { // no weights found for this group ID edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: " << gid.id() << " and EcalTDCId: " << tdcid << "\n skipping digi with id: " << EEDetId(itdg.id()); @@ -422,7 +384,6 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even #ifdef DEBUG LogDebug("EcalUncalibRecHitDebug") << "accessing matrices of weights..."; - // std::cout << "accessing matrices of weights..."; #endif const EcalWeightSet::EcalWeightMatrix& mat1 = wset.getWeightsBeforeGainSwitch(); const EcalWeightSet::EcalWeightMatrix& mat2 = wset.getWeightsAfterGainSwitch(); @@ -441,24 +402,18 @@ void EcalTBWeightUncalibRecHitProducer::produce(edm::Event& evt, const edm::Even //chi2mat[0]=&mat3; //chi2mat[1]=&mat4; - EcalUncalibratedRecHit aHit = EEalgo_.makeRecHit(itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEEShape); - //EEalgo_.makeRecHit(itdg, pedVec, gainRatios, weights, chi2mat); + EcalUncalibratedRecHit aHit = eeAlgo_.makeRecHit(itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEEShape); EEuncalibRechits->push_back(aHit); #ifdef DEBUG if (aHit.amplitude() > 0.) { LogDebug("EcalUncalibRecHitDebug") << "processed EEDataFrame with id: " << EEDetId(itdg.id()) << "\n" - << "uncalib rechit amplitude: " << aHit.amplitude() - - // std::cout << "processed EEDataFrame with id: " - // << EEDetId(itdg.id()) << "\n" - // << "uncalib rechit amplitude: " << aHit.amplitude() << std::endl; - ; + << "uncalib rechit amplitude: " << aHit.amplitude(); } #endif } } // put the collection of reconstructed hits in the event - evt.put(std::move(EEuncalibRechits), EEhitCollection_); + evt.put(std::move(EEuncalibRechits), eeHitCollection_); } // HepMatrix From 9a7dbd1cba5f445480412aa7731438ce10751772 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 3 Sep 2021 18:53:24 +0200 Subject: [PATCH 392/923] Apply code-format. --- .../src/EcalTBWeightUncalibRecHitProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc index 6719b89ef40e2..07e6b3022b01f 100644 --- a/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc +++ b/RecoTBCalo/EcalTBRecProducers/src/EcalTBWeightUncalibRecHitProducer.cc @@ -44,8 +44,8 @@ EcalTBWeightUncalibRecHitProducer::EcalTBWeightUncalibRecHitProducer(const edm:: gainRatiosToken_(esConsumes()), tbWeightsToken_(esConsumes()), pedestalsToken_(esConsumes()), - testbeamEEShape(), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(consumesCollector())//EEShape(consumesCollector()) are used - testbeamEBShape(), // use default constructor if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) + testbeamEEShape(), // Shapes have been updated in 2018 such as to be able to fetch shape from the DB if EBShape(consumesCollector())//EEShape(consumesCollector()) are used + testbeamEBShape(), // use default constructor if you would rather prefer to use Phase I hardcoded shapes (18.05.2018 K. Theofilatos) nbTimeBin_(ps.getParameter("nbTimeBin")), use2004OffsetConvention_(ps.getUntrackedParameter("use2004OffsetConvention", false)) { produces(ebHitCollection_); From 372464452650562166ad0cedfcfdb0d74809bbb7 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 12:37:53 -0500 Subject: [PATCH 393/923] Make header internally consistent --- SimMuon/MCTruth/interface/DTHitAssociator.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SimMuon/MCTruth/interface/DTHitAssociator.h b/SimMuon/MCTruth/interface/DTHitAssociator.h index 6ae5012f7561f..559935597e07a 100644 --- a/SimMuon/MCTruth/interface/DTHitAssociator.h +++ b/SimMuon/MCTruth/interface/DTHitAssociator.h @@ -15,10 +15,13 @@ #include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h" #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include #include +class MuonGeometryRecord; + class DTHitAssociator { public: typedef std::pair SimHitIdpr; From 15362a998e136a571c67ed49fa473b8319d629af Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 12:38:05 -0500 Subject: [PATCH 394/923] Add missing esConsumes --- SimMuon/MCTruth/interface/MuonAssociatorByHits.h | 3 +++ SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 11 ++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h index 7a75308f68607..ae809ce4ed1ec 100644 --- a/SimMuon/MCTruth/interface/MuonAssociatorByHits.h +++ b/SimMuon/MCTruth/interface/MuonAssociatorByHits.h @@ -26,6 +26,8 @@ namespace muonAssociatorByHitsDiagnostics { class InputDumper; } +class TrackerTopologyRcd; + class MuonAssociatorByHits { public: MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC); @@ -84,6 +86,7 @@ class MuonAssociatorByHits { CSCHitAssociator::Config cscHitAssociatorConfig_; DTHitAssociator::Config dtHitAssociatorConfig_; + const edm::ESGetToken ttopoToken_; std::unique_ptr diagnostics_; }; diff --git a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc index ef234b1b504eb..acbd9d35e1a5c 100644 --- a/SimMuon/MCTruth/src/MuonAssociatorByHits.cc +++ b/SimMuon/MCTruth/src/MuonAssociatorByHits.cc @@ -142,7 +142,8 @@ MuonAssociatorByHits::MuonAssociatorByHits(const edm::ParameterSet &conf, edm::C gemHitAssociatorConfig_(conf, iC), rpcHitAssociatorConfig_(conf, iC), cscHitAssociatorConfig_(conf, iC), - dtHitAssociatorConfig_(conf, iC) { + dtHitAssociatorConfig_(conf, iC), + ttopoToken_(iC.esConsumes()) { // hack for consumes if (conf.getUntrackedParameter("dumpInputCollections")) { diagnostics_ = std::make_unique(conf, std::move(iC)); @@ -164,9 +165,7 @@ RecoToSimCollection MuonAssociatorByHits::associateRecoToSim( } // Retrieve tracker topology from geometry - edm::ESHandle tTopoHand; - setup->get().get(tTopoHand); - const TrackerTopology *tTopo = tTopoHand.product(); + const TrackerTopology *tTopo = &setup->getData(ttopoToken_); // Tracker hit association TrackerHitAssociator trackertruth(*e, trackerHitAssociatorConfig_); @@ -212,9 +211,7 @@ SimToRecoCollection MuonAssociatorByHits::associateSimToReco( } // Retrieve tracker topology from geometry - edm::ESHandle tTopoHand; - setup->get().get(tTopoHand); - const TrackerTopology *tTopo = tTopoHand.product(); + const TrackerTopology *tTopo = &setup->getData(ttopoToken_); // Tracker hit association TrackerHitAssociator trackertruth(*e, trackerHitAssociatorConfig_); From baa591039632751cf9f717dc7e9474c75e149c8c Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 13:11:51 -0500 Subject: [PATCH 395/923] Add additional esConsumes to PhotonIsolationCalculator --- .../interface/PhotonIsolationCalculator.h | 4 ++++ .../PhotonIdentification/src/PhotonIsolationCalculator.cc | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 437ae038f2f5b..edbebc27626e4 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -25,6 +25,9 @@ #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" +class EcalSeverityLevelAlgo; +class EcalSeverityLevelAlgoRcd; + class PhotonIsolationCalculator { public: PhotonIsolationCalculator() {} @@ -99,6 +102,7 @@ class PhotonIsolationCalculator { edm::ESGetToken hcalChannelQualityToken_; edm::ESGetToken hcalSevLvlComputerToken_; edm::ESGetToken towerMapToken_; + edm::ESGetToken ecalSevLvlToken_; edm::EDGetToken trackInputTag_; edm::EDGetToken beamSpotProducerTag_; diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 7bb78e6e696d9..8a3442f9da7ae 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -48,6 +48,7 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, hcalChannelQualityToken_ = decltype(hcalChannelQualityToken_){iC.esConsumes(edm::ESInputTag("", "withTopo"))}; hcalSevLvlComputerToken_ = decltype(hcalSevLvlComputerToken_){iC.esConsumes()}; towerMapToken_ = decltype(towerMapToken_){iC.esConsumes()}; + ecalSevLvlToken_ = iC.esConsumes(); // gsfRecoInputTag_ = conf.getParameter("GsfRecoCollection"); modulePhiBoundary_ = conf.getParameter("modulePhiBoundary"); @@ -499,12 +500,9 @@ double PhotonIsolationCalculator::calculateEcalRecHitIso(const reco::Photon* pho const EcalRecHitCollection* rechitsCollectionEE_ = ecalhitsCollEE.product(); const EcalRecHitCollection* rechitsCollectionEB_ = ecalhitsCollEB.product(); - edm::ESHandle sevlv; - iSetup.get().get(sevlv); - const EcalSeverityLevelAlgo* sevLevel = sevlv.product(); + const EcalSeverityLevelAlgo* sevLevel = &iSetup.getData(ecalSevLvlToken_); - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); + edm::ESHandle geoHandle = iSetup.getHandle(caloGeometryToken_); EgammaRecHitIsolation phoIsoEB( RCone, RConeInner, etaSlice, etMin, eMin, geoHandle, *rechitsCollectionEB_, sevLevel, DetId::Ecal); From 2610ccad24b39fbd58886d5d9f7da91deecdd7de Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 16:07:26 -0500 Subject: [PATCH 396/923] Refactored EGEnergyCorrector to accomodates esConsumes - Split class into corrector and factories - Removed delayed initialization (now constructor initializes) --- .../interface/PhotonEnergyCorrector.h | 2 + .../src/PhotonEnergyCorrector.cc | 22 +++-- .../EgammaTools/interface/EGEnergyCorrector.h | 24 +++--- .../EGEnergyCorrectorFactoryFromEventSetup.h | 51 ++++++++++++ .../egEnergyCorrectorFactoryFromRootFile.h | 31 +++++++ .../EgammaTools/plugins/EGEnergyAnalyzer.cc | 21 +++-- .../EgammaTools/src/EGEnergyCorrector.cc | 81 +++---------------- .../EGEnergyCorrectorFactoryFromEventSetup.cc | 56 +++++++++++++ .../egEnergyCorrectorFactoryFromRootFile.cc | 33 ++++++++ 9 files changed, 220 insertions(+), 101 deletions(-) create mode 100644 RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h create mode 100644 RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h create mode 100644 RecoEgamma/EgammaTools/src/EGEnergyCorrectorFactoryFromEventSetup.cc create mode 100644 RecoEgamma/EgammaTools/src/egEnergyCorrectorFactoryFromRootFile.cc diff --git a/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h b/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h index f512f93fd9681..bc4aad4bc1cec 100644 --- a/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h +++ b/RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h @@ -13,6 +13,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h" +#include "RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h" #include "CommonTools/CandAlgos/interface/ModifyObjectValueBase.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" @@ -38,6 +39,7 @@ class PhotonEnergyCorrector { std::string w_file_; std::string w_db_; std::string candidateP4type_; + std::unique_ptr regressionCorrectorFactory_; std::unique_ptr regressionCorrector_; std::unique_ptr scEnergyFunction_; std::unique_ptr scCrackEnergyFunction_; diff --git a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc index cf3964dfa3ec0..a5e7bff93dae1 100644 --- a/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc +++ b/RecoEgamma/EgammaPhotonAlgos/src/PhotonEnergyCorrector.cc @@ -1,4 +1,5 @@ #include "RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h" +#include "RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" @@ -50,11 +51,14 @@ PhotonEnergyCorrector::PhotonEnergyCorrector(const edm::ParameterSet& config, ed // ingredient for energy regression weightsfromDB_ = config.getParameter("regressionWeightsFromDB"); w_file_ = config.getParameter("energyRegressionWeightsFileLocation"); - if (weightsfromDB_) + if (weightsfromDB_) { w_db_ = config.getParameter("energyRegressionWeightsDBLocation"); - else - w_db_ = "none"; - regressionCorrector_ = std::make_unique(); + regressionCorrectorFactory_ = std::make_unique(iC, w_db_); + } else if (w_file_ != "none") { + regressionCorrector_ = std::make_unique(egEnergyCorrectorFactoryFromRootFile(w_file_.c_str())); + } else { + regressionCorrector_ = std::make_unique(); + } } void PhotonEnergyCorrector::init(const edm::EventSetup& theEventSetup) { @@ -65,15 +69,9 @@ void PhotonEnergyCorrector::init(const edm::EventSetup& theEventSetup) { scEnergyErrorFunction_->init(theEventSetup); photonEcalEnergyCorrFunction_->init(theEventSetup); - if (weightsfromDB_) { - if (!regressionCorrector_->IsInitialized()) - regressionCorrector_->Initialize(theEventSetup, w_db_, weightsfromDB_); - } - if (!weightsfromDB_ && !(w_file_ == "none")) { - if (!regressionCorrector_->IsInitialized()) - regressionCorrector_->Initialize(theEventSetup, w_file_, weightsfromDB_); + if (not regressionCorrector_) { + regressionCorrector_ = std::make_unique(regressionCorrectorFactory_->build(theEventSetup)); } - photonUncertaintyCalculator_->init(theEventSetup); } diff --git a/RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h b/RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h index 32f37d6d13659..2f80ca0d5a9f9 100644 --- a/RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h +++ b/RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h @@ -10,21 +10,27 @@ #ifndef EGAMMATOOLS_EGEnergyCorrector_H #define EGAMMATOOLS_EGEnergyCorrector_H -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" #include +#include class GBRForest; class EGEnergyCorrector { public: - ~EGEnergyCorrector(); + struct Initializer { + std::shared_ptr readereb_; + std::shared_ptr readerebvariance_; + std::shared_ptr readeree_; + std::shared_ptr readereevariance_; + }; - void Initialize(const edm::EventSetup &iSetup, std::string regweights, bool weightsFromDB = false); - bool IsInitialized() const { return fIsInitialized; } + ~EGEnergyCorrector() = default; + EGEnergyCorrector() = default; + explicit EGEnergyCorrector(Initializer) noexcept; std::pair CorrectedEnergyWithError(const reco::Photon &p, const reco::VertexCollection &vtxcol, @@ -39,13 +45,11 @@ class EGEnergyCorrector { bool applyRescale = false); protected: - const GBRForest *fReadereb = nullptr; - const GBRForest *fReaderebvariance = nullptr; - const GBRForest *fReaderee = nullptr; - const GBRForest *fReadereevariance = nullptr; + std::shared_ptr fReadereb; + std::shared_ptr fReaderebvariance; + std::shared_ptr fReaderee; + std::shared_ptr fReadereevariance; - bool fIsInitialized = false; - bool fOwnsForests = false; std::array fVals; }; diff --git a/RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h b/RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h new file mode 100644 index 0000000000000..712dcb9911fb3 --- /dev/null +++ b/RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h @@ -0,0 +1,51 @@ +#ifndef RecoEgamma_EgammaTools_EGEnergyCorrectorFactoryFromEventSetup_h +#define RecoEgamma_EgammaTools_EGEnergyCorrectorFactoryFromEventSetup_h +// -*- C++ -*- +// +// Package: RecoEgamma/EgammaTools +// Class : EGEnergyCorrectorFactoryFromEventSetup +// +/**\class EGEnergyCorrectorFactoryFromEventSetup EGEnergyCorrectorFactoryFromEventSetup.h "RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h" + + Description: Initializes a EGEnergyCorrector from data in the DB + + Usage: + + +*/ +// +// Original Author: Christopher Jones +// Created: Fri, 03 Sep 2021 18:54:38 GMT +// + +// system include files + +// user include files +#include "EGEnergyCorrector.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EventSetup.h" + +// forward declarations +class GBRWrapperRcd; + +class EGEnergyCorrectorFactoryFromEventSetup { +public: + EGEnergyCorrectorFactoryFromEventSetup(edm::ConsumesCollector, std::string const& regweigths); + + EGEnergyCorrectorFactoryFromEventSetup(const EGEnergyCorrectorFactoryFromEventSetup&) = delete; // stop default + const EGEnergyCorrectorFactoryFromEventSetup& operator=(const EGEnergyCorrectorFactoryFromEventSetup&) = + delete; // stop default + + // ---------- const member functions --------------------- + EGEnergyCorrector::Initializer build(edm::EventSetup const&) const; + +private: + // ---------- member data -------------------------------- + edm::ESGetToken const ebCorrectionTag_; + edm::ESGetToken const ebUncertaintyTag_; + edm::ESGetToken const eeCorrectionTag_; + edm::ESGetToken const eeUncertaintyTag_; +}; + +#endif diff --git a/RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h b/RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h new file mode 100644 index 0000000000000..a997cc1b36fa3 --- /dev/null +++ b/RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h @@ -0,0 +1,31 @@ +#ifndef RecoEgamma_EgammaTools_egEnergyCorrectorFactoryFromRootFile_h +#define RecoEgamma_EgammaTools_egEnergyCorrectorFactoryFromRootFile_h +// -*- C++ -*- +// +// Package: RecoEgamma/EgammaTools +// Class : egEnergyCorrectorFactoryFromRootFile +// +/**\class egEnergyCorrectorFactoryFromRootFile egEnergyCorrectorFactoryFromRootFile.h "RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h" + + Description: function to setup initialization ofr EGEnergyCorrector based on data stored in a file + + Usage: + + +*/ +// +// Original Author: Christopher Jones +// Created: Fri, 03 Sep 2021 18:54:50 GMT +// + +// system include files +#include + +// user include files +#include "EGEnergyCorrector.h" + +// forward declarations + +EGEnergyCorrector::Initializer egEnergyCorrectorFactoryFromRootFile(const char* fileName); + +#endif diff --git a/RecoEgamma/EgammaTools/plugins/EGEnergyAnalyzer.cc b/RecoEgamma/EgammaTools/plugins/EGEnergyAnalyzer.cc index 992be35f2d9e5..1c0567e86c6af 100644 --- a/RecoEgamma/EgammaTools/plugins/EGEnergyAnalyzer.cc +++ b/RecoEgamma/EgammaTools/plugins/EGEnergyAnalyzer.cc @@ -35,6 +35,8 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" #include "RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h" +#include "RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h" +#include "RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h" #include "DataFormats/EgammaCandidates/interface/Photon.h" // @@ -53,15 +55,18 @@ class EGEnergyAnalyzer : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; + EGEnergyCorrectorFactoryFromEventSetup corddbFactory_; EGEnergyCorrector corfile; - EGEnergyCorrector cordb; + std::optional cordb; edm::EDGetTokenT ebRHToken_, eeRHToken_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; }; EGEnergyAnalyzer::EGEnergyAnalyzer(const edm::ParameterSet& iConfig) - : ecalClusterToolsESGetTokens_{consumesCollector()} { + : corddbFactory_(consumesCollector(), "wgbrph"), + corfile(egEnergyCorrectorFactoryFromRootFile("/afs/cern.ch/user/b/bendavid/cmspublic/gbrv3ph.root")), + ecalClusterToolsESGetTokens_{consumesCollector()} { ebRHToken_ = consumes(edm::InputTag("reducedEcalRecHitsEB")); eeRHToken_ = consumes(edm::InputTag("reducedEcalRecHitsEE")); } @@ -79,14 +84,8 @@ EGEnergyAnalyzer::~EGEnergyAnalyzer() { void EGEnergyAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - if (!corfile.IsInitialized()) { - corfile.Initialize(iSetup, "/afs/cern.ch/user/b/bendavid/cmspublic/gbrv3ph.root"); - //corfile.Initialize(iSetup,"wgbrph",true); - } - - if (!cordb.IsInitialized()) { - //cordb.Initialize(iSetup,"/afs/cern.ch/user/b/bendavid/cmspublic/regweights/gbrph.root"); - cordb.Initialize(iSetup, "wgbrph", true); + if (!cordb) { + cordb = EGEnergyCorrector(corddbFactory_.build(iSetup)); } // get photon collection @@ -102,7 +101,7 @@ void EGEnergyAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& for (auto const& it : *hPhotonProduct) { std::pair corsfile = corfile.CorrectedEnergyWithError(it, *hVertexProduct, lazyTools, caloGeometry); - std::pair corsdb = cordb.CorrectedEnergyWithError(it, *hVertexProduct, lazyTools, caloGeometry); + std::pair corsdb = cordb->CorrectedEnergyWithError(it, *hVertexProduct, lazyTools, caloGeometry); printf("file: default = %5f, correction = %5f, uncertainty = %5f\n", it.energy(), corsfile.first, corsfile.second); printf("db: default = %5f, correction = %5f, uncertainty = %5f\n", it.energy(), corsdb.first, corsdb.second); diff --git a/RecoEgamma/EgammaTools/src/EGEnergyCorrector.cc b/RecoEgamma/EgammaTools/src/EGEnergyCorrector.cc index 36514104e6657..c4494a02af7d8 100644 --- a/RecoEgamma/EgammaTools/src/EGEnergyCorrector.cc +++ b/RecoEgamma/EgammaTools/src/EGEnergyCorrector.cc @@ -1,76 +1,21 @@ -#include #include "RecoEgamma/EgammaTools/interface/EGEnergyCorrector.h" #include "CondFormats/GBRForest/interface/GBRForest.h" -#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/EgammaCandidates/interface/Photon.h" #include "DataFormats/Math/interface/deltaPhi.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "RecoEgamma/EgammaTools/interface/EcalClusterLocal.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" using namespace reco; //-------------------------------------------------------------------------------------------------- -EGEnergyCorrector::~EGEnergyCorrector() { - if (fOwnsForests) { - if (fReadereb) - delete fReadereb; - if (fReaderebvariance) - delete fReaderebvariance; - if (fReaderee) - delete fReaderee; - if (fReadereevariance) - delete fReadereevariance; - } -} - -//-------------------------------------------------------------------------------------------------- -void EGEnergyCorrector::Initialize(const edm::EventSetup &iSetup, std::string regweights, bool weightsFromDB) { - fIsInitialized = true; - - if (fOwnsForests) { - if (fReadereb) - delete fReadereb; - if (fReaderebvariance) - delete fReaderebvariance; - if (fReaderee) - delete fReaderee; - if (fReadereevariance) - delete fReadereevariance; - } - +EGEnergyCorrector::EGEnergyCorrector(Initializer init) noexcept + : fReadereb(std::move(init.readereb_)), + fReaderebvariance(std::move(init.readerebvariance_)), + fReaderee(std::move(init.readeree_)), + fReadereevariance(std::move(init.readereevariance_)) { fVals.fill(0.0f); - - if (weightsFromDB) { //weights from event setup - - edm::ESHandle readereb; - edm::ESHandle readerebvar; - edm::ESHandle readeree; - edm::ESHandle readereevar; - - iSetup.get().get(regweights + "_EBCorrection", readereb); - iSetup.get().get(regweights + "_EBUncertainty", readerebvar); - iSetup.get().get(regweights + "_EECorrection", readeree); - iSetup.get().get(regweights + "_EEUncertainty", readereevar); - - fReadereb = readereb.product(); - fReaderebvariance = readerebvar.product(); - fReaderee = readeree.product(); - fReadereevariance = readereevar.product(); - - } else { //weights from root file - fOwnsForests = true; - - TFile *fgbr = TFile::Open(regweights.c_str(), "READ"); - fReadereb = (GBRForest *)fgbr->Get("EBCorrection"); - fReaderebvariance = (GBRForest *)fgbr->Get("EBUncertainty"); - fReaderee = (GBRForest *)fgbr->Get("EECorrection"); - fReadereevariance = (GBRForest *)fgbr->Get("EEUncertainty"); - fgbr->Close(); - } } //-------------------------------------------------------------------------------------------------- @@ -252,12 +197,12 @@ std::pair EGEnergyCorrector::CorrectedEnergyWithError(const Phot const GBRForest *readervar; if (isbarrel) { den = s->rawEnergy(); - reader = fReadereb; - readervar = fReaderebvariance; + reader = fReadereb.get(); + readervar = fReaderebvariance.get(); } else { den = s->rawEnergy() + s->preshowerEnergy(); - reader = fReaderee; - readervar = fReadereevariance; + reader = fReaderee.get(); + readervar = fReadereevariance.get(); } double ecor = reader->GetResponse(fVals.data()) * den; @@ -361,12 +306,12 @@ std::pair EGEnergyCorrector::CorrectedEnergyWithErrorV3(const Ph const GBRForest *readervar; if (isbarrel) { den = s->rawEnergy(); - reader = fReadereb; - readervar = fReaderebvariance; + reader = fReadereb.get(); + readervar = fReaderebvariance.get(); } else { den = s->rawEnergy() + s->preshowerEnergy(); - reader = fReaderee; - readervar = fReadereevariance; + reader = fReaderee.get(); + readervar = fReadereevariance.get(); } double ecor = reader->GetResponse(fVals.data()) * den; diff --git a/RecoEgamma/EgammaTools/src/EGEnergyCorrectorFactoryFromEventSetup.cc b/RecoEgamma/EgammaTools/src/EGEnergyCorrectorFactoryFromEventSetup.cc new file mode 100644 index 0000000000000..112802d370f18 --- /dev/null +++ b/RecoEgamma/EgammaTools/src/EGEnergyCorrectorFactoryFromEventSetup.cc @@ -0,0 +1,56 @@ +// -*- C++ -*- +// +// Package: RecoEgamma/EgammaTools +// Class : EGEnergyCorrectorFactoryFromEventSetup +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Christopher Jones +// Created: Fri, 03 Sep 2021 18:55:05 GMT +// + +// system include files + +// user include files +#include "RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h" + +#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" +#include "FWCore/Framework/interface/ESHandle.h" + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +EGEnergyCorrectorFactoryFromEventSetup::EGEnergyCorrectorFactoryFromEventSetup(edm::ConsumesCollector cc, + std::string const& regweigths) + : ebCorrectionTag_(cc.esConsumes(edm::ESInputTag("", regweigths + "_EBCorrection"))), + ebUncertaintyTag_(cc.esConsumes(edm::ESInputTag("", regweigths + "_EBUncertainty"))), + eeCorrectionTag_(cc.esConsumes(edm::ESInputTag("", regweigths + "_EECorrection"))), + eeUncertaintyTag_(cc.esConsumes(edm::ESInputTag("", regweigths + "_EEUncertainty"))) {} + +// +// const member functions +// +EGEnergyCorrector::Initializer EGEnergyCorrectorFactoryFromEventSetup::build(edm::EventSetup const& iSetup) const { + EGEnergyCorrector::Initializer ret; + auto no_del = [](void const*) {}; + + ret.readereb_ = std::shared_ptr(&iSetup.getData(ebCorrectionTag_), no_del); + ret.readerebvariance_ = std::shared_ptr(&iSetup.getData(ebUncertaintyTag_), no_del); + ret.readeree_ = std::shared_ptr(&iSetup.getData(eeCorrectionTag_), no_del); + ret.readereevariance_ = std::shared_ptr(&iSetup.getData(eeUncertaintyTag_), no_del); + + return ret; +} + +// +// static member functions +// diff --git a/RecoEgamma/EgammaTools/src/egEnergyCorrectorFactoryFromRootFile.cc b/RecoEgamma/EgammaTools/src/egEnergyCorrectorFactoryFromRootFile.cc new file mode 100644 index 0000000000000..62ce398e1e148 --- /dev/null +++ b/RecoEgamma/EgammaTools/src/egEnergyCorrectorFactoryFromRootFile.cc @@ -0,0 +1,33 @@ +// -*- C++ -*- +// +// Package: RecoEgamma/EgammaTools +// Class : egEnergyCorrectorFactoryFromRootFile +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Christopher Jones +// Created: Fri, 03 Sep 2021 18:57:07 GMT +// + +// system include files +#include + +// user include files +#include "RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h" +#include "CondFormats/GBRForest/interface/GBRForest.h" + +// +// constants, enums and typedefs +// + +EGEnergyCorrector::Initializer egEnergyCorrectorFactoryFromRootFile(const char *fileName) { + EGEnergyCorrector::Initializer ret; + std::unique_ptr fgbr(TFile::Open(fileName, "READ")); + ret.readereb_.reset((GBRForest *)fgbr->Get("EBCorrection")); + ret.readerebvariance_.reset((GBRForest *)fgbr->Get("EBUncertainty")); + ret.readeree_.reset((GBRForest *)fgbr->Get("EECorrection")); + ret.readereevariance_.reset((GBRForest *)fgbr->Get("EEUncertainty")); + fgbr->Close(); + return ret; +} From 67fec66410ca4d22987e51edd7b89ed492cacfe8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 3 Sep 2021 16:33:23 -0500 Subject: [PATCH 397/923] Added esConsumes to PhotonProducer --- .../src/PhotonProducer.cc | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index d3d9edcf4e154..8fdf6f536cbe2 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -58,8 +58,7 @@ class PhotonProducer : public edm::stream::EDProducer<> { ElectronHcalHelper const& hcalHelperBc, reco::VertexCollection& pvVertices, reco::PhotonCollection& outputCollection, - int& iSC, - const EcalSeverityLevelAlgo* sevLv); + int& iSC); // std::string PhotonCoreCollection_; std::string PhotonCollection_; @@ -68,6 +67,8 @@ class PhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT endcapEcalHits_; edm::EDGetTokenT hbheRecHits_; edm::EDGetTokenT vertexProducer_; + const edm::ESGetToken caloGeomToken_; + const edm::ESGetToken topologyToken_; //AA //Flags and severities to be excluded from calculations @@ -110,7 +111,8 @@ class PhotonProducer : public edm::stream::EDProducer<> { #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(PhotonProducer); -PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCorrector_(config, consumesCollector()) { +PhotonProducer::PhotonProducer(const edm::ParameterSet& config) + : caloGeomToken_(esConsumes()), topologyToken_(esConsumes()), photonEnergyCorrector_(config, consumesCollector()) { // use configuration file to setup input/output collection names photonCoreProducer_ = consumes(config.getParameter("photonCoreProducer")); @@ -271,15 +273,7 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve if (validEcalRecHits) endcapRecHits = *(endcapHitHandle.product()); - //AA - //Get the severity level object - edm::ESHandle sevLv; - theEventSetup.get().get(sevLv); - // - - edm::ESHandle pTopology; - theEventSetup.get().get(pTopology); - const CaloTopology* topology = pTopology.product(); + const CaloTopology* topology = &theEventSetup.getData(topologyToken_); // prepare access to hcal data hcalHelperCone_->beginEvent(theEvent, theEventSetup); @@ -313,8 +307,7 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve *hcalHelperBc_, vertexCollection, outputPhotonCollection, - iSC, - sevLv.product()); + iSC); // put the product in the event edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n"; @@ -339,15 +332,11 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, ElectronHcalHelper const& hcalHelperBc, reco::VertexCollection& vertexCollection, reco::PhotonCollection& outputPhotonCollection, - int& iSC, - const EcalSeverityLevelAlgo* sevLv) { + int& iSC) { // get the geometry from the event setup: - edm::ESHandle caloGeomHandle; - es.get().get(caloGeomHandle); - - const CaloGeometry* geometry = caloGeomHandle.product(); + const CaloGeometry* geometry = &es.getData(caloGeomToken_); const CaloSubdetectorGeometry* subDetGeometry = nullptr; - const CaloSubdetectorGeometry* geometryES = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); + const CaloSubdetectorGeometry* geometryES = geometry->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); const EcalRecHitCollection* hits = nullptr; std::vector preselCutValues; float minR9 = 0; @@ -362,7 +351,7 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, iSC++; int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId(); - subDetGeometry = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, subdet); + subDetGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, subdet); if (subdet == EcalBarrel) { preselCutValues = preselCutValuesBarrel_; From 9405871c39643702b9462e23ef0fd9ee0f5df006 Mon Sep 17 00:00:00 2001 From: Salavat Date: Sat, 4 Sep 2021 07:24:28 +0200 Subject: [PATCH 398/923] preparation for reformatted HF SL --- SimG4CMS/Calo/src/HFShowerLibrary.cc | 3 ++- .../interface/HcalForwardLibWriter.h | 2 ++ .../plugins/HcalForwardLibWriter.cc | 20 ++++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/SimG4CMS/Calo/src/HFShowerLibrary.cc b/SimG4CMS/Calo/src/HFShowerLibrary.cc index 9b9980b205119..ab45964fdfd0b 100644 --- a/SimG4CMS/Calo/src/HFShowerLibrary.cc +++ b/SimG4CMS/Calo/src/HFShowerLibrary.cc @@ -354,7 +354,8 @@ void HFShowerLibrary::getRecord(int type, int record) { if (newForm) { if (!v3version) { hadBranch->SetAddress(&photo); - hadBranch->GetEntry(nrc + totEvents); + int position = (fileVersion_ >= 2) ? nrc : (nrc + totEvents); + hadBranch->GetEntry(position); } else { std::vector t; std::vector* tp = &t; diff --git a/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h b/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h index 57566ecfe123b..ee177ee60903e 100644 --- a/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h +++ b/SimG4CMS/ShowerLibraryProducer/interface/HcalForwardLibWriter.h @@ -50,6 +50,8 @@ class HcalForwardLibWriter : public edm::one::EDAnalyzer<> { TTree* theTree; TFile* LibFile; TTree* LibTree; + TBranch* emBranch; + TBranch* hadBranch; edm::Service fs; std::string theDataFile; diff --git a/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc index 8d47db85692a5..8626a85bbbfff 100644 --- a/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc +++ b/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc @@ -27,8 +27,8 @@ HcalForwardLibWriter::HcalForwardLibWriter(const edm::ParameterSet& iConfig) { //https://root.cern/root/html534/TTree.html // TBranch*Branch(const char* name, const char* classname, void** obj, Int_t bufsize = 32000, Int_t splitlevel = 99) - LibTree->Branch("emParticles", "HFShowerPhotons-emParticles", &emColl, bsize, splitlevel); - LibTree->Branch("hadParticles", "HFShowerPhotons-hadParticles", &hadColl, bsize, splitlevel); + emBranch = LibTree->Branch("emParticles", "HFShowerPhotons-emParticles", &emColl, bsize, splitlevel); + hadBranch = LibTree->Branch("hadParticles", "HFShowerPhotons-hadParticles", &hadColl, bsize, splitlevel); } HcalForwardLibWriter::~HcalForwardLibWriter() {} @@ -41,6 +41,9 @@ void HcalForwardLibWriter::analyze(const edm::Event& iEvent, const edm::EventSet for (int i = 0; i < nbins; ++i) en.push_back(momBin[i]); + int nem = 0; + int nhad = 0; + //shower photons int n = theFileHandle.size(); // cycle over files ++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -113,16 +116,15 @@ void HcalForwardLibWriter::analyze(const edm::Event& iEvent, const edm::EventSet } // end of cycle over photons in shower ------------------------------------------- - // if(iev>0) LibTree->SetBranchStatus("HFShowerLibInfo",0); - if (particle == "electron") { - LibTree->SetBranchStatus("hadParticles", false); - } else { - LibTree->SetBranchStatus("emParticles", false); - } - LibTree->Fill(); if (particle == "electron") { + LibTree->SetEntries(nem + 1); + emBranch->Fill(); + nem++; emColl.clear(); } else { + LibTree->SetEntries(nhad + 1); + nhad++; + hadBranch->Fill(); hadColl.clear(); } } From 4a543e166226470daac16908272b619598e26456 Mon Sep 17 00:00:00 2001 From: Salavat Date: Sat, 4 Sep 2021 07:54:11 +0200 Subject: [PATCH 399/923] activating reformatted HF SL --- Geometry/HcalSimData/python/HFParameters_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/HcalSimData/python/HFParameters_cff.py b/Geometry/HcalSimData/python/HFParameters_cff.py index b126e42e620f5..a4c925fd28075 100644 --- a/Geometry/HcalSimData/python/HFParameters_cff.py +++ b/Geometry/HcalSimData/python/HFParameters_cff.py @@ -33,5 +33,5 @@ ## Change for the new HFShowerLibrary file to be used for Run 3 ## from Configuration.Eras.Modifier_run3_HFSL_cff import run3_HFSL -run3_HFSL.toModify( HFLibraryFileBlock, FileName = 'SimG4CMS/Calo/data/HFShowerLibrary_run3_v5.root', FileVersion = 1 ) +run3_HFSL.toModify( HFLibraryFileBlock, FileName = 'SimG4CMS/Calo/data/HFShowerLibrary_run3_v6.root', FileVersion = 2 ) run3_HFSL.toModify( HFShowerBlock, EqualizeTimeShift = True ) From be8a2d8d3e300fdf7e199427bf88092c625131d4 Mon Sep 17 00:00:00 2001 From: Salavat Date: Sat, 4 Sep 2021 08:04:47 +0200 Subject: [PATCH 400/923] adjusting samplingFactors --- .../HcalSimProducers/python/hcalSimParameters_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimCalorimetry/HcalSimProducers/python/hcalSimParameters_cfi.py b/SimCalorimetry/HcalSimProducers/python/hcalSimParameters_cfi.py index 88f2ca002a518..8367c15283f66 100644 --- a/SimCalorimetry/HcalSimProducers/python/hcalSimParameters_cfi.py +++ b/SimCalorimetry/HcalSimProducers/python/hcalSimParameters_cfi.py @@ -180,10 +180,10 @@ readoutFrameSize = cms.int32(10), binOfMaximum = cms.int32(6) ), - hf1 = dict( samplingFactor = 0.36, + hf1 = dict( samplingFactor = 0.37, timePhase = 9.0 ), - hf2 = dict( samplingFactor = 0.36, + hf2 = dict( samplingFactor = 0.37, timePhase = 8.0 ) ) From cfe70c03000271bd3a6ce065277c9a9534c7332a Mon Sep 17 00:00:00 2001 From: Salavat Date: Sat, 4 Sep 2021 08:50:38 +0200 Subject: [PATCH 401/923] SL production recipe --- .../test/README_SL_production_recipe.txt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt diff --git a/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt b/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt new file mode 100644 index 0000000000000..3b3e985a87d51 --- /dev/null +++ b/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt @@ -0,0 +1,40 @@ +(1) +Use configuration file runHFShowerTMP_cfg.py in directory +/CMSSW_12_*_*/src/SimG4CMS/ShowerLibraryProducer/test/python. +with EDProducer parameters as listed below (here - for electrons of 100 GeV): + PartID = cms.vint32(11), + MinEta = cms.double(4), + MaxEta = cms.double(4), + MinPhi = cms.double(-3.14159265359), + MaxPhi = cms.double(3.14159265359), + MinE = cms.double(100), + MaxE = cms.double(100) +to perform a full simulation of showers in HF. +Do it for all necessary energy points separately for pions and electrons. + +(2) +Incident angle fixed to eta=4 and with random phi. +The grid of energies is specified in the file +/CMSSW_12_*_*/src/SimG4CMS/ShowerLibraryProducer/data/fileList.txt. +Energies from the list should be used in the producer parameter list above (1). + +(3) +Simulation is performed in special geometry with a staring point at 1000 mm from HF surface filled with air. +To produce a sample with 10k showers for each energy, the number of simulated events should be somewhat bigger, +since some part of incident particles interacts in the air. +The latter showers are excluded from final sample and exactly 10k showers are selected and recorded. +So in production configuration file, number of event should be set this way: + process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(11000) +) + +(4) +Once 16*2 samples of showers are produced, they should be moved to the directory +/CMSSW_12_*_*/src/SimG4CMS/ShowerLibraryProducer/python, +where HF ShowerLibrary can be assembled from these input files using writelibraryfile_cfg.py [*] + + +----- +[*] +Source file /CMSSW_*_*/src/SimG4CMS/ShowerLibraryProducer/plugins/HcalForwardLibWriter.cc +Configuration file is /CMSSW_12_*_*/src/SimG4CMS/ShowerLibraryProducer/python/writelibraryfile_cfg.py From 772b3e45b8734af9838f345bcd8d3affcd61ef5e Mon Sep 17 00:00:00 2001 From: Mateusz Date: Sat, 4 Sep 2021 17:23:48 +0200 Subject: [PATCH 402/923] Deleted obsolete files and lines of code. --- .../plugins/PPSAlignmentConfigESSource.cc | 690 ------------------ CondCore/Utilities/plugins/Module_2XML.cc | 1 - CondCore/Utilities/src/CondDBFetch.cc | 1 - CondCore/Utilities/src/CondDBImport.cc | 1 - CondCore/Utilities/src/CondFormats.h | 1 - CondFormats/PPSObjects/test/BuildFile.xml | 4 - .../testSerializationPPSAlignmentConfig.cc | 17 - .../plugins/RetrievePPSAlignmentConfig.cc | 42 -- .../CTPPS/plugins/WritePPSAlignmentConfig.cc | 51 -- .../test/retrieve_PPSAlignmentConfig_cfg.py | 52 -- .../test/write_PPSAlignmentConfig_cfg.py | 88 --- 11 files changed, 948 deletions(-) delete mode 100644 CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc delete mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc delete mode 100644 CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc delete mode 100644 CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc delete mode 100644 CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py delete mode 100644 CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc deleted file mode 100644 index 5a23314fe8e8b..0000000000000 --- a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc +++ /dev/null @@ -1,690 +0,0 @@ -/**************************************************************************** - * - * CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc - * - * Description: Constructs PPSAlignmentConfig instance - * - * Authors: - * - Jan KaÅ¡par - * - Mateusz Kocot - * - ****************************************************************************/ - -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/SourceFactory.h" -#include "FWCore/Framework/interface/ModuleFactory.h" - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESProducts.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/ESInputTag.h" - -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" - -#include -#include -#include -#include -#include - -#include "TF1.h" -#include "TProfile.h" -#include "TFile.h" -#include "TKey.h" -#include "TSystemFile.h" - -//--------------------------------------------------------------------------------------------- - -class PPSAlignmentConfigESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - PPSAlignmentConfigESSource(const edm::ParameterSet &iConfig); - - std::unique_ptr produce(const PPSAlignmentConfigRcd &); - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc); - TDirectory *findDirectoryWithName(TDirectory *dir, std::string searchName); - std::vector buildVectorFromDirectory(TDirectory *dir, const RPConfig &rpd); - - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, - const edm::IOVSyncValue &iosv, - edm::ValidityInterval &oValidity) override; - - bool debug; - - std::vector sequence; - std::string resultsDir; - - SectorConfig sectorConfig45, sectorConfig56; - - double x_ali_sh_step; - - double y_mode_sys_unc; - double chiSqThreshold; - double y_mode_unc_max_valid; - double y_mode_max_valid; - - unsigned int maxRPTracksSize; - double n_si; - - std::map> matchingReferencePoints; - std::map matchingShiftRanges; - - std::map alignment_x_meth_o_ranges; - unsigned int fitProfileMinBinEntries; - unsigned int fitProfileMinNReasonable; - unsigned int methOGraphMinN; - double methOUncFitRange; - - std::map alignment_x_relative_ranges; - unsigned int nearFarMinEntries; - - std::map alignment_y_ranges; - unsigned int modeGraphMinN; - unsigned int multSelProjYMinEntries; - - Binning binning; - - std::string label; -}; - -//--------------------------------------------------------------------------------------------- - -PPSAlignmentConfigESSource::PPSAlignmentConfigESSource(const edm::ParameterSet &iConfig) { - label = iConfig.getParameter("label"); - - debug = iConfig.getParameter("debug"); - TFile *debugFile = nullptr; - if (debug) { - debugFile = new TFile(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate"); - } - - sequence = iConfig.getParameter>("sequence"); - resultsDir = iConfig.getParameter("results_dir"); - - sectorConfig45.name_ = "sector 45"; - - sectorConfig45.rp_N_.position_ = "N"; - sectorConfig45.rp_F_.position_ = "F"; - - sectorConfig56.name_ = "sector 56"; - - sectorConfig56.rp_N_.position_ = "N"; - sectorConfig56.rp_F_.position_ = "F"; - - for (std::string sectorName : {"sector_45", "sector_56"}) { - const auto &sps = iConfig.getParameter(sectorName); - SectorConfig *sc; - if (sectorName == "sector_45") - sc = §orConfig45; - else - sc = §orConfig56; - - for (std::string rpName : {"rp_N", "rp_F"}) { - const auto &rpps = sps.getParameter(rpName); - RPConfig *rc; - if (rpName == "rp_N") - rc = &sc->rp_N_; - else - rc = &sc->rp_F_; - - rc->name_ = rpps.getParameter("name"); - rc->id_ = rpps.getParameter("id"); - - rc->slope_ = rpps.getParameter("slope"); - rc->sh_x_ = rpps.getParameter("sh_x"); - - rc->x_min_fit_mode_ = rpps.getParameter("x_min_fit_mode"); - rc->x_max_fit_mode_ = rpps.getParameter("x_max_fit_mode"); - rc->y_max_fit_mode_ = rpps.getParameter("y_max_fit_mode"); - rc->y_cen_add_ = rpps.getParameter("y_cen_add"); - rc->y_width_mult_ = rpps.getParameter("y_width_mult"); - - rc->x_slice_min_ = rpps.getParameter("x_slice_min"); - rc->x_slice_w_ = rpps.getParameter("x_slice_w"); - rc->x_slice_n_ = std::ceil((rpps.getParameter("x_slice_max") - rc->x_slice_min_) / rc->x_slice_w_); - } - - sc->slope_ = sps.getParameter("slope"); - - sc->cut_h_apply_ = sps.getParameter("cut_h_apply"); - sc->cut_h_a_ = sps.getParameter("cut_h_a"); - sc->cut_h_c_ = sps.getParameter("cut_h_c"); - sc->cut_h_si_ = sps.getParameter("cut_h_si"); - - sc->cut_v_apply_ = sps.getParameter("cut_v_apply"); - sc->cut_v_a_ = sps.getParameter("cut_v_a"); - sc->cut_v_c_ = sps.getParameter("cut_v_c"); - sc->cut_v_si_ = sps.getParameter("cut_v_si"); - } - - std::map rpTags = {{sectorConfig45.rp_F_.id_, "rp_L_F"}, - {sectorConfig45.rp_N_.id_, "rp_L_N"}, - {sectorConfig56.rp_N_.id_, "rp_R_N"}, - {sectorConfig56.rp_F_.id_, "rp_R_F"}}; - - std::map sectorNames = {{sectorConfig45.rp_F_.id_, sectorConfig45.name_}, - {sectorConfig45.rp_N_.id_, sectorConfig45.name_}, - {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, - {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; - - std::map rpConfigs = {{sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, - {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, - {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, - {sectorConfig56.rp_F_.id_, §orConfig56.rp_F_}}; - - x_ali_sh_step = iConfig.getParameter("x_ali_sh_step"); - - y_mode_sys_unc = iConfig.getParameter("y_mode_sys_unc"); - chiSqThreshold = iConfig.getParameter("chiSqThreshold"); - y_mode_unc_max_valid = iConfig.getParameter("y_mode_unc_max_valid"); - y_mode_max_valid = iConfig.getParameter("y_mode_max_valid"); - - maxRPTracksSize = iConfig.getParameter("max_RP_tracks_size"); - n_si = iConfig.getParameter("n_si"); - - const auto &c_axo = iConfig.getParameter("x_alignment_meth_o"); - for (const auto &p : rpTags) { - const auto &ps = c_axo.getParameter(p.second); - alignment_x_meth_o_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; - } - fitProfileMinBinEntries = c_axo.getParameter("fit_profile_min_bin_entries"); - fitProfileMinNReasonable = c_axo.getParameter("fit_profile_min_N_reasonable"); - methOGraphMinN = c_axo.getParameter("meth_o_graph_min_N"); - methOUncFitRange = c_axo.getParameter("meth_o_unc_fit_range"); - - const auto &c_m = iConfig.getParameter("matching"); - const auto &referenceDataset = c_m.getParameter("reference_dataset"); - - // constructing vectors with reference data - if (!referenceDataset.empty()) { - TFile *f_ref = TFile::Open(referenceDataset.c_str()); - if (!f_ref->IsOpen()) { - edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset; - } else { - TDirectory *ad_ref = findDirectoryWithName((TDirectory *)f_ref, sectorConfig45.name_); - if (ad_ref == nullptr) { - edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset; - } else { - edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath(); - - for (const auto &p : rpTags) { - if (debug) - gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref"); - - auto *d_ref = (TDirectory *)ad_ref->Get( - (sectorNames[p.first] + "/near_far/x slices, " + rpConfigs[p.first]->position_).c_str()); - if (d_ref == nullptr) { - edm::LogWarning("PPS") << "[ESSource] could not load d_ref"; - } else { - matchingReferencePoints[p.first] = buildVectorFromDirectory(d_ref, *rpConfigs[p.first]); - } - } - } - } - delete f_ref; - } - - for (const auto &p : rpTags) { - const auto &ps = c_m.getParameter(p.second); - matchingShiftRanges[p.first] = {ps.getParameter("sh_min"), ps.getParameter("sh_max")}; - } - - const auto &c_axr = iConfig.getParameter("x_alignment_relative"); - for (const auto &p : rpTags) { - const auto &ps = c_axr.getParameter(p.second); - alignment_x_relative_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; - } - nearFarMinEntries = c_axr.getParameter("near_far_min_entries"); - - const auto &c_ay = iConfig.getParameter("y_alignment"); - for (const auto &p : rpTags) { - const auto &ps = c_ay.getParameter(p.second); - alignment_y_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; - } - modeGraphMinN = c_ay.getParameter("mode_graph_min_N"); - multSelProjYMinEntries = c_ay.getParameter("mult_sel_proj_y_min_entries"); - - const auto &bps = iConfig.getParameter("binning"); - binning.bin_size_x_ = bps.getParameter("bin_size_x"); - binning.n_bins_x_ = bps.getParameter("n_bins_x"); - binning.pixel_x_offset_ = bps.getParameter("pixel_x_offset"); - binning.n_bins_y_ = bps.getParameter("n_bins_y"); - binning.y_min_ = bps.getParameter("y_min"); - binning.y_max_ = bps.getParameter("y_max"); - - setWhatProduced(this, label); - findingRecord(); - - if (debug) - delete debugFile; -} - -//--------------------------------------------------------------------------------------------- - -std::unique_ptr PPSAlignmentConfigESSource::produce(const PPSAlignmentConfigRcd &) { - auto p = std::make_unique(); - - p->setSequence(sequence); - p->setResultsDir(resultsDir); - - p->setSectorConfig45(sectorConfig45); - p->setSectorConfig56(sectorConfig56); - - p->setX_ali_sh_step(x_ali_sh_step); - - p->setY_mode_sys_unc(y_mode_sys_unc); - p->setChiSqThreshold(chiSqThreshold); - p->setY_mode_unc_max_valid(y_mode_unc_max_valid); - p->setY_mode_max_valid(y_mode_max_valid); - - p->setMaxRPTracksSize(maxRPTracksSize); - p->setN_si(n_si); - - p->setMatchingReferencePoints(matchingReferencePoints); - p->setMatchingShiftRanges(matchingShiftRanges); - - p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges); - p->setFitProfileMinBinEntries(fitProfileMinBinEntries); - p->setFitProfileMinNReasonable(fitProfileMinNReasonable); - p->setMethOGraphMinN(methOGraphMinN); - p->setMethOUncFitRange(methOUncFitRange); - - p->setAlignment_x_relative_ranges(alignment_x_relative_ranges); - p->setNearFarMinEntries(nearFarMinEntries); - - p->setAlignment_y_ranges(alignment_y_ranges); - p->setModeGraphMinN(modeGraphMinN); - p->setMultSelProjYMinEntries(multSelProjYMinEntries); - - p->setBinning(binning); - - edm::LogInfo("PPS") << "\n" - << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n" - << (*p); - - return p; -} - -//--------------------------------------------------------------------------------------------- - -// most default values come from 2018 period -void PPSAlignmentConfigESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - edm::ParameterSetDescription desc; - - desc.add("debug", false); - - desc.add("label", ""); - - desc.add>("sequence", {}); - desc.add("results_dir", "./alignment_results.txt"); - - // sector_45 - { - edm::ParameterSetDescription sector45; - - edm::ParameterSetDescription rp_N; - rp_N.add("name", "L_1_F"); - rp_N.add("id", 3); - - rp_N.add("slope", 0.19); - rp_N.add("sh_x", -3.6); - - rp_N.add("x_min_fit_mode", 2.); - rp_N.add("x_max_fit_mode", 7.0); - rp_N.add("y_max_fit_mode", 7.0); - rp_N.add("y_cen_add", -0.3); - rp_N.add("y_width_mult", 1.1); - - rp_N.add("x_slice_min", 7.); - rp_N.add("x_slice_max", 19.); - rp_N.add("x_slice_w", 0.2); - sector45.add("rp_N", rp_N); - - edm::ParameterSetDescription rp_F; - rp_F.add("name", "L_2_F"); - rp_F.add("id", 23); - - rp_F.add("slope", 0.19); - rp_F.add("sh_x", -42.); - - rp_F.add("x_min_fit_mode", 2.); - rp_F.add("x_max_fit_mode", 7.5); - rp_F.add("y_max_fit_mode", 7.5); - rp_F.add("y_cen_add", -0.3); - rp_F.add("y_width_mult", 1.1); - - rp_F.add("x_slice_min", 46.); - rp_F.add("x_slice_max", 58.); - rp_F.add("x_slice_w", 0.2); - sector45.add("rp_F", rp_F); - - sector45.add("slope", 0.006); - sector45.add("cut_h_apply", true); - sector45.add("cut_h_a", -1.); - sector45.add("cut_h_c", -38.55); - sector45.add("cut_h_si", 0.2); - sector45.add("cut_v_apply", true); - sector45.add("cut_v_a", -1.07); - sector45.add("cut_v_c", 1.63); - sector45.add("cut_v_si", 0.15); - - desc.add("sector_45", sector45); - } - - // sector_56 - { - edm::ParameterSetDescription sector56; - - edm::ParameterSetDescription rp_N; - rp_N.add("name", "R_1_F"); - rp_N.add("id", 103); - - rp_N.add("slope", 0.40); - rp_N.add("sh_x", -2.8); - - rp_N.add("x_min_fit_mode", 2.); - rp_N.add("x_max_fit_mode", 7.4); - rp_N.add("y_max_fit_mode", 7.4); - rp_N.add("y_cen_add", -0.8); - rp_N.add("y_width_mult", 1.0); - - rp_N.add("x_slice_min", 6.); - rp_N.add("x_slice_max", 17.); - rp_N.add("x_slice_w", 0.2); - sector56.add("rp_N", rp_N); - - edm::ParameterSetDescription rp_F; - rp_F.add("name", "R_2_F"); - rp_F.add("id", 123); - - rp_F.add("slope", 0.39); - rp_F.add("sh_x", -41.9); - - rp_F.add("x_min_fit_mode", 2.); - rp_F.add("x_max_fit_mode", 8.0); - rp_F.add("y_max_fit_mode", 8.0); - rp_F.add("y_cen_add", -0.8); - rp_F.add("y_width_mult", 1.0); - - rp_F.add("x_slice_min", 45.); - rp_F.add("x_slice_max", 57.); - rp_F.add("x_slice_w", 0.2); - sector56.add("rp_F", rp_F); - - sector56.add("slope", -0.015); - sector56.add("cut_h_apply", true); - sector56.add("cut_h_a", -1.); - sector56.add("cut_h_c", -39.26); - sector56.add("cut_h_si", 0.2); - sector56.add("cut_v_apply", true); - sector56.add("cut_v_a", -1.07); - sector56.add("cut_v_c", 1.49); - sector56.add("cut_v_si", 0.15); - - desc.add("sector_56", sector56); - } - - desc.add("x_ali_sh_step", 0.01); - - desc.add("y_mode_sys_unc", 0.03); - desc.add("chiSqThreshold", 50.); - desc.add("y_mode_unc_max_valid", 5.); - desc.add("y_mode_max_valid", 20.); - - desc.add("max_RP_tracks_size", 2); - desc.add("n_si", 4.); - - // matching - { - edm::ParameterSetDescription matching; - matching.add("reference_dataset", ""); - - edm::ParameterSetDescription rpLF; - rpLF.add("sh_min", -43.); - rpLF.add("sh_max", -41.); - matching.add("rp_L_F", rpLF); - - edm::ParameterSetDescription rpLN; - rpLN.add("sh_min", -4.2); - rpLN.add("sh_max", -2.4); - matching.add("rp_L_N", rpLN); - - edm::ParameterSetDescription rpRN; - rpRN.add("sh_min", -3.6); - rpRN.add("sh_max", -1.8); - matching.add("rp_R_N", rpRN); - - edm::ParameterSetDescription rpRF; - rpRF.add("sh_min", -43.2); - rpRF.add("sh_max", -41.2); - matching.add("rp_R_F", rpRF); - - desc.add("matching", matching); - } - - // x alignment meth o - { - edm::ParameterSetDescription x_alignment_meth_o; - - edm::ParameterSetDescription rpLF; - rpLF.add("x_min", 47.); - rpLF.add("x_max", 56.5); - x_alignment_meth_o.add("rp_L_F", rpLF); - - edm::ParameterSetDescription rpLN; - rpLN.add("x_min", 9.); - rpLN.add("x_max", 18.5); - x_alignment_meth_o.add("rp_L_N", rpLN); - - edm::ParameterSetDescription rpRN; - rpRN.add("x_min", 7.); - rpRN.add("x_max", 15.); - x_alignment_meth_o.add("rp_R_N", rpRN); - - edm::ParameterSetDescription rpRF; - rpRF.add("x_min", 46.); - rpRF.add("x_max", 54.); - x_alignment_meth_o.add("rp_R_F", rpRF); - - x_alignment_meth_o.add("fit_profile_min_bin_entries", 5); - x_alignment_meth_o.add("fit_profile_min_N_reasonable", 10); - x_alignment_meth_o.add("meth_o_graph_min_N", 5); - x_alignment_meth_o.add("meth_o_unc_fit_range", 0.5); - - desc.add("x_alignment_meth_o", x_alignment_meth_o); - } - - // x alignment relative - { - edm::ParameterSetDescription x_alignment_relative; - - edm::ParameterSetDescription rpLF; - rpLF.add("x_min", 0.); - rpLF.add("x_max", 0.); - x_alignment_relative.add("rp_L_F", rpLF); - - edm::ParameterSetDescription rpLN; - rpLN.add("x_min", 7.5); - rpLN.add("x_max", 12.); - x_alignment_relative.add("rp_L_N", rpLN); - - edm::ParameterSetDescription rpRN; - rpRN.add("x_min", 6.); - rpRN.add("x_max", 10.); - x_alignment_relative.add("rp_R_N", rpRN); - - edm::ParameterSetDescription rpRF; - rpRF.add("x_min", 0.); - rpRF.add("x_max", 0.); - x_alignment_relative.add("rp_R_F", rpRF); - - x_alignment_relative.add("near_far_min_entries", 100); - - desc.add("x_alignment_relative", x_alignment_relative); - } - - // y alignment - { - edm::ParameterSetDescription y_alignment; - - edm::ParameterSetDescription rpLF; - rpLF.add("x_min", 44.5); - rpLF.add("x_max", 49.); - y_alignment.add("rp_L_F", rpLF); - - edm::ParameterSetDescription rpLN; - rpLN.add("x_min", 6.7); - rpLN.add("x_max", 11.); - y_alignment.add("rp_L_N", rpLN); - - edm::ParameterSetDescription rpRN; - rpRN.add("x_min", 5.9); - rpRN.add("x_max", 10.); - y_alignment.add("rp_R_N", rpRN); - - edm::ParameterSetDescription rpRF; - rpRF.add("x_min", 44.5); - rpRF.add("x_max", 49.); - y_alignment.add("rp_R_F", rpRF); - - y_alignment.add("mode_graph_min_N", 5); - y_alignment.add("mult_sel_proj_y_min_entries", 300); - - desc.add("y_alignment", y_alignment); - } - - // binning - { - edm::ParameterSetDescription binning; - - binning.add("bin_size_x", 142.3314E-3); - binning.add("n_bins_x", 210); - binning.add("pixel_x_offset", 40.); - binning.add("n_bins_y", 400); - binning.add("y_min", -20.); - binning.add("y_max", 20.); - - desc.add("binning", binning); - } - - descriptions.add("ppsAlignmentConfigESSource", desc); -} - -//--------------------------------------------------------------------------------------------- - -// Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). -int PPSAlignmentConfigESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { - unsigned int n_reasonable = 0; - for (int bi = 1; bi <= p->GetNbinsX(); bi++) { - if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { - p->SetBinContent(bi, 0.); - p->SetBinError(bi, 0.); - } else { - n_reasonable++; - } - } - - if (n_reasonable < fitProfileMinNReasonable) - return 1; - - double xMin = x_mean - x_rms, xMax = x_mean + x_rms; - - TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); - - ff_pol1->SetParameter(0., 0.); - p->Fit(ff_pol1, "Q", "", xMin, xMax); - - sl = ff_pol1->GetParameter(1); - sl_unc = ff_pol1->GetParError(1); - - return 0; -} - -//--------------------------------------------------------------------------------------------- - -// Performs a breadth first search on dir. If found, returns the directory with object -// named searchName inside. Otherwise, returns nullptr. -TDirectory *PPSAlignmentConfigESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { - TIter next(dir->GetListOfKeys()); - std::queue dirQueue; - TObject *o; - while ((o = next())) { - TKey *k = (TKey *)o; - - std::string name = k->GetName(); - if (name == searchName) - return dir; - - if (((TSystemFile *)k)->IsDirectory()) - dirQueue.push((TDirectory *)k->ReadObj()); - } - - while (!dirQueue.empty()) { - TDirectory *resultDir = findDirectoryWithName(dirQueue.front(), searchName); - dirQueue.pop(); - if (resultDir != nullptr) - return resultDir; - } - - return nullptr; -} - -//--------------------------------------------------------------------------------------------- - -// Builds vector of PointErrors instances from slice plots in dir. -std::vector PPSAlignmentConfigESSource::buildVectorFromDirectory(TDirectory *dir, const RPConfig &rpd) { - std::vector pv; - - TIter next(dir->GetListOfKeys()); - TObject *o; - while ((o = next())) { - TKey *k = (TKey *)o; - - std::string name = k->GetName(); - size_t d = name.find('-'); - const double x_min = std::stod(name.substr(0, d)); - const double x_max = std::stod(name.substr(d + 1)); - - TDirectory *d_slice = (TDirectory *)k->ReadObj(); - - TH1D *h_y = (TH1D *)d_slice->Get("h_y"); - TProfile *p_y_diffFN_vs_y = (TProfile *)d_slice->Get("p_y_diffFN_vs_y"); - - double y_cen = h_y->GetMean(); - double y_width = h_y->GetRMS(); - - y_cen += rpd.y_cen_add_; - y_width *= rpd.y_width_mult_; - - double sl = 0., sl_unc = 0.; - int fr = fitProfile(p_y_diffFN_vs_y, y_cen, y_width, sl, sl_unc); - if (fr != 0) - continue; - - if (debug) - p_y_diffFN_vs_y->Write(name.c_str()); - - pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc}); - } - - return pv; -} - -//--------------------------------------------------------------------------------------------- - -void PPSAlignmentConfigESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, - const edm::IOVSyncValue &iosv, - edm::ValidityInterval &oValidity) { - edm::LogInfo("PPS") << ">> PPSAlignmentConfigESSource::setIntervalFor(" << key.name() << ")\n" - << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); - - edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); - oValidity = infinity; -} - -DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigESSource); \ No newline at end of file diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 639ffe22fe632..5bc423fd9de50 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -30,7 +30,6 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(CTPPSPixelAnalysisMask); PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping); PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations); - PAYLOAD_2XML_CLASS(PPSAlignmentConfig) PAYLOAD_2XML_CLASS(PPSAlignmentConfiguration) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index d7ff2191b49ee..b251891ac817f 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -56,7 +56,6 @@ namespace cond { FETCH_PAYLOAD_CASE(CTPPSPixelAnalysisMask) FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations) FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) - FETCH_PAYLOAD_CASE(PPSAlignmentConfig) FETCH_PAYLOAD_CASE(PPSAlignmentConfiguration) FETCH_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) FETCH_PAYLOAD_CASE(CastorChannelQuality) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 3d68b71a3e9de..85fc2f8604576 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -76,7 +76,6 @@ namespace cond { IMPORT_PAYLOAD_CASE(CTPPSPixelAnalysisMask) IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations) IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) - IMPORT_PAYLOAD_CASE(PPSAlignmentConfig) IMPORT_PAYLOAD_CASE(PPSAlignmentConfiguration) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 8fb8a6358cd47..c9832ed9f24eb 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -35,7 +35,6 @@ #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.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/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index ad9fcb974a153..df6c93de895a5 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -10,10 +10,6 @@ - - - - diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc deleted file mode 100644 index e979996e0d532..0000000000000 --- a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc +++ /dev/null @@ -1,17 +0,0 @@ -#include "CondFormats/Serialization/interface/Test.h" - -#include "../src/headers.h" - -int main() { - testSerialization(); - testSerialization(); - testSerialization(); - testSerialization(); - testSerialization(); - - testSerialization>(); - testSerialization>>(); - testSerialization>(); - - testSerialization(); -} diff --git a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc deleted file mode 100644 index b780cf149ce30..0000000000000 --- a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -* 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 deleted file mode 100644 index bef365aec7d57..0000000000000 --- a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -* 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 deleted file mode 100644 index 5614bfe76bc4f..0000000000000 --- a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py +++ /dev/null @@ -1,52 +0,0 @@ -##### 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 deleted file mode 100644 index 0a1fe540a76be..0000000000000 --- a/CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py +++ /dev/null @@ -1,88 +0,0 @@ -##### 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 From a3f3ba60ba8287e1eb9dda865d863e84c87d25ae Mon Sep 17 00:00:00 2001 From: Mateusz Date: Sat, 4 Sep 2021 18:06:06 +0200 Subject: [PATCH 403/923] Added extraParams vector to PPSAlignmentConfiguration. --- .../plugins/PPSAlignmentConfigurationESSource.cc | 8 ++++++++ .../PPSObjects/interface/PPSAlignmentConfiguration.h | 6 ++++++ .../PPSObjects/src/PPSAlignmentConfiguration.cc | 12 ++++++++++++ .../test/write_PPSAlignmentConfiguration_cfg.py | 3 ++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc index 3ea6fc4c7739a..19c5157ad80e3 100644 --- a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc @@ -82,6 +82,8 @@ class PPSAlignmentConfigurationESSource : public edm::ESProducer, public edm::Ev PPSAlignmentConfiguration::Binning binning; + std::vector extraParams; + std::string label; }; @@ -262,6 +264,8 @@ PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm:: binning.slice_y_min_ = bps.getParameter("slice_y_min"); binning.slice_y_max_ = bps.getParameter("slice_y_max"); + extraParams = iConfig.getParameter>("extra_params"); + setWhatProduced(this, label); findingRecord(); @@ -307,6 +311,8 @@ std::unique_ptr PPSAlignmentConfigurationESSource::pr p->setBinning(binning); + p->setExtraParams(extraParams); + edm::LogInfo("PPS") << "\n" << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n" << (*p); @@ -575,6 +581,8 @@ void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescr desc.add("binning", binning); } + desc.add>("extra_params", {}); + descriptions.add("ppsAlignmentConfigurationESSource", desc); } diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h index f5ac52d169da6..f514fa1c9bbd2 100644 --- a/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h @@ -115,6 +115,8 @@ class PPSAlignmentConfiguration { const Binning& binning() const; + const std::vector& extraParams() const; + // Setters void setSectorConfig45(SectorConfig& sectorConfig45); void setSectorConfig56(SectorConfig& sectorConfig56); @@ -148,6 +150,8 @@ class PPSAlignmentConfiguration { void setBinning(Binning& binning); + void setExtraParams(std::vector& extraParams); + // << operator friend std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c); @@ -183,6 +187,8 @@ class PPSAlignmentConfiguration { Binning binning_; + std::vector extraParams_; + COND_SERIALIZABLE; }; diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc index 757cbde15105c..d0f07be384426 100644 --- a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc @@ -63,6 +63,8 @@ unsigned int PPSAlignmentConfiguration::multSelProjYMinEntries() const { return const PPSAlignmentConfiguration::Binning& PPSAlignmentConfiguration::binning() const { return binning_; } +const std::vector& PPSAlignmentConfiguration::extraParams() const { return extraParams_; } + // -------------------------------- PPSAlignmentConfiguration setters -------------------------------- void PPSAlignmentConfiguration::setSectorConfig45(PPSAlignmentConfiguration::SectorConfig& sectorConfig45) { @@ -126,6 +128,8 @@ void PPSAlignmentConfiguration::setMultSelProjYMinEntries(unsigned int multSelPr void PPSAlignmentConfiguration::setBinning(PPSAlignmentConfiguration::Binning& binning) { binning_ = binning; } +void PPSAlignmentConfiguration::setExtraParams(std::vector& extraParams) { extraParams_ = extraParams; } + // -------------------------------- << operators -------------------------------- std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc) { @@ -247,5 +251,13 @@ std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c) { << "* binning\n"; os << c.binning_ << "\n"; + if (!c.extraParams_.empty()) { + os << "\n"; + os << "extra_params:\n"; + for (size_t i = 0; i < c.extraParams_.size(); i++) { + os << std::setw(5) << i << ": " << c.extraParams_[i] << "\n"; + } + } + return os; } diff --git a/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py index 81a55a4c05326..0c5b693ff9cab 100644 --- a/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py +++ b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py @@ -72,7 +72,8 @@ x_min = cms.double(102), x_max = cms.double(210.0) ) - ) + ), + extra_params = cms.vdouble( 1.15, 102., 777.7 ) ) # DB object maker From c41936f5d26fdda71977c453ad8fd0983021a07f Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Sat, 4 Sep 2021 20:02:37 +0200 Subject: [PATCH 404/923] Merge SimTracksters producers --- ...rsProducer.cc => SimTrackstersProducer.cc} | 46 +++++-- .../TrackstersFromCaloParticlesProducer.cc | 123 ------------------ RecoHGCal/TICL/python/SimTracksters_cff.py | 12 +- .../python/HGCalValidator_cfi.py | 2 +- 4 files changed, 40 insertions(+), 143 deletions(-) rename RecoHGCal/TICL/plugins/{TrackstersFromSimClustersProducer.cc => SimTrackstersProducer.cc} (79%) delete mode 100644 RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc similarity index 79% rename from RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc rename to RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 711def949d955..0f7c49904ed42 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -1,5 +1,5 @@ -// Author: Felice Pantaleo - felice.pantaleo@cern.ch -// Date: 02/2021 +// Author: Leonardo Cristella - leonardo.cristella@cern.ch +// Date: 09/2021 // user include files @@ -34,9 +34,9 @@ using namespace ticl; -class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { +class SimTrackstersProducer : public edm::stream::EDProducer<> { public: - explicit TrackstersFromSimClustersProducer(const edm::ParameterSet&); + explicit SimTrackstersProducer(const edm::ParameterSet&); static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void produce(edm::Event&, const edm::EventSetup&) override; @@ -57,9 +57,9 @@ class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { hgcal::RecHitTools rhtools_; const double fractionCut_; }; -DEFINE_FWK_MODULE(TrackstersFromSimClustersProducer); +DEFINE_FWK_MODULE(SimTrackstersProducer); -TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm::ParameterSet& ps) +SimTrackstersProducer::SimTrackstersProducer(const edm::ParameterSet& ps) : detector_(ps.getParameter("detector")), doNose_(detector_ == "HFNose"), clusters_token_(consumes(ps.getParameter("layer_clusters"))), @@ -75,9 +75,11 @@ TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm:: fractionCut_(ps.getParameter("fractionCut")) { produces>(); produces>(); + produces>("fromCPs"); + produces>("fromCPs"); } -void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void SimTrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { // hgcalMultiClusters edm::ParameterSetDescription desc; desc.add("detector", "HGCAL"); @@ -95,13 +97,16 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr descriptions.addWithDefaultLabel(desc); } -void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::EventSetup& es) { +void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) { auto result = std::make_unique>(); auto output_mask = std::make_unique>(); + auto result_fromCP = std::make_unique>(); + auto output_mask_fromCP = 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); + output_mask_fromCP->resize(layerClusters.size(), 1.f); const auto& simclusters = evt.get(simclusters_token_); const auto& caloparticles = evt.get(caloparticles_token_); @@ -112,11 +117,15 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even const auto& geom = es.getData(geom_token_); rhtools_.setGeometry(geom); auto num_simclusters = simclusters.size(); - result->reserve(num_simclusters); + result->reserve(num_simclusters); // Conservative size, will call shrink_to_fit later + auto num_caloparticles = caloparticles.size(); + result_fromCP->reserve(num_caloparticles); for (const auto& [key, lcVec] : caloParticlesToRecoColl) { auto const& cp = *(key); auto cpIndex = &cp - &caloparticles[0]; + + // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { addTrackster(cpIndex, lcVec, @@ -128,7 +137,6 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even key.id(), *output_mask, *result); - } else { for (const auto& scRef : cp.simClusters()) { const auto& it = simClustersToRecoColl.find(scRef); @@ -150,12 +158,30 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even *result); } } + + // Create a Trackster from any CP + addTrackster(cpIndex, + lcVec, + inputClusterMask, + fractionCut_, + cp.g4Tracks()[0].getMomentumAtBoundary().energy(), + cp.pdgId(), + cp.charge(), + key.id(), + *output_mask_fromCP, + *result_fromCP); + } ticl::assignPCAtoTracksters( *result, layerClusters, layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE(doNose_)).z()); result->shrink_to_fit(); + ticl::assignPCAtoTracksters( + *result_fromCP, layerClusters, layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE(doNose_)).z()); + result_fromCP->shrink_to_fit(); evt.put(std::move(result)); evt.put(std::move(output_mask)); + evt.put(std::move(result_fromCP), "fromCPs"); + evt.put(std::move(output_mask_fromCP), "fromCPs"); } diff --git a/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc deleted file mode 100644 index 7d8cfef261f1d..0000000000000 --- a/RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc +++ /dev/null @@ -1,123 +0,0 @@ -// 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/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index cfee090998a9b..7f4d2db7df1e5 100644 --- a/RecoHGCal/TICL/python/SimTracksters_cff.py +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -1,7 +1,6 @@ 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.simTrackstersProducer_cfi import simTrackstersProducer as _simTrackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer @@ -15,9 +14,7 @@ iteration_label = "ticlSimTracksters" ) -ticlSimTracksters = _trackstersFromSimClustersProducer.clone( -) -ticlSimTrackstersFromCP = _trackstersFromCaloParticlesProducer.clone( +ticlSimTracksters = _simTrackstersProducer.clone( ) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 @@ -25,8 +22,5 @@ simclusters = "mixData:MergedCaloTruth", caloparticles = "mixData:MergedCaloTruth", ) -premix_stage2.toModify(ticlSimTrackstersFromCP, - caloparticles = "mixData:MergedCaloTruth", -) -ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters, ticlSimTrackstersFromCP) +ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters) diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index 811b89f58e9b6..301f285bb8b85 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -25,7 +25,7 @@ #2DLayerClusters, PFClusters, Tracksters label_lcl = layerClusterCaloParticleAssociation.label_lc, label_tst = cms.VInputTag(labelTst), - label_simTSFromCP = cms.InputTag("ticlSimTracksters"), + label_simTSFromCP = cms.InputTag("ticlSimTracksters", "fromCPs"), associator = cms.untracked.InputTag("layerClusterCaloParticleAssociationProducer"), From 5ba9b2ceacc57eae178c3fd1c454dba8214e79ba Mon Sep 17 00:00:00 2001 From: Salavat Date: Sat, 4 Sep 2021 21:30:42 +0200 Subject: [PATCH 405/923] minor textual corrections --- .../test/README_SL_production_recipe.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt b/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt index 3b3e985a87d51..281f44b8c3edd 100644 --- a/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt +++ b/SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt @@ -10,7 +10,7 @@ with EDProducer parameters as listed below (here - for electrons of 100 GeV): MinE = cms.double(100), MaxE = cms.double(100) to perform a full simulation of showers in HF. -Do it for all necessary energy points separately for pions and electrons. +Do it for all necessary energy points, separately for pions and electrons. (2) Incident angle fixed to eta=4 and with random phi. @@ -19,8 +19,8 @@ The grid of energies is specified in the file Energies from the list should be used in the producer parameter list above (1). (3) -Simulation is performed in special geometry with a staring point at 1000 mm from HF surface filled with air. -To produce a sample with 10k showers for each energy, the number of simulated events should be somewhat bigger, +Simulation is performed using special geometry with a starting point at 1000 mm from HF surface, the path filled with air. +To produce a sample of 10k showers for each energy, the number of simulated events should be somewhat bigger, since some part of incident particles interacts in the air. The latter showers are excluded from final sample and exactly 10k showers are selected and recorded. So in production configuration file, number of event should be set this way: From da38030c7b4e0619a1c0208d8da59dba3a16e825 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Sat, 4 Sep 2021 21:31:33 +0200 Subject: [PATCH 406/923] Improve regressed energy --- RecoHGCal/TICL/plugins/SimTrackstersProducer.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 0f7c49904ed42..cfcfbc78923bc 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -125,13 +125,17 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto const& cp = *(key); auto cpIndex = &cp - &caloparticles[0]; + auto regr_energy = cp.energy(); + // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { + regr_energy = cp.g4Tracks()[0].getMomentumAtBoundary().energy(); + addTrackster(cpIndex, lcVec, inputClusterMask, fractionCut_, - cp.g4Tracks()[0].getMomentumAtBoundary().energy(), + regr_energy, cp.pdgId(), cp.charge(), key.id(), @@ -164,7 +168,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) lcVec, inputClusterMask, fractionCut_, - cp.g4Tracks()[0].getMomentumAtBoundary().energy(), + regr_energy, cp.pdgId(), cp.charge(), key.id(), From 8eff02e2ac7316a47644c390fba1b5293b59f946 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 4 Sep 2021 22:51:53 +0200 Subject: [PATCH 407/923] Correct a few analyzers in Calibration/HcalCalibAlgos aganist static analyzers --- .../HcalCalibAlgos/{src => interface}/TCell.h | 0 .../HcalCalibAlgos/interface/hcalCalib.h | 97 +++++++------------ .../{src => interface}/hcalCalibUtils.h | 2 +- .../HcalCalibAlgos/plugins/HcalCalibrator.cc | 79 ++++++++++++--- .../HcalCalibAlgos/plugins/HcalCalibrator.h | 83 ---------------- .../plugins/HcalHBHEMuonAnalyzer.cc | 5 +- .../HcalCalibAlgos/plugins/HitReCalibrator.cc | 52 +++++++++- .../HcalCalibAlgos/plugins/HitReCalibrator.h | 57 ----------- Calibration/HcalCalibAlgos/src/classes.h | 2 +- Calibration/HcalCalibAlgos/src/hcalCalib.cc | 93 ++++++++++-------- .../HcalCalibAlgos/src/hcalCalibUtils.cc | 2 +- 11 files changed, 214 insertions(+), 258 deletions(-) rename Calibration/HcalCalibAlgos/{src => interface}/TCell.h (100%) rename Calibration/HcalCalibAlgos/{src => interface}/hcalCalibUtils.h (96%) delete mode 100644 Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h delete mode 100644 Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h diff --git a/Calibration/HcalCalibAlgos/src/TCell.h b/Calibration/HcalCalibAlgos/interface/TCell.h similarity index 100% rename from Calibration/HcalCalibAlgos/src/TCell.h rename to Calibration/HcalCalibAlgos/interface/TCell.h diff --git a/Calibration/HcalCalibAlgos/interface/hcalCalib.h b/Calibration/HcalCalibAlgos/interface/hcalCalib.h index c2311f816ac9f..866908c46de32 100644 --- a/Calibration/HcalCalibAlgos/interface/hcalCalib.h +++ b/Calibration/HcalCalibAlgos/interface/hcalCalib.h @@ -27,9 +27,17 @@ #include #include -#include "TLorentzVector.h" -#include "TClonesArray.h" -#include "TRefArray.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // needed to get cell coordinates #include "Geometry/CaloGeometry/interface/CaloGeometry.h" @@ -84,6 +92,32 @@ class hcalCalib : public TSelector { TBranch *b_tagJetP4; //! TBranch *b_probeJetP4; //! + UInt_t nEvents; + + TFile* histoFile; + + // sanity check histograms + TH1F* h1_trkP; + TH1F* h1_allTrkP; + + TH1F* h1_selTrkP_iEta10; + + TH1F* h1_rawSumE; + TH1F* h1_rawResp; + TH1F* h1_corResp; + TH1F* h1_rawRespBarrel; + TH1F* h1_corRespBarrel; + TH1F* h1_rawRespEndcap; + TH1F* h1_corRespEndcap; + TH1F* h1_numEventsTwrIEta; + + TH2F* h2_dHitRefBarrel; + TH2F* h2_dHitRefEndcap; + + // histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower) + // expect range |iEta|<=24 (to do: add flexibility for arbitrary range) + TH1F* h1_corRespIEta[48]; + hcalCalib(TTree * /*tree*/ = nullptr) {} ~hcalCalib() override {} Int_t Version() const override { return 2; } @@ -204,60 +238,3 @@ class hcalCalib : public TSelector { }; #endif - -#ifdef hcalCalib_cxx -inline void hcalCalib::Init(TTree *tree) { - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normaly not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set object pointer - cells = nullptr; - tagJetP4 = nullptr; - probeJetP4 = nullptr; - - // Set branch addresses and branch pointers - if (!tree) - return; - fChain = tree; - - // fChain->SetMakeClass(1); - - fChain->SetBranchAddress("eventNumber", &eventNumber, &b_eventNumber); - fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber); - fChain->SetBranchAddress("iEtaHit", &iEtaHit, &b_iEtaHit); - fChain->SetBranchAddress("iPhiHit", &iPhiHit, &b_iPhiHit); - fChain->SetBranchAddress("cells", &cells, &b_cells); - fChain->SetBranchAddress("emEnergy", &emEnergy, &b_emEnergy); - fChain->SetBranchAddress("targetE", &targetE, &b_targetE); - fChain->SetBranchAddress("etVetoJet", &etVetoJet, &b_etVetoJet); - - fChain->SetBranchAddress("xTrkHcal", &xTrkHcal, &b_xTrkHcal); - fChain->SetBranchAddress("yTrkHcal", &yTrkHcal, &b_yTrkHcal); - fChain->SetBranchAddress("zTrkHcal", &zTrkHcal, &b_zTrkHcal); - fChain->SetBranchAddress("xTrkEcal", &xTrkEcal, &b_xTrkEcal); - fChain->SetBranchAddress("yTrkEcal", &yTrkEcal, &b_yTrkEcal); - fChain->SetBranchAddress("zTrkEcal", &zTrkEcal, &b_zTrkEcal); - - fChain->SetBranchAddress("tagJetEmFrac", &tagJetEmFrac, &b_tagJetEmFrac); - fChain->SetBranchAddress("probeJetEmFrac", &probeJetEmFrac, &b_probeJetEmFrac); - - fChain->SetBranchAddress("tagJetP4", &tagJetP4, &b_tagJetP4); - fChain->SetBranchAddress("probeJetP4", &probeJetP4, &b_probeJetP4); -} - -inline Bool_t hcalCalib::Notify() { - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normaly not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - -#endif // #ifdef hcalCalib_cxx diff --git a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.h b/Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h similarity index 96% rename from Calibration/HcalCalibAlgos/src/hcalCalibUtils.h rename to Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h index 088d7ea7e5d1c..106a843b0753e 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.h +++ b/Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h @@ -8,7 +8,7 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Calibration/HcalCalibAlgos/src/TCell.h" +#include "Calibration/HcalCalibAlgos/interface/TCell.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc index fe1556c135f89..70775cffe4496 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc @@ -27,30 +27,85 @@ to the actual calibration code in "endJob()". #include #include #include +#include // user include files -#include "Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h" #include "Calibration/HcalCalibAlgos/interface/hcalCalib.h" +#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.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 "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 "DataFormats/Common/interface/Handle.h" - -#include "TFile.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" + +class HcalCalibrator : public edm::one::EDAnalyzer<> { +public: + explicit HcalCalibrator(const edm::ParameterSet&); + ~HcalCalibrator() override; + + // Added for running the CaloTower creation algorithm + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + std::string mOutputFile; + std::string mInputFileList; + + std::string mCalibType; + std::string mCalibMethod; + double mMinTargetE; + double mMaxTargetE; + double mMinCellE; + double mMinEOverP; + double mMaxEOverP; + double mMaxTrkEmE; + + double mMaxEtThirdJet; + double mMinDPhiDiJets; + bool mSumDepths; + bool mSumSmallDepths; + bool mCombinePhi; + int mHbClusterSize; + int mHeClusterSize; + + bool mUseConeClustering; + double mMaxConeDist; + + int mCalibAbsIEtaMax; + int mCalibAbsIEtaMin; + + double mMaxProbeJetEmFrac; + double mMaxTagJetEmFrac; + double mMaxTagJetAbsEta; + double mMinTagJetEt; + double mMinProbeJetAbsEta; + + std::string mPhiSymCorFileName; + bool mApplyPhiSymCorFlag; + + std::string mOutputCorCoefFileName; + std::string mHistoFileName; + + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_htopo_; + + const CaloGeometry* mTheCaloGeometry; + const HcalTopology* mTheHcalTopology; + + bool allowMissingInputs_; +}; // constructor diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h deleted file mode 100644 index 103ced9f6174a..0000000000000 --- a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef HCALCALIBRATOR_H -#define HCALCALIBRATOR_H - -#include - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" - -//------------------- -#include "TString.h" -#include "TFile.h" -#include "TTree.h" -#include "TObject.h" -#include "TObjArray.h" -#include "TClonesArray.h" -#include "TRefArray.h" -#include "TLorentzVector.h" -//--------------------- - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" - -class HcalCalibrator : public edm::EDAnalyzer { -public: - explicit HcalCalibrator(const edm::ParameterSet&); - ~HcalCalibrator() override; - - // Added for running the CaloTower creation algorithm - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - std::string mOutputFile; - std::string mInputFileList; - - std::string mCalibType; - std::string mCalibMethod; - double mMinTargetE; - double mMaxTargetE; - double mMinCellE; - double mMinEOverP; - double mMaxEOverP; - double mMaxTrkEmE; - - double mMaxEtThirdJet; - double mMinDPhiDiJets; - bool mSumDepths; - bool mSumSmallDepths; - bool mCombinePhi; - int mHbClusterSize; - int mHeClusterSize; - - bool mUseConeClustering; - double mMaxConeDist; - - int mCalibAbsIEtaMax; - int mCalibAbsIEtaMin; - - double mMaxProbeJetEmFrac; - double mMaxTagJetEmFrac; - double mMaxTagJetAbsEta; - double mMinTagJetEt; - double mMinProbeJetAbsEta; - - std::string mPhiSymCorFileName; - bool mApplyPhiSymCorFlag; - - std::string mOutputCorCoefFileName; - std::string mHistoFileName; - - edm::ESGetToken tok_geom_; - edm::ESGetToken tok_htopo_; - - const CaloGeometry* mTheCaloGeometry; - const HcalTopology* mTheHcalTopology; - - bool allowMissingInputs_; -}; - -#endif diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc index 8762f9ad223f6..6c16fb5dd00b8 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc @@ -810,8 +810,9 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet } if (accept) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HBHEMuon") << "ieta/iphi for entry to " - << "HCAL has value of " << hcal_ieta_ << ":" << hcal_iphi_; + for (unsigned int i = 0; i < hcal_ieta.size(); ++i) + edm::LogVerbatim("HBHEMuon") << "[" << i << "] ieta/iphi for entry to " + << "HCAL has value of " << hcal_ieta[i] << ":" << hcal_iphi[i]; #endif for (unsigned int k = 0; k < muon_is_good.size(); ++k) { muon_is_good_ = muon_is_good[k]; diff --git a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc index 04de1ebaf9861..57f3359848c6d 100644 --- a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc @@ -1,13 +1,59 @@ -#include "Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +// system include files +#include +#include + +// user include files +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" + +#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" +#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "FWCore/Utilities/interface/Exception.h" +// +// class declaration +// + +namespace cms { + + class HitReCalibrator : public edm::one::EDProducer<> { + public: + explicit HitReCalibrator(const edm::ParameterSet &); + ~HitReCalibrator() override; + + void beginJob() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + + private: + // ----------member data --------------------------- + + bool allowMissingInputs_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::ESGetToken tok_resp_; + }; +} // end namespace cms + namespace cms { HitReCalibrator::HitReCalibrator(const edm::ParameterSet& iConfig) { diff --git a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h deleted file mode 100644 index e7781f71811d1..0000000000000 --- a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef HitReCalibrator_h -#define HitReCalibrator_h - -// -*- C++ -*- - -// system include files -#include -#include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" -#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" - -// -// class declaration -// -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -namespace cms { - - class HitReCalibrator : public edm::EDProducer { - public: - explicit HitReCalibrator(const edm::ParameterSet &); - ~HitReCalibrator() override; - - void beginJob() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - - private: - // ----------member data --------------------------- - - bool allowMissingInputs_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::ESGetToken tok_resp_; - }; -} // end namespace cms -#endif diff --git a/Calibration/HcalCalibAlgos/src/classes.h b/Calibration/HcalCalibAlgos/src/classes.h index 8a8c57566aad9..a073736f97380 100644 --- a/Calibration/HcalCalibAlgos/src/classes.h +++ b/Calibration/HcalCalibAlgos/src/classes.h @@ -1,4 +1,4 @@ -#include "Calibration/HcalCalibAlgos/src/TCell.h" +#include "Calibration/HcalCalibAlgos/interface/TCell.h" namespace Calibration_HcalCalibAlgos { struct dictionary {}; diff --git a/Calibration/HcalCalibAlgos/src/hcalCalib.cc b/Calibration/HcalCalibAlgos/src/hcalCalib.cc index c14fc6f828eaf..843baf784197b 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalib.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalib.cc @@ -1,5 +1,3 @@ -#define hcalCalib_cxx - // TSelector-based code for getting the HCAL resp. correction // from physics events. Works for DiJet and IsoTrack calibration. // @@ -9,16 +7,11 @@ // #include "Calibration/HcalCalibAlgos/interface/hcalCalib.h" -#include "Calibration/HcalCalibAlgos/src/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include -#include "TFile.h" - #include #include - #include #include @@ -29,39 +22,9 @@ #include "Calibration/Tools/interface/MinL3AlgoUniv.h" -#include "TMatrixF.h" -#include "TMatrixD.h" -#include "TDecompSVD.h" -#include "TDecompQRH.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -UInt_t nEvents; - -TFile* histoFile; - -// sanity check histograms -TH1F* h1_trkP; -TH1F* h1_allTrkP; - -TH1F* h1_selTrkP_iEta10; - -TH1F* h1_rawSumE; -TH1F* h1_rawResp; -TH1F* h1_corResp; -TH1F* h1_rawRespBarrel; -TH1F* h1_corRespBarrel; -TH1F* h1_rawRespEndcap; -TH1F* h1_corRespEndcap; -TH1F* h1_numEventsTwrIEta; - -TH2F* h2_dHitRefBarrel; -TH2F* h2_dHitRefEndcap; - -// histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower) -// expect range |iEta|<=24 (to do: add flexibility for arbitrary range) -TH1F* h1_corRespIEta[48]; void hcalCalib::Begin(TTree* /*tree*/) { TString option = GetOption(); @@ -731,3 +694,57 @@ void hcalCalib::makeTextFile() { return; } + +inline void hcalCalib::Init(TTree *tree) { + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the branch addresses and branch + // pointers of the tree will be set. + // It is normaly not necessary to make changes to the generated + // code, but the routine can be extended by the user if needed. + // Init() will be called many times when running on PROOF + // (once per file to be processed). + + // Set object pointer + cells = nullptr; + tagJetP4 = nullptr; + probeJetP4 = nullptr; + + // Set branch addresses and branch pointers + if (!tree) + return; + fChain = tree; + + // fChain->SetMakeClass(1); + + fChain->SetBranchAddress("eventNumber", &eventNumber, &b_eventNumber); + fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber); + fChain->SetBranchAddress("iEtaHit", &iEtaHit, &b_iEtaHit); + fChain->SetBranchAddress("iPhiHit", &iPhiHit, &b_iPhiHit); + fChain->SetBranchAddress("cells", &cells, &b_cells); + fChain->SetBranchAddress("emEnergy", &emEnergy, &b_emEnergy); + fChain->SetBranchAddress("targetE", &targetE, &b_targetE); + fChain->SetBranchAddress("etVetoJet", &etVetoJet, &b_etVetoJet); + + fChain->SetBranchAddress("xTrkHcal", &xTrkHcal, &b_xTrkHcal); + fChain->SetBranchAddress("yTrkHcal", &yTrkHcal, &b_yTrkHcal); + fChain->SetBranchAddress("zTrkHcal", &zTrkHcal, &b_zTrkHcal); + fChain->SetBranchAddress("xTrkEcal", &xTrkEcal, &b_xTrkEcal); + fChain->SetBranchAddress("yTrkEcal", &yTrkEcal, &b_yTrkEcal); + fChain->SetBranchAddress("zTrkEcal", &zTrkEcal, &b_zTrkEcal); + + fChain->SetBranchAddress("tagJetEmFrac", &tagJetEmFrac, &b_tagJetEmFrac); + fChain->SetBranchAddress("probeJetEmFrac", &probeJetEmFrac, &b_probeJetEmFrac); + + fChain->SetBranchAddress("tagJetP4", &tagJetP4, &b_tagJetP4); + fChain->SetBranchAddress("probeJetP4", &probeJetP4, &b_probeJetP4); +} + +inline Bool_t hcalCalib::Notify() { + // The Notify() function is called when a new file is opened. This + // can be either for a new TTree in a TChain or when when a new TTree + // is started when using PROOF. It is normaly not necessary to make changes + // to the generated code, but the routine can be extended by the + // user if needed. The return value is currently not used. + + return kTRUE; +} diff --git a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc index 93d4a64369e81..cd0b396b53856 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/src/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" //#include "Calibration/HcalCalibAlgos/plugins/CommonUsefulStuff.h" #include "Calibration/HcalCalibAlgos/interface/CommonUsefulStuff.h" From 5a96c024f50c55db8fb5a0e0d9077a4c7596645e Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 4 Sep 2021 23:35:14 +0200 Subject: [PATCH 408/923] Code Check --- .../HcalCalibAlgos/interface/hcalCalib.h | 36 +++++++++---------- .../HcalCalibAlgos/plugins/HitReCalibrator.cc | 4 +-- Calibration/HcalCalibAlgos/src/hcalCalib.cc | 3 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Calibration/HcalCalibAlgos/interface/hcalCalib.h b/Calibration/HcalCalibAlgos/interface/hcalCalib.h index 866908c46de32..c59db703b3ed9 100644 --- a/Calibration/HcalCalibAlgos/interface/hcalCalib.h +++ b/Calibration/HcalCalibAlgos/interface/hcalCalib.h @@ -94,29 +94,29 @@ class hcalCalib : public TSelector { UInt_t nEvents; - TFile* histoFile; + TFile *histoFile; // sanity check histograms - TH1F* h1_trkP; - TH1F* h1_allTrkP; - - TH1F* h1_selTrkP_iEta10; - - TH1F* h1_rawSumE; - TH1F* h1_rawResp; - TH1F* h1_corResp; - TH1F* h1_rawRespBarrel; - TH1F* h1_corRespBarrel; - TH1F* h1_rawRespEndcap; - TH1F* h1_corRespEndcap; - TH1F* h1_numEventsTwrIEta; - - TH2F* h2_dHitRefBarrel; - TH2F* h2_dHitRefEndcap; + TH1F *h1_trkP; + TH1F *h1_allTrkP; + + TH1F *h1_selTrkP_iEta10; + + TH1F *h1_rawSumE; + TH1F *h1_rawResp; + TH1F *h1_corResp; + TH1F *h1_rawRespBarrel; + TH1F *h1_corRespBarrel; + TH1F *h1_rawRespEndcap; + TH1F *h1_corRespEndcap; + TH1F *h1_numEventsTwrIEta; + + TH2F *h2_dHitRefBarrel; + TH2F *h2_dHitRefEndcap; // histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower) // expect range |iEta|<=24 (to do: add flexibility for arbitrary range) - TH1F* h1_corRespIEta[48]; + TH1F *h1_corRespIEta[48]; hcalCalib(TTree * /*tree*/ = nullptr) {} ~hcalCalib() override {} diff --git a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc index 57f3359848c6d..325aeb5905076 100644 --- a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc @@ -34,12 +34,12 @@ namespace cms { class HitReCalibrator : public edm::one::EDProducer<> { public: - explicit HitReCalibrator(const edm::ParameterSet &); + explicit HitReCalibrator(const edm::ParameterSet&); ~HitReCalibrator() override; void beginJob() override; - void produce(edm::Event &, const edm::EventSetup &) override; + void produce(edm::Event&, const edm::EventSetup&) override; private: // ----------member data --------------------------- diff --git a/Calibration/HcalCalibAlgos/src/hcalCalib.cc b/Calibration/HcalCalibAlgos/src/hcalCalib.cc index 843baf784197b..8300138eeef0c 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalib.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalib.cc @@ -25,7 +25,6 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" - void hcalCalib::Begin(TTree* /*tree*/) { TString option = GetOption(); @@ -695,7 +694,7 @@ void hcalCalib::makeTextFile() { return; } -inline void hcalCalib::Init(TTree *tree) { +inline void hcalCalib::Init(TTree* tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. From fbcbd71944412214b905628dba09cbe1e31be4c2 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 5 Sep 2021 16:33:41 +0200 Subject: [PATCH 409/923] Use of ESGetToken in Calibration/HcalCalibAlgos --- .../plugins/HcalIsoTrkAnalyzer.cc | 4 +- .../HcalCalibAlgos/test/HcalIsoTrackStudy.cc | 56 +++++++++---------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc index 8bbed91e23e8d..3e344c698b64b 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc @@ -411,9 +411,7 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const const CaloGeometry* geo = &iSetup.getData(tok_geom_); const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_); const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_); - const HcalRespCorrs* resp = &iSetup.getData(tok_resp_); - HcalRespCorrs* respCorrs = new HcalRespCorrs(*resp); - respCorrs->setTopo(theHBHETopology); + const HcalRespCorrs* respCorrs = &iSetup.getData(tok_resp_); //=== genParticle information edm::Handle genParticles; diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc index 46186a5a906b2..466378445aee8 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc @@ -186,6 +186,15 @@ class HcalIsoTrackStudy : public edm::one::EDAnalyzer tok_ew_; edm::EDGetTokenT> tok_alg_; + edm::ESGetToken tok_ddrec_; + edm::ESGetToken tok_bFieldH_; + edm::ESGetToken tok_ecalChStatus_; + edm::ESGetToken tok_sevlv_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_caloTopology_; + edm::ESGetToken tok_htopo_; + edm::ESGetToken tok_resp_; + TTree *tree, *tree2; unsigned int t_RunNo, t_EventNo; int t_Run, t_Event, t_DataType, t_ieta, t_iphi; @@ -352,6 +361,15 @@ HcalIsoTrackStudy::HcalIsoTrackStudy(const edm::ParameterSet& iConfig) edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; } + tok_ddrec_ = esConsumes(); + tok_bFieldH_ = esConsumes(); + tok_ecalChStatus_ = esConsumes(); + tok_sevlv_ = esConsumes(); + tok_geom_ = esConsumes(); + tok_caloTopology_ = esConsumes(); + tok_htopo_ = esConsumes(); + tok_resp_ = esConsumes(); + for (int i = 0; i < 10; i++) phibins_.push_back(-M_PI + 0.1 * (2 * i + 1) * M_PI); for (int i = 0; i < 8; ++i) @@ -382,35 +400,15 @@ void HcalIsoTrackStudy::analyze(edm::Event const& iEvent, edm::EventSetup const& << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); #endif //Get magnetic field and ECAL channel status - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - const MagneticField* bField = bFieldH.product(); - - edm::ESHandle ecalChStatus; - iSetup.get().get(ecalChStatus); - const EcalChannelStatus* theEcalChStatus = ecalChStatus.product(); - - edm::ESHandle sevlv; - iSetup.get().get(sevlv); - const EcalSeverityLevelAlgo* theEcalSevlv = sevlv.product(); + const MagneticField* bField = &iSetup.getData(tok_bFieldH_); + const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_); + const EcalSeverityLevelAlgo* theEcalSevlv = &iSetup.getData(tok_sevlv_); // get handles to calogeometry and calotopology - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); - - edm::ESHandle theCaloTopology; - iSetup.get().get(theCaloTopology); - const CaloTopology* caloTopology = theCaloTopology.product(); - - edm::ESHandle htopo; - iSetup.get().get(htopo); - const HcalTopology* theHBHETopology = htopo.product(); - - edm::ESHandle resp; - iSetup.get().get(resp); - HcalRespCorrs* respCorrs = new HcalRespCorrs(*resp.product()); - respCorrs->setTopo(theHBHETopology); + const CaloGeometry* geo = &iSetup.getData(tok_geom_); + const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_); + const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_); + const HcalRespCorrs* respCorrs = &iSetup.getData(tok_resp_); //=== genParticle information edm::Handle genParticles; @@ -803,9 +801,7 @@ void HcalIsoTrackStudy::beginJob() { // ------------ method called when starting to processes a run ------------ void HcalIsoTrackStudy::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { - edm::ESHandle pHRNDC; - iSetup.get().get(pHRNDC); - hdc_ = pHRNDC.product(); + hdc_ = &iSetup.getData(tok_ddrec_); bool changed_(true); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_); From e487015d67aed33dfe897dc447f6b303664455a9 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 5 Sep 2021 16:41:09 +0200 Subject: [PATCH 410/923] Make use of ESGetToken in SimCalorimetry/HcalSimProducers --- .../interface/HcalSignalGenerator.h | 15 +++++------ SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc | 2 -- .../HcalSimAlgos/test/CaloSamplesAnalyzer.cc | 26 ++++++++++--------- .../HcalSimAlgos/test/HcalDigitizerTest.cc | 17 ++++++------ .../test/HcalSignalGeneratorTest.cpp | 20 +++++++------- .../plugins/PreMixingHcalWorker.cc | 15 ++++++----- .../plugins/DataMixingHcalDigiWorkerProd.cc | 15 ++++++----- .../plugins/DataMixingHcalDigiWorkerProd.h | 4 ++- .../plugins/DataMixingModule.cc | 3 ++- .../plugins/DataMixingModule.h | 2 ++ 10 files changed, 64 insertions(+), 55 deletions(-) diff --git a/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h b/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h index f0b389a2fe7d1..ab1290f7caf1d 100644 --- a/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h +++ b/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h @@ -2,7 +2,6 @@ #define HcalSimAlgos_HcalSignalGenerator_h #include "SimCalorimetry/HcalSimAlgos/interface/HcalBaseSignalGenerator.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventPrincipal.h" @@ -40,17 +39,17 @@ class HcalSignalGenerator : public HcalBaseSignalGenerator { ~HcalSignalGenerator() override {} - void initializeEvent(const edm::Event* event, const edm::EventSetup* eventSetup) { + void initializeEvent(const edm::Event* event, const edm::EventSetup* eventSetup, const edm::ESGetToken& tok) { theEvent = event; - eventSetup->get().get(theConditions); - theParameterMap->setDbService(theConditions.product()); + theConditions = &(eventSetup->getData(tok)); + theParameterMap->setDbService(theConditions); } /// some users use EventPrincipals, not Events. We support both - void initializeEvent(const edm::EventPrincipal* eventPrincipal, const edm::EventSetup* eventSetup) { + void initializeEvent(const edm::EventPrincipal* eventPrincipal, const edm::EventSetup* eventSetup, const edm::ESGetToken& tok) { theEventPrincipal = eventPrincipal; - eventSetup->get().get(theConditions); - theParameterMap->setDbService(theConditions.product()); + theConditions = &(eventSetup->getData(tok)); + theParameterMap->setDbService(theConditions); } virtual void fill(edm::ModuleCallingContext const* mcc) { @@ -156,7 +155,7 @@ class HcalSignalGenerator : public HcalBaseSignalGenerator { /// these fields are set in initializeEvent() const edm::Event* theEvent; const edm::EventPrincipal* theEventPrincipal; - edm::ESHandle theConditions; + const HcalDbService* theConditions; /// these come from the ParameterSet edm::InputTag theInputTag; edm::EDGetTokenT tok_; diff --git a/SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc b/SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc index 9558094fb80f3..4dff2879a1123 100644 --- a/SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc +++ b/SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc @@ -1,6 +1,4 @@ #include "SimCalorimetry/HcalSimAlgos/interface/HcalShapes.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "SimCalorimetry/CaloSimAlgos/interface/CaloCachedShapeIntegrator.h" #include "CondFormats/HcalObjects/interface/HcalMCParam.h" #include "CondFormats/HcalObjects/interface/HcalMCParams.h" diff --git a/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc b/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc index 8b7591338b617..4dfa3082e7b8a 100644 --- a/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc +++ b/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc @@ -4,7 +4,6 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -93,6 +92,9 @@ class CaloSamplesAnalyzer : public edm::one::EDAnalyzer> tok_sim; edm::EDGetTokenT> tok_calo; + edm::ESGetToken tokGeom_; + edm::ESGetToken tokRecCns_; + edm::ESGetToken tokDB_; }; // @@ -107,7 +109,10 @@ CaloSamplesAnalyzer::CaloSamplesAnalyzer(const edm::ParameterSet& iConfig) TestNumbering(iConfig.getParameter("TestNumbering")), tok_sim(consumes>( edm::InputTag(iConfig.getParameter("hitsProducer"), "HcalHits"))), - tok_calo(consumes>(iConfig.getParameter("CaloSamplesTag"))) { + tok_calo(consumes>(iConfig.getParameter("CaloSamplesTag"))), + tokGeom_(esConsumes()), + tokRecCns_(esConsumes()), + tokDB_(esConsumes()) { usesResource("TFileService"); } @@ -143,15 +148,13 @@ void CaloSamplesAnalyzer::beginJob() { } void CaloSamplesAnalyzer::doBeginRun_(const edm::Run& iRun, const edm::EventSetup& iSetup) { - edm::ESHandle geometry; - iSetup.get().get(geometry); - edm::ESHandle pHRNDC; - iSetup.get().get(pHRNDC); + auto geometry = &iSetup.getData(tokGeom_); + auto pHRNDC = &iSetup.getData(tokRecCns_); // See if it's been updated - if (&*geometry != theGeometry) { - theGeometry = &*geometry; - theRecNumber = &*pHRNDC; + if (geometry != theGeometry) { + theGeometry = geometry; + theRecNumber = pHRNDC; theResponse->setGeometry(theGeometry); } } @@ -161,9 +164,8 @@ void CaloSamplesAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetu treemap.clear(); //conditions - edm::ESHandle conditions; - iSetup.get().get(conditions); - theParameterMap->setDbService(conditions.product()); + auto conditions = &iSetup.getData(tokDB_); + theParameterMap->setDbService(conditions); // Event information const edm::EventAuxiliary& aux = iEvent.eventAuxiliary(); diff --git a/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc b/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc index d8259419a7652..45705fda440d9 100644 --- a/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc +++ b/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc @@ -31,7 +31,6 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "Geometry/HcalTowerAlgo/interface/HcalHardcodeGeometryLoader.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" @@ -61,10 +60,15 @@ class HcalDigitizerTest : public edm::one::EDAnalyzer { std::vector hcalDetIds, hoDetIds, hfDetIds, hzdcDetIds, allDetIds; std::vector outerHcalDetIds; + const edm::ESGetToken tok_htopo_; + const edm::ESGetToken tok_slew_; + const HcalTimeSlew* hcalTimeSlew_delay_; }; -HcalDigitizerTest::HcalDigitizerTest(const edm::ParameterSet& iConfig) { +HcalDigitizerTest::HcalDigitizerTest(const edm::ParameterSet& iConfig) : + tok_htopo_(esConsumes()), + tok_slew_(esConsumes(edm::ESInputTag("", "HBHE"))) { //DB helper preparation dbHardcode.setHB(HcalHardcodeParameters(iConfig.getParameter("hb"))); dbHardcode.setHE(HcalHardcodeParameters(iConfig.getParameter("he"))); @@ -130,13 +134,8 @@ void HcalDigitizerTest::beginJob() { } void HcalDigitizerTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle htopo; - iSetup.get().get(htopo); - HcalTopology topology = (*htopo); - - edm::ESHandle delay; - iSetup.get().get("HBHE", delay); - hcalTimeSlew_delay_ = &*delay; + auto topology = iSetup.getData(tok_htopo_); + hcalTimeSlew_delay_ = &iSetup.getData(tok_slew_); std::string hitsName = "HcalHits"; std::vector caloDets; diff --git a/SimCalorimetry/HcalSimAlgos/test/HcalSignalGeneratorTest.cpp b/SimCalorimetry/HcalSimAlgos/test/HcalSignalGeneratorTest.cpp index a14e292baba89..d497a64bc19ea 100644 --- a/SimCalorimetry/HcalSimAlgos/test/HcalSignalGeneratorTest.cpp +++ b/SimCalorimetry/HcalSimAlgos/test/HcalSignalGeneratorTest.cpp @@ -1,11 +1,11 @@ // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h" -class HcalSignalGeneratorTest : public edm::EDAnalyzer { +class HcalSignalGeneratorTest : public edm::one::EDAnalyzer<> { public: explicit HcalSignalGeneratorTest(const edm::ParameterSet&); ~HcalSignalGeneratorTest() override {} @@ -34,6 +34,7 @@ class HcalSignalGeneratorTest : public edm::EDAnalyzer { edm::EDGetTokenT tok_qie11_; edm::InputTag theHBHETag_, theHOTag_, theHFTag_, theZDCTag_, theQIE10Tag_, theQIE11Tag_; + const edm::ESGetToken tokDB_; }; HcalSignalGeneratorTest::HcalSignalGeneratorTest(const edm::ParameterSet& iConfig) @@ -43,7 +44,8 @@ HcalSignalGeneratorTest::HcalSignalGeneratorTest(const edm::ParameterSet& iConfi theHFTag_(iConfig.getParameter("HFdigiCollectionPile")), theZDCTag_(iConfig.getParameter("ZDCdigiCollectionPile")), theQIE10Tag_(iConfig.getParameter("QIE10digiCollectionPile")), - theQIE11Tag_(iConfig.getParameter("QIE11digiCollectionPile")) { + theQIE11Tag_(iConfig.getParameter("QIE11digiCollectionPile")), + tokDB_(esConsumes()) { tok_hbhe_ = consumes(theHBHETag_); tok_ho_ = consumes(theHOTag_); tok_hf_ = consumes(theHFTag_); @@ -67,12 +69,12 @@ HcalSignalGeneratorTest::HcalSignalGeneratorTest(const edm::ParameterSet& iConfi } void HcalSignalGeneratorTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - theHBHESignalGenerator.initializeEvent(&iEvent, &iSetup); - theHOSignalGenerator.initializeEvent(&iEvent, &iSetup); - theHFSignalGenerator.initializeEvent(&iEvent, &iSetup); - theZDCSignalGenerator.initializeEvent(&iEvent, &iSetup); - theQIE10SignalGenerator.initializeEvent(&iEvent, &iSetup); - theQIE11SignalGenerator.initializeEvent(&iEvent, &iSetup); + theHBHESignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); + theHOSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); + theHFSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); + theZDCSignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); + theQIE10SignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); + theQIE11SignalGenerator.initializeEvent(&iEvent, &iSetup, tokDB_); theHBHESignalGenerator.fill(nullptr); theHOSignalGenerator.fill(nullptr); diff --git a/SimCalorimetry/HcalSimProducers/plugins/PreMixingHcalWorker.cc b/SimCalorimetry/HcalSimProducers/plugins/PreMixingHcalWorker.cc index 1125d61ef3d30..ec8f2e15434ae 100644 --- a/SimCalorimetry/HcalSimProducers/plugins/PreMixingHcalWorker.cc +++ b/SimCalorimetry/HcalSimProducers/plugins/PreMixingHcalWorker.cc @@ -57,6 +57,8 @@ class PreMixingHcalWorker : public PreMixingWorker { edm::EDGetTokenT tok_qie10_; edm::EDGetTokenT tok_qie11_; + const edm::ESGetToken tokDB_; + HcalDigiProducer myHcalDigitizer_; HBHESignalGenerator theHBHESignalGenerator; HOSignalGenerator theHOSignalGenerator; @@ -76,6 +78,7 @@ PreMixingHcalWorker::PreMixingHcalWorker(const edm::ParameterSet &ps, ZDCPileInputTag_(ps.getParameter("ZDCPileInputTag")), QIE10PileInputTag_(ps.getParameter("QIE10PileInputTag")), QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), + tokDB_(iC.esConsumes()), myHcalDigitizer_(ps, iC) { tok_hbhe_ = iC.consumes(HBHEPileInputTag_); tok_ho_ = iC.consumes(HOPileInputTag_); @@ -135,12 +138,12 @@ void PreMixingHcalWorker::addPileups(const PileUpEventPrincipal &pep, const edm: LogDebug("PreMixingHcalWorker") << "\n===============> adding pileups from event " << ep.id() << " for bunchcrossing " << pep.bunchCrossing(); - theHBHESignalGenerator.initializeEvent(&ep, &ES); - theHOSignalGenerator.initializeEvent(&ep, &ES); - theHFSignalGenerator.initializeEvent(&ep, &ES); - theZDCSignalGenerator.initializeEvent(&ep, &ES); - theQIE10SignalGenerator.initializeEvent(&ep, &ES); - theQIE11SignalGenerator.initializeEvent(&ep, &ES); + theHBHESignalGenerator.initializeEvent(&ep, &ES, tokDB_); + theHOSignalGenerator.initializeEvent(&ep, &ES, tokDB_); + theHFSignalGenerator.initializeEvent(&ep, &ES, tokDB_); + theZDCSignalGenerator.initializeEvent(&ep, &ES, tokDB_); + theQIE10SignalGenerator.initializeEvent(&ep, &ES, tokDB_); + theQIE11SignalGenerator.initializeEvent(&ep, &ES, tokDB_); // put digis from pileup event into digitizer diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc index e1ac54ebe2256..0dbd95834299d 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc @@ -16,13 +16,14 @@ using namespace std; namespace edm { // Constructor - DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC) + DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC, const edm::ESGetToken& tok) : HBHEPileInputTag_(ps.getParameter("HBHEPileInputTag")), HOPileInputTag_(ps.getParameter("HOPileInputTag")), HFPileInputTag_(ps.getParameter("HFPileInputTag")), ZDCPileInputTag_(ps.getParameter("ZDCPileInputTag")), QIE10PileInputTag_(ps.getParameter("QIE10PileInputTag")), QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), + tokDB_(tok), label_(ps.getParameter("Label")) { // tok_hbhe_ = iC.consumes(HBHEPileInputTag_); @@ -91,12 +92,12 @@ namespace edm { LogDebug("DataMixingHcalDigiWorkerProd") << "\n===============> adding pileups from event " << ep->id() << " for bunchcrossing " << bcr; - theHBHESignalGenerator.initializeEvent(ep, &ES); - theHOSignalGenerator.initializeEvent(ep, &ES); - theHFSignalGenerator.initializeEvent(ep, &ES); - theZDCSignalGenerator.initializeEvent(ep, &ES); - theQIE10SignalGenerator.initializeEvent(ep, &ES); - theQIE11SignalGenerator.initializeEvent(ep, &ES); + theHBHESignalGenerator.initializeEvent(ep, &ES, tokDB_); + theHOSignalGenerator.initializeEvent(ep, &ES, tokDB_); + theHFSignalGenerator.initializeEvent(ep, &ES, tokDB_); + theZDCSignalGenerator.initializeEvent(ep, &ES, tokDB_); + theQIE10SignalGenerator.initializeEvent(ep, &ES, tokDB_); + theQIE11SignalGenerator.initializeEvent(ep, &ES, tokDB_); // put digis from pileup event into digitizer diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h index 3bf45e8c8216b..c4fb996ff6509 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h @@ -43,7 +43,7 @@ namespace edm { class DataMixingHcalDigiWorkerProd { public: /** standard constructor*/ - explicit DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC); + explicit DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC, const edm::ESGetToken&); /**Default destructor*/ virtual ~DataMixingHcalDigiWorkerProd(); @@ -86,6 +86,8 @@ namespace edm { edm::EDGetTokenT tok_qie10_; edm::EDGetTokenT tok_qie11_; + const edm::ESGetToken tokDB_; + HcalDigiProducer *myHcalDigitizer_; HBHESignalGenerator theHBHESignalGenerator; HOSignalGenerator theHOSignalGenerator; diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index 776028b92e5d3..77155f122e132 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -39,6 +39,7 @@ namespace edm { ZDCPileInputTag_(ps.getParameter("ZDCPileInputTag")), QIE10PileInputTag_(ps.getParameter("QIE10PileInputTag")), QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), + tokDB_(esConsumes()), label_(ps.getParameter("Label")) { // prepare for data access in DataMixingHcalDigiWorkerProd tok_hbhe_ = consumes(HBHEPileInputTag_); @@ -119,7 +120,7 @@ namespace edm { } if (MergeHcalDigisProd_) - HcalDigiWorkerProd_ = new DataMixingHcalDigiWorkerProd(ps, consumesCollector()); + HcalDigiWorkerProd_ = new DataMixingHcalDigiWorkerProd(ps, consumesCollector(), tokDB_); else HcalDigiWorker_ = new DataMixingHcalDigiWorker(ps, consumesCollector()); diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 76e99d2f60d86..e79eb5eeae7d9 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -164,6 +164,8 @@ namespace edm { edm::EDGetTokenT tok_qie10_; edm::EDGetTokenT tok_qie11_; + const edm::ESGetToken tokDB_; + bool MergeHcalDigis_; bool MergeHcalDigisProd_; From c81ed0a552e9851be8a414f11fb200d49d1859bf Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 5 Sep 2021 16:49:33 +0200 Subject: [PATCH 411/923] Code check --- .../HcalSimAlgos/interface/HcalSignalGenerator.h | 8 ++++++-- SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc | 6 +++--- SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc | 6 +++--- .../plugins/DataMixingHcalDigiWorkerProd.cc | 4 +++- .../plugins/DataMixingHcalDigiWorkerProd.h | 4 +++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h b/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h index ab1290f7caf1d..bbfe1e4bacf76 100644 --- a/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h +++ b/SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h @@ -39,14 +39,18 @@ class HcalSignalGenerator : public HcalBaseSignalGenerator { ~HcalSignalGenerator() override {} - void initializeEvent(const edm::Event* event, const edm::EventSetup* eventSetup, const edm::ESGetToken& tok) { + void initializeEvent(const edm::Event* event, + const edm::EventSetup* eventSetup, + const edm::ESGetToken& tok) { theEvent = event; theConditions = &(eventSetup->getData(tok)); theParameterMap->setDbService(theConditions); } /// some users use EventPrincipals, not Events. We support both - void initializeEvent(const edm::EventPrincipal* eventPrincipal, const edm::EventSetup* eventSetup, const edm::ESGetToken& tok) { + void initializeEvent(const edm::EventPrincipal* eventPrincipal, + const edm::EventSetup* eventSetup, + const edm::ESGetToken& tok) { theEventPrincipal = eventPrincipal; theConditions = &(eventSetup->getData(tok)); theParameterMap->setDbService(theConditions); diff --git a/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc b/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc index 4dfa3082e7b8a..52e39ebabb79b 100644 --- a/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc +++ b/SimCalorimetry/HcalSimAlgos/test/CaloSamplesAnalyzer.cc @@ -94,7 +94,7 @@ class CaloSamplesAnalyzer : public edm::one::EDAnalyzer> tok_calo; edm::ESGetToken tokGeom_; edm::ESGetToken tokRecCns_; - edm::ESGetToken tokDB_; + edm::ESGetToken tokDB_; }; // @@ -111,8 +111,8 @@ CaloSamplesAnalyzer::CaloSamplesAnalyzer(const edm::ParameterSet& iConfig) edm::InputTag(iConfig.getParameter("hitsProducer"), "HcalHits"))), tok_calo(consumes>(iConfig.getParameter("CaloSamplesTag"))), tokGeom_(esConsumes()), - tokRecCns_(esConsumes()), - tokDB_(esConsumes()) { + tokRecCns_(esConsumes()), + tokDB_(esConsumes()) { usesResource("TFileService"); } diff --git a/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc b/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc index 45705fda440d9..7b5ee043944d4 100644 --- a/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc +++ b/SimCalorimetry/HcalSimAlgos/test/HcalDigitizerTest.cc @@ -66,9 +66,9 @@ class HcalDigitizerTest : public edm::one::EDAnalyzer { const HcalTimeSlew* hcalTimeSlew_delay_; }; -HcalDigitizerTest::HcalDigitizerTest(const edm::ParameterSet& iConfig) : - tok_htopo_(esConsumes()), - tok_slew_(esConsumes(edm::ESInputTag("", "HBHE"))) { +HcalDigitizerTest::HcalDigitizerTest(const edm::ParameterSet& iConfig) + : tok_htopo_(esConsumes()), + tok_slew_(esConsumes(edm::ESInputTag("", "HBHE"))) { //DB helper preparation dbHardcode.setHB(HcalHardcodeParameters(iConfig.getParameter("hb"))); dbHardcode.setHE(HcalHardcodeParameters(iConfig.getParameter("he"))); diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc index 0dbd95834299d..12a6870f59ee5 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.cc @@ -16,7 +16,9 @@ using namespace std; namespace edm { // Constructor - DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC, const edm::ESGetToken& tok) + DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, + edm::ConsumesCollector &&iC, + const edm::ESGetToken &tok) : HBHEPileInputTag_(ps.getParameter("HBHEPileInputTag")), HOPileInputTag_(ps.getParameter("HOPileInputTag")), HFPileInputTag_(ps.getParameter("HFPileInputTag")), diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h index c4fb996ff6509..803cada6e4af1 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h @@ -43,7 +43,9 @@ namespace edm { class DataMixingHcalDigiWorkerProd { public: /** standard constructor*/ - explicit DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC, const edm::ESGetToken&); + explicit DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps, + edm::ConsumesCollector &&iC, + const edm::ESGetToken &); /**Default destructor*/ virtual ~DataMixingHcalDigiWorkerProd(); From 49615d2d3ae8c9de51720e762a20551d571aa94a Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Sun, 5 Sep 2021 19:58:04 +0200 Subject: [PATCH 412/923] midgrate modules to use esConsumes --- .../Geometry/plugins/CSCRecoIdealDBLoader.cc | 16 +++-- .../Geometry/plugins/DTRecoIdealDBLoader.cc | 16 +++-- .../Geometry/plugins/GEMRecoIdealDBLoader.cc | 17 +++-- .../plugins/HcalParametersDBBuilder.cc | 10 +-- .../Geometry/plugins/ME0RecoIdealDBLoader.cc | 16 +++-- .../Geometry/plugins/PCaloGeometryBuilder.cc | 64 +++++++++++-------- .../Geometry/plugins/PGeometricDetBuilder.cc | 16 +++-- .../plugins/PHGCalParametersDBBuilder.cc | 11 ++-- .../plugins/PTrackerParametersDBBuilder.cc | 10 +-- .../Geometry/plugins/RPCRecoIdealDBLoader.cc | 16 +++-- .../Geometry/plugins/XMLGeometryReader.cc | 5 +- 11 files changed, 113 insertions(+), 84 deletions(-) diff --git a/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc index ab0ee4eb17814..885ca3858378a 100644 --- a/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class CSCRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; CSCRecoIdealDBLoader::CSCRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void CSCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -45,19 +51,15 @@ void CSCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); CSCGeometryParsFromDD cscgp; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; cscgp.build(&cpv, *pMNDC, *rig, *rdp); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; cscgp.build(&cpv, *pMNDC, *rig, *rdp); } diff --git a/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc index 1311f825cedde..c8f9dc2795fce 100644 --- a/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc @@ -29,10 +29,16 @@ class DTRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; DTRecoIdealDBLoader::DTRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void DTRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -43,19 +49,15 @@ void DTRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); DTGeometryParsFromDD dtgp; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; dtgp.build(&cpv, *pMNDC, *rig); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; dtgp.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc index 48fd98f03488b..7787aa61d5e33 100644 --- a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc @@ -30,10 +30,16 @@ class GEMRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; GEMRecoIdealDBLoader::GEMRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); // set true for DD4HEP + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void GEMRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -46,22 +52,19 @@ void GEMRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) } if (mydbservice->isNewTagRequest("GEMRecoGeometryRcd")) { - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); + GEMGeometryParsFromDD rpcpd; RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4Hep_) { edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DD4HEP "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } else { edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DDD "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc b/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc index bd49e5ac6aafb..1a21df2ad7a8f 100644 --- a/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc @@ -26,6 +26,8 @@ class HcalParametersDBBuilder : public edm::one::EDAnalyzer private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; HcalParametersDBBuilder::HcalParametersDBBuilder(const edm::ParameterSet& ps) @@ -34,6 +36,8 @@ HcalParametersDBBuilder::HcalParametersDBBuilder(const edm::ParameterSet& ps) edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::HcalParametersDBBuilder called with dd4hep: " << fromDD4Hep_; #endif + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); } void HcalParametersDBBuilder::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -56,15 +60,13 @@ void HcalParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& e #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access cms::DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build((*cpv), *php); } else { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(&(*cpv), *php); } diff --git a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc index c28765de7483a..84e71da6d2888 100644 --- a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class ME0RecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; ME0RecoIdealDBLoader::ME0RecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); // set true for DD4HEP + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void ME0RecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -44,21 +50,17 @@ void ME0RecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) } if (mydbservice->isNewTagRequest("ME0RecoGeometryRcd")) { - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); ME0GeometryParsFromDD me0pd; RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4Hep_) { edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DD4HEP "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; me0pd.build(&cpv, *pMNDC, *rig); } else { edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DDD "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; me0pd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc b/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc index 258b2d17fcc6a..a5542127e73c1 100644 --- a/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc @@ -19,7 +19,17 @@ class PCaloGeometryBuilder : public edm::one::EDAnalyzer { PCaloGeometryBuilder(const edm::ParameterSet& pset) : m_ecalE(pset.getUntrackedParameter("EcalE", true)), m_ecalP(pset.getUntrackedParameter("EcalP", true)), - m_hgcal(pset.getUntrackedParameter("HGCal", false)) {} + m_hgcal(pset.getUntrackedParameter("HGCal", false)) { + const std::string toDB("_toDB"); + ebGeomToken_ = esConsumes(edm::ESInputTag(EcalBarrelGeometry::producerTag() + toDB)); + eeGeomToken_ = esConsumes(edm::ESInputTag(EcalEndcapGeometry::producerTag() + toDB)); + esGeomToken_ = esConsumes(edm::ESInputTag(EcalPreshowerGeometry::producerTag() + toDB)); + hgcalGeomToken_ = esConsumes(edm::ESInputTag(HGCalGeometry::producerTag() + toDB)); + hcalGeomToken_ = esConsumes(edm::ESInputTag(HcalGeometry::producerTag() + toDB)); + ctGeomToken_ = esConsumes(edm::ESInputTag(CaloTowerGeometry::producerTag() + toDB)); + zdcGeomToken_ = esConsumes(edm::ESInputTag(ZdcGeometry::producerTag() + toDB)); + castGeomToken_ = esConsumes(edm::ESInputTag(CastorGeometry::producerTag() + toDB)); + } void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -29,48 +39,46 @@ class PCaloGeometryBuilder : public edm::one::EDAnalyzer { bool m_ecalE; bool m_ecalP; bool m_hgcal; + edm::ESGetToken ebGeomToken_; + edm::ESGetToken eeGeomToken_; + edm::ESGetToken esGeomToken_; + edm::ESGetToken hgcalGeomToken_; + edm::ESGetToken hcalGeomToken_; + edm::ESGetToken ctGeomToken_; + edm::ESGetToken zdcGeomToken_; + edm::ESGetToken castGeomToken_; }; void PCaloGeometryBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { - const std::string toDB("_toDB"); - - std::cout << "Writing out " << EcalBarrelGeometry::producerTag() << std::endl; - edm::ESHandle pGeb; - es.get().get(EcalBarrelGeometry::producerTag() + toDB, pGeb); - + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalBarrelGeometry::producerTag() << std::endl; + auto pGeb = es.getHandle(ebGeomToken_); if (m_ecalE) { - std::cout << "Writing out " << EcalEndcapGeometry::producerTag() << std::endl; - edm::ESHandle pGee; - es.get().get(EcalEndcapGeometry::producerTag() + toDB, pGee); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalEndcapGeometry::producerTag() << std::endl; + auto pGeb = es.getHandle(eeGeomToken_); } if (m_ecalP) { - std::cout << "Writing out " << EcalPreshowerGeometry::producerTag() << std::endl; - edm::ESHandle pGes; - es.get().get(EcalPreshowerGeometry::producerTag() + toDB, pGes); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalPreshowerGeometry::producerTag() << std::endl; + auto pGes = es.getHandle(esGeomToken_); } if (m_hgcal) { - std::cout << "Writing out " << HGCalGeometry::producerTag() << std::endl; - edm::ESHandle pGee; - es.get().get(HGCalGeometry::producerTag() + toDB, pGee); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HGCalGeometry::producerTag() << std::endl; + auto pGhgcal = es.getHandle(hgcalGeomToken_); + ; } - std::cout << "Writing out " << HcalGeometry::producerTag() << std::endl; - edm::ESHandle pGhcal; - es.get().get(HcalGeometry::producerTag() + toDB, pGhcal); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HcalGeometry::producerTag() << std::endl; + auto pGhcal = es.getHandle(hcalGeomToken_); - std::cout << "Writing out " << CaloTowerGeometry::producerTag() << std::endl; - edm::ESHandle pGct; - es.get().get(CaloTowerGeometry::producerTag() + toDB, pGct); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CaloTowerGeometry::producerTag() << std::endl; + auto pGct = es.getHandle(ctGeomToken_); - std::cout << "Writing out " << ZdcGeometry::producerTag() << std::endl; - edm::ESHandle pGzdc; - es.get().get(ZdcGeometry::producerTag() + toDB, pGzdc); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << ZdcGeometry::producerTag() << std::endl; + auto pGzdc = es.getHandle(zdcGeomToken_); - std::cout << "Writing out " << CastorGeometry::producerTag() << std::endl; - edm::ESHandle pGcast; - es.get().get(CastorGeometry::producerTag() + toDB, pGcast); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CastorGeometry::producerTag() << std::endl; + auto pGcast = es.getHandle(castGeomToken_); } DEFINE_FWK_MODULE(PCaloGeometryBuilder); diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 2e9fae089ae4c..5b4ad5d8d4302 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -32,10 +32,16 @@ class PGeometricDetBuilder : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); bool fromDD4hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken geometricDetToken_; }; PGeometricDetBuilder::PGeometricDetBuilder(const edm::ParameterSet& iConfig) { fromDD4hep_ = iConfig.getParameter("fromDD4hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + geometricDetToken_ = esConsumes(); } void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -46,15 +52,11 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) return; } if (!fromDD4hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); + auto pDD = es.getTransientHandle(compactViewToken_); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); } - edm::ESHandle rDD; - es.get().get(rDD); - const GeometricDet* tracker = &(*rDD); + const GeometricDet* tracker = &es.getData(geometricDetToken_); // so now I have the tracker itself. loop over all its components to store them. putOne(tracker, pgd, 0); diff --git a/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc b/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc index 6e70a64d40ed5..5468c050f6d70 100644 --- a/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc @@ -31,6 +31,8 @@ class PHGCalParametersDBBuilder : public edm::one::EDAnalyzer dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; PHGCalParametersDBBuilder::PHGCalParametersDBBuilder(const edm::ParameterSet& iC) { @@ -40,6 +42,9 @@ PHGCalParametersDBBuilder::PHGCalParametersDBBuilder(const edm::ParameterSet& iC namec_ = iC.getParameter("nameC"); namet_ = iC.getParameter("nameT"); fromDD4Hep_ = iC.getParameter("fromDD4Hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule for " << name_ << ":" << name2_ << ":" << namew_ << ":" << namec_ << ":" << namet_ << " and fromDD4Hep flag " << fromDD4Hep_; @@ -71,15 +76,13 @@ void PHGCalParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access cm::DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_, name2_); } else { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_); } swapParameters(ptp, phgp); diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 834408e29356c..7013331e71f41 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -20,10 +20,14 @@ class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(const edm::ParameterSet& iConfig) { fromDD4hep_ = iConfig.getParameter("fromDD4hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); } void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -37,12 +41,10 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons TrackerParametersFromDD builder; if (!fromDD4hep_) { - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(&(*cpv), *ptp); } else { - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build(&(*cpv), *ptp); } diff --git a/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc index 2c7fd91be2331..69332ef488c9e 100644 --- a/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class RPCRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; RPCRecoIdealDBLoader::RPCRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void RPCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -42,19 +48,15 @@ void RPCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); RPCGeometryParsFromDD rpcpd; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/XMLGeometryReader.cc b/CondTools/Geometry/plugins/XMLGeometryReader.cc index e1011abab24e7..ff6350373266d 100644 --- a/CondTools/Geometry/plugins/XMLGeometryReader.cc +++ b/CondTools/Geometry/plugins/XMLGeometryReader.cc @@ -25,18 +25,19 @@ class XMLGeometryReader : public edm::one::EDAnalyzer { private: std::string m_fname; std::string m_label; + edm::ESGetToken fileBlobToken_; }; XMLGeometryReader::XMLGeometryReader(const edm::ParameterSet& iConfig) { m_fname = iConfig.getUntrackedParameter("XMLFileName", "test.xml"); m_label = iConfig.getUntrackedParameter("geomLabel", "Extended"); + fileBlobToken_ = esConsumes(); } void XMLGeometryReader::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) { edm::LogInfo("XMLGeometryReader") << "XMLGeometryReader::beginRun"; - edm::ESHandle geometry; - iSetup.get().get(m_label, geometry); + auto geometry = iSetup.getHandle(fileBlobToken_); std::unique_ptr > blob((*geometry).getUncompressedBlob()); std::string outfile1(m_fname); From 15c89d40fe526d723ec4377953e550480a1062bc Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Sun, 5 Sep 2021 23:30:24 +0200 Subject: [PATCH 413/923] Introduce SimTracksters linking --- .../TICL/plugins/SimTrackstersProducer.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index cfcfbc78923bc..229491ec75785 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -29,6 +29,7 @@ #include "TrackstersPCA.h" #include +#include #include #include @@ -73,10 +74,11 @@ SimTrackstersProducer::SimTrackstersProducer(const edm::ParameterSet& ps) consumes(ps.getParameter("layerClusterCaloParticleAssociator"))), geom_token_(esConsumes()), fractionCut_(ps.getParameter("fractionCut")) { - produces>(); + produces(); produces>(); - produces>("fromCPs"); + produces("fromCPs"); produces>("fromCPs"); + produces>>(); } void SimTrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -98,10 +100,11 @@ void SimTrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& des } void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) { - auto result = std::make_unique>(); + auto result = std::make_unique(); auto output_mask = std::make_unique>(); - auto result_fromCP = std::make_unique>(); + auto result_fromCP = std::make_unique(); auto output_mask_fromCP = std::make_unique>(); + auto cpToSc_STS = 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_); @@ -117,7 +120,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) const auto& geom = es.getData(geom_token_); rhtools_.setGeometry(geom); auto num_simclusters = simclusters.size(); - result->reserve(num_simclusters); // Conservative size, will call shrink_to_fit later + result->reserve(num_simclusters); // Conservative size, will call shrink_to_fit later auto num_caloparticles = caloparticles.size(); result_fromCP->reserve(num_caloparticles); @@ -126,6 +129,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto cpIndex = &cp - &caloparticles[0]; auto regr_energy = cp.energy(); + std::vector scSTS; // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { @@ -160,6 +164,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) scRef.id(), *output_mask, *result); + scSTS.push_back(result->size() - 1); } } @@ -174,7 +179,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) key.id(), *output_mask_fromCP, *result_fromCP); - + (*cpToSc_STS)[result_fromCP->size() - 1] = scSTS; } ticl::assignPCAtoTracksters( @@ -188,4 +193,5 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) evt.put(std::move(output_mask)); evt.put(std::move(result_fromCP), "fromCPs"); evt.put(std::move(output_mask_fromCP), "fromCPs"); + evt.put(std::move(cpToSc_STS)); } From 7960a8dfca3ae2cee81328f21c762c5a007197df Mon Sep 17 00:00:00 2001 From: Norraphat Date: Mon, 6 Sep 2021 05:38:56 +0200 Subject: [PATCH 414/923] Update README --- Configuration/Geometry/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index a8c1dea16db2d..f3381af3afa17 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -1,3 +1,18 @@ +# To work on geometry package + +### To create or update geometries +``` +git cms-addpkg Geometry/CMSCommonData +git cms-addpkg Configuration/Geometry +scram b -j 8 +cd Configuration/Geometry +vi python/dict2021Geometry.py +python3 ./scripts/generate2021Geometry.py -D 2021 +``` +Note: +* For Phase-2, use [generate2026Geometry.py](./python/dict2026Geometry.py) and [generate2026Geometry.py](./scripts/generate2026Geometry.py) instead. +* For the list of geometries, see below. + # Run 3 Geometries The Run 3 geometry is automatically created using the script [generate2021Geometry.py](./scripts/generate2021Geometry.py). From be63951d459ab7c273c369e5ddd7993f9a2e347d Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 6 Sep 2021 10:41:33 +0200 Subject: [PATCH 415/923] esConsumes migration EcalFEtoDigi. --- .../interface/EcalFEtoDigi.h | 17 +++++++----- .../src/EcalFEtoDigi.cc | 27 +++++++------------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/SimCalorimetry/EcalElectronicsEmulation/interface/EcalFEtoDigi.h b/SimCalorimetry/EcalElectronicsEmulation/interface/EcalFEtoDigi.h index 7579280adb433..8f3bb80091d7a 100644 --- a/SimCalorimetry/EcalElectronicsEmulation/interface/EcalFEtoDigi.h +++ b/SimCalorimetry/EcalElectronicsEmulation/interface/EcalFEtoDigi.h @@ -8,7 +8,6 @@ * Created: Thu Feb 22 11:32:53 CET 2007 */ -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -18,8 +17,11 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -//#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" #include #include @@ -50,15 +52,18 @@ class EcalFEtoDigi : public edm::one::EDProducer<> { int SMidToTCCid(const int) const; void getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &) const; + const edm::ESGetToken tpgLutGroupToken_; + const edm::ESGetToken tpgLutIdMapToken_; + TCCInputData inputdata_[N_SM]; - std::string basename_; - bool useIdentityLUT_; + const std::string basename_; + const bool useIdentityLUT_; int sm_; bool singlefile; - int fileEventOffset_; - bool debug_; + const int fileEventOffset_; + const bool debug_; std::ofstream outfile; }; diff --git a/SimCalorimetry/EcalElectronicsEmulation/src/EcalFEtoDigi.cc b/SimCalorimetry/EcalElectronicsEmulation/src/EcalFEtoDigi.cc index 76866e7e8065e..a1e14424b83da 100644 --- a/SimCalorimetry/EcalElectronicsEmulation/src/EcalFEtoDigi.cc +++ b/SimCalorimetry/EcalElectronicsEmulation/src/EcalFEtoDigi.cc @@ -1,16 +1,13 @@ -#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" #include "SimCalorimetry/EcalElectronicsEmulation/interface/EcalFEtoDigi.h" -EcalFEtoDigi::EcalFEtoDigi(const edm::ParameterSet &iConfig) { - basename_ = iConfig.getUntrackedParameter("FlatBaseName", "ecal_tcc_"); - sm_ = iConfig.getUntrackedParameter("SuperModuleId", -1); - fileEventOffset_ = iConfig.getUntrackedParameter("FileEventOffset", 0); - useIdentityLUT_ = iConfig.getUntrackedParameter("UseIdentityLUT", false); - debug_ = iConfig.getUntrackedParameter("debugPrintFlag", false); - +EcalFEtoDigi::EcalFEtoDigi(const edm::ParameterSet &iConfig) + : tpgLutGroupToken_(esConsumes()), + tpgLutIdMapToken_(esConsumes()), + basename_(iConfig.getUntrackedParameter("FlatBaseName", "ecal_tcc_")), + useIdentityLUT_(iConfig.getUntrackedParameter("UseIdentityLUT", false)), + sm_(iConfig.getUntrackedParameter("SuperModuleId", -1)), + fileEventOffset_(iConfig.getUntrackedParameter("FileEventOffset", 0)), + debug_(iConfig.getUntrackedParameter("debugPrintFlag", false)) { singlefile = (sm_ == -1) ? false : true; produces(); @@ -301,17 +298,13 @@ int EcalFEtoDigi::SMidToTCCid(const int smid) const { return (smid <= 18) ? smid /// return the LUT from eventSetup void EcalFEtoDigi::getLUT(unsigned int *lut, const int towerId, const edm::EventSetup &evtSetup) const { - edm::ESHandle lutGrpHandle; - evtSetup.get().get(lutGrpHandle); - const EcalTPGGroups::EcalTPGGroupsMap &lutGrpMap = lutGrpHandle.product()->getMap(); + const EcalTPGGroups::EcalTPGGroupsMap &lutGrpMap = evtSetup.getData(tpgLutGroupToken_).getMap(); EcalTPGGroups::EcalTPGGroupsMapItr itgrp = lutGrpMap.find(towerId); uint32_t lutGrp = 999; if (itgrp != lutGrpMap.end()) lutGrp = itgrp->second; - edm::ESHandle lutMapHandle; - evtSetup.get().get(lutMapHandle); - const EcalTPGLutIdMap::EcalTPGLutMap &lutMap = lutMapHandle.product()->getMap(); + const EcalTPGLutIdMap::EcalTPGLutMap &lutMap = evtSetup.getData(tpgLutIdMapToken_).getMap(); EcalTPGLutIdMap::EcalTPGLutMapItr itLut = lutMap.find(lutGrp); if (itLut != lutMap.end()) { const unsigned int *theLut = (itLut->second).getLut(); From dff9eba1ed57911b7fb74de900aa0df00bfa03a0 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 6 Sep 2021 11:13:03 +0200 Subject: [PATCH 416/923] esConsumes migration EcalSRCondTools. --- .../interface/EcalSRCondTools.h | 11 +++++- .../src/EcalSRCondTools.cc | 38 +++++++++---------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSRCondTools.h b/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSRCondTools.h index ac11ead800bc1..1c24c59541e90 100644 --- a/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSRCondTools.h +++ b/SimCalorimetry/EcalSelectiveReadoutProducers/interface/EcalSRCondTools.h @@ -10,7 +10,10 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "CondFormats/EcalObjects/interface/EcalSRSettings.h" #include "CondFormats/DataRecord/interface/EcalSRSettingsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" +#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" +#include /** */ class EcalSRCondTools : public edm::one::EDAnalyzer<> { @@ -68,10 +71,14 @@ class EcalSRCondTools : public edm::one::EDAnalyzer<> { //fields private: - edm::ParameterSet ps_; - edm::ESGetToken hSrToken_; + const edm::ParameterSet ps_; + const std::string mode_; + bool iomode_write_; bool done_; + + edm::ESGetToken hSrToken_; + edm::ESGetToken tpgPhysicsConstToken_; }; #endif //SRCONDACCESS_H not defined diff --git a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc index 178250bdecd4e..2fb1d24fc0629 100644 --- a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc +++ b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc @@ -12,11 +12,6 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondFormats/EcalObjects/interface/EcalSRSettings.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" -#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" - -#include #include #include #include @@ -58,7 +53,16 @@ constexpr int dccNum[12][12] = { using namespace std; EcalSRCondTools::EcalSRCondTools(const edm::ParameterSet& ps) - : ps_(ps), hSrToken_(esConsumes()), done_(false) {} + : ps_(ps), + mode_(ps.getParameter("mode")), + iomode_write_(true), + done_(false) { + if (mode_ == "read") { + iomode_write_ = false; + hSrToken_ = esConsumes(); + tpgPhysicsConstToken_ = esConsumes(); + } +} EcalSRCondTools::~EcalSRCondTools() {} @@ -67,10 +71,7 @@ void EcalSRCondTools::analyze(const edm::Event& event, const edm::EventSetup& es return; EcalSRSettings* sr = new EcalSRSettings; - string mode = ps_.getParameter("mode"); - - bool iomode_write = true; - if (mode == "online_config" || mode == "combine_config") { + if (mode_ == "online_config" || mode_ == "combine_config") { string fname = ps_.getParameter("onlineSrpConfigFile"); ifstream f(fname.c_str()); if (!f.good()) { @@ -79,20 +80,16 @@ void EcalSRCondTools::analyze(const edm::Event& event, const edm::EventSetup& es importSrpConfigFile(*sr, f, true); } - if (mode == "python_config" || mode == "combine_config") { + if (mode_ == "python_config" || mode_ == "combine_config") { importParameterSet(*sr, ps_); } - if (mode == "read") { - iomode_write = false; - } - - if (!(mode == "python_config" || mode == "online_config" || mode == "combine_config" || (mode == "read"))) { - throw cms::Exception("Config") << "Invalid value," << mode << ", for parameter mode. " + if (!(mode_ == "python_config" || mode_ == "online_config" || mode_ == "combine_config" || (mode_ == "read"))) { + throw cms::Exception("Config") << "Invalid value," << mode_ << ", for parameter mode. " << "Valid values: online_config, python_config, combine_config, read"; } - if (iomode_write) { + if (iomode_write_) { sr->bxGlobalOffset_ = ps_.getParameter("bxGlobalOffset"); sr->automaticSrpSelect_ = ps_.getParameter("automaticSrpSelect"); sr->automaticMasks_ = ps_.getParameter("automaticMasks"); @@ -107,7 +104,7 @@ void EcalSRCondTools::analyze(const edm::Event& event, const edm::EventSetup& es db->writeOne(sr, firstSinceTime, "EcalSRSettingsRcd"); done_ = true; } else { //read mode - edm::ESHandle hSr = es.getHandle(hSrToken_); + const edm::ESHandle hSr = es.getHandle(hSrToken_); if (!hSr.isValid()) { cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n"; } else { @@ -117,8 +114,7 @@ void EcalSRCondTools::analyze(const edm::Event& event, const edm::EventSetup& es } //trigger tower thresholds (from FENIX configuration): - edm::ESHandle hTp; - es.get().get(hTp); + const edm::ESHandle hTp = es.getHandle(tpgPhysicsConstToken_); if (!hTp.isValid()) { cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n"; } else { From 0e91ab5b6996a04f64e41678a97b1bfdfd841941 Mon Sep 17 00:00:00 2001 From: Suchandra Date: Mon, 6 Sep 2021 11:23:25 +0200 Subject: [PATCH 417/923] Updating the Tracker Phase2 Digitizer framework to include Bricked Pixel algorithm for the inner pixel tracker --- .../plugins/Phase2TrackerDigitizer.cc | 25 +- .../plugins/Phase2TrackerDigitizer.h | 2 +- .../Phase2TrackerDigitizerAlgorithm.cc | 41 ++-- .../plugins/Phase2TrackerDigitizerAlgorithm.h | 3 + .../plugins/PixelBrickedDigitizerAlgorithm.cc | 228 ++++++++++++++++++ .../plugins/PixelBrickedDigitizerAlgorithm.h | 26 ++ .../plugins/PixelDigitizerAlgorithm.h | 8 +- .../python/phase2TrackerDigitizer_cfi.py | 3 +- 8 files changed, 302 insertions(+), 34 deletions(-) create mode 100644 SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.cc create mode 100644 SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index ec0b3ec349f95..a1e69059269ff 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -23,6 +23,7 @@ #include "SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h" #include "SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h" #include "SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.h" +#include "SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h" #include "SimTracker/SiPhase2Digitizer/plugins/DigitizerUtility.h" #include "FWCore/Framework/interface/EDProducer.h" @@ -91,6 +92,7 @@ namespace cms { } // creating algorithm objects and pushing them into the map algomap_[AlgorithmType::InnerPixel] = std::make_unique(iConfig, iC); + algomap_[AlgorithmType::InnerPixelBricked] = std::make_unique(iConfig, iC); algomap_[AlgorithmType::InnerPixel3D] = std::make_unique(iConfig, iC); algomap_[AlgorithmType::PixelinPS] = std::make_unique(iConfig, iC); algomap_[AlgorithmType::StripinPS] = std::make_unique(iConfig, iC); @@ -234,6 +236,9 @@ namespace cms { moduleTypeCache_.emplace(detId_raw, mType); } + auto detUnit = detectorUnits_.find(detId_raw); + const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast(detUnit->second); + const Phase2TrackerTopology* topol = &pixdet->specificTopology(); AlgorithmType algotype = AlgorithmType::Unknown; switch (mType) { case TrackerGeometry::ModuleType::Ph1PXB: @@ -243,10 +248,16 @@ namespace cms { algotype = AlgorithmType::InnerPixel; break; case TrackerGeometry::ModuleType::Ph2PXB: - algotype = AlgorithmType::InnerPixel; + if (topol->isBricked()) + algotype = AlgorithmType::InnerPixelBricked; + else + algotype = AlgorithmType::InnerPixel; break; case TrackerGeometry::ModuleType::Ph2PXF: - algotype = AlgorithmType::InnerPixel; + if (topol->isBricked()) + algotype = AlgorithmType::InnerPixelBricked; + else + algotype = AlgorithmType::InnerPixel; break; case TrackerGeometry::ModuleType::Ph2PXB3D: algotype = AlgorithmType::InnerPixel3D; @@ -282,9 +293,10 @@ namespace cms { continue; // Decide if we want analog readout for Outer Tracker. - if (!ot_analog && (algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D)) { + if (!ot_analog && algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D && + algotype != AlgorithmType::InnerPixelBricked) continue; - } + std::map digi_map; fiter->second->digitize(dynamic_cast(det_u), digi_map, tTopo_); @@ -345,9 +357,10 @@ namespace cms { auto algotype = getAlgoType(rawId); auto fiter = algomap_.find(algotype); - if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D) { + if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D || + algotype == AlgorithmType::InnerPixelBricked) continue; - } + std::map digi_map; fiter->second->digitize(dynamic_cast(det_u), digi_map, tTopo_); diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h index 7a8889959700a..17817420fd90e 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h @@ -73,7 +73,7 @@ namespace cms { using vstring = std::vector; // constants of different algorithm types - enum class AlgorithmType { InnerPixel, InnerPixel3D, PixelinPS, StripinPS, TwoStrip, Unknown }; + enum class AlgorithmType { InnerPixel, InnerPixelBricked, InnerPixel3D, PixelinPS, StripinPS, TwoStrip, Unknown }; AlgorithmType getAlgoType(uint32_t idet); void accumulatePixelHits(edm::Handle >, size_t globalSimHitIndex, const uint32_t tofBin); diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc index a3293b5c7600c..67439e12fa87d 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc @@ -37,25 +37,14 @@ using namespace edm; using namespace sipixelobjects; -namespace { +namespace Ph2TkDigiAlgo { // Mass in MeV constexpr double m_pion = 139.571; constexpr double m_kaon = 493.677; constexpr double m_electron = 0.511; constexpr double m_muon = 105.658; constexpr double m_proton = 938.272; - float calcQ(float x); -} // namespace -namespace { - float calcQ(float x) { - constexpr float p1 = 12.5f; - constexpr float p2 = 0.2733f; - constexpr float p3 = 0.147f; - - auto xx = std::min(0.5f * x * x, p1); - return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x)); - } -} // namespace +} // namespace Ph2TkDigiAlgo Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, const edm::ParameterSet& conf_specific, edm::ConsumesCollector iC) @@ -279,17 +268,17 @@ std::vector Phase2TrackerDigitizerAlgorithm //============================================================================== std::vector Phase2TrackerDigitizerAlgorithm::fluctuateEloss( int pid, float particleMomentum, float eloss, float length, int NumberOfSegs) const { - double particleMass = ::m_pion; // Mass in MeV, assume pion + double particleMass = Ph2TkDigiAlgo::m_pion; // Mass in MeV, assume pion pid = std::abs(pid); if (pid != 211) { // Mass in MeV if (pid == 11) - particleMass = ::m_electron; + particleMass = Ph2TkDigiAlgo::m_electron; else if (pid == 13) - particleMass = ::m_muon; + particleMass = Ph2TkDigiAlgo::m_muon; else if (pid == 321) - particleMass = ::m_kaon; + particleMass = Ph2TkDigiAlgo::m_kaon; else if (pid == 2212) - particleMass = ::m_proton; + particleMass = Ph2TkDigiAlgo::m_proton; } // What is the track segment length. float segmentLength = length / NumberOfSegs; @@ -513,7 +502,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal( } else { mp = MeasurementPoint(ix, 0.0); xLB = topol->localPosition(mp).x(); - LowerBound = 1 - ::calcQ((xLB - CloudCenterX) / SigmaX); + LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX); } float xUB, UpperBound; @@ -522,7 +511,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal( } else { mp = MeasurementPoint(ix + 1, 0.0); xUB = topol->localPosition(mp).x(); - UpperBound = 1. - ::calcQ((xUB - CloudCenterX) / SigmaX); + UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX); } float TotalIntegrationRange = UpperBound - LowerBound; // get strip x.emplace(ix, TotalIntegrationRange); // save strip integral @@ -537,7 +526,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal( } else { mp = MeasurementPoint(0.0, iy); yLB = topol->localPosition(mp).y(); - LowerBound = 1. - ::calcQ((yLB - CloudCenterY) / SigmaY); + LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY); } float yUB, UpperBound; @@ -546,7 +535,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal( } else { mp = MeasurementPoint(0.0, iy + 1); yUB = topol->localPosition(mp).y(); - UpperBound = 1. - ::calcQ((yUB - CloudCenterY) / SigmaY); + UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY); } float TotalIntegrationRange = UpperBound - LowerBound; @@ -1041,3 +1030,11 @@ int Phase2TrackerDigitizerAlgorithm::convertSignalToAdc(uint32_t detID, float si } return signal_in_adc; } +float Phase2TrackerDigitizerAlgorithm::calcQ(float x) { + constexpr float p1 = 12.5f; + constexpr float p2 = 0.2733f; + constexpr float p3 = 0.147f; + + auto xx = std::min(0.5f * x * x, p1); + return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x)); +} diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index df855ff7a0ecd..192f1e3be8dff 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -1,3 +1,5 @@ + + #ifndef __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizerAlgorithm_h #define __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizerAlgorithm_h @@ -218,6 +220,7 @@ class Phase2TrackerDigitizerAlgorithm { const Phase2TrackerGeomDetUnit* pixdet); // remove dead modules uisng the list in the DB const SubdetEfficiencies subdetEfficiencies_; + float calcQ(float x); // For random numbers std::unique_ptr gaussDistribution_; diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.cc new file mode 100644 index 0000000000000..1654c51b4d0ee --- /dev/null +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.cc @@ -0,0 +1,228 @@ +#include +#include + +#include "SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationOfflineSimService.h" + +#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleSimRcd.h" + +// Geometry +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" + +using namespace edm; +using namespace sipixelobjects; + +PixelBrickedDigitizerAlgorithm::PixelBrickedDigitizerAlgorithm(const edm::ParameterSet& conf, edm::ConsumesCollector iC) + : PixelDigitizerAlgorithm(conf, iC) +/* odd_row_interchannelCoupling_next_row_(conf.getParameter("PixelBrickedDigitizerAlgorithm") + .getParameter("Odd_row_interchannelCoupling_next_row")) + even_row_interchannelCoupling_next_row_(conf.getParameter("PixelBrickedDigitizerAlgorithm") + .getParameter("Even_row_interchannelCoupling_next_row")), + odd_column_interchannelCoupling_next_column_( + conf.getParameter("PixelBrickedDigitizerAlgorithm") + .getParameter("Odd_column_interchannelCoupling_next_column")), + even_column_interchannelCoupling_next_column_( + conf.getParameter("PixelBrickedDigitizerAlgorithm") + .getParameter("Even_column_interchannelCoupling_next_column"))*/ +{ + even_row_interchannelCoupling_next_row_ = conf.getParameter("PixelBrickedDigitizerAlgorithm") + .getParameter("Even_row_interchannelCoupling_next_row"); + pixelFlag_ = true; + LogDebug("PixelBrickedDigitizerAlgorithm") + << "Algorithm constructed " + << "Configuration parameters:" + << "Threshold/Gain = " + << "threshold in electron Endcap = " << theThresholdInE_Endcap_ + << "threshold in electron Barrel = " << theThresholdInE_Barrel_ << " " << theElectronPerADC_ << " " + << theAdcFullScale_ << " The delta cut-off is set to " << tMax_ << " pix-inefficiency " << addPixelInefficiency_; +} +PixelBrickedDigitizerAlgorithm::~PixelBrickedDigitizerAlgorithm() { + LogDebug("PixelBrickedDigitizerAlgorithm") << "Algorithm deleted"; +} +void PixelBrickedDigitizerAlgorithm::induce_signal(const PSimHit& hit, + const size_t hitIndex, + const uint32_t tofBin, + const Phase2TrackerGeomDetUnit* pixdet, + const std::vector& collection_points) { + // X - Rows, Left-Right, 160, (1.6cm) for barrel + // Y - Columns, Down-Up, 416, (6.4cm) + const Phase2TrackerTopology* topol = &pixdet->specificTopology(); + uint32_t detID = pixdet->geographicalId().rawId(); + signal_map_type& theSignal = _signal[detID]; + + // local map to store pixels hit by 1 Hit. + using hit_map_type = std::map >; + hit_map_type hit_signal; + + // Assign signals to readout channels and store sorted by channel number + // Iterate over collection points on the collection plane + for (auto const& v : collection_points) { + float CloudCenterX = v.position().x(); // Charge position in x + float CloudCenterY = v.position().y(); // in y + float SigmaX = v.sigma_x(); // Charge spread in x + float SigmaY = v.sigma_y(); // in y + float Charge = v.amplitude(); // Charge amplitude + + // Find the maximum cloud spread in 2D plane , assume 3*sigma + float CloudRight = CloudCenterX + clusterWidth_ * SigmaX; + float CloudLeft = CloudCenterX - clusterWidth_ * SigmaX; + float CloudUp = CloudCenterY + clusterWidth_ * SigmaY; + float CloudDown = CloudCenterY - clusterWidth_ * SigmaY; + + // Define 2D cloud limit points + LocalPoint PointRightUp = LocalPoint(CloudRight, CloudUp); + LocalPoint PointLeftDown = LocalPoint(CloudLeft, CloudDown); + + // This points can be located outside the sensor area. + // The conversion to measurement point does not check for that + // so the returned pixel index might be wrong (outside range). + // We rely on the limits check below to fix this. + // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE + // PIXEL ARE IS LOST, it should not be collected. + + // Convert the 2D points to pixel indices + MeasurementPoint mp = topol->measurementPosition(PointRightUp); + //MeasurementPoint mp_bricked = topol->measurementPosition(PointRightUp); + int IPixRightUpX = static_cast(std::floor(mp.x())); // cast reqd. + //int IPixRightUpY = static_cast(std::floor(mp.y())); + + int numColumns = topol->ncolumns(); // det module number of cols&rows + int numRows = topol->nrows(); + IPixRightUpX = numRows > IPixRightUpX ? IPixRightUpX : numRows - 1; + + //Specific to bricked geometry + int IPixRightUpY = static_cast(mp.y() - 0.5 * (IPixRightUpX % 2)); + + mp = topol->measurementPosition(PointLeftDown); + + int IPixLeftDownX = static_cast(std::floor(mp.x())); + + IPixLeftDownX = 0 < IPixLeftDownX ? IPixLeftDownX : 0; + + //Specific to bricked geometry + int IPixLeftDownY = static_cast(mp.y() - 0.5 * (IPixLeftDownX % 2)); //changed in case negative value + + IPixRightUpY = numColumns > IPixRightUpY ? IPixRightUpY : numColumns - 1; + IPixLeftDownY = 0 < IPixLeftDownY ? IPixLeftDownY : 0; + + // First integrate charge strips in x + hit_map_type x; + for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index + float xLB, LowerBound; + // Why is set to 0 if ix=0, does it meen that we accept charge + // outside the sensor? + if (ix == 0 || SigmaX == 0.) { // skip for surface segemnts + LowerBound = 0.; + } else { + mp = MeasurementPoint(ix, 0.0); + xLB = topol->localPosition(mp).x(); + LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX); + } + + float xUB, UpperBound; + if (ix == numRows - 1 || SigmaX == 0.) { + UpperBound = 1.; + } else { + mp = MeasurementPoint(ix + 1, 0.0); + xUB = topol->localPosition(mp).x(); + UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX); + } + float TotalIntegrationRange = UpperBound - LowerBound; // get strip + x.emplace(ix, TotalIntegrationRange); // save strip integral + } + + // Now integrate strips in y. Two maps will be filled: y and y_bricked which will both be used for the induced signal. + int IPixLeftDownY_bricked = IPixLeftDownY; + int IPixRightUpY_bricked = IPixRightUpY; + + //Specific to bricked geometry + IPixRightUpY = std::min(IPixRightUpY + int((IPixRightUpX % 2)), numColumns - 1); + + //This map will be twice as large as the non-bricked hit map in y to harbor both the integrated charge from the bricked and non-bricked columns. + hit_map_type y; + for (int iy = IPixLeftDownY; iy <= IPixRightUpY; ++iy) { // loop over y index + float yLB, LowerBound; + if (iy == 0 || SigmaY == 0.) { + LowerBound = 0.; + } else { + mp = MeasurementPoint(0.0, iy); + yLB = topol->localPosition(mp).y(); + LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY); + } + + float yUB, UpperBound; + if (iy >= numColumns - 1 || SigmaY == 0.) { + UpperBound = 1.; + } else { + mp = MeasurementPoint(0.0, iy + 1); + yUB = topol->localPosition(mp).y(); + UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY); + } + + float TotalIntegrationRange = UpperBound - LowerBound; + + //Even indices correspond to the non-bricked columns + y.emplace(2 * iy, TotalIntegrationRange); // save strip integral + } + + IPixLeftDownY_bricked = std::max(IPixLeftDownY_bricked - int((!(IPixLeftDownX % 2))), 0); + for (int iy = IPixLeftDownY_bricked; iy <= IPixRightUpY_bricked; ++iy) { // loop over y index + float yLB, LowerBound; + if (iy == 0 || SigmaY == 0.) { + LowerBound = 0.; + } else { + mp = MeasurementPoint(0.0, iy + 0.5); + yLB = topol->localPosition(mp).y(); + LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY); + } + + float yUB, UpperBound; + if (iy >= numColumns || SigmaY == 0.) { // This was changed for bricked pixels + UpperBound = 1.; + } else { + mp = MeasurementPoint(0.0, iy + 1.5); + yUB = topol->localPosition(mp).y(); + UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY); + } + + float TotalIntegrationRange = UpperBound - LowerBound; + //Odd indices correspond to bricked columns + y.emplace(2 * iy + 1, TotalIntegrationRange); // save strip integral + } //loop over y index + + // Get the 2D charge integrals by folding x and y strips + for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index + for (int iy = std::max(0, IPixLeftDownY - int((ix % 2))); iy <= IPixRightUpY; ++iy) { // loop over y index + int iy_considered = iy * 2 + ix % 2; + float ChargeFraction = Charge * x[ix] * y[iy_considered]; + + int chanFired = -1; + if (ChargeFraction > 0.) { + chanFired = + pixelFlag_ ? PixelDigi::pixelToChannel(ix, iy) : Phase2TrackerDigi::pixelToChannel(ix, iy); // Get index + // Load the ampl + hit_signal[chanFired] += ChargeFraction; + } + } + } //x loop + } //collection loop + // Fill the global map with all hit pixels from this event + float corr_time = hit.tof() - pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv; + for (auto const& hit_s : hit_signal) { + int chan = hit_s.first; + theSignal[chan] += + (makeDigiSimLinks_ ? DigitizerUtility::Amplitude(hit_s.second, &hit, hit_s.second, corr_time, hitIndex, tofBin) + : DigitizerUtility::Amplitude(hit_s.second, nullptr, hit_s.second)); + } +} diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h new file mode 100644 index 0000000000000..40258fb517437 --- /dev/null +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h @@ -0,0 +1,26 @@ + +#ifndef _SimTracker_SiPhase2Digitizer_PixelBrickedDigitizerAlgorithm_h +#define _SimTracker_SiPhase2Digitizer_PixelBrickedDigitizerAlgorithm_h + +#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleSimRcd.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h" + +class PixelBrickedDigitizerAlgorithm : public PixelDigitizerAlgorithm { +private: +public: + PixelBrickedDigitizerAlgorithm(const edm::ParameterSet& conf, edm::ConsumesCollector iC); + ~PixelBrickedDigitizerAlgorithm() override; + + // Specific for bricked pixel + void induce_signal(const PSimHit& hit, + const size_t hitIndex, + const unsigned int tofBin, + const Phase2TrackerGeomDetUnit* pixdet, + const std::vector& collection_points) override; +}; +#endif diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h index 3fb7a37ded709..d51f1a8c985c1 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h @@ -52,10 +52,10 @@ class PixelDigitizerAlgorithm : public Phase2TrackerDigitizerAlgorithm { void add_cross_talk(const Phase2TrackerGeomDetUnit* pixdet) override; // Addition four xtalk-related parameters to PixelDigitizerAlgorithm specific parameters initialized in Phase2TrackerDigitizerAlgorithm - const double odd_row_interchannelCoupling_next_row_; - const double even_row_interchannelCoupling_next_row_; - const double odd_column_interchannelCoupling_next_column_; - const double even_column_interchannelCoupling_next_column_; + double odd_row_interchannelCoupling_next_row_; + double even_row_interchannelCoupling_next_row_; + double odd_column_interchannelCoupling_next_column_; + double even_column_interchannelCoupling_next_column_; // Timewalk parameters bool apply_timewalk_; diff --git a/SimTracker/SiPhase2Digitizer/python/phase2TrackerDigitizer_cfi.py b/SimTracker/SiPhase2Digitizer/python/phase2TrackerDigitizer_cfi.py index 4fed519b3cd25..f516c20eda7e8 100644 --- a/SimTracker/SiPhase2Digitizer/python/phase2TrackerDigitizer_cfi.py +++ b/SimTracker/SiPhase2Digitizer/python/phase2TrackerDigitizer_cfi.py @@ -90,7 +90,8 @@ OhmicColumnRadius = cms.double(4.0), NPColumnGap = cms.double(46.0) ), - +#Pixel-Bricked Digitizer Algorithm + PixelBrickedDigitizerAlgorithm = PixelDigitizerAlgorithmCommon.clone(), #Pixel in PS Module PSPDigitizerAlgorithm = cms.PSet( ElectronPerAdc = cms.double(135.0), From e99eba6df02721ab7bc403b0cf11348b0310daf5 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Mon, 6 Sep 2021 12:27:09 +0200 Subject: [PATCH 418/923] Prevent race condition in os.makedirs --- Validation/RecoTrack/python/plotting/validation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Validation/RecoTrack/python/plotting/validation.py b/Validation/RecoTrack/python/plotting/validation.py index 3b208d4bb943e..be56a6ac3ebfa 100644 --- a/Validation/RecoTrack/python/plotting/validation.py +++ b/Validation/RecoTrack/python/plotting/validation.py @@ -1274,7 +1274,13 @@ def _doPlotsForPlotter(self, plotter, sample, limitSubFoldersOnlyTo=None): for plotterFolder, dqmSubFolder in plotterInstance.iterFolders(limitSubFoldersOnlyTo=limitSubFoldersOnlyTo): if sample is not None and not _processPlotsForSample(plotterFolder, sample): continue - p = multiprocessing.Process(target=self._doPlots, args=(plotterFolder, dqmSubFolder, iProc, return_dict)) + + newsubdir = self._subdirprefix+plotterFolder.getSelectionName(dqmSubFolder) + newdir = os.path.join(self._newdir, newsubdir) + if not os.path.exists(newdir): + os.makedirs(newdir) + + p = multiprocessing.Process(target=self._doPlots, args=(plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict)) proc.append((plotterFolder, dqmSubFolder, p)) p.start() iProc += 1 @@ -1283,12 +1289,8 @@ def _doPlotsForPlotter(self, plotter, sample, limitSubFoldersOnlyTo=None): 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): + def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict): plotterFolder.create(self._openFiles, self._labels, dqmSubFolder) - newsubdir = self._subdirprefix+plotterFolder.getSelectionName(dqmSubFolder) - newdir = os.path.join(self._newdir, newsubdir) - if not os.path.exists(newdir): - os.makedirs(newdir) fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs) for tableCreator in plotterFolder.getTableCreators(): From d216e83ddb3f0bae19a77ad33479a84f72d162a5 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Mon, 6 Sep 2021 13:17:20 +0200 Subject: [PATCH 419/923] comments from Maria --- PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py | 7 +++++-- PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py | 3 ++- .../python/tools/runMETCorrectionsAndUncertainties.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py b/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py index 27a1bea045697..2d26c02350157 100644 --- a/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/puppiForMET_cff.py @@ -12,7 +12,8 @@ def makePuppies( process ): def makePuppiesFromMiniAOD( process, createScheduledSequence=False ): task = getPatAlgosToolsTask(process) - process.load('CommonTools.ParticleFlow.pfCHS_cff') + from CommonTools.ParticleFlow.pfCHS_cff import packedPrimaryVertexAssociationJME + setattr(process, "packedPrimaryVertexAssociationJME", packedPrimaryVertexAssociationJME.clone()) task.add(process.packedPrimaryVertexAssociationJME) process.load('CommonTools.PileupAlgos.Puppi_cff') task.add(process.puppi) @@ -30,5 +31,7 @@ def makePuppiesFromMiniAOD( process, createScheduledSequence=False ): #making a sequence for people running the MET tool in scheduled mode if createScheduledSequence: - puppiMETSequence = cms.Sequence(process.packedPrimaryVertexAssociationJME*process.puppi*process.puppiNoLep) + puppiMETTask = cms.Task(process.packedPrimaryVertexAssociationJME, process.puppi, process.puppiNoLep) + setattr(process, "puppiMETTask", puppiMETTask) + puppiMETSequence = cms.Sequence(puppiMETTask) setattr(process, "puppiMETSequence", puppiMETSequence) diff --git a/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py b/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py index f39e4b0a90c16..01d00edfec39b 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetCollectionTools.py @@ -283,8 +283,9 @@ def addRecoJetCollection(self, # elif recoJetInfo.jetPUMethod == "chs": from CommonTools.ParticleFlow.pfCHS_cff import pfCHS, packedPrimaryVertexAssociationJME + self.addProcessAndTask(proc, "packedPrimaryVertexAssociationJME", packedPrimaryVertexAssociationJME.clone()) + self.prerequisites.append("packedPrimaryVertexAssociationJME") self.addProcessAndTask(proc, pfCand, pfCHS.clone()) - self.prerequisites.append(process.packedPrimaryVertexAssociationJME) self.prerequisites.append(pfCand) # # PUPPI diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index 739cc55562a12..a37b20ba73048 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -915,7 +915,7 @@ def getMETUncertainties(self, process, metType, metModName, electronCollection, # PFPhotons : #------------ pfPhotons = cms.EDFilter("CandPtrSelector", - src = pfCandCollection, + src = pfCandCollection if self._parameters["Puppi"].value or not self._parameters["onMiniAOD"].value else cms.InputTag("pfCHS"), cut = cms.string("abs(pdgId) = 22") ) addToProcessAndTask("pfPhotons"+postfix, pfPhotons, process, task) From 9712294b6e8ea0912a6db541c56481e2fbc1164a Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 6 Sep 2021 13:54:59 +0200 Subject: [PATCH 420/923] remove unused data member EcalMatacqDigi::freq --- DataFormats/EcalDigi/interface/EcalMatacqDigi.h | 8 ++------ DataFormats/EcalDigi/src/classes_def.xml | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h index 6233c8e807b11..f33815d7b73d5 100644 --- a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h +++ b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h @@ -29,7 +29,7 @@ class EcalMatacqDigi { public: /** Default constructor. */ - EcalMatacqDigi() : chId_(-1), freq(0), ts_(0.), tTrigS_(999.), version_(-1) { init(); } + EcalMatacqDigi() : chId_(-1), ts_(0.), tTrigS_(999.), version_(-1) { init(); } /** Constructor * @param samples adc time samples @@ -43,7 +43,7 @@ class EcalMatacqDigi { const double& ts, const short& version = -1, const double& tTrig = 999.) - : chId_(chId), data_(samples), freq(0), ts_(ts), tTrigS_(tTrig), version_(version) { + : chId_(chId), data_(samples), ts_(ts), tTrigS_(tTrig), version_(version) { init(); }; @@ -300,10 +300,6 @@ class EcalMatacqDigi { */ std::vector data_; - /** Frequency mode. 1->1GHz sampling, 2->2GHz sampling - */ - int freq; - /**Sampling period in seconds. In priniciple 1ns or 0.5ns */ double ts_; diff --git a/DataFormats/EcalDigi/src/classes_def.xml b/DataFormats/EcalDigi/src/classes_def.xml index 9c40edacab4db..5f365f96523b4 100644 --- a/DataFormats/EcalDigi/src/classes_def.xml +++ b/DataFormats/EcalDigi/src/classes_def.xml @@ -48,7 +48,8 @@ - + + From 69724a511afa7d5c2bd8402027867357b3fb7d9c Mon Sep 17 00:00:00 2001 From: Abhirami Harilal Date: Mon, 6 Sep 2021 16:06:16 +0200 Subject: [PATCH 421/923] FIx laser correction timing error --- DQM/EcalMonitorTasks/interface/OccupancyTask.h | 1 - DQM/EcalMonitorTasks/src/OccupancyTask.cc | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DQM/EcalMonitorTasks/interface/OccupancyTask.h b/DQM/EcalMonitorTasks/interface/OccupancyTask.h index bd4cd4e9d0a48..d58a0f1172fcd 100644 --- a/DQM/EcalMonitorTasks/interface/OccupancyTask.h +++ b/DQM/EcalMonitorTasks/interface/OccupancyTask.h @@ -29,7 +29,6 @@ namespace ecaldqm { void runOnDigis(DigiCollection const&, Collections); void runOnTPDigis(EcalTrigPrimDigiCollection const&); void runOnRecHits(EcalRecHitCollection const&, Collections); - void setEventTime(const edm::TimeValue_t& iTime); void setTokens(edm::ConsumesCollector&) override; private: diff --git a/DQM/EcalMonitorTasks/src/OccupancyTask.cc b/DQM/EcalMonitorTasks/src/OccupancyTask.cc index 83571c22458f2..f89cdf7016d5c 100644 --- a/DQM/EcalMonitorTasks/src/OccupancyTask.cc +++ b/DQM/EcalMonitorTasks/src/OccupancyTask.cc @@ -1,5 +1,5 @@ #include "DQM/EcalMonitorTasks/interface/OccupancyTask.h" - +#include "FWCore/Framework/interface/Event.h" #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,6 @@ namespace ecaldqm { } void OccupancyTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillLaser = true; } - void OccupancyTask::setEventTime(const edm::TimeValue_t& iTime) { m_iTime = iTime; } void OccupancyTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const& ByLumiResetSwitch, @@ -39,6 +38,7 @@ namespace ecaldqm { MEs_.at("RecHitThrAllByLumi").reset(GetElectronicsMap()); } MESet& meLaserCorrProjEta(MEs_.at("LaserCorrProjEta")); + m_iTime = _evt.time().value(); if (FillLaser) { float lasercalib = 1.; auto const& laser = &_es.getData(lasertoken_); From a497b31340c380f62d3a4098c2efcdb06f38e43f Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 6 Sep 2021 16:18:30 +0200 Subject: [PATCH 422/923] adding normalization of control histos --- .../HGCalSimAlgos/src/HGCalRadiationMap.cc | 3 +- .../test/HGCHEbackSignalScalerAnalyzer.cc | 353 ++++++------------ .../test/hgchebacksignalscaler_cfg.py | 10 +- .../test/hgcsiNoiseMapTester_cfg.py | 10 +- .../data/doseParams_3000fb_fluka-6.2.0.1.txt | 61 +++ 5 files changed, 192 insertions(+), 245 deletions(-) create mode 100644 SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-6.2.0.1.txt diff --git a/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc b/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc index a515705faf61a..50059996c0415 100644 --- a/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc +++ b/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc @@ -56,8 +56,7 @@ double HGCalRadiationMap::getFluenceValue(const int subdet, const int layer, con } // -std::map, HGCalRadiationMap::DoseParameters> HGCalRadiationMap::readDosePars( - const std::string& fullpath) { +std::map, HGCalRadiationMap::DoseParameters> HGCalRadiationMap::readDosePars(const std::string& fullpath) { doseParametersMap result; //no dose file means no aging diff --git a/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc b/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc index a4dca4d718f4f..5e2f8e544e797 100644 --- a/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc +++ b/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc @@ -18,9 +18,7 @@ #include "SimCalorimetry/HGCalSimAlgos/interface/HGCalSciNoiseMap.h" //ROOT headers -#include #include -#include #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/PluginManager/interface/ModuleDef.h" @@ -32,6 +30,7 @@ #include #include #include +#include #include "vdt/vdtMath.h" @@ -59,26 +58,20 @@ class HGCHEbackSignalScalerAnalyzer : public edm::one::EDAnalyzer> layerRadiusMap_; - std::map layerMap_; - std::map> hgcrocMap_; - std::map> hgcrocNcellsMap_; + std::set allLayers_, allIeta_; //allIphi_ const HGCalGeometry* gHGCal_; const HGCalDDDConstants* hgcCons_; - int firstLayer_, lastLayer_; - const float radiusMin_ = 70; //cm - const float radiusMax_ = 280; //cm - const int radiusBins_ = 525; //cm - const int nWedges_ = 72; + std::map > layerHistos_; + std::map histos_; }; // // constructors and destructor // HGCHEbackSignalScalerAnalyzer::HGCHEbackSignalScalerAnalyzer(const edm::ParameterSet& iConfig) - : doseMap_(iConfig.getParameter("doseMap")), + : doseMap_(iConfig.getParameter("doseMap")), sipmMap_(iConfig.getParameter("sipmMap")), nPEperMIP_(iConfig.getParameter("nPEperMIP")) { usesResource("TFileService"); @@ -102,7 +95,7 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: } gHGCal_ = geomhandle.product(); const std::vector& detIdVec = gHGCal_->getValidDetIds(); - std::cout << "total number of cells: " << detIdVec.size() << std::endl; + LogDebug("HGCHEbackSignalScalerAnalyzer") << "Total number of DetIDs: " << detIdVec.size(); //get ddd constants edm::ESHandle dddhandle; @@ -115,55 +108,44 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: //setup maps createBinning(detIdVec); - printBoundaries(); - //instantiate binning array - std::vector tmpVec; - for (auto elem : layerMap_) - tmpVec.push_back(elem.second); - - double* zBins = tmpVec.data(); - int nzBins = tmpVec.size() - 1; - - TProfile2D* doseMap = fs->make("doseMap", "doseMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* fluenceMap = - fs->make("fluenceMap", "fluenceMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* scaleByDoseMap = - fs->make("scaleByDoseMap", "scaleByDoseMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* scaleByTileAreaMap = fs->make( - "scaleByTileAreaMap", "scaleByTileAreaMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* scaleByDoseAreaMap = fs->make( - "scaleByDoseAreaMap", "scaleByDoseAreaMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* noiseByFluenceMap = fs->make( - "noiseByFluenceMap", "noiseByFluenceMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* probNoiseAboveHalfMip = fs->make( - "probNoiseAboveHalfMip", "probNoiseAboveHalfMip", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - - TProfile2D* signalToNoiseFlatAreaMap = fs->make( - "signalToNoiseFlatAreaMap", "signalToNoiseFlatAreaMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* signalToNoiseDoseMap = fs->make( - "signalToNoiseDoseMap", "signalToNoiseDoseMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* signalToNoiseAreaMap = fs->make( - "signalToNoiseAreaMap", "signalToNoiseAreaMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* signalToNoiseDoseAreaMap = fs->make( - "signalToNoiseDoseAreaMap", "signalToNoiseDoseAreaMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - TProfile2D* signalToNoiseDoseAreaSipmMap = fs->make("signalToNoiseDoseAreaSipmMap", - "signalToNoiseDoseAreaSipmMap", - nzBins, - zBins, - radiusBins_, - radiusMin_, - radiusMax_); - - TProfile2D* saturationMap = - fs->make("saturationMap", "saturationMap", nzBins, zBins, radiusBins_, radiusMin_, radiusMax_); - - //book per layer plots - std::map probNoiseAboveHalfMip_layerMap; - for (auto lay : layerRadiusMap_) - probNoiseAboveHalfMip_layerMap[lay.first] = fs->make(Form("probNoiseAboveHalfMip_layer%d", lay.first), - "", - hgcrocMap_[lay.first].size() - 1, - hgcrocMap_[lay.first].data()); + int minLayer( *std::min_element(allLayers_.begin(),allLayers_.end()) ); + int maxLayer( *std::max_element(allLayers_.begin(),allLayers_.end()) ); + int nLayers(maxLayer - minLayer + 1); + int minIeta( *std::min_element(allIeta_.begin(),allIeta_.end()) ); + int maxIeta( *std::max_element(allIeta_.begin(),allIeta_.end()) ); + int nIeta(maxIeta - minIeta + 1); + //int minIphi( *std::min_element(allIphi_.begin(),allIphi_.end()) ); + //int maxIphi( *std::max_element(allIphi_.begin(),allIphi_.end()) ); + //int nIphi(maxIphi - minIphi + 1); + + TString hnames[] = {"count", "radius", "dose", "fluence", "s", "n", "sn", "lysf"}; + TString htitles[] = {"tiles", + "#rho [cm]", + " [krad]", + " [1 MeV n_{eq}/cm^{2}]", + " [pe]", + "<#sigma_{N}> [pe]", + "", + "LY SF"}; + for (size_t i = 0; i < sizeof(hnames) / sizeof(TString); i++) { + histos_[hnames[i] + "_ieta"] = fs->make( + hnames[i] + "_ieta", ";Layer;i-#eta;" + htitles[i], nLayers, minLayer, maxLayer + 1, nIeta, minIeta, maxIeta); + //histos_[hnames[i] + "_iphi"] = fs->make( + // hnames[i] + "_iphi", ";Layer;i-#phi;" + htitles[i], nLayers, minLayer, maxLayer + 1, nIphi, minIphi, maxIphi); + + //add per-layer profiles + for (int ilay = minLayer; ilay <= maxLayer; ilay++) { + if (layerHistos_.count(ilay) == 0) { + std::map templ_map; + layerHistos_[ilay] = templ_map; + } + TString hnameLay(Form("%s_lay%d_", hnames[i].Data(), ilay)); + layerHistos_[ilay][hnames[i] + "_ieta"] = + fs->make(hnameLay + "ieta", ";i-#eta;" + htitles[i], nIeta, minIeta, maxIeta); + //layerHistos_[ilay][hnames[i] + "_iphi"] = + //fs->make(hnameLay + "iphi", ";i-#phi;" + htitles[i], nIphi, minIphi, maxIphi); + } + } //instantiate scaler HGCalSciNoiseMap scal; @@ -172,201 +154,102 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: scal.setGeometry(gHGCal_); //loop over valid detId from the HGCHEback - LogDebug("HGCHEbackSignalScalerAnalyzer") << "Total number of DetIDs: " << detIdVec.size(); - for (std::vector::const_iterator myId = detIdVec.begin(); myId != detIdVec.end(); ++myId) { - HGCScintillatorDetId scId(myId->rawId()); + for (auto myId : detIdVec) { + HGCScintillatorDetId scId(myId.rawId()); - int layer = scId.layer(); + int layer = std::abs(scId.layer()); + std::pair ietaphi = scId.ietaphi(); + int ieta = std::abs(ietaphi.first); + //int iphi = std::abs(ietaphi.second); + //characteristics of this tile GlobalPoint global = gHGCal_->getPosition(scId); double radius = std::sqrt(std::pow(global.x(), 2) + std::pow(global.y(), 2)); - double dose = scal.getDoseValue(DetId::HGCalHSc, layer, radius); double fluence = scal.getFluenceValue(DetId::HGCalHSc, layer, radius); - + auto dosePair = scal.scaleByDose(scId, radius); float scaleFactorBySipmArea = scal.scaleBySipmArea(scId, radius); float scaleFactorByTileArea = scal.scaleByTileArea(scId, radius); float scaleFactorByDose = dosePair.first; float noiseByFluence = dosePair.second; - float expNoise = noiseByFluence * sqrt(scaleFactorBySipmArea); - - TF1 mypois("mypois", "TMath::Poisson(x+[0],[0])", 0, 10000); //subtract ped mean - mypois.SetParameter(0, std::pow(expNoise, 2)); - double prob = - mypois.Integral(nPEperMIP_ * scaleFactorByTileArea * scaleFactorBySipmArea * scaleFactorByDose * 0.5, 10000); - - int ilayer = scId.layer(); - int iradius = scId.iradiusAbs(); - std::pair cellSize = hgcCons_->cellSizeTrap(scId.type(), scId.iradiusAbs()); - float inradius = cellSize.first; - - float zpos = std::abs(global.z()); - - int bin = doseMap->GetYaxis()->FindBin(inradius); - while (scaleByDoseMap->GetYaxis()->GetBinLowEdge(bin) < layerRadiusMap_[ilayer][iradius + 1]) { - LogDebug("HGCHEbackSignalScalerAnalyzer") - << "rIN = " << layerRadiusMap_[ilayer][iradius] << " rIN+1 = " << layerRadiusMap_[ilayer][iradius + 1] - << " inradius = " << inradius << " type = " << scId.type() << " ilayer = " << scId.layer(); - - doseMap->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), dose); - fluenceMap->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), fluence); - scaleByDoseMap->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), scaleFactorByDose); - scaleByTileAreaMap->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), scaleFactorByTileArea); - scaleByDoseAreaMap->Fill( - zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), scaleFactorByDose * scaleFactorByTileArea); - noiseByFluenceMap->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), noiseByFluence); - probNoiseAboveHalfMip->Fill(zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), prob); - - signalToNoiseFlatAreaMap->Fill(zpos, - scaleByDoseMap->GetYaxis()->GetBinCenter(bin), - 100 * scaleFactorByTileArea * scaleFactorBySipmArea / expNoise); - signalToNoiseDoseMap->Fill( - zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), nPEperMIP_ * scaleFactorByDose / noiseByFluence); - signalToNoiseAreaMap->Fill( - zpos, scaleByDoseMap->GetYaxis()->GetBinCenter(bin), nPEperMIP_ * scaleFactorByTileArea / noiseByFluence); - signalToNoiseDoseAreaMap->Fill(zpos, - scaleByDoseMap->GetYaxis()->GetBinCenter(bin), - nPEperMIP_ * scaleFactorByTileArea * scaleFactorByDose / noiseByFluence); - signalToNoiseDoseAreaSipmMap->Fill( - zpos, - scaleByDoseMap->GetYaxis()->GetBinCenter(bin), - nPEperMIP_ * scaleFactorByTileArea * scaleFactorByDose * scaleFactorBySipmArea / expNoise); - saturationMap->Fill( - zpos, - scaleByDoseMap->GetYaxis()->GetBinCenter(bin), - nPEperMIP_ * scaleFactorByTileArea * scaleFactorByDose * scaleFactorBySipmArea + std::pow(expNoise, 2)); - - ++bin; + + float lysf = scaleFactorByTileArea * scaleFactorBySipmArea * scaleFactorByDose; + float s=nPEperMIP_ * lysf; + float n=noiseByFluence*sqrt(scaleFactorBySipmArea); + float sn=s/n; + + histos_["count_ieta"]->Fill(layer, ieta, 1); + //histos_["count_iphi"]->Fill(layer, iphi, 1); + histos_["radius_ieta"]->Fill(layer, ieta, radius); + //histos_["radius_iphi"]->Fill(layer, iphi, radius); + histos_["dose_ieta"]->Fill(layer, ieta, dose); + //histos_["dose_iphi"]->Fill(layer, iphi, dose); + histos_["fluence_ieta"]->Fill(layer, ieta, fluence); + //histos_["fluence_iphi"]->Fill(layer, iphi, fluence); + histos_["s_ieta"]->Fill(layer, ieta, s); + //histos_["s_iphi"]->Fill(layer, iphi, s); + histos_["n_ieta"]->Fill(layer, ieta, n); + //histos_["n_iphi"]->Fill(layer, iphi, n); + histos_["sn_ieta"]->Fill(layer, ieta, sn); + //histos_["sn_iphi"]->Fill(layer, iphi, sn); + histos_["lysf_ieta"]->Fill(layer, ieta, lysf); + //histos_["lysf_iphi"]->Fill(layer, iphi, lysf); + + if (layerHistos_.count(layer) == 0) { + continue; } - //fill per layer plots - //float rpos = sqrt(global.x()*global.x() + global.y()*global.y()); - int rocbin = probNoiseAboveHalfMip_layerMap[ilayer]->FindBin(radius * 10); - double scaleValue = prob / nWedges_ / hgcrocNcellsMap_[ilayer][rocbin - 1]; - probNoiseAboveHalfMip_layerMap[ilayer]->Fill(radius * 10, scaleValue); + //per layer + layerHistos_[layer]["count_ieta"]->Fill(ieta, 1); + //layerHistos_[layer]["count_iphi"]->Fill(iphi, 1); + layerHistos_[layer]["radius_ieta"]->Fill(ieta, radius); + //layerHistos_[layer]["radius_iphi"]->Fill(iphi, radius); + layerHistos_[layer]["dose_ieta"]->Fill(ieta, dose); + //layerHistos_[layer]["dose_iphi"]->Fill(iphi, dose); + layerHistos_[layer]["fluence_ieta"]->Fill(ieta, fluence); + //layerHistos_[layer]["fluence_iphi"]->Fill(iphi, fluence); + layerHistos_[layer]["s_ieta"]->Fill(ieta, s); + //layerHistos_[layer]["s_iphi"]->Fill(iphi, s); + layerHistos_[layer]["n_ieta"]->Fill(ieta, n); + //layerHistos_[layer]["n_iphi"]->Fill(iphi, n); + layerHistos_[layer]["sn_ieta"]->Fill(ieta, sn); + //layerHistos_[layer]["sn_iphi"]->Fill(iphi, sn); + layerHistos_[layer]["lysf_ieta"]->Fill(ieta, lysf); + //layerHistos_[layer]["lysf_iphi"]->Fill(iphi, lysf); } - //print boundaries for S/N < 5 --> define where sipms get more area - std::cout << std::endl; - std::cout << "S/N > 5 boundaries" << std::endl; - std::cout << std::setw(5) << "layer" << std::setw(15) << "boundary" << std::endl; - for (int xx = 1; xx < signalToNoiseDoseAreaMap->GetNbinsX() + 1; ++xx) { - bool print = true; - float SoN = 0; - for (int yy = 1; yy < signalToNoiseDoseAreaMap->GetNbinsY() + 1; ++yy) { - SoN = signalToNoiseDoseAreaMap->GetBinContent(xx, yy); - if (SoN > 5 && print == true) { - std::cout << std::setprecision(5) << std::setw(5) << xx + 8 << std::setw(15) - << signalToNoiseDoseAreaMap->GetYaxis()->GetBinLowEdge(yy) << std::endl; - print = false; - } + + //for all (except count histograms) normalize by the number of sensors + for(auto &lit : layerHistos_) { + for(auto &hit : lit.second) { + TString name(hit.first); + if(name.Contains("count_")) continue; + TString count_name(name.Contains("_ieta") ? "count_ieta" : "count_iphi"); + hit.second->Divide(lit.second[count_name]); } } + + for(auto &hit : histos_) { + TString name(hit.first); + if(name.Contains("count_")) continue; + TString count_name(name.Contains("_ieta") ? "count_ieta" : "count_iphi"); + hit.second->Divide(histos_[count_name]); + } + } +// void HGCHEbackSignalScalerAnalyzer::createBinning(const std::vector& detIdVec) { - for (std::vector::const_iterator myId = detIdVec.begin(); myId != detIdVec.end(); ++myId) { - HGCScintillatorDetId scId(myId->rawId()); - + //loop over detids to find possible values + for (auto myId : detIdVec) { + HGCScintillatorDetId scId(myId.rawId()); int layer = std::abs(scId.layer()); - int radius = scId.iradiusAbs(); - GlobalPoint global = gHGCal_->getPosition(scId); - - //z-binning - layerMap_[layer] = std::abs(global.z()); - - //r-binning - layerRadiusMap_[layer][radius] = (hgcCons_->cellSizeTrap(scId.type(), radius)).first; //internal radius - } - //guess the last bins Z - auto last = std::prev(layerMap_.end(), 1); - auto lastbo = std::prev(layerMap_.end(), 2); - layerMap_[last->first + 1] = last->second + (last->second - lastbo->second); - - //get external rad for the last bins r - firstLayer_ = layerRadiusMap_.begin()->first; - lastLayer_ = layerRadiusMap_.rbegin()->first; - for (int lay = firstLayer_; lay <= lastLayer_; ++lay) { - auto lastr = std::prev((layerRadiusMap_[lay]).end(), 1); - layerRadiusMap_[lay][lastr->first + 1] = - (hgcCons_->cellSizeTrap(hgcCons_->getTypeTrap(lay), lastr->first)).second; //external radius - } - - //implement by hand the approximate hgcroc boundaries - std::vector arr9 = {1537.0, 1790.7, 1997.1}; - hgcrocMap_[9] = arr9; - std::vector arr10 = {1537.0, 1790.7, 2086.2}; - hgcrocMap_[10] = arr10; - std::vector arr11 = {1537.0, 1790.7, 2132.2}; - hgcrocMap_[11] = arr11; - std::vector arr12 = {1537.0, 1790.7, 2179.2}; - hgcrocMap_[12] = arr12; - std::vector arr13 = {1378.2, 1503.9, 1790.7, 2132.2, 2326.6}; - hgcrocMap_[13] = arr13; - std::vector arr14 = {1378.2, 1503.9, 1790.7, 2132.2, 2430.4}; - hgcrocMap_[14] = arr14; - std::vector arr15 = {1183.0, 1503.9, 1790.7, 2132.2, 2538.8}; - hgcrocMap_[15] = arr15; - std::vector arr16 = {1183.0, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[16] = arr16; - std::vector arr17 = {1183.0, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[17] = arr17; - std::vector arr18 = {1183.0, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[18] = arr18; - std::vector arr19 = {1037.8, 1157.5, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[19] = arr19; - std::vector arr20 = {1037.8, 1157.5, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[20] = arr20; - std::vector arr21 = {1037.8, 1157.5, 1503.9, 1790.7, 2132.2, 2594.8}; - hgcrocMap_[21] = arr21; - std::vector arr22 = {1037.8, 1157.5, 1503.9, 1790.7, 2132.2, 2484.0}; - hgcrocMap_[22] = arr22; - std::vector ncells9 = {64, 32}; - hgcrocNcellsMap_[9] = ncells9; - std::vector ncells10 = {64, 48}; - hgcrocNcellsMap_[10] = ncells10; - std::vector ncells11 = {64, 56}; - hgcrocNcellsMap_[11] = ncells11; - std::vector ncells12 = {64, 64}; - hgcrocNcellsMap_[12] = ncells12; - std::vector ncells13 = {40, 64, 64, 24}; - hgcrocNcellsMap_[13] = ncells13; - std::vector ncells14 = {40, 64, 64, 40}; - hgcrocNcellsMap_[14] = ncells14; - std::vector ncells15 = {88, 64, 64, 56}; - hgcrocNcellsMap_[15] = ncells15; - std::vector ncells16 = {88, 64, 64, 64}; - hgcrocNcellsMap_[16] = ncells16; - std::vector ncells17 = {88, 64, 64, 64}; - hgcrocNcellsMap_[17] = ncells17; - std::vector ncells18 = {88, 64, 64, 64}; - hgcrocNcellsMap_[18] = ncells18; - std::vector ncells19 = {40, 96, 64, 64, 64}; - hgcrocNcellsMap_[19] = ncells19; - std::vector ncells20 = {40, 96, 64, 64, 64}; - hgcrocNcellsMap_[20] = ncells20; - std::vector ncells21 = {40, 96, 64, 64, 64}; - hgcrocNcellsMap_[21] = ncells21; - std::vector ncells22 = {40, 96, 64, 64, 48}; - hgcrocNcellsMap_[22] = ncells22; -} + std::pair ietaphi = scId.ietaphi(); -void HGCHEbackSignalScalerAnalyzer::printBoundaries() { - std::cout << std::endl; - std::cout << "z boundaries" << std::endl; - std::cout << std::setw(5) << "layer" << std::setw(15) << "z-position" << std::endl; - for (auto elem : layerMap_) - std::cout << std::setprecision(5) << std::setw(5) << elem.first << std::setw(15) << elem.second << std::endl; - - std::cout << std::endl; - std::cout << "r boundaries" << std::endl; - std::cout << std::setw(5) << "layer" << std::setw(10) << "r-min" << std::setw(10) << "r-max" << std::endl; - for (auto elem : layerRadiusMap_) { - auto rMin = (elem.second).begin(); - auto rMax = (elem.second).rbegin(); - std::cout << std::setprecision(5) << std::setw(5) << elem.first << std::setw(10) << rMin->second << std::setw(10) - << rMax->second << std::endl; + allLayers_.insert(std::abs(layer)); + allIeta_.insert(std::abs(ietaphi.first)); + //allIphi_.insert(std::abs(ietaphi.second)); } } diff --git a/SimCalorimetry/HGCalSimAlgos/test/hgchebacksignalscaler_cfg.py b/SimCalorimetry/HGCalSimAlgos/test/hgchebacksignalscaler_cfg.py index ea68a73e345b2..c153ce021af1d 100644 --- a/SimCalorimetry/HGCalSimAlgos/test/hgchebacksignalscaler_cfg.py +++ b/SimCalorimetry/HGCalSimAlgos/test/hgchebacksignalscaler_cfg.py @@ -1,4 +1,4 @@ -#run with: cmsRun hgchebacksignalscaler_cfg.py doseMap=SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.5.15.9.txt sipmMap=SimCalorimetry/HGCalSimProducers/data/sipmParams_geom-10.txt nPEperMIP=21 +#run with: cmsRun hgchebacksignalscaler_cfg.py doseMap=SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt geometry=GeometryExtended2026D49Reco sipmMap=SimCalorimetry/HGCalSimProducers/data/sipmParams_geom-10.txt nPEperMIP=21 import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing @@ -8,12 +8,14 @@ options.register ("doseMap", "", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.register ("sipmMap", "", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.register ("nPEperMIP", "", VarParsing.multiplicity.singleton, VarParsing.varType.int) +options.register ("geometry", "GeometryExtended2026D49Reco", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.parseArguments() -process = cms.Process("demo",eras.Phase2C8) +from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 +process = cms.Process('demo',Phase2C11I13M9) process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff') +process.load('Configuration.Geometry.{}_cff'.format(options.geometry)) from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') @@ -27,7 +29,7 @@ ) process.TFileService = cms.Service("TFileService", - fileName = cms.string("scalingNumbers.root") + fileName = cms.string("dosemap_output_sipmontile.root") ) process.p = cms.Path(process.plotter) diff --git a/SimCalorimetry/HGCalSimAlgos/test/hgcsiNoiseMapTester_cfg.py b/SimCalorimetry/HGCalSimAlgos/test/hgcsiNoiseMapTester_cfg.py index d08579ac9428c..839603371106e 100644 --- a/SimCalorimetry/HGCalSimAlgos/test/hgcsiNoiseMapTester_cfg.py +++ b/SimCalorimetry/HGCalSimAlgos/test/hgcsiNoiseMapTester_cfg.py @@ -1,17 +1,19 @@ -#run with: cmsRun hgcsiNoiseMapTester_cfg.py doseMap=SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb.txt +#run with: cmsRun hgcsiNoiseMapTester_cfg.py doseMap=SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt geometry=GeometryExtended2026D49Reco import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing from Configuration.StandardSequences.Eras import eras options = VarParsing() -options.register ("doseMap", "", VarParsing.multiplicity.singleton, VarParsing.varType.string) +options.register ("doseMap", "SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt", VarParsing.multiplicity.singleton, VarParsing.varType.string) +options.register ("geometry", "GeometryExtended2026D49Reco", VarParsing.multiplicity.singleton, VarParsing.varType.string) options.parseArguments() -process = cms.Process("demo",eras.Phase2C8) +from Configuration.Eras.Era_Phase2C11I13M9_cff import Phase2C11I13M9 +process = cms.Process('demo',Phase2C11I13M9) process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.Geometry.{}_cff'.format(options.geometry)) from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') diff --git a/SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-6.2.0.1.txt b/SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-6.2.0.1.txt new file mode 100644 index 0000000000000..81dcfb431c71e --- /dev/null +++ b/SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-6.2.0.1.txt @@ -0,0 +1,61 @@ +8 1 0.0 0.0 0.0 0.0 0.0 0.0 15.631098528000662 -0.010008339414303125 -0.00024641468456211937 3.905415981117501e-06 -1.8033013608090354e-08 40.0 +8 2 0.0 0.0 0.0 0.0 0.0 0.0 15.675057141569031 -0.009268558914256387 -0.00027297070016436267 4.247541935965215e-06 -1.9623493509234605e-08 40.0 +8 3 0.0 0.0 0.0 0.0 0.0 0.0 15.724855288307396 -0.008706278681487876 -0.00030064882798616296 4.659089635677368e-06 -2.168972873927851e-08 40.0 +8 4 0.0 0.0 0.0 0.0 0.0 0.0 15.746132079593549 -0.00823450376956708 -0.00031536469399816297 4.828527689732458e-06 -2.2412374715699826e-08 40.0 +8 5 0.0 0.0 0.0 0.0 0.0 0.0 15.773893946364305 -0.008022705846900673 -0.0003254447620986822 4.9753834423606096e-06 -2.3183719438604202e-08 40.0 +8 6 0.0 0.0 0.0 0.0 0.0 0.0 15.786428714750585 -0.007880966764795926 -0.0003248977938148429 4.914516581560736e-06 -2.278536843773692e-08 40.0 +8 7 0.0 0.0 0.0 0.0 0.0 0.0 15.800826272536955 -0.007626328306127596 -0.00033146243251606775 4.970509786209677e-06 -2.2979359794594102e-08 40.0 +8 8 0.0 0.0 0.0 0.0 0.0 0.0 15.808761807811324 -0.007466906850134121 -0.0003344149752704433 4.978255221823955e-06 -2.2925096845530717e-08 40.0 +8 9 0.0 0.0 0.0 0.0 0.0 0.0 15.817122086934656 -0.0073663407129099445 -0.0003357927366292898 4.974420724574202e-06 -2.2875100075370454e-08 40.0 +8 10 0.0 0.0 0.0 0.0 0.0 0.0 15.822789354438058 -0.007319878574246009 -0.0003353328290618891 4.940409219309537e-06 -2.2630285713661296e-08 40.0 +8 11 0.0 0.0 0.0 0.0 0.0 0.0 15.82765417484668 -0.007328009250750926 -0.00033415400482140654 4.913736566013334e-06 -2.249294516898887e-08 40.0 +8 12 0.0 0.0 0.0 0.0 0.0 0.0 15.832332576801695 -0.007376195484693282 -0.00033095912026935434 4.850329391805314e-06 -2.2146416675302786e-08 40.0 +8 13 0.0 0.0 0.0 0.0 0.0 0.0 15.834139881087587 -0.007366791656125323 -0.00032962194610346743 4.806391628848308e-06 -2.1866507215886416e-08 40.0 +8 14 0.0 0.0 0.0 0.0 0.0 0.0 15.837595763132125 -0.007401855859692145 -0.00032627151625641803 4.729149047988929e-06 -2.14113259678477e-08 40.0 +8 15 0.0 0.0 0.0 0.0 0.0 0.0 15.83843805824799 -0.0074382904340713225 -0.00032495791795583375 4.708138255186084e-06 -2.130366529067705e-08 40.0 +8 16 0.0 0.0 0.0 0.0 0.0 0.0 15.841933996828084 -0.007406195622257779 -0.00032638278274147256 4.7103069963084725e-06 -2.122813675188859e-08 40.0 +8 17 0.0 0.0 0.0 0.0 0.0 0.0 15.843584393658588 -0.007481484666374619 -0.00032056656729166015 4.580767148961683e-06 -2.0456722101862333e-08 40.0 +8 18 0.0 0.0 0.0 0.0 0.0 0.0 15.849636748975485 -0.007496122760086707 -0.00032061629687501526 4.568297982405512e-06 -2.032378467091438e-08 40.0 +8 19 0.0 0.0 0.0 0.0 0.0 0.0 15.847114704756457 -0.007589044236189014 -0.00031882015878122166 4.540000944757966e-06 -2.0167067180907255e-08 40.0 +8 20 0.0 0.0 0.0 0.0 0.0 0.0 15.84409154161506 -0.007575382745413764 -0.00031644788038631363 4.476878873260806e-06 -1.9767030832495758e-08 40.0 +8 21 0.0 0.0 0.0 0.0 0.0 0.0 15.837997880463922 -0.007762061870235067 -0.00030951847255501796 4.364999908961735e-06 -1.9190181133515438e-08 40.0 +8 22 0.0 0.0 0.0 0.0 0.0 0.0 15.837574444488716 -0.007923512419090731 -0.00030245134447915003 4.250265516631477e-06 -1.861020597872229e-08 40.0 +8 23 0.0 0.0 0.0 0.0 0.0 0.0 15.825932807193873 -0.008121435113572524 -0.0002940328367186151 4.116590444142258e-06 -1.7954852059629055e-08 40.0 +8 24 0.0 0.0 0.0 0.0 0.0 0.0 15.823386316221507 -0.008192417555546748 -0.0002898230006013799 4.0423866650280095e-06 -1.7567891956107687e-08 40.0 +8 25 0.0 0.0 0.0 0.0 0.0 0.0 15.805413978387529 -0.008119764931564718 -0.00029125608360824353 4.049631759788942e-06 -1.7578536821925454e-08 40.0 +8 26 0.0 0.0 0.0 0.0 0.0 0.0 15.79176969694651 -0.008141729254185453 -0.0002840343322609301 3.9073352848147715e-06 -1.6840110463080158e-08 40.0 +9 1 0.0 0.0 0.0 0.0 0.0 0.0 14.853364358365877 -0.014734962076135474 4.320179169922532e-05 -1.0769942436777783e-07 -1.1962559753179334e-08 100.0 +9 2 0.0 0.0 0.0 0.0 0.0 0.0 14.79394043216817 -0.014921939752969333 4.256217282287193e-05 -7.064105555408368e-08 -1.0434194832002367e-08 100.0 +9 3 0.0 0.0 0.0 0.0 0.0 0.0 14.732385011243958 -0.015151186845928807 4.193420492901784e-05 -2.000754384386892e-08 -9.046379416076473e-09 100.0 +9 4 0.0 0.0 0.0 0.0 0.0 0.0 14.670149822148352 -0.015389025821014523 4.0910554706006246e-05 3.032849335394541e-08 -7.306710643666587e-09 100.0 +9 5 0.0 0.0 0.0 0.0 0.0 0.0 14.60658995428338 -0.015693853212658534 3.7619686165931596e-05 8.997746665434103e-08 -4.950976071280129e-09 100.0 +9 6 0.0 0.0 0.0 0.0 0.0 0.0 14.543300123081348 -0.016044268131709064 2.979584907952961e-05 1.6175685018951692e-07 -1.880872928954945e-09 100.0 +9 7 0.0 0.0 0.0 0.0 0.0 0.0 14.481555739660287 -0.016384436190168085 2.2678467128465062e-05 2.1735559632004787e-07 2.567553370303283e-11 100.0 +9 8 0.0 0.0 0.0 0.0 0.0 0.0 14.41262313974562 -0.016142946239907804 4.4252458230571905e-05 2.3789326298864488e-08 -7.293530662759967e-09 100.0 +9 9 0.0 0.0 0.0 0.0 0.0 0.0 14.34683833142246 -0.016326180434096216 4.5316507209147855e-05 -1.6210729585297733e-08 -7.558263575251512e-09 100.0 +9 10 0.0 0.0 0.0 0.0 0.0 0.0 14.28547566866201 -0.016511537202336522 4.430542142833498e-05 -5.225919120782197e-08 -6.768373979247886e-09 100.0 +9 11 0.0 0.0 0.0 0.0 0.0 0.0 14.228593798868422 -0.016837100571178123 4.302044754080841e-05 -3.520420605276961e-08 -6.323531887518846e-09 100.0 +9 12 0.0 0.0 0.0 0.0 0.0 0.0 14.14876203454718 -0.017281353326217445 4.690922530744127e-05 -1.0642829738955181e-07 -9.837606446629636e-09 100.0 +9 13 0.0 0.0 0.0 0.0 0.0 0.0 14.0676025340467 -0.01792129430337632 3.975487102415777e-05 -2.795361679059809e-07 -7.658009696592656e-09 100.0 +9 14 0.0 0.0 0.0 0.0 0.0 0.0 13.992104060371227 -0.01884491591996276 1.58285014637303e-05 -1.107027568472236e-06 -1.2721003822508704e-08 100.0 +9 15 0.0 0.0 0.0 0.0 0.0 0.0 13.917635862647696 -0.019731076944948793 2.729319982647398e-05 -9.758997911964988e-07 -1.2244015171312015e-08 100.0 +9 16 0.0 0.0 0.0 0.0 0.0 0.0 13.848968103789076 -0.02057965755042568 3.818136318091585e-05 -1.1948101885506693e-06 -1.8988445415069276e-08 100.0 +9 17 0.0 0.0 0.0 0.0 0.0 0.0 13.784370278867732 -0.022171973821216807 2.1250009559893555e-05 -1.290679795261199e-06 -1.9163620808873716e-08 100.0 +9 18 0.0 0.0 0.0 0.0 0.0 0.0 13.729439254163921 -0.023252803228984435 2.443497703787624e-05 -1.1641909129418052e-06 -2.0849334720609228e-08 100.0 +9 19 0.0 0.0 0.0 0.0 0.0 0.0 13.681952430884362 -0.024837547127234426 -4.258163194932722e-05 -2.8806465217900023e-06 -3.65321008965802e-08 100.0 +9 20 0.0 0.0 0.0 0.0 0.0 0.0 13.644497050742046 -0.025183239972832994 -0.00010678406830837003 -5.593090006849659e-06 -6.631440089833924e-08 100.0 +9 21 0.0 0.0 0.0 0.0 0.0 0.0 13.624442958597067 -0.022892241627869184 -5.611448868394064e-05 -4.650232311995746e-06 -5.320415267479581e-08 100.0 +10 8 -53.669361548764854 3.1801651302477105 -0.06532923999981319 0.0005830201735903009 -1.9071121477484352e-06 100.0 7.737325491901405 0.38433490213057747 -0.008791724045278096 8.373597855076441e-05 -2.872984846373797e-07 100.0 +10 9 -12.375720143380397 0.9073548560212117 -0.019260264429883274 0.000174146966113252 -5.671825629142338e-07 100.0 11.73379441810294 0.15928256491482357 -0.004182483763417339 4.207212588389706e-05 -1.4688336017924285e-07 100.0 +10 10 4.670336988994015 0.00370595772909489 -0.0017197993635048388 2.5311046856950983e-05 -1.0201343339210166e-07 100.0 14.298295735610065 0.01717216949301019 -0.0013539086282460778 1.7350167651703716e-05 -6.674821391050204e-08 100.0 +10 11 10.248269539536896 -0.2797624625051756 0.0036381915330437695 -1.8997380328839177e-05 3.2283177606120206e-08 100.0 15.076964077755848 -0.029390111452098567 -0.00039655902968801815 8.669282926929734e-06 -3.765139235263748e-08 100.0 +10 12 2.6293037280225615 0.042647979205222564 -0.0013957564446439128 1.4647730565889533e-05 -4.9254009991010395e-08 100.0 13.819892384665662 0.016897058507895 -0.0010154924440760106 1.1697198255207303e-05 -4.090366203132179e-08 100.0 +10 13 4.281745542179817 -0.04946537718217123 0.0003373105047449364 4.4981299719097146e-07 -7.168354804702223e-09 100.0 14.19069987372294 -0.01712413302409312 -0.00023268993376994243 4.412291237383767e-06 -1.7281941836162924e-08 100.0 +10 14 3.4283851716987317 -0.018045068061695157 -0.00013167575456908686 3.1387427055234163e-06 -1.2166612176974165e-08 100.0 13.88277628635511 -0.010479320833569372 -0.0002848761378867125 4.226663551519504e-06 -1.511319854385025e-08 100.0 +10 15 3.2411312625424564 -0.00036389942559811317 -0.0005299544237895165 6.466883337448789e-06 -2.165479627690859e-08 100.0 13.800351465059896 -0.011761595569742675 -0.00025488028612079614 3.89187789150976e-06 -1.389043040211256e-08 100.0 +10 16 3.0978384973311046 -0.0001581289430332422 -0.0005284824566441654 6.330655350971965e-06 -2.093625083346801e-08 100.0 13.738740719013506 -0.013838501147309305 -0.0002048369436010674 3.367627475327243e-06 -1.2107723986669741e-08 100.0 +10 17 2.9627004080463304 -0.0014420560670242658 -0.000464519673256497 5.370660925180373e-06 -1.6964615022580925e-08 100.0 13.637400107339397 -0.013316873274117442 -0.00020441329784350867 3.208299408534212e-06 -1.1259057200591821e-08 100.0 +10 18 3.0057059277842164 -0.016096087506032888 -0.00010622495353304552 1.9793498849566627e-06 -6.361587617224516e-09 100.0 13.691132842904176 -0.02317460599987545 1.729668543155395e-05 1.1929260749570155e-06 -5.091182597082146e-09 100.0 +10 19 2.9389983062019245 -0.016132447600897947 -0.00011111840593993676 1.9000733114347362e-06 -5.702010730531271e-09 100.0 13.648635837849087 -0.025170304910184946 9.032320909553313e-05 3.092923305974041e-07 -1.958388054171414e-09 100.0 +10 20 3.071444954833229 -0.019195007925497058 -9.584942998348883e-06 6.878645349638378e-07 -1.313082987347117e-09 100.0 13.62426471597608 -0.026147984384636065 0.0001521712399610157 -5.229844226605055e-07 1.081404704563181e-09 100.0 +10 21 2.9835492013028113 -0.021928279953076585 0.00013113336631012155 -8.675632204941052e-07 3.7109439542699378e-09 100.0 13.604237407010787 -0.0241210587976705 0.00016865555554796376 -9.311687617193678e-07 2.5312753188715062e-09 100.0 From 276099b92e67e501489c311d3497365214ccb602 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Mon, 6 Sep 2021 22:47:58 +0800 Subject: [PATCH 423/923] remove unused headers for RECO/SIM --- .../EgammaTools/interface/ConversionTools.h | 1 - .../EgammaTools/interface/EffectiveAreas.h | 1 - RecoHI/HiJetAlgos/interface/UECalibration.h | 162 - RecoJets/JetAnalyzers/doc/myJetAna.html | 90 - .../interface/CaloTowerBoundries.h | 139 - RecoJets/JetAnalyzers/interface/MyCluster.h | 68 - RecoJets/JetAnalyzers/interface/myFilter.h | 64 - RecoJets/JetAnalyzers/interface/myJetAna.h | 487 --- RecoJets/JetAnalyzers/test/myFilter.cc | 1024 ------ RecoJets/JetAnalyzers/test/myJetAna.cc | 2736 ----------------- .../EcalUncalibRecHitLeadingEdgeAlgo.h | 71 - .../interface/MuonSeedDetLayer.h | 72 - .../interface/EtaPhiMeasurementEstimator.h | 1 - .../interface/rangesIntersect.h | 25 - .../interface/GsfTrackProducerAlgorithm.h | 71 - .../interface/GSTransientTrackingRecHit.h | 8 - .../interface/ReconstructorFromLinPtFinder.h | 26 - .../interface/CombinedKinematicConstraintT.h | 218 -- .../MonteCarloLinearizationPointFinder.h | 33 - .../src/MonteCarloLinearizationPointFinder.cc | 28 - .../CaloSimAlgos/interface/CaloVNoisifier.h | 19 - .../interface/RPCDigiSimLinkfwd.h | 4 - .../interface/PixelDigiSimLinkfwd.h | 4 - .../interface/StripCompactDigiSimLinksfwd.h | 4 - .../interface/StripDigiSimLinkfwd.h | 4 - SimG4CMS/Calo/interface/HcalTestHistoClass.h | 1 - .../Application/interface/DDDWorldObserver.h | 21 - .../Notification/interface/ComponentBuilder.h | 14 - .../interface/ComponentFactoryByName.h | 42 - .../interface/DispatchableG4Step.h | 8 - SimG4Core/Notification/interface/OwnIt.h | 23 - 31 files changed, 5469 deletions(-) delete mode 100644 RecoEgamma/EgammaTools/interface/ConversionTools.h delete mode 100644 RecoEgamma/EgammaTools/interface/EffectiveAreas.h delete mode 100644 RecoHI/HiJetAlgos/interface/UECalibration.h delete mode 100644 RecoJets/JetAnalyzers/doc/myJetAna.html delete mode 100644 RecoJets/JetAnalyzers/interface/CaloTowerBoundries.h delete mode 100644 RecoJets/JetAnalyzers/interface/MyCluster.h delete mode 100644 RecoJets/JetAnalyzers/interface/myFilter.h delete mode 100755 RecoJets/JetAnalyzers/interface/myJetAna.h delete mode 100644 RecoJets/JetAnalyzers/test/myFilter.cc delete mode 100644 RecoJets/JetAnalyzers/test/myJetAna.cc delete mode 100644 RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h delete mode 100644 RecoMuon/TrackingTools/interface/MuonSeedDetLayer.h delete mode 100755 RecoTracker/SpecialSeedGenerators/interface/EtaPhiMeasurementEstimator.h delete mode 100644 RecoTracker/TkMSParametrization/interface/rangesIntersect.h delete mode 100644 RecoTracker/TrackProducer/interface/GsfTrackProducerAlgorithm.h delete mode 100644 RecoTracker/TransientTrackingRecHit/interface/GSTransientTrackingRecHit.h delete mode 100644 RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromLinPtFinder.h delete mode 100644 RecoVertex/KinematicFit/interface/CombinedKinematicConstraintT.h delete mode 100644 RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h delete mode 100644 RecoVertex/LinearizationPointFinders/src/MonteCarloLinearizationPointFinder.cc delete mode 100644 SimCalorimetry/CaloSimAlgos/interface/CaloVNoisifier.h delete mode 100644 SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLinkfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinksfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkfwd.h delete mode 100644 SimG4CMS/Calo/interface/HcalTestHistoClass.h delete mode 100644 SimG4Core/Application/interface/DDDWorldObserver.h delete mode 100644 SimG4Core/Notification/interface/ComponentBuilder.h delete mode 100644 SimG4Core/Notification/interface/ComponentFactoryByName.h delete mode 100644 SimG4Core/Notification/interface/DispatchableG4Step.h delete mode 100644 SimG4Core/Notification/interface/OwnIt.h diff --git a/RecoEgamma/EgammaTools/interface/ConversionTools.h b/RecoEgamma/EgammaTools/interface/ConversionTools.h deleted file mode 100644 index 49907adb05a8d..0000000000000 --- a/RecoEgamma/EgammaTools/interface/ConversionTools.h +++ /dev/null @@ -1 +0,0 @@ -#warning "Obsolete header, include CommonTools/Egamma/interface/ConversionTools.h instead" diff --git a/RecoEgamma/EgammaTools/interface/EffectiveAreas.h b/RecoEgamma/EgammaTools/interface/EffectiveAreas.h deleted file mode 100644 index ee1f9cfd46e6a..0000000000000 --- a/RecoEgamma/EgammaTools/interface/EffectiveAreas.h +++ /dev/null @@ -1 +0,0 @@ -#warning "Obsolete header, include CommonTools/Egamma/interface/EffectiveAreas.h instead" diff --git a/RecoHI/HiJetAlgos/interface/UECalibration.h b/RecoHI/HiJetAlgos/interface/UECalibration.h deleted file mode 100644 index 4221dec146ddc..0000000000000 --- a/RecoHI/HiJetAlgos/interface/UECalibration.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef __HiJetAlgos_UECalibration_h__ -#define __HiJetAlgos_UECalibration_h__ - -///////////////////////////////////////////////////////////////////// -// SVD Block Predictor -#include -#include -#include -#include - -#include "FWCore/ParameterSet/interface/FileInPath.h" - -struct UECalibration { - UECalibration(const std::vector &v) - { - np[0] = 3; // Number of reduced PF ID (track, ECAL, HCAL) - np[1] = 15; // Number of pseudorapidity block - np[2] = 5; // Fourier series order - np[3] = 2; // Re or Im - np[4] = 82; // Number of feature parameter - - ni0[0] = np[1]; - ni0[1] = 344; - - ni1[0] = np[1]; - ni1[1] = 344; - - ni2[0] = np[1]; - ni2[1] = 82; - - unsigned int Nnp_full = np[0] * np[1] * np[2] * np[3] * np[4]; - unsigned int Nnp = np[0] * np[1] * (1 + (np[2] - 1) * np[3]) * np[4]; - unsigned int Nni0 = ni0[0]*ni0[1]; - unsigned int Nni1 = ni1[0]*ni1[1]; - unsigned int Nni2 = ni2[0]*ni2[1]; - - memset(ue_predictor_pf, 0, Nnp_full * sizeof(float)); - memset(ue_interpolation_pf0, 0, Nni0 * sizeof(float)); - memset(ue_interpolation_pf1, 0, Nni1 * sizeof(float)); - memset(ue_interpolation_pf2, 0, Nni2 * sizeof(float)); - - for (index = 0; index < Nnp + Nni0 + Nni1 + Nni2; index++) { - float val = v[index]; - int bin0, bin1, bin2, bin3, bin4; - - if (index < Nnp){ - bin4 = index % np[4]; - - unsigned int u = (index / np[4]) % (1 + (np[2] - 1) * np[3]); - - if (u == 0) { - bin2 = 0; - bin3 = 0; - } - else { - bin2 = (u - 1) / np[3] + 1; - bin3 = (u - 1) % np[3]; - } - - bin1 = ((index / np[4]) / (1 + (np[2] - 1) * np[3])) % np[1]; - bin0 = ((index / np[4]) / (1 + (np[2] - 1) * np[3])) / np[1]; - - ue_predictor_pf[bin0][bin1][bin2][bin3][bin4] = val; - } - else if (index < Nnp + Nni0) { - bin1 = (index - Nnp) % ni0[1]; - bin0 = (index - Nnp) / ni0[1]; - ue_interpolation_pf0[bin0][bin1] = val; - } - else if (index < Nnp + Nni0 + Nni1) { - bin1 = (index - Nnp - Nni0) % ni1[1]; - bin0 = (index - Nnp - Nni0) / ni1[1]; - ue_interpolation_pf1[bin0][bin1] = val; - } - else { - bin1 = (index - Nnp - Nni0 - Nni1) % ni2[1]; - bin0 = (index - Nnp - Nni0 - Nni1) / ni2[1]; - ue_interpolation_pf2[bin0][bin1] = val; - } - } - } - - UECalibration(std::string calibrationFile){ - np[0] = 3; // Number of reduced PF ID (track, ECAL, HCAL) - np[1] = 15; // Number of pseudorapidity block - np[2] = 5; // Fourier series order - np[3] = 2; // Re or Im - np[4] = 82; // Number of feature parameter - - ni0[0] = np[1]; - ni0[1] = 344; - - ni1[0] = np[1]; - ni1[1] = 344; - - ni2[0] = np[1]; - ni2[1] = 82; - - index = 0; - - unsigned int Nnp_full = np[0] * np[1] * np[2] * np[3] * np[4]; - unsigned int Nnp = np[0] * np[1] * (1 + (np[2] - 1) * np[3]) * np[4]; - unsigned int Nni0 = ni0[0]*ni0[1]; - unsigned int Nni1 = ni1[0]*ni1[1]; - unsigned int Nni2 = ni2[0]*ni2[1]; - - memset(ue_predictor_pf, 0, Nnp_full * sizeof(float)); - memset(ue_interpolation_pf0, 0, Nni0 * sizeof(float)); - memset(ue_interpolation_pf1, 0, Nni1 * sizeof(float)); - memset(ue_interpolation_pf2, 0, Nni2 * sizeof(float)); - - edm::FileInPath ueData(calibrationFile.data()); - std::string qpDataName = ueData.fullPath(); - std::ifstream in( qpDataName.c_str() ); - std::string line; - - while( std::getline( in, line)){ - if(!line.size() || line[0]=='#') { - continue; - } - std::istringstream linestream(line); - float val; - int bin0, bin1, bin2, bin3, bin4; - if(index < Nnp){ - // cout<<"predictor "<>bin0>>bin1>>bin2>>bin3>>bin4>>val; - ue_predictor_pf[bin0][bin1][bin2][bin3][bin4] = val; - }else if(index < Nnp + Nni0){ - // cout<<"inter_0 "<>bin0>>bin1>>val; - ue_interpolation_pf0[bin0][bin1] = val; - }else if(index < Nnp + Nni0 + Nni1){ - // cout<<"inter_1 "<>bin0>>bin1>>val; - ue_interpolation_pf1[bin0][bin1] = val; - }else if(index < Nnp + Nni0 + Nni1 + Nni2){ - // cout<<"inter_2 "<>bin0>>bin1>>val; - ue_interpolation_pf2[bin0][bin1] = val; - } - ++index; - } - } - - unsigned int index, - np[5], - ni0[2], - ni1[2], - ni2[2]; - - float ue_predictor_pf[3][15][5][2][82], - ue_interpolation_pf0[15][344], - ue_interpolation_pf1[15][344], - ue_interpolation_pf2[15][82]; - -}; - - -#endif - - - diff --git a/RecoJets/JetAnalyzers/doc/myJetAna.html b/RecoJets/JetAnalyzers/doc/myJetAna.html deleted file mode 100644 index 3fbc3e17294f7..0000000000000 --- a/RecoJets/JetAnalyzers/doc/myJetAna.html +++ /dev/null @@ -1,90 +0,0 @@ -

myJetAna

- -
-

Compile and Run

- -

- -

Checkout -

-  scramv1 project CMSSW CMSSW_2_1_10
-  cd CMSSW_2_1_10/src 
-  eval `scramv1 runtime -csh` 
-  cvs co RecoJets/JetAnalyzers
-
- -

Compile -

-  scramv1 b 
-
- -

Run -

-  cmsRun RecoJets/JetAnalyzers/test/cruzet4.py
-
- -

You will get a bunch of errors about missing files... but eventually you should get -printout which looks like: - -

-  Begin processing the 108006th record. Run 57381, Event 63185, LumiSection 4 at 14-Sep-2008 14:12:04 CDT
-  >>> processing event # run: 57381 event: 63185 time 5235845788462952912
-  Begin processing the 108007th record. Run 57381, Event 63186, LumiSection 4 at 14-Sep-2008 14:12:04 CDT
-  >>> processing event # run: 57381 event: 63186 time 5235845788462948185
-  Begin processing the 108008th record. Run 57381, Event 63187, LumiSection 4 at 14-Sep-2008 14:12:04 CDT
-  >>> processing event # run: 57381 event: 63187 time 5235845792757001089
-  Begin processing the 108009th record. Run 57381, Event 63188, LumiSection 4 at 14-Sep-2008 14:12:04 CDT
-
- -

You can stop the event processing by hitting Ctrl-c. The job should end and the output -files should be written. - -


-

Event Analysis

-

The example will run over the cruzet4 reconstructed files -and write out histograms to the file myhisto.root. - -

The code to analize events is located in: -

-  RecoJets/JetAnalyzers/src/myJetAna.cc
-  RecoJets/JetAnalyzers/interface/myJetAna.h
-
- -
-

Event Filter

- -The events passing the filter will be written to the file -FilteredEvents.root. - -

The code to filter events is located in: -

-  RecoJets/JetAnalyzers/src/myFilter.cc
-  RecoJets/JetAnalyzers/interface/myFilter.h
-
- -

The filter loops over the jets and selects events passing a minimum -jet pt requirement or events with jets that have some EM energy: -

-  for ( CaloJetCollection::const_iterator ijet=jets->begin(); ijet!=jets->end(); ijet++) {
-    if (ijet->pt() > 100.)                filter_Pt  = true;
-    if (ijet->emEnergyFraction() > 0.05)  filter_EMF = true;
-  }
-
- - - -
-

Scanning Events

- -

To view events you can use fireworks/cmsShow. This is a standalone -event display which works reasonably well. -

-  wget http://cern.ch/cms-sdt/fireworks/cmsShow21.tar.gz
-  tar xzf cmsShow21.tar.gz
-  cmsShow FilteredEvents.root
-
- -

If this does not work, refer to the instructions which can be found at: -WorkBookFireworks - - diff --git a/RecoJets/JetAnalyzers/interface/CaloTowerBoundries.h b/RecoJets/JetAnalyzers/interface/CaloTowerBoundries.h deleted file mode 100644 index 7790a185aaa0a..0000000000000 --- a/RecoJets/JetAnalyzers/interface/CaloTowerBoundries.h +++ /dev/null @@ -1,139 +0,0 @@ -// File: CaloTowerBoundaries.h -// Description: The eta boundaries of the CaloTowers used by JetAnalysis.cc -// Author: Anwar Bhatti -// Date: August 31, 2006 -// -#ifndef CALOTOWERETABOUNDRIES_HH -#define CALOTOWERETABOUNDRIES_HH - -const int NETA=82; -const float CaloTowerEtaBoundriesPositiveOnly[42]={0.000, - 0.087, - 0.174, - 0.261, - 0.348, - 0.435, - 0.522, - 0.609, - 0.696, - 0.783, - 0.879, - 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.853, - 2.964, - 3.139, - 3.314, - 3.489, - 3.664, - 3.839, - 4.013, - 4.191, - 4.363, - 4.538, - 4.716, - 4.889, - 5.191}; - - - const float CaloTowerEtaBoundries[83]={ - -5.191, - -4.889, - -4.716, - -4.538, - -4.363, - -4.191, - -4.013, - -3.839, - -3.664, - -3.489, - -3.314, - -3.139, - -2.964, - -2.853, - -2.650, - -2.500, - -2.322, - -2.172, - -2.043, - -1.930, - -1.830, - -1.740, - -1.653, - -1.566, - -1.479, - -1.392, - -1.305, - -1.218, - -1.131, - -1.044, - -0.957, - -0.879, - -0.783, - -0.696, - -0.609, - -0.522, - -0.435, - -0.348, - -0.261, - -0.174, - -0.087, - 0.000, - 0.087, - 0.174, - 0.261, - 0.348, - 0.435, - 0.522, - 0.609, - 0.696, - 0.783, - 0.879, - 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.853, - 2.964, - 3.139, - 3.314, - 3.489, - 3.664, - 3.839, - 4.013, - 4.191, - 4.363, - 4.538, - 4.716, - 4.889, - 5.191}; - -#endif diff --git a/RecoJets/JetAnalyzers/interface/MyCluster.h b/RecoJets/JetAnalyzers/interface/MyCluster.h deleted file mode 100644 index 631c52366317f..0000000000000 --- a/RecoJets/JetAnalyzers/interface/MyCluster.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef MYCLUSTER_H -#define MYCLUSTER_H -#include "CLHEP/Vector/LorentzVector.h" - -#include - -enum {ClusterEm=0,ClusterHd=1,ClusterEmHd=2,ClusterTower=3,RecHitEm=4,RecHitHd=5,CaloTowerEm=6,CaloTowerHd=7}; - -struct MatchParam{ - int index; - double distance; -}; - -struct CalCell{ - CLHEP::HepLorentzVector Momentum; - int pid; - bool used; -}; - - -struct CalCluster{ - CLHEP::HepLorentzVector Momentum; - double em; - double hd; - int type; - int ncells; - std::vector clusterCellList; - std::vector MatchedClusters; - std::vector SubClusterList; -}; - -class CellGreater { - public: - bool operator () (const CalCell& i, const CalCell& j) { - return (i.Momentum.e() > j.Momentum.e()); - } -}; - -class CellEtGreater { - public: - bool operator () (const CalCell& i, const CalCell& j) { - return (i.Momentum.perp() > j.Momentum.perp()); - } -}; - -class ClusterGreater { - public: - bool operator () (const CalCluster& i, const CalCluster& j) { - return (i.Momentum.e() > j.Momentum.e()); - } -}; - -class ClusterEtGreater { - public: - bool operator () (const CalCluster& i, const CalCluster& j) { - return (i.Momentum.perp() > j.Momentum.perp()); - } -}; -class ClusterPtGreater { - public: - - bool operator () (const CalCluster& i, const CalCluster& j) { - return (i.Momentum.perp() > j.Momentum.perp()); - } -}; - - -#endif diff --git a/RecoJets/JetAnalyzers/interface/myFilter.h b/RecoJets/JetAnalyzers/interface/myFilter.h deleted file mode 100644 index 43492e435f648..0000000000000 --- a/RecoJets/JetAnalyzers/interface/myFilter.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef RecoJets_myFilter_h -#define RecoJets_myFilter_h - -#include "FWCore/Framework/interface/EDFilter.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include - -class myFilter : public edm::EDFilter { - -public: - myFilter(const edm::ParameterSet& ); - virtual ~myFilter(); - virtual bool filter(edm::Event& e, edm::EventSetup const& c); - virtual void beginJob(); - virtual void endJob(); - -private: - - int _nEvent; - int _nTotal; - - int _acceptedEvt; - - int _passPt; - int _passNTrks; - int _passEMF; - int _passNJets; - int _passDiJet; - int _passNTowers; - int _passMET; - int _passMETSig; - int _passHighPtTower; - int _passNRBX; - int _passNHPDNoise; - int _passHLT; - int _passNPMTHits; - int _passNMultiPMTHits; - int _passPKAM; - int _passHFMET; - int _passNoiseSummary; - int _passNoiseSummaryEMF; - int _passNoiseSummaryE2E10; - int _passNoiseSummaryNHITS; - int _passNoiseSummaryADC0; - int _passNoiseSummaryNoOther; - int _passOERatio; - int _passTime; - int _passHFTime; - int _passHBHETime; - int _passHFFlagged; - int _passHFHighEnergy; - - int _NoiseResult[10]; - - std::string CaloJetAlgorithm; - edm::InputTag theTriggerResultsLabel; - edm::InputTag hcalNoiseSummaryTag_; -}; - -#endif diff --git a/RecoJets/JetAnalyzers/interface/myJetAna.h b/RecoJets/JetAnalyzers/interface/myJetAna.h deleted file mode 100755 index fb8ec0ff458e0..0000000000000 --- a/RecoJets/JetAnalyzers/interface/myJetAna.h +++ /dev/null @@ -1,487 +0,0 @@ -#ifndef RecoExamples_myJetAna_h -#define RecoExamples_myJetAna_h -#include -#include -#include -#include - -/* \class myJetAna - * - * \author Frank Chlebana - * - * \version 1 - * - */ -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" - -// class TFile; - -/**** -class RBX { - RBX(); - - private: - int nTowers; - int ieta; - int iphi; - float energy; - float time; -}; - -class RBXCollection { - - RBXCollection(); - void addRBX(RBX r) {rbx_.push_back(r)}; - - private: - std::vector rbx_; - -}; -*****/ - - -class myJetAna : public edm::EDAnalyzer { - -public: - myJetAna( const edm::ParameterSet & ); - -private: - void beginJob( ); - void analyze ( const edm::Event& , const edm::EventSetup& ); - void endJob(); - - std::string CaloJetAlgorithm; - std::string GenJetAlgorithm; - edm::InputTag theTriggerResultsLabel; - edm::InputTag hcalNoiseSummaryTag_; - std::string JetCorrectionService; - - int totBNC, nBNC[4000]; - - // --- Passed selection cuts - TH1F *h_pt; - TH1F *h_ptTower; - TH1F *h_ptRBX; - TH1F *h_ptHPD; - TH1F *h_et; - TH1F *h_eta; - TH1F *h_phi; - // --- - - // --- RecHits - TH1F *HBEneOOT; - TH1F *HEEneOOT; - TH1F *HFEneOOT; - TH1F *HOEneOOT; - - TH1F *HBEneOOTTh; - TH1F *HEEneOOTTh; - TH1F *HFEneOOTTh; - TH1F *HOEneOOTTh; - - TH1F *HBEneOOTTh1; - TH1F *HEEneOOTTh1; - TH1F *HFEneOOTTh1; - TH1F *HOEneOOTTh1; - - - TH1F *HBEneTThr; - TH1F *HEEneTThr; - TH1F *HFEneTThr; - - TH1F *HBEne; - TH1F *HBEneTh; - TH1F *HBEneTh1; - TH1F *HBEneX; - TH1F *HBEneY; - TH1F *HBTime; - TH1F *HBTimeTh; - TH1F *HBTimeTh1; - TH1F *HBTimeTh2; - TH1F *HBTimeTh3; - TH1F *HBTimeThR; - TH1F *HBTimeTh1R; - TH1F *HBTimeTh2R; - TH1F *HBTimeTh3R; - - TH1F *HBTimeFlagged; - TH1F *HBTimeThFlagged; - TH1F *HBTimeTh1Flagged; - TH1F *HBTimeTh2Flagged; - - TH1F *HBTimeFlagged2; - TH1F *HBTimeThFlagged2; - TH1F *HBTimeTh1Flagged2; - TH1F *HBTimeTh2Flagged2; - - TH1F *HBTimeX; - TH1F *HBTimeY; - TH1F *HEEne; - TH1F *HEEneTh; - TH1F *HEEneTh1; - TH1F *HEEneX; - TH1F *HEEneY; - TH1F *HEposEne; - TH1F *HEnegEne; - TH1F *HETime; - TH1F *HETimeTh; - TH1F *HETimeTh1; - TH1F *HETimeTh2; - TH1F *HETimeTh3; - TH1F *HETimeThR; - TH1F *HETimeTh1R; - TH1F *HETimeTh2R; - TH1F *HETimeTh3R; - - TH1F *HETimeFlagged; - TH1F *HETimeThFlagged; - TH1F *HETimeTh1Flagged; - TH1F *HETimeTh2Flagged; - - TH1F *HETimeFlagged2; - TH1F *HETimeThFlagged2; - TH1F *HETimeTh1Flagged2; - TH1F *HETimeTh2Flagged2; - - TH1F *HETimeX; - TH1F *HETimeY; - TH1F *HEposTime; - TH1F *HEnegTime; - TH1F *HFLSRatio; - TH1F *HFOERatio; - TH1F *HFEnePMT0; - TH1F *HFEnePMT1; - TH1F *HFEnePMT2; - TH1F *HFEne; - TH1F *HFEneFlagged; - TH1F *HFEneFlagged2; - TH1F *HFEneTh; - TH1F *HFEneTh1; - TH1F *HFTimePMT0; - TH1F *HFTimePMT1; - TH1F *HFTimePMT2; - TH1F *HFTime; - TH1F *PMTHits; - TH1F *HFTimeFlagged; - TH1F *HFTimeFlagged2; - TH1F *HFTimeThFlagged2; - TH1F *HFTimeTh1Flagged2; - TH1F *HFTimeTh2Flagged2; - TH1F *HFTimeTh3Flagged2; - TH1F *HFTimeFlagged3; - TH1F *HFTimeThFlagged3; - TH1F *HFTimeTh1Flagged3; - TH1F *HFTimeTh2Flagged3; - TH1F *HFTimeTh3Flagged3; - TH1F *HFTimeTh; - TH1F *HFTimeTh1; - TH1F *HFTimeTh2; - TH1F *HFTimeTh3; - TH1F *HFTimeThR; - TH1F *HFTimeTh1R; - TH1F *HFTimeTh2R; - TH1F *HFTimeTh3R; - TH1F *TrkMultFlagged0; - TH1F *TrkMultFlagged1; - TH1F *TrkMultFlagged2; - TH1F *TrkMultFlagged3; - TH1F *TrkMultFlagged4; - TH1F *TrkMultFlaggedM; - TH1F *HFTimeThFlagged; - TH1F *HFTimeTh2Flagged; - TH1F *HFTimeTh3Flagged; - TH1F *HFTimeThFlaggedR; - TH1F *HFTimeThFlaggedR1; - TH1F *HFTimeThFlaggedR2; - TH1F *HFTimeThFlaggedR3; - TH1F *HFTimeThFlaggedR4; - TH1F *HFTimeThFlaggedRM; - TH1F *HFEneP; - TH1F *HFTimeP; - TH1F *HFTimePMa; - TH1F *HFTimePM; - TH1F *HFEneM; - TH1F *HFTimeM; - TH1F *HFLEne; - TH1F *HFLEneNoS; - TH1F *HFLEneNoSFlagged; - TH1F *HFLEneNoSFlaggedN; - TH1F *HFLTime; - TH1F *HFSEneAll; - TH1F *HFSEneAllF; - TH1F *HFLEneAll; - TH1F *HFLEneAllF; - TH1F *HFSEne; - TH1F *HFSEneNoL; - TH1F *HFSEneNoLFlagged; - TH1F *HFSEneNoLFlaggedN; - TH2F *HFLvsS; - - TH2F *HBTvsE; - TH2F *HETvsE; - TH2F *HFTvsE; - TH2F *HFTvsEFlagged; - TH2F *HFTvsEFlagged2; - TH2F *HFTvsEThr; - TH2F *HFTvsEFlaggedThr; - TH2F *HFTvsEFlagged2Thr; - TH2F *HOTvsE; - - TH1F *HFSTime; - TH1F *HOEne; - TH1F *HOEneTh; - TH1F *HOEneTh1; - TH1F *HOTime; - TH1F *HOTimeTh; - TH1F *HFEtaFlagged; - TH1F *HFEtaFlaggedL; - TH1F *HFEtaFlaggedLN; - TH1F *HFEtaFlaggedS; - TH1F *HFEtaFlaggedSN; - - TProfile *HFEtaNFlagged; - TH2F *HOocc; - TH2F *HBocc; - TH2F *HEocc; - TH2F *HFocc; - TH2F *HFoccTime; - TH2F *HFEtaPhiNFlagged; - TH2F *HFoccFlagged; - TH2F *HFoccFlagged2; - TH2F *HOoccOOT; - TH2F *HBoccOOT; - TH2F *HEoccOOT; - TH2F *HFoccOOT; - TH1F *HOSEne; - TH1F *HOSTime; - TH1F *HOHEne; - TH1F *HOHTime; - TH1F *HOHr0Ene; - TH1F *HOHr0Time; - TH1F *HOHrm1Ene; - TH1F *HOHrm1Time; - TH1F *HOHrm2Ene; - TH1F *HOHrm2Time; - TH1F *HOHrp1Ene; - TH1F *HOHrp1Time; - TH1F *HOHrp2Ene; - TH1F *HOHrp2Time; - TH1F *EBEne; - TH1F *EBEneTh; - TH1F *EBEneX; - TH1F *EBEneY; - TH1F *EBTime; - TH1F *EBTimeTh; - TH1F *EBTimeX; - TH1F *EBTimeY; - TH1F *EEEne; - TH1F *EEEneTh; - TH1F *EEEneX; - TH1F *EEEneY; - TH1F *EEnegEne; - TH1F *EEposEne; - TH1F *EETime; - TH1F *EETimeTh; - TH1F *EETimeX; - TH1F *EETimeY; - TH1F *EEnegTime; - TH1F *EEposTime; - - TH2F *fedSize; - TH1F *totFedSize; - - TH1F *towerHadEnHB; - TH1F *towerHadEnHE; - TH1F *towerHadEnHF; - TH1F *towerHadEn; - TH1F *towerEmEnHB; - TH1F *towerEmEnHE; - TH1F *towerEmEnHF; - TH1F *towerEmEn; - TH1F *towerOuterEn; - - TH1F *towerEmFrac; - - TH1F *RBX_et; - TH1F *RBX_hadEnergy; - TH1F *RBX_hcalTime; - TH1F *RBX_nTowers; - TH1F *RBX_N; - - TH1F *HPD_et; - TH1F *HPD_hadEnergy; - TH1F *HPD_hcalTime; - TH1F *HPD_nTowers; - TH1F *HPD_N; - - // --- from reco calomet - TH1F *HFSumEt; - TH1F *HFMET; - - TH1F *SumEt; - TH1F *MET; - TH1F *OERMET; - TH1F *MET_Tower; - TH1F *MET_RBX; - TH1F *MET_HPD; - TH1F *METSig; - TH1F *MEx; - TH1F *MEy; - TH1F *METPhi; - // --- - - TH1F *SiClusters; - - // --- from reco vertexs - TH1F *h_Vx; - TH1F *h_Vy; - TH1F *h_Vz; - TH1F *h_VNTrks; - // --- - - // --- from reco tracks - TH1F *h_Trk_pt; - TH1F *h_Trk_NTrk; - // --- - - TH1F *hf_sumTowerAllEx; - TH1F *hf_sumTowerAllEy; - TH1F *hf_TowerJetEt; - - TH1F *ETime; - TH1F *HTime; - - TH1F *nTowers1; - TH1F *nTowers2; - TH1F *nTowers3; - TH1F *nTowers4; - TH1F *nTowersLeadJetPt1; - TH1F *nTowersLeadJetPt2; - TH1F *nTowersLeadJetPt3; - TH1F *nTowersLeadJetPt4; - - TH1F *totEneLeadJetEta1; - TH1F *totEneLeadJetEta2; - TH1F *totEneLeadJetEta3; - TH1F *hadEneLeadJetEta1; - TH1F *hadEneLeadJetEta2; - TH1F *hadEneLeadJetEta3; - TH1F *emEneLeadJetEta1; - TH1F *emEneLeadJetEta2; - TH1F *emEneLeadJetEta3; - - TH1F *hadFracEta1; - TH1F *hadFracEta2; - TH1F *hadFracEta3; - - TH1F *tMassGen; - - TH1F *dijetMass; - - TH1F *h_nCalJets; - TH1F *h_nGenJets; - - TH1F *caloEtaEt; - TH1F *caloEta; - TH1F *caloPhi; - - TH1F *hitEtaEt; - TH1F *hitEta; - TH1F *hitPhi; - - TH1F *h_nTowersCal; - TH1F *h_EMFracCal; - TH1F *h_ptCal; - TH1F *h_etaCal; - TH1F *h_phiCal; - - TH1F *h_ptGen; - TH1F *h_etaGen; - TH1F *h_phiGen; - - TH1F *h_ptGenL; - TH1F *h_etaGenL; - TH1F *h_phiGenL; - - TH1F *h_jetEt; - - TH1F *h_UnclusteredEt; - TH1F *h_UnclusteredEts; - TH1F *h_TotalUnclusteredEt; - - TH1F *h_UnclusteredE; - TH1F *h_TotalUnclusteredE; - - TH1F *h_ClusteredE; - TH1F *h_TotalClusteredE; - - TH1F *h_jet1Pt; - TH1F *h_jet2Pt; - TH1F *h_jet1Eta; - TH1F *h_jet2Eta; - TH1F *h_jet1PtHLT; - - TH1F *jetHOEne; - TH1F *jetEMFraction; - TH1F *NTowers; - - TH2F *h_EmEnergy; - TH2F *h_HadEnergy; - - TH1F *st_Pt; - TH1F *st_Constituents; - TH1F *st_Energy; - TH1F *st_EmEnergy; - TH1F *st_HadEnergy; - TH1F *st_OuterEnergy; - TH1F *st_Eta; - TH1F *st_Phi; - TH1F *st_iEta; - TH1F *st_iPhi; - TH1F *st_Frac; - - TH1F *NPass; - TH1F *NTotal; - TH1F *NTime; - - TH1F *HFRecHitEne; - TH1F *HFRecHitEneClean; - TH1F *HFRecHitTime; - - TH1F *HFLongShortPhi; - TH1F *HFLongShortEta; - TH1F *HFLongShortEne; - TH1F *HFLongShortTime; - - TH1F *HFDigiTimePhi; - TH1F *HFDigiTimeEta; - TH1F *HFDigiTimeEne; - TH1F *HFDigiTimeTime; - - TH1F *HFLongShortNHits; - TH1F *HFDigiTimeNHits; - - TH2F *HFvsZ; - TH2F *EBvHB; - TH2F *EEvHE; - TH2F *ECALvHCAL; - TH2F *ECALvHCALEta1; - TH2F *ECALvHCALEta2; - TH2F *ECALvHCALEta3; - TProfile *EMF_Phi; - TProfile *EMF_Eta; - TProfile *EMF_PhiX; - TProfile *EMF_EtaX; - - TProfile *HFTimeVsiEtaP; - TProfile *HFTimeVsiEtaM; - TProfile *HFTimeVsiEtaP5; - TProfile *HFTimeVsiEtaM5; - TProfile *HFTimeVsiEtaP20; - TProfile *HFTimeVsiEtaM20; -}; - -#endif diff --git a/RecoJets/JetAnalyzers/test/myFilter.cc b/RecoJets/JetAnalyzers/test/myFilter.cc deleted file mode 100644 index 3b5b9ff2df890..0000000000000 --- a/RecoJets/JetAnalyzers/test/myFilter.cc +++ /dev/null @@ -1,1024 +0,0 @@ -#include "RecoJets/JetAnalyzers/interface/myFilter.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "DataFormats/METReco/interface/CaloMET.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/METReco/interface/HcalCaloFlagLabels.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" - -#include "DataFormats/HLTReco/interface/TriggerObject.h" -// #include "FWCore/Common/interface/TriggerNames.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" - -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" - -// #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" - -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" - -// #include "DataFormats/PhotonReco/interface/PhotonFwd.h" -// #include "DataFormats/PhotonReco/interface/Photon.h" - - -// include files -#include "DataFormats/METReco/interface/HcalNoiseSummary.h" - - -using namespace edm; -using namespace reco; -using namespace std; - -#define DEBUG false -#define INVALID 9999. - -typedef struct RBX_struct { - double et; - double hadEnergy; - double emEnergy; - float hcalTime; - float ecalTime; - int nTowers; -} RBX ; - -typedef struct HPD_struct { - double et; - double hadEnergy; - double emEnergy; - double time; - float hcalTime; - float ecalTime; - int nTowers; -} HPD ; - - - - -//enum HcalSubdetector { HcalEmpty=0, HcalBarrel=1, HcalEndcap=2, HcalOuter=3, HcalForward=4, HcalTriggerTower=5, HcalOther=7 }; - -//enum SectorId { HBplus=1, HBminus=2, -// HEplus=3, HEminus=4, -// HO2plus=5, HO1plus=6, HOzero=7, HO1minus=8, HO2minus=9, -// HFplus=10, HFminus=11 }; - - -myFilter::myFilter(const edm::ParameterSet& cfg) : - CaloJetAlgorithm( cfg.getParameter( "CaloJetAlgorithm" ) ), - hcalNoiseSummaryTag_(cfg.getParameter("hcalNoiseSummaryTag")) -{ - _nTotal = 0; - _nEvent = 0; - _acceptedEvt = 0; - _passPt = 0; - _passNJets = 0; - _passDiJet = 0; - _passNTrks = 0; - _passEMF = 0; - _passNTowers = 0; - _passMET = 0; - _passMETSig = 0; - _passHighPtTower = 0; - _passNRBX = 0; - _passNHPDNoise = 0; - _passHLT = 0; - _passNPMTHits = 0; - _passNMultiPMTHits = 0; - _passPKAM = 0; - _passHFMET = 0; - _passNoiseSummary = 0; - _passNoiseSummaryEMF = 0; - _passNoiseSummaryE2E10 = 0; - _passNoiseSummaryNHITS = 0; - _passNoiseSummaryNoOther = 0; - _passNoiseSummaryADC0 = 0; - _passOERatio = 0; - _passTime = 0; - _passHBHETime = 0; - _passHFTime = 0; - _passHFFlagged = 0; - _passHFHighEnergy = 0; - - for (int i=0; i<10; i++) _NoiseResult[i] = 0; - - theTriggerResultsLabel = cfg.getParameter("TriggerResultsLabel"); - -} - -myFilter::~myFilter() { -} - -void myFilter::beginJob() { -} - -void myFilter::endJob() { - - edm::LogInfo ("summary") << "=============================================================" ; - edm::LogVerbatim ("summary") << "myFilter: accepted " - << _acceptedEvt << " / " << _nEvent << " / " << _nTotal << " events" ; - edm::LogVerbatim ("summary") << "Pt = " << _passPt ; - edm::LogVerbatim ("summary") << "NJets = " << _passNJets ; - edm::LogVerbatim ("summary") << "DiJets = " << _passDiJet ; - edm::LogVerbatim ("summary") << "NTrks = " << _passNTrks ; - edm::LogVerbatim ("summary") << "EMF = " << _passEMF ; - edm::LogVerbatim ("summary") << "NTowers = " << _passNTowers ; - edm::LogVerbatim ("summary") << "MET = " << _passMET ; - edm::LogVerbatim ("summary") << "METSig = " << _passMETSig ; - edm::LogVerbatim ("summary") << "HighPtTower = " << _passHighPtTower ; - edm::LogVerbatim ("summary") << "NRBX = " << _passNRBX ; - edm::LogVerbatim ("summary") << "NHPDNoise = " << _passNHPDNoise ; - edm::LogVerbatim ("summary") << "NPMTHits = " << _passNPMTHits ; - edm::LogVerbatim ("summary") << "NMultPMTHits = " << _passNMultiPMTHits ; - edm::LogVerbatim ("summary") << "PKAM = " << _passPKAM ; - edm::LogVerbatim ("summary") << "HFMET = " << _passHFMET ; - edm::LogVerbatim ("summary") << "Noise Summary = " << _passNoiseSummary ; - edm::LogVerbatim ("summary") << "Noise Summary EMF = " << _passNoiseSummaryEMF ; - edm::LogVerbatim ("summary") << "Noise Summary E2E10 = " << _passNoiseSummaryE2E10 ; - edm::LogVerbatim ("summary") << "Noise Summary NHITS = " << _passNoiseSummaryNHITS ; - edm::LogVerbatim ("summary") << "Noise Summary ADC0 = " << _passNoiseSummaryADC0 ; - edm::LogVerbatim ("summary") << "Noise Summary NoOther = " << _passNoiseSummaryNoOther ; - edm::LogVerbatim ("summary") << "OERatio = " << _passOERatio ; - edm::LogVerbatim ("summary") << "Time = " << _passTime ; - edm::LogVerbatim ("summary") << "HF Time = " << _passHFTime ; - edm::LogVerbatim ("summary") << "HBHE Time = " << _passHBHETime ; - edm::LogVerbatim ("summary") << "HF Flagged = " << _passHFFlagged ; - edm::LogVerbatim ("summary") << "HF High Energy= " << _passHFHighEnergy ; - edm::LogVerbatim ("summary") << "=============================================================" ; - - - for (int i=0; i<10; i++) { - edm::LogVerbatim ("summary") << "Noise Results = " << _NoiseResult[i] ; - } - -} - -bool -myFilter::filter(edm::Event& evt, edm::EventSetup const& es) { - - double HFRecHit[100][100][2]; - - - double HFThreshold = 4.0; - //double HOThreshold = 1.0; - - - bool result = false; - bool filter_Pt = false; - bool filter_DiJet = false; - bool filter_NTrks = false; - bool filter_EMF = false; - bool filter_NJets = false; - //bool filter_NTowers = false; - bool filter_MET = false; - bool filter_METSig = false; - bool filter_HighPtTower = false; - bool filter_NRBX = false; - bool filter_NHPDNoise = false; - bool filter_HLT = false; - bool filter_NPMTHits = false; - bool filter_NMultiPMTHits = false; -// bool filter_PKAM = false; - bool filter_HFMET = false; - bool filter_NoiseSummary = false; - bool filter_NoiseSummaryEMF = false; - bool filter_NoiseSummaryE2E10 = false; - bool filter_NoiseSummaryNHITS = false; - bool filter_NoiseSummaryADC0 = false; - bool filter_NoiseSummaryNoOther = false; - bool filter_OERatio = false; - bool filter_Time = false; - bool filter_HFTime = false; - bool filter_HBHETime = false; - bool filter_HFFlagged = false; - bool filter_HFHighEnergy = false; - - - bool Pass = false; - if (evt.id().run() == 124009) { - if ( (evt.bunchCrossing() == 51) || - (evt.bunchCrossing() == 151) || - (evt.bunchCrossing() == 2824) ) { - Pass = true; - } - } - if (evt.id().run() == 124020) { - if ( (evt.bunchCrossing() == 51) || - (evt.bunchCrossing() == 151) || - (evt.bunchCrossing() == 2824) ) { - Pass = true; - } - } - if (evt.id().run() == 124024) { - if ( (evt.bunchCrossing() == 51) || - (evt.bunchCrossing() == 151) || - (evt.bunchCrossing() == 2824) ) { - Pass = true; - } - } - - if ( (evt.bunchCrossing() == 51) || - (evt.bunchCrossing() == 151) || - (evt.bunchCrossing() == 2824) ) { - Pass = true; - } - - - // *********************** - // *********************** - // get the Noise summary object - - edm::Handle summary_h; - evt.getByLabel(hcalNoiseSummaryTag_, summary_h); - if(!summary_h.isValid()) { - throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseSummary.\n"; - // return true; - } - const HcalNoiseSummary summary = *summary_h; - - if(summary.minE2Over10TS()<0.7) { - filter_NoiseSummaryE2E10 = true; - filter_NoiseSummary = true; - _NoiseResult[0]++; - } - if(summary.maxE2Over10TS()>0.96) { - filter_NoiseSummaryE2E10 = true; - filter_NoiseSummary = true; - _NoiseResult[1]++; - } - if(summary.maxHPDHits()>=17) { - filter_NoiseSummaryNHITS = true; - filter_NoiseSummary = true; - _NoiseResult[2]++; - } - if(summary.maxRBXHits()>=999) { - filter_NoiseSummary = true; - _NoiseResult[3]++; - } - if(summary.maxHPDNoOtherHits()>=10) { - filter_NoiseSummary = true; - filter_NoiseSummaryNoOther = true; - _NoiseResult[4]++; - } - if(summary.maxZeros()>=10) { - filter_NoiseSummaryADC0 = true; - filter_NoiseSummary = true; - _NoiseResult[5]++; - } - if(summary.min25GeVHitTime()<-9999.0) { - filter_NoiseSummary = true; - _NoiseResult[6]++; - } - if(summary.max25GeVHitTime()>9999.0) { - filter_NoiseSummary = true; - _NoiseResult[7]++; - } - if(summary.minRBXEMF()<0.01) { - filter_NoiseSummaryEMF = true; - // filter_NoiseSummary = true; - _NoiseResult[8]++; - } - - // if (filter_NoiseSummary) - // std::cout << ">>> Noise Filter = " << filter_NoiseSummary << std::endl; - - - // summary.passLooseNoiseFilter(); - // summary.passTightNoiseFilter(); - // summary.passHighLevelNoiseFilter(); - - - // *********************** - // *********************** - - for (int i=0; i<100; i++) { - for (int j=0; j<100; j++) { - HFRecHit[i][j][0] = -10.; - HFRecHit[i][j][1] = -10.; - } - } - - - double HFM_ETime, HFP_ETime; - double HFM_E, HFP_E; - double HF_PMM; - double MaxRecHitEne; - - MaxRecHitEne = 0; - HFM_ETime = 0.; - HFM_E = 0.; - HFP_ETime = 0.; - HFP_E = 0.; - int NPMTHits; - int NHFDigiTimeHits; - int NHFLongShortHits; - int nTime = 0; - - NPMTHits = 0; - NHFDigiTimeHits = 0; - NHFLongShortHits = 0; - - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i=colls.begin(); i!=colls.end(); i++) { - for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - if (j->id().subdet() == HcalForward) { - - int myFlag; - myFlag= j->flagField(HcalCaloFlagLabels::HFLongShort); - if (myFlag==1) { - filter_HFFlagged=true; - NHFLongShortHits++; - } - myFlag= j->flagField(HcalCaloFlagLabels::HFDigiTime); - if (myFlag==1) { - filter_HFFlagged=true; - NHFDigiTimeHits++; - } - - if ( ( (j->flagField(HcalCaloFlagLabels::HFLongShort)) == 0) && - ( (j->flagField(HcalCaloFlagLabels::HFDigiTime)) == 0) ) { - if (j->energy() > MaxRecHitEne) MaxRecHitEne = j->energy(); - } - - - // if (filter_HFFlagged) { - // std::cout << "HF Flagged = " << _passHFFlagged << std::endl; - // } - - - // Long: depth = 1 - // Short: depth = 2 - float en = j->energy(); - float time = j->time(); - if ( (en > 20.) && (time > 10.)) { - nTime++; - } - int ieta = j->id().ieta(); - int iphi = j->id().iphi(); - int depth = j->id().depth(); - HFRecHit[ieta+41][iphi][depth-1] = en; - - // Exclude PMTs with crystals - if ( (j->id().iphi() == 67) && - ((j->id().ieta() == 29) || - ((j->id().ieta() == 30) && (j->id().depth() == 2)) || - ((j->id().ieta() == 32) && (j->id().depth() == 2)) || - ((j->id().ieta() == 35) && (j->id().depth() == 1)) || - ((j->id().ieta() == 36) && (j->id().depth() == 2)) || - ((j->id().ieta() == 37) && (j->id().depth() == 1)) || - ((j->id().ieta() == 38) && (j->id().depth() == 2)) ) ) { - } else { - if ( (j->flagField(0) != 0) && (j->energy() > 1.) ) { - NPMTHits++; - if (NPMTHits > 1) { - edm::LogInfo("myFilter") << ">>>> MultiHit: Run = " << evt.id().run() - << " Event = " << evt.id().event() - << " iEta = " << j->id().ieta() - << " iPhi = " << j->id().iphi() - << " depth = " << j->id().depth() - << " flag = " << j->flagField(0) - << " hits = " << NPMTHits - << " energy = " << j->energy(); - } - - } - } - - if (j->id().ieta()<0) { - if (j->energy() > HFThreshold) { - HFM_ETime += j->energy()*j->time(); - HFM_E += j->energy(); - } - } else { - if (j->energy() > HFThreshold) { - HFP_ETime += j->energy()*j->time(); - HFP_E += j->energy(); - } - } - - - } - } - break; - } - - if (MaxRecHitEne > 1000.) filter_HFHighEnergy = true; - - if (nTime > 0) filter_Time = true; - if (nTime > 0) filter_HFTime = true; - - - double OER, OddEne, EvenEne; - int nOdd, nEven; - - OER = 0.0; - for (int iphi=0; iphi<100; iphi++) { - OddEne = EvenEne = 0.; - nOdd = 0; - nEven = 0; - for (int ieta=0; ieta<100; ieta++) { - if (HFRecHit[ieta][iphi][0] > 1.0) { - if (ieta%2 == 0) { - EvenEne += HFRecHit[ieta][iphi][0]; - nEven++; - } else { - OddEne += HFRecHit[ieta][iphi][0]; - nOdd++; - } - } - if (HFRecHit[ieta][iphi][1] > 1.0) { - if (ieta%2 == 0) { - EvenEne += HFRecHit[ieta][iphi][1]; - nEven++; - } else { - OddEne += HFRecHit[ieta][iphi][1]; - nOdd++; - } - } - } - if (((OddEne + EvenEne) > 10.) && (nOdd > 1) && (nEven > 1)) { - OER = (OddEne - EvenEne) / (OddEne + EvenEne); - } - } - - - if (NPMTHits > 0) filter_NPMTHits = true; - if (NPMTHits > 1) filter_NMultiPMTHits = true; - // cout << "NPMTHits = " << NPMTHits << endl; - - - if ((HFP_E > 0.) && (HFM_E > 0.)) { - HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E); - } else { - HF_PMM = INVALID; - } - - - if (fabs(HF_PMM) < 10.) { - Pass = true; - } else { - Pass = false; - } - - _nTotal++; - Pass = true; - if (Pass) { - /*** - std::cout << ">>>> FIL: Run = " << evt.id().run() - << " Event = " << evt.id().event() - << " Bunch Crossing = " << evt.bunchCrossing() - << " Orbit Number = " << evt.orbitNumber() - << std::endl; - ***/ - // ********************************************************* - // --- Event Classification - // ********************************************************* - - RBX RBXColl[36]; - HPD HPDColl[144]; - - int evtType = 0; - - Handle caloTowers; - evt.getByLabel( "towerMaker", caloTowers ); - - for (int i=0;i<36;i++) { - RBXColl[i].et = 0; - RBXColl[i].hadEnergy = 0; - RBXColl[i].emEnergy = 0; - RBXColl[i].hcalTime = 0; - RBXColl[i].ecalTime = 0; - RBXColl[i].nTowers = 0; - } - for (int i=0;i<144;i++) { - HPDColl[i].et = 0; - HPDColl[i].hadEnergy = 0; - HPDColl[i].emEnergy = 0; - HPDColl[i].hcalTime = 0; - HPDColl[i].ecalTime = 0; - HPDColl[i].nTowers = 0; - } - - double HFMET = 0.0; - double HFsum_et = 0.0; - double HFsum_ex = 0.0; - double HFsum_ey = 0.0; - - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); - tower != caloTowers->end(); tower++) { - - if (tower->hadEnergy() < 0.) { - } - if (tower->emEnergy() < 0.) { - } - - - if (tower->et()>0.5) { - - int iRBX = tower->iphi(); - iRBX = iRBX-2; - if (iRBX == 0) iRBX = 17; - if (iRBX == -1) iRBX = 18; - iRBX = (iRBX-1)/4; - - if (tower->ieta() < 0) iRBX += 18; - if (iRBX < 36) { - RBXColl[iRBX].et += tower->et(); - RBXColl[iRBX].hadEnergy += tower->hadEnergy(); - RBXColl[iRBX].emEnergy += tower->emEnergy(); - RBXColl[iRBX].hcalTime += tower->hcalTime(); - RBXColl[iRBX].ecalTime += tower->ecalTime(); - RBXColl[iRBX].nTowers++; - } - /*** - std::cout << "iRBX = " << iRBX << " " - << "ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << " et = " << tower->et() - << std::endl; - ***/ - int iHPD = tower->iphi(); - if (tower->ieta() < 0) iHPD = iHPD + 72; - if (iHPD < 144) { - HPDColl[iHPD].et += tower->et(); - HPDColl[iHPD].hadEnergy += tower->hadEnergy(); - HPDColl[iHPD].emEnergy += tower->emEnergy(); - HPDColl[iHPD].hcalTime += tower->hcalTime(); - HPDColl[iHPD].ecalTime += tower->ecalTime(); - HPDColl[iHPD].nTowers++; - } - /*** - std::cout << "iHPD = " << iHPD << " " - << "ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << " et = " << tower->et() - << std::endl; - ***/ - - Double_t et = tower->et(); - Double_t phix = tower->phi(); - - if (fabs(tower->ieta()) > 29) { - HFsum_et += et; - HFsum_ex += et*cos(phix); - HFsum_ey += et*sin(phix); - } - - } - } - - HFMET = sqrt( HFsum_ex*HFsum_ex + HFsum_ey*HFsum_ey); - if ( (HFMET > 40.) && (NPMTHits == 0) ) filter_HFMET = true; - - // Loop over the RBX Collection - int nRBX = 0; - int nTowers = 0; - for (int i=0;i<36;i++) { - if (RBXColl[i].hadEnergy > 3.0) { - nRBX++; - nTowers = RBXColl[i].nTowers; - } - } - if ( (nRBX == 1) && (nTowers > 24) ) { - evtType = 1; - } - - // Loop over the HPD Collection - int nHPD = 0; - for (int i=0;i<144;i++) { - if (HPDColl[i].hadEnergy > 3.0) { - nHPD++; - nTowers = HPDColl[i].nTowers; - } - } - if ( (nHPD == 1) && (nTowers > 6) ) { - evtType = 2; - // cout << " nHPD = " << nHPD - // << " Towers = " << nTowers - // << " Type = " << evtType - // << endl; - } - - - - // ********************************************************* - // --- Access Trigger Info - // ********************************************************* - - // **** Get the TriggerResults container - Handle triggerResults; - evt.getByLabel(theTriggerResultsLabel, triggerResults); - - Int_t JetLoPass = 0; - - /**** - if (triggerResults.isValid()) { - if (DEBUG) std::cout << "trigger valid " << std::endl; - edm::TriggerNames triggerNames; // TriggerNames class - triggerNames.init(*triggerResults); - unsigned int n = triggerResults->size(); - for (unsigned int i=0; i!=n; i++) { - if ( triggerNames.triggerName(i) == "HLT_Jet30" ) { - JetLoPass = triggerResults->accept(i); - if (DEBUG) std::cout << "Found HLT_Jet30" << std::endl; - } - } - } - *****/ - - // ********************************************************* - // --- Vertex Selection - // ********************************************************* - - // ********************************************************* - // --- Pixel Track and Clusters - // ********************************************************* - /******* - // -- Tracks - edm::Handle > hTrackCollection; - evt.getByLabel("generalTracks", hTrackCollection); - - if (hTrackCollection.isValid()) { - const std::vector trackColl = *(hTrackCollection.product()); - nTk = trackColl.size(); - } - *******/ - - // ********************************************************* - // --- Pixel Clusters - // ********************************************************* - // -- Pixel cluster - /*** - edm::Handle hClusterColl; - evt.getByLabel("siPixelClusters", hClusterColl); - const reco::SiPixelCluster cC = *(hClusterColl.product()); - ***/ - - edm::Handle< edmNew::DetSetVector > hClusterColl; - evt.getByLabel("siPixelClusters", hClusterColl); - auto const & clustColl = *(hClusterColl.product()); - // nCl = clustColl.size(); - - /*** - int nCl = 0; - if (hClusterColl.isValid()) { - const edmNew::DetSetVector clustColl = *(hClusterColl.product()); - nCl = clustColl.size(); - } - ***/ - - // ********************************************************* - // --- Track Selection - // ********************************************************* - edm::Handle trackCollection; - // evt.getByLabel("ctfWithMaterialTracks", trackCollection); - evt.getByLabel("generalTracks", trackCollection); - - auto const & tC = *(trackCollection.product()); - // std::cout << "FIL: Reconstructed "<< tC.size() << " tracks" << std::endl ; - - if (tC.size() > 3) filter_NTrks = true; - - // h_Trk_NTrk->Fill(tC.size()); - - // for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++){ - // h_Trk_pt->Fill(track->pt()); - // } - - /**** - std::cout << "Track number "<< i << std::endl ; - std::cout << "\tmomentum: " << track->momentum()<< std::endl; - std::cout << "\tPT: " << track->pt()<< std::endl; - std::cout << "\tvertex: " << track->vertex()<< std::endl; - std::cout << "\timpact parameter: " << track->d0()<< std::endl; - std::cout << "\tcharge: " << track->charge()<< std::endl; - std::cout << "\tnormalizedChi2: " << track->normalizedChi2()<< std::endl; - - cout<<"\tFrom EXTRA : "<outerPt()<seedDirection() << std::endl; - ****/ - - - if ((tC.size() > 100) && (clustColl.size() > 1000)) { - _passPKAM++; -// filter_PKAM = true; - } - // std::cout << "N Tracks = " << tC.size() - // << " N Cluster = " << clustColl.size() << std::endl ; - - - - // ********************************************************* - // --- RecHits - // ********************************************************* - // Handle caloTowers; - // evt.getByLabel( "towerMaker", caloTowers ); - edm::Handle spd; - - int nHPDNoise = 0; - nTime = 0; - - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i=colls.begin(); i!=colls.end(); i++) { - for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - // std::cout << *j << std::endl; - if (j->id().subdet() == HcalBarrel) { - // std::cout << "Barrel : " << j->id() << std::endl; - } - if (j->id().subdet() == HcalEndcap) { - } - - if (j->flagField(0) != 0) nHPDNoise++; - - float en = j->energy(); - float time = j->time(); - - if ( (en > 10.) && (time > 20.)) { - nTime++; - } - - /*** - std::cout << j->id() << " " - << j->id().subdet() << " " - << j->id().ieta() << " " - << j->id().iphi() << " " - << j->id().depth() << " " - << j->energy() << " " - << j->time() << std::endl; - ****/ - } - } - - if (nHPDNoise > 10) filter_NHPDNoise = true; - if (nTime > 0) filter_HBHETime = true; - - /*** - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i=colls.begin(); i!=colls.end(); i++) { - for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - // std::cout << *j << std::endl; - } - } - - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i=colls.begin(); i!=colls.end(); i++) { - for (HORecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - // std::cout << *j << std::endl; - } - } - ****/ - - - - // ********************************************************* - // --- CaloTower Selection - // ********************************************************* - // Handle caloTowers; - // evt.getByLabel( "towerMaker", caloTowers ); - - // --- Loop over towers and make a lists of used and unused towers - int nTow = 0; - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); - tower != caloTowers->end(); tower++) { - // std::cout << *tower << std::endl; - if (tower->et() > 0.5) { - nTow++; - /**** - std::cout << "Tower Et = " - << tower->et() << " " - << tower->emEnergy() << " EmEne = " - << tower->hadEnergy() << " HadEne = " - << tower->outerEnergy() << " ETime = " - << tower->ecalTime() << " HTime = " - << tower->hcalTime() << " ieta = " - << tower->ieta() << " iphi = " - << tower->iphi() << " " - << tower->iphi() / 4 - << endl; - ****/ - } - - } - /**** - std::cout << "Number of caloTowers = " - << caloTowers->size() - << " / " - << nTow - << std::endl; - ****/ - - // ********************************************************* - // --- Jet Selection - // ********************************************************* - - Handle jets; - evt.getByLabel( CaloJetAlgorithm, jets ); - int njet = 0; - int nDiJet = 0; - for ( CaloJetCollection::const_iterator ijet=jets->begin(); ijet!=jets->end(); ijet++) { - - if ( (ijet->pt() > 100.) && (JetLoPass != 0) ) { - filter_HLT = true; - } - - - if ((ijet->pt() > 100.) && (evtType == 0)) { - filter_HighPtTower = true; - } - - if (ijet->pt() > 50.) nDiJet++; - if (ijet->pt() > 50.) filter_Pt = true; - if (ijet->pt() > 10.) njet++; - if (ijet->pt() > 10.) { - if (ijet->emEnergyFraction() > 0.05) filter_EMF = true; - } - - // if (filter_EMF) { - // std::cout << "pt = " << ijet->pt() - // << " EMF = " << ijet->emEnergyFraction() << std::endl; - // } - - // std::cout << "pt = " << ijet->pt() << std::endl; - - } - - if (nDiJet > 1) filter_DiJet = true; - if (njet > 1) filter_NJets = true; - // if (filter_EMF) { - // std::cout << "NJets = " << njet << std::endl; - // } - - - // ********************************************************* - // --- MET Selection - // ********************************************************* - - Handle calometcoll; - evt.getByLabel("met", calometcoll); - double caloMET = 0; - if (calometcoll.isValid()) { - const CaloMETCollection *calometcol = calometcoll.product(); - const CaloMET *calomet; - calomet = &(calometcol->front()); - caloMET = calomet->pt(); - //double caloMETSig = calomet->mEtSig(); - //double caloSumET = calomet->sumEt(); - // if ((caloMET > 50.) && (evtType = 0)) filter_MET = true; - if (caloMET > 40.) filter_MET = true; - } - if ((std::abs(OER) > 0.9) && (caloMET > 20.0)) filter_OERatio = true; - if (nRBX > 3) filter_NRBX = true; - - // ********************************************************* - _nEvent++; - - // if ( (filter_HLT) || (filter_NJets) ) { - // result = true; - // _acceptedEvt++; - // } - - /*** - if ( (filter_Pt) || (filter_NTrks) || (filter_EMF) || (filter_NJets) || - (filter_MET) || (filter_METSig) || (filter_HighPtTower) ) { - result = true; - _acceptedEvt++; - } - ***/ - - // if ( (filter_Pt) || (filter_NJets) ) { - // result = true; - // _acceptedEvt++; - // } - - // if ((filter_PKAM) || (filter_HFMET) ||(filter_NMultiPMTHits) ) { - // if ( (filter_DiJet) || (filter_HFMET) ||(filter_NMultiPMTHits) ) { - // if ( (filter_NHPDNoise) && ( (filter_Pt) || (filter_MET) ) ) { - // result = true; - // _acceptedEvt++; - // } - - // if ( (filter_NoiseSummary) && ( (filter_Pt) || (filter_MET) ) ) { - // result = true; - // _acceptedEvt++; - // } - - // if (filter_NoiseSummaryEMF) { - // result = true; - // _acceptedEvt++; - // } - - // if (filter_Time) { - // if ( (filter_MET) && (!filter_NoiseSummary) ) { - - // if (filter_NoiseSummary) { - // result = true; - // _acceptedEvt++; - // } - - // if (filter_HFTime) { - // result = true; - // _acceptedEvt++; - // } - - // if (filter_HBHETime) { - // result = true; - // _acceptedEvt++; - // } - - - // if (!filter_NoiseSummary && filter_HBHETime) { - // result = true; - // _acceptedEvt++; - // } - - // if (filter_NoiseSummary && filter_NTrks) { - // result = true; - // _acceptedEvt++; - // } - - // if (!filter_NoiseSummaryADC0 && !filter_NoiseSummaryNHITS && - // filter_NoiseSummaryE2E10 && !filter_NoiseSummaryNoOther) { - // result = true; - // _acceptedEvt++; - // } - - - // if ((filter_HFFlagged) && ((NHFLongShortHits > 2) || (NHFDigiTimeHits > 2))) { - // result = true; - // _acceptedEvt++; - // } - - if (filter_HFHighEnergy) { - result = true; - _acceptedEvt++; - } - - if (filter_Pt) _passPt++; - if (filter_NJets) _passNJets++; - if (filter_DiJet) _passDiJet++; - if (filter_NTrks) _passNTrks++; - if (filter_EMF) _passEMF++; - if (filter_MET) _passMET++; - if (filter_METSig) _passMETSig++; - if (filter_HighPtTower) _passHighPtTower++; - if (filter_NRBX) _passNRBX++; - if (filter_NHPDNoise) _passNHPDNoise++; - if (filter_HLT) _passHLT++; - if (filter_NPMTHits) _passNPMTHits++; - if (filter_NMultiPMTHits) _passNMultiPMTHits++; - if (filter_HFMET) _passHFMET++; - if (filter_NoiseSummary) _passNoiseSummary++; - if (filter_NoiseSummaryEMF) _passNoiseSummaryEMF++; - if (filter_NoiseSummaryE2E10) _passNoiseSummaryE2E10++; - if (filter_NoiseSummaryNHITS) _passNoiseSummaryNHITS++; - if (filter_NoiseSummaryADC0) _passNoiseSummaryADC0++; - if (filter_NoiseSummaryNoOther) _passNoiseSummaryNoOther++; - if (filter_OERatio) _passOERatio++; - if (filter_Time) _passTime++; - if (filter_HFTime) _passHFTime++; - if (filter_HBHETime) _passHBHETime++; - if (filter_HFFlagged) _passHFFlagged++; - if (filter_HFHighEnergy) _passHFHighEnergy++; - - /**** - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - result = true; - _acceptedEvt++; - } else { - result = false; - } - ****/ - - // result = true; - - } - - if (result) { - edm::LogInfo ("summary")<< "<<<< Event Passed myFilter" ; - } - return result; - -} -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(myFilter); diff --git a/RecoJets/JetAnalyzers/test/myJetAna.cc b/RecoJets/JetAnalyzers/test/myJetAna.cc deleted file mode 100644 index a42e1733c44f9..0000000000000 --- a/RecoJets/JetAnalyzers/test/myJetAna.cc +++ /dev/null @@ -1,2736 +0,0 @@ -// myJetAna.cc -// Description: Access Cruzet Data -// Author: Frank Chlebana -// Date: 24 - July - 2008 -// -#include "RecoJets/JetAnalyzers/interface/myJetAna.h" -#include "RecoJets/JetAlgorithms/interface/JetAlgoHelper.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/JetReco/interface/GenJet.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "DataFormats/METReco/interface/CaloMET.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/METReco/interface/HcalCaloFlagLabels.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" - -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" - -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" - -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" - -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" - -// #include "DataFormats/PhotonReco/interface/PhotonFwd.h" -// #include "DataFormats/PhotonReco/interface/Photon.h" - -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/Math/interface/deltaPhi.h" -// #include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h" -#include "DataFormats/Candidate/interface/Candidate.h" -// #include "FWCore/Framework/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -// #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" - -#include "DataFormats/HLTReco/interface/TriggerObject.h" -// #include "FWCore/Common/interface/TriggerNames.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" - -// #include "DataFormats/Scalers/interface/DcsStatus.h" - -// include files -#include "DataFormats/METReco/interface/HcalNoiseSummary.h" - -#include "DataFormats/METReco/interface/HcalCaloFlagLabels.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "JetMETCorrections/Objects/interface/JetCorrector.h" -#include -#include -#include -#include -#include - -using namespace edm; -using namespace reco; -using namespace std; - -#define INVALID 9999. -#define DEBUG false -#define MAXJETS 100 - -typedef struct RBX_struct { - double et; - double hadEnergy; - double emEnergy; - float hcalTime; - float ecalTime; - int nTowers; -} RBX; - -typedef struct HPD_struct { - double et; - double hadEnergy; - double emEnergy; - double time; - float hcalTime; - float ecalTime; - int nTowers; -} HPD; - -// ************************ -// ************************ - -// Get the algorithm of the jet collections we will read from the .cfg file -// which defines the value of the strings CaloJetAlgorithm and GenJetAlgorithm. - -myJetAna::myJetAna(const ParameterSet &cfg) - : CaloJetAlgorithm(cfg.getParameter("CaloJetAlgorithm")), - GenJetAlgorithm(cfg.getParameter("GenJetAlgorithm")), - hcalNoiseSummaryTag_(cfg.getParameter("hcalNoiseSummaryTag")) { - theTriggerResultsLabel = cfg.getParameter("TriggerResultsLabel"); -} - -// ************************ -// ************************ - -void myJetAna::beginJob() { - edm::Service fs; - - // --- passed selection cuts - h_pt = fs->make("pt", "Jet p_{T}", 100, 0, 50); - h_ptRBX = fs->make("ptRBX", "RBX: Jet p_{T}", 100, 0, 50); - h_ptHPD = fs->make("ptHPD", "HPD: Jet p_{T}", 100, 0, 50); - h_ptTower = fs->make("ptTower", "Jet p_{T}", 100, 0, 50); - h_et = fs->make("et", "Jet E_{T}", 100, 0, 50); - h_eta = fs->make("eta", "Jet #eta", 100, -5, 5); - h_phi = fs->make("phi", "Jet #phi", 50, -M_PI, M_PI); - // --- - - hitEtaEt = fs->make("hitEtaEt", "RecHit #eta", 90, -45, 45); - hitEta = fs->make("hitEta", "RecHit #eta", 90, -45, 45); - hitPhi = fs->make("hitPhi", "RecHit #phi", 73, 0, 73); - - caloEtaEt = fs->make("caloEtaEt", "CaloTower #eta", 100, -4, 4); - caloEta = fs->make("caloEta", "CaloTower #eta", 100, -4, 4); - caloPhi = fs->make("caloPhi", "CaloTower #phi", 50, -M_PI, M_PI); - - dijetMass = fs->make("dijetMass", "DiJet Mass", 100, 0, 100); - - totEneLeadJetEta1 = fs->make("totEneLeadJetEta1", "Total Energy Lead Jet Eta1 1", 100, 0, 100); - totEneLeadJetEta2 = fs->make("totEneLeadJetEta2", "Total Energy Lead Jet Eta2 1", 150, 0, 150); - totEneLeadJetEta3 = fs->make("totEneLeadJetEta3", "Total Energy Lead Jet Eta3 1", 150, 0, 150); - - hadEneLeadJetEta1 = fs->make("hadEneLeadJetEta1", "Hadronic Energy Lead Jet Eta1 1", 50, 0, 50); - hadEneLeadJetEta2 = fs->make("hadEneLeadJetEta2", "Hadronic Energy Lead Jet Eta2 1", 100, 0, 100); - hadEneLeadJetEta3 = fs->make("hadEneLeadJetEta3", "Hadronic Energy Lead Jet Eta3 1", 100, 0, 100); - emEneLeadJetEta1 = fs->make("emEneLeadJetEta1", "EM Energy Lead Jet Eta1 1", 50, 0, 50); - emEneLeadJetEta2 = fs->make("emEneLeadJetEta2", "EM Energy Lead Jet Eta2 1", 100, 0, 100); - emEneLeadJetEta3 = fs->make("emEneLeadJetEta3", "EM Energy Lead Jet Eta3 1", 100, 0, 100); - - hadFracEta1 = fs->make("hadFracEta11", "Hadronic Fraction Eta1 Jet 1", 100, 0, 1); - hadFracEta2 = fs->make("hadFracEta21", "Hadronic Fraction Eta2 Jet 1", 100, 0, 1); - hadFracEta3 = fs->make("hadFracEta31", "Hadronic Fraction Eta3 Jet 1", 100, 0, 1); - - HFSumEt = fs->make("HFSumEt", "HFSumEt", 100, 0, 100); - HFMET = fs->make("HFMET", "HFMET", 120, 0, 120); - - SumEt = fs->make("SumEt", "SumEt", 100, 0, 100); - MET = fs->make("MET", "MET", 120, 0, 120); - OERMET = fs->make("OERMET", "OERMET", 120, 0, 120); - METSig = fs->make("METSig", "METSig", 100, 0, 50); - MEx = fs->make("MEx", "MEx", 100, -20, 20); - MEy = fs->make("MEy", "MEy", 100, -20, 20); - METPhi = fs->make("METPhi", "METPhi", 315, 0, 3.15); - MET_RBX = fs->make("MET_RBX", "MET", 100, 0, 1000); - MET_HPD = fs->make("MET_HPD", "MET", 100, 0, 1000); - MET_Tower = fs->make("MET_Tower", "MET", 100, 0, 1000); - - SiClusters = fs->make("SiClusters", "SiClusters", 150, 0, 1500); - - h_Vx = fs->make("Vx", "Vx", 100, -0.5, 0.5); - h_Vy = fs->make("Vy", "Vy", 100, -0.5, 0.5); - h_Vz = fs->make("Vz", "Vz", 100, -20, 20); - h_VNTrks = fs->make("VNTrks", "VNTrks", 10, 1, 100); - - h_Trk_pt = fs->make("Trk_pt", "Trk_pt", 100, 0, 20); - h_Trk_NTrk = fs->make("Trk_NTrk", "Trk_NTrk", 150, 0, 150); - - hf_sumTowerAllEx = fs->make("sumTowerAllEx", "Tower Ex", 100, -1000, 1000); - hf_sumTowerAllEy = fs->make("sumTowerAllEy", "Tower Ey", 100, -1000, 1000); - - hf_TowerJetEt = fs->make("TowerJetEt", "Tower/Jet Et 1", 50, 0, 1); - - ETime = fs->make("ETime", "Ecal Time", 200, -200, 200); - HTime = fs->make("HTime", "Hcal Time", 200, -200, 200); - - towerHadEnHB = fs->make("towerHadEnHB", "HB: Calo Tower HAD Energy", 210, -1, 20); - towerHadEnHE = fs->make("towerHadEnHE", "HE: Calo Tower HAD Energy", 510, -1, 50); - towerHadEnHF = fs->make("towerHadEnHF", "HF: Calo Tower HAD Energy", 510, -1, 50); - - towerEmEnHB = fs->make("towerEmEnHB", "HB: Calo Tower EM Energy", 210, -1, 20); - towerEmEnHE = fs->make("towerEmEnHE", "HE: Calo Tower EM Energy", 510, -1, 50); - towerEmEnHF = fs->make("towerEmEnHF", "HF: Calo Tower EM Energy", 510, -1, 50); - - towerHadEn = fs->make("towerHadEn", "Hadronic Energy in Calo Tower", 2000, -100, 100); - towerEmEn = fs->make("towerEmEn", "EM Energy in Calo Tower", 2000, -100, 100); - towerOuterEn = fs->make("towerOuterEn", "HO Energy in Calo Tower", 2000, -100, 100); - - towerEmFrac = fs->make("towerEmFrac", "EM Fraction of Energy in Calo Tower", 100, -1., 1.); - - RBX_et = fs->make("RBX_et", "ET in RBX", 1000, -20, 100); - RBX_hadEnergy = fs->make("RBX_hadEnergy", "Hcal Energy in RBX", 1000, -20, 100); - RBX_hcalTime = fs->make("RBX_hcalTime", "Hcal Time in RBX", 200, -200, 200); - RBX_nTowers = fs->make("RBX_nTowers", "Number of Towers in RBX", 75, 0, 75); - RBX_N = fs->make("RBX_N", "Number of RBX", 10, 0, 10); - - HPD_et = fs->make("HPD_et", "ET in HPD", 1000, -20, 100); - HPD_hadEnergy = fs->make("HPD_hadEnergy", "Hcal Energy in HPD", 1000, -20, 100); - HPD_hcalTime = fs->make("HPD_hcalTime", "Hcal Time in HPD", 200, -200, 200); - HPD_nTowers = fs->make("HPD_nTowers", "Number of Towers in HPD", 20, 0, 20); - HPD_N = fs->make("HPD_N", "Number of HPD", 10, 0, 10); - - nTowers1 = fs->make("nTowers1", "Number of Towers pt 0.5", 100, 0, 200); - nTowers2 = fs->make("nTowers2", "Number of Towers pt 1.0", 100, 0, 200); - nTowers3 = fs->make("nTowers3", "Number of Towers pt 1.5", 100, 0, 200); - nTowers4 = fs->make("nTowers4", "Number of Towers pt 2.0", 100, 0, 200); - - nTowersLeadJetPt1 = fs->make("nTowersLeadJetPt1", "Number of Towers in Lead Jet pt 0.5", 100, 0, 100); - nTowersLeadJetPt2 = fs->make("nTowersLeadJetPt2", "Number of Towers in Lead Jet pt 1.0", 100, 0, 100); - nTowersLeadJetPt3 = fs->make("nTowersLeadJetPt3", "Number of Towers in Lead Jet pt 1.5", 100, 0, 100); - nTowersLeadJetPt4 = fs->make("nTowersLeadJetPt4", "Number of Towers in Lead Jet pt 2.0", 100, 0, 100); - - h_nCalJets = fs->make("nCalJets", "Number of CalJets", 20, 0, 20); - - HBEneOOT = fs->make("HBEneOOT", "HBEneOOT", 200, -5, 10); - HEEneOOT = fs->make("HEEneOOT", "HEEneOOT", 200, -5, 10); - HFEneOOT = fs->make("HFEneOOT", "HFEneOOT", 200, -5, 10); - HOEneOOT = fs->make("HOEneOOT", "HOEneOOT", 200, -5, 10); - - HBEneOOTTh = fs->make("HBEneOOTTh", "HBEneOOTTh", 200, -5, 10); - HEEneOOTTh = fs->make("HEEneOOTTh", "HEEneOOTTh", 200, -5, 10); - HFEneOOTTh = fs->make("HFEneOOTTh", "HFEneOOTTh", 200, -5, 10); - HOEneOOTTh = fs->make("HOEneOOTTh", "HOEneOOTTh", 200, -5, 10); - - HBEneOOTTh1 = fs->make("HBEneOOTTh1", "HBEneOOT", 200, -5, 10); - HEEneOOTTh1 = fs->make("HEEneOOTTh1", "HEEneOOT", 200, -5, 10); - HFEneOOTTh1 = fs->make("HFEneOOTTh1", "HFEneOOT", 200, -5, 10); - HOEneOOTTh1 = fs->make("HOEneOOTTh1", "HOEneOOT", 200, -5, 10); - - HBEneTThr = fs->make("HBEneTThr", "HBEneTThr", 105, -5, 100); - HEEneTThr = fs->make("HEEneTThr", "HEEneTThr", 105, -5, 100); - HFEneTThr = fs->make("HFEneTThr", "HFEneTThr", 105, -5, 100); - - HBEne = fs->make("HBEne", "HBEne", 205, -5, 200); - HBEneTh = fs->make("HBEneTh", "HBEneTh", 205, -5, 200); - HBEneTh1 = fs->make("HBEneTh1", "HBEneTh1", 205, -5, 200); - HBEneX = fs->make("HBEneX", "HBEneX", 200, -5, 10); - HBEneY = fs->make("HBEneY", "HBEnedY", 200, -5, 10); - HBTime = fs->make("HBTime", "HBTime", 200, -100, 100); - HBTimeTh = fs->make("HBTimeTh", "HBTimeTh", 200, -100, 100); - HBTimeTh1 = fs->make("HBTimeTh1", "HBTimeTh1", 200, -100, 100); - HBTimeTh2 = fs->make("HBTimeTh2", "HBTimeTh2", 200, -100, 100); - HBTimeTh3 = fs->make("HBTimeTh3", "HBTimeTh3", 200, -100, 100); - HBTimeThR = fs->make("HBTimeThR", "HBTimeThR", 200, -100, 100); - HBTimeTh1R = fs->make("HBTimeTh1R", "HBTimeTh1R", 200, -100, 100); - HBTimeTh2R = fs->make("HBTimeTh2R", "HBTimeTh2R", 200, -100, 100); - HBTimeTh3R = fs->make("HBTimeTh3R", "HBTimeTh3R", 200, -100, 100); - - HBTimeFlagged = fs->make("HBTimeFlagged", "HBTimeFlagged", 200, -100, 100); - HBTimeThFlagged = fs->make("HBTimeThFlagged", "HBTimeThFlagged", 200, -100, 100); - HBTimeTh1Flagged = fs->make("HBTimeTh1Flagged", "HBTimeTh1Flagged", 200, -100, 100); - HBTimeTh2Flagged = fs->make("HBTimeTh2Flagged", "HBTimeTh2Flagged", 200, -100, 100); - - HBTimeFlagged2 = fs->make("HBTimeFlagged2", "HBTimeFlagged2", 200, -100, 100); - HBTimeThFlagged2 = fs->make("HBTimeThFlagged2", "HBTimeThFlagged2", 200, -100, 100); - HBTimeTh1Flagged2 = fs->make("HBTimeTh1Flagged2", "HBTimeTh1Flagged2", 200, -100, 100); - HBTimeTh2Flagged2 = fs->make("HBTimeTh2Flagged2", "HBTimeTh2Flagged2", 200, -100, 100); - - HBTimeX = fs->make("HBTimeX", "HBTimeX", 200, -100, 100); - HBTimeY = fs->make("HBTimeY", "HBTimeY", 200, -100, 100); - HEEne = fs->make("HEEne", "HEEne", 205, -5, 200); - HEEneTh = fs->make("HEEneTh", "HEEneTh", 205, -5, 200); - HEEneTh1 = fs->make("HEEneTh1", "HEEneTh1", 205, -5, 200); - HEEneX = fs->make("HEEneX", "HEEneX", 200, -5, 10); - HEEneY = fs->make("HEEneY", "HEEneY", 200, -5, 10); - HEposEne = fs->make("HEposEne", "HEposEne", 200, -5, 10); - HEnegEne = fs->make("HEnegEne", "HEnegEne", 200, -5, 10); - HETime = fs->make("HETime", "HETime", 200, -100, 100); - HETimeTh = fs->make("HETimeTh", "HETimeTh", 200, -100, 100); - HETimeTh1 = fs->make("HETimeTh1", "HETimeTh1", 200, -100, 100); - HETimeTh2 = fs->make("HETimeTh2", "HETimeTh2", 200, -100, 100); - HETimeTh3 = fs->make("HETimeTh3", "HETimeTh3", 200, -100, 100); - HETimeThR = fs->make("HETimeThR", "HETimeThR", 200, -100, 100); - HETimeTh1R = fs->make("HETimeTh1R", "HETimeTh1R", 200, -100, 100); - HETimeTh2R = fs->make("HETimeTh2R", "HETimeTh2R", 200, -100, 100); - HETimeTh3R = fs->make("HETimeTh3R", "HETimeTh3R", 200, -100, 100); - - HETimeFlagged = fs->make("HETimeFlagged", "HETimeFlagged", 200, -100, 100); - HETimeThFlagged = fs->make("HETimeThFlagged", "HETimeThFlagged", 200, -100, 100); - HETimeTh1Flagged = fs->make("HETimeTh1Flagged", "HETimeTh1Flagged", 200, -100, 100); - HETimeTh2Flagged = fs->make("HETimeTh2Flagged", "HETimeTh2Flagged", 200, -100, 100); - - HETimeFlagged2 = fs->make("HETimeFlagged2", "HETimeFlagged2", 200, -100, 100); - HETimeThFlagged2 = fs->make("HETimeThFlagged2", "HETimeThFlagged2", 200, -100, 100); - HETimeTh1Flagged2 = fs->make("HETimeTh1Flagged2", "HETimeTh1Flagged2", 200, -100, 100); - HETimeTh2Flagged2 = fs->make("HETimeTh2Flagged2", "HETimeTh2Flagged2", 200, -100, 100); - - HETimeX = fs->make("HETimeX", "HETimeX", 200, -100, 100); - HETimeY = fs->make("HETimeY", "HETimeY", 200, -100, 100); - HEposTime = fs->make("HEposTime", "HEposTime", 200, -100, 100); - HEnegTime = fs->make("HEnegTime", "HEnegTime", 200, -100, 100); - HOEne = fs->make("HOEne", "HOEne", 200, -5, 10); - HOEneTh = fs->make("HOEneTh", "HOEneTh", 200, -5, 10); - HOEneTh1 = fs->make("HOEneTh1", "HOEneTh1", 200, -5, 10); - HOTime = fs->make("HOTime", "HOTime", 200, -100, 100); - HOTimeTh = fs->make("HOTimeTh", "HOTimeTh", 200, -100, 100); - - // Histos for separating SiPMs and HPDs in HO: - HOSEne = fs->make("HOSEne", "HOSEne", 12000, -20, 100); - HOSTime = fs->make("HOSTime", "HOSTime", 200, -100, 100); - HOHEne = fs->make("HOHEne", "HOHEne", 12000, -20, 100); - HOHTime = fs->make("HOHTime", "HOHTime", 200, -100, 100); - - HOHr0Ene = fs->make("HOHr0Ene", "HOHr0Ene", 12000, -20, 100); - HOHr0Time = fs->make("HOHr0Time", "HOHr0Time", 200, -200, 200); - HOHrm1Ene = fs->make("HOHrm1Ene", "HOHrm1Ene", 12000, -20, 100); - HOHrm1Time = fs->make("HOHrm1Time", "HOHrm1Time", 200, -200, 200); - HOHrm2Ene = fs->make("HOHrm2Ene", "HOHrm2Ene", 12000, -20, 100); - HOHrm2Time = fs->make("HOHrm2Time", "HOHrm2Time", 200, -200, 200); - HOHrp1Ene = fs->make("HOHrp1Ene", "HOHrp1Ene", 12000, -20, 100); - HOHrp1Time = fs->make("HOHrp1Time", "HOHrp1Time", 200, -200, 200); - HOHrp2Ene = fs->make("HOHrp2Ene", "HOHrp2Ene", 12000, -20, 100); - HOHrp2Time = fs->make("HOHrp2Time", "HOHrp2Time", 200, -200, 200); - - HBTvsE = fs->make("HBTvsE", "HBTvsE", 305, -5, 300, 100, -100, 100); - HETvsE = fs->make("HETvsE", "HETvsE", 305, -5, 300, 100, -100, 100); - - HFTvsE = fs->make("HFTvsE", "HFTvsE", 305, -5, 300, 100, -100, 100); - HFTvsEFlagged = fs->make("HFTvsEFlagged", "HFTvsEFlagged", 305, -5, 300, 100, -100, 100); - HFTvsEFlagged2 = fs->make("HFTvsEFlagged2", "HFTvsEFlagged2", 305, -5, 300, 100, -100, 100); - - HFTvsEThr = fs->make("HFTvsEThr", "HFTvsEThr", 305, -5, 300, 100, -100, 100); - HFTvsEFlaggedThr = fs->make("HFTvsEFlaggedThr", "HFTvsEFlaggedThr", 305, -5, 300, 100, -100, 100); - HFTvsEFlagged2Thr = fs->make("HFTvsEFlagged2Thr", "HFTvsEFlagged2Thr", 305, -5, 300, 100, -100, 100); - - HOTvsE = fs->make("HOTvsE", "HOTvsE", 305, -5, 300, 100, -100, 100); - - HFvsZ = fs->make("HFvsZ", "HFvsZ", 100, -50, 50, 100, -50, 50); - - HOocc = fs->make("HOocc", "HOocc", 85, -42.5, 42.5, 70, 0.5, 70.5); - HBocc = fs->make("HBocc", "HBocc", 85, -42.5, 42.5, 70, 0.5, 70.5); - HEocc = fs->make("HEocc", "HEocc", 85, -42.5, 42.5, 70, 0.5, 70.5); - HFocc = fs->make("HFocc", "HFocc", 85, -42.5, 42.5, 70, 0.5, 70.5); - HFoccTime = fs->make("HFoccTime", "HFoccTime", 85, -42.5, 42.5, 70, 0.5, 70.5); - HFoccFlagged = fs->make("HFoccFlagged", "HFoccFlagged", 85, -42.5, 42.5, 70, 0.5, 70.5); - HFoccFlagged2 = fs->make("HFoccFlagged2", "HFoccFlagged2", 85, -42.5, 42.5, 70, 0.5, 70.5); - - HFEtaPhiNFlagged = fs->make("HFEtaPhiNFlagged", "HFEtaPhiNFlagged", 85, -42.5, 42.5, 70, 0.5, 70.5); - - // HFEtaFlagged = fs->make( "HFEtaFlagged", "HFEtaFlagged",85,-42.5,42.5,0, 10000); - HFEtaFlagged = fs->make("HFEtaFlagged", "HFEtaFlagged", 85, -42.5, 42.5); - HFEtaFlaggedL = fs->make("HFEtaFlaggedL", "HFEtaFlaggedL", 85, -42.5, 42.5); - HFEtaFlaggedLN = fs->make("HFEtaFlaggedLN", "HFEtaFlaggedLN", 85, -42.5, 42.5); - HFEtaFlaggedS = fs->make("HFEtaFlaggedS", "HFEtaFlaggedS", 85, -42.5, 42.5); - HFEtaFlaggedSN = fs->make("HFEtaFlaggedSN", "HFEtaFlaggedSN", 85, -42.5, 42.5); - - HFEtaNFlagged = fs->make("HFEtaNFlagged", "HFEtaNFlagged", 85, -42.5, 42.5, 0, 10000); - - HOoccOOT = fs->make("HOoccOOT", "HOoccOOT", 85, -42.5, 42.5, 70, 0.5, 70.5); - HBoccOOT = fs->make("HBoccOOT", "HBoccOOT", 85, -42.5, 42.5, 70, 0.5, 70.5); - HEoccOOT = fs->make("HEoccOOT", "HEoccOOT", 85, -42.5, 42.5, 70, 0.5, 70.5); - HFoccOOT = fs->make("HFoccOOT", "HFoccOOT", 85, -42.5, 42.5, 70, 0.5, 70.5); - - HFEnePMT0 = fs->make("HFEnePMT0", "HFEnePMT0", 210, -10, 200); - HFEnePMT1 = fs->make("HFEnePMT1", "HFEnePMT1", 210, -10, 200); - HFEnePMT2 = fs->make("HFEnePMT2", "HFEnePMT2", 210, -10, 200); - HFTimePMT0 = fs->make("HFTimePMT0", "HFTimePMT0", 200, -100, 100); - HFTimePMT1 = fs->make("HFTimePMT1", "HFTimePMT1", 200, -100, 100); - HFTimePMT2 = fs->make("HFTimePMT2", "HFTimePMT2", 200, -100, 100); - - HFEne = fs->make("HFEne", "HFEne", 210, -10, 200); - HFEneFlagged = fs->make("HFEneFlagged", "HFEneFlagged", 210, -10, 200); - HFEneFlagged2 = fs->make("HFEneFlagged2", "HFEneFlagged2", 210, -10, 200); - HFEneTh = fs->make("HFEneTh", "HFEneTh", 210, -10, 200); - HFEneTh1 = fs->make("HFEneTh1", "HFEneTh1", 210, -10, 200); - HFEneP = fs->make("HFEneP", "HFEneP", 200, -5, 10); - HFEneM = fs->make("HFEneM", "HFEneM", 200, -5, 10); - HFTime = fs->make("HFTime", "HFTime", 200, -100, 100); - PMTHits = fs->make("PMTHits", "PMTHits", 10, 0, 10); - HFTimeFlagged = fs->make("HFTimeFlagged", "HFTimeFlagged", 200, -100, 100); - - HFTimeFlagged2 = fs->make("HFTimeFlagged2", "HFTimeFlagged2", 200, -100, 100); - HFTimeThFlagged2 = fs->make("HFTimeThFlagged2", "HFTimeThFlagged2", 200, -100, 100); - HFTimeTh1Flagged2 = fs->make("HFTimeTh1Flagged2", "HFTimeTh1Flagged2", 200, -100, 100); - HFTimeTh2Flagged2 = fs->make("HFTimeTh2Flagged2", "HFTimeTh2Flagged2", 200, -100, 100); - HFTimeTh3Flagged2 = fs->make("HFTimeTh3Flagged2", "HFTimeTh3Flagged2", 200, -100, 100); - - HFTimeFlagged3 = fs->make("HFTimeFlagged3", "HFTimeFlagged3", 200, -100, 100); - HFTimeThFlagged3 = fs->make("HFTimeThFlagged3", "HFTimeThFlagged3", 200, -100, 100); - HFTimeTh1Flagged3 = fs->make("HFTimeTh1Flagged3", "HFTimeTh1Flagged3", 200, -100, 100); - HFTimeTh2Flagged3 = fs->make("HFTimeTh2Flagged3", "HFTimeTh2Flagged3", 200, -100, 100); - HFTimeTh3Flagged3 = fs->make("HFTimeTh3Flagged3", "HFTimeTh3Flagged3", 200, -100, 100); - - HFTimeThFlagged = fs->make("HFTimeThFlagged", "HFTimeThFlagged", 200, -100, 100); - HFTimeTh2Flagged = fs->make("HFTimeTh2Flagged", "HFTimeTh2Flagged", 200, -100, 100); - HFTimeTh3Flagged = fs->make("HFTimeTh3Flagged", "HFTimeTh3Flagged", 200, -100, 100); - - HFTimeThFlaggedR = fs->make("HFTimeThFlaggedR", "HFTimeThFlaggedR", 200, -100, 100); - HFTimeThFlaggedR1 = fs->make("HFTimeThFlaggedR1", "HFTimeThFlaggedR1", 200, -100, 100); - HFTimeThFlaggedR2 = fs->make("HFTimeThFlaggedR2", "HFTimeThFlaggedR2", 200, -100, 100); - HFTimeThFlaggedR3 = fs->make("HFTimeThFlaggedR3", "HFTimeThFlaggedR3", 200, -100, 100); - HFTimeThFlaggedR4 = fs->make("HFTimeThFlaggedR4", "HFTimeThFlaggedR4", 200, -100, 100); - HFTimeThFlaggedRM = fs->make("HFTimeThFlaggedRM", "HFTimeThFlaggedRM", 200, -100, 100); - TrkMultFlagged0 = fs->make("TrkMultFlagged0", "TrkMultFlagged0", 100, 0, 100); - TrkMultFlagged1 = fs->make("TrkMultFlagged1", "TrkMultFlagged1", 100, 0, 100); - TrkMultFlagged2 = fs->make("TrkMultFlagged2", "TrkMultFlagged2", 100, 0, 100); - TrkMultFlagged3 = fs->make("TrkMultFlagged3", "TrkMultFlagged3", 100, 0, 100); - TrkMultFlagged4 = fs->make("TrkMultFlagged4", "TrkMultFlagged4", 100, 0, 100); - TrkMultFlaggedM = fs->make("TrkMultFlaggedM", "TrkMultFlaggedM", 100, 0, 100); - HFTimeTh = fs->make("HFTimeTh", "HFTimeTh", 200, -100, 100); - HFTimeTh1 = fs->make("HFTimeTh1", "HFTimeTh1", 200, -100, 100); - HFTimeTh2 = fs->make("HFTimeTh2", "HFTimeTh2", 200, -100, 100); - HFTimeTh3 = fs->make("HFTimeTh3", "HFTimeTh3", 200, -100, 100); - HFTimeThR = fs->make("HFTimeThR", "HFTimeThR", 200, -100, 100); - HFTimeTh1R = fs->make("HFTimeTh1R", "HFTimeTh1R", 200, -100, 100); - HFTimeTh2R = fs->make("HFTimeTh2R", "HFTimeTh2R", 200, -100, 100); - HFTimeTh3R = fs->make("HFTimeTh3R", "HFTimeTh3R", 200, -100, 100); - HFTimeP = fs->make("HFTimeP", "HFTimeP", 100, -100, 50); - HFTimeM = fs->make("HFTimeM", "HFTimeM", 100, -100, 50); - HFTimePMa = fs->make("HFTimePMa", "HFTimePMa", 100, -100, 100); - HFTimePM = fs->make("HFTimePM", "HFTimePM", 100, -100, 100); - - // Histos for separating HF long/short fibers: - HFLEneAll = fs->make("HFLEneAll", "HFLEneAll", 210, -10, 200); - HFLEneAllF = fs->make("HFLEneAllF", "HFLEneAllF", 210, -10, 200); - HFSEneAll = fs->make("HFSEneAll", "HFSEneAll", 210, -10, 200); - HFSEneAllF = fs->make("HFSEneAllF", "HFSEneAllF", 210, -10, 200); - HFLEne = fs->make("HFLEne", "HFLEne", 200, -5, 10); - HFLTime = fs->make("HFLTime", "HFLTime", 200, -100, 100); - HFSEne = fs->make("HFSEne", "HFSEne", 200, -5, 10); - HFSTime = fs->make("HFSTime", "HFSTime", 200, -100, 100); - HFLSRatio = fs->make("HFLSRatio", "HFLSRatio", 220, -1.1, 1.1); - - HFOERatio = fs->make("HFOERatio", "HFOERatio", 2200, -1.1, 1.1); - - HFLvsS = fs->make("HFLvsS", "HFLvsS", 220, -20, 200, 220, -20, 200); - HFLEneNoS = fs->make("HFLEneNoS", "HFLEneNoS", 205, -5, 200); - HFSEneNoL = fs->make("HFSEneNoL", "HFSEneNoL", 205, -5, 200); - HFLEneNoSFlagged = fs->make("HFLEneNoSFlagged", "HFLEneNoSFlagged", 205, -5, 200); - HFSEneNoLFlagged = fs->make("HFSEneNoLFlagged", "HFSEneNoLFlagged", 205, -5, 200); - HFLEneNoSFlaggedN = fs->make("HFLEneNoSFlaggedN", "HFLEneNoSFlaggedN", 205, -5, 200); - HFSEneNoLFlaggedN = fs->make("HFSEneNoLFlaggedN", "HFSEneNoLFlaggedN", 205, -5, 200); - - EBEne = fs->make("EBEne", "EBEne", 200, -5, 10); - EBEneTh = fs->make("EBEneTh", "EBEneTh", 200, -5, 10); - EBEneX = fs->make("EBEneX", "EBEneX", 200, -5, 10); - EBEneY = fs->make("EBEneY", "EBEneY", 200, -5, 10); - EBTime = fs->make("EBTime", "EBTime", 200, -100, 100); - EBTimeTh = fs->make("EBTimeTh", "EBTimeTh", 200, -100, 100); - EBTimeX = fs->make("EBTimeX", "EBTimeX", 200, -100, 100); - EBTimeY = fs->make("EBTimeY", "EBTimeY", 200, -100, 100); - EEEne = fs->make("EEEne", "EEEne", 200, -5, 10); - EEEneTh = fs->make("EEEneTh", "EEEneTh", 200, -5, 10); - EEEneX = fs->make("EEEneX", "EEEneX", 200, -5, 10); - EEEneY = fs->make("EEEneY", "EEEneY", 200, -5, 10); - EEnegEne = fs->make("EEnegEne", "EEnegEne", 200, -5, 10); - EEposEne = fs->make("EEposEne", "EEposEne", 200, -5, 10); - EETime = fs->make("EETime", "EETime", 200, -100, 100); - EETimeTh = fs->make("EETimeTh", "EETimeTh", 200, -100, 100); - EETimeX = fs->make("EETimeX", "EETimeX", 200, -100, 100); - EETimeY = fs->make("EETimeY", "EETimeY", 200, -100, 100); - EEnegTime = fs->make("EEnegTime", "EEnegTime", 200, -100, 100); - EEposTime = fs->make("EEposTime", "EEposTime", 200, -100, 100); - - h_nTowersCal = fs->make("nTowersCal", "N Towers in Jet", 100, 0, 50); - h_EMFracCal = fs->make("EMFracCal", "EM Fraction in Jet", 100, -1.1, 1.1); - h_ptCal = fs->make("ptCal", "p_{T} of CalJet", 100, 0, 50); - h_etaCal = fs->make("etaCal", "#eta of CalJet", 100, -4, 4); - h_phiCal = fs->make("phiCal", "#phi of CalJet", 50, -M_PI, M_PI); - - h_nGenJets = fs->make("nGenJets", "Number of GenJets", 20, 0, 20); - - h_ptGen = fs->make("ptGen", "p_{T} of GenJet", 100, 0, 50); - h_etaGen = fs->make("etaGen", "#eta of GenJet", 100, -4, 4); - h_phiGen = fs->make("phiGen", "#phi of GenJet", 50, -M_PI, M_PI); - - h_ptGenL = fs->make("ptGenL", "p_{T} of GenJetL", 100, 0, 50); - h_etaGenL = fs->make("etaGenL", "#eta of GenJetL", 100, -4, 4); - h_phiGenL = fs->make("phiGenL", "#phi of GenJetL", 50, -M_PI, M_PI); - - h_jetEt = fs->make("jetEt", "Total Jet Et", 100, 0, 3000); - - h_jet1Pt = fs->make("jet1Pt", "Jet1 Pt", 100, 0, 1000); - h_jet2Pt = fs->make("jet2Pt", "Jet2 Pt", 100, 0, 1000); - h_jet1Eta = fs->make("jet1Eta", "Jet1 Eta", 50, -5, 5); - h_jet2Eta = fs->make("jet2Eta", "Jet2 Eta", 50, -5, 5); - h_jet1PtHLT = fs->make("jet1PtHLT", "Jet1 Pt HLT", 100, 0, 1000); - - h_TotalUnclusteredEt = fs->make("TotalUnclusteredEt", "Total Unclustered Et", 100, 0, 500); - h_UnclusteredEt = fs->make("UnclusteredEt", "Unclustered Et", 100, 0, 50); - h_UnclusteredEts = fs->make("UnclusteredEts", "Unclustered Et", 100, 0, 2); - - h_ClusteredE = fs->make("ClusteredE", "Clustered E", 200, 0, 20); - h_TotalClusteredE = fs->make("TotalClusteredE", "Total Clustered E", 200, 0, 100); - h_UnclusteredE = fs->make("UnclusteredE", "Unclustered E", 200, 0, 20); - h_TotalUnclusteredE = fs->make("TotalUnclusteredE", "Total Unclustered E", 200, 0, 100); - - jetHOEne = fs->make("jetHOEne", "HO Energy in Jet", 100, 0, 100); - jetEMFraction = fs->make("jetEMFraction", "Jet EM Fraction", 100, -1.1, 1.1); - NTowers = fs->make("NTowers", "Number of Towers", 100, 0, 100); - - h_EmEnergy = fs->make("EmEnergy", "Em Energy", 90, -45, 45, 73, 0, 73); - h_HadEnergy = fs->make("HadEnergy", "Had Energy", 90, -45, 45, 73, 0, 73); - - st_Pt = fs->make("st_Pt", "Pt", 200, 0, 200); - st_Constituents = fs->make("st_Constituents", "Constituents", 200, 0, 200); - st_Energy = fs->make("st_Energy", "Tower Energy", 200, 0, 200); - st_EmEnergy = fs->make("st_EmEnergy", "Tower EmEnergy", 200, 0, 200); - st_HadEnergy = fs->make("st_HadEnergy", "Tower HadEnergy", 200, 0, 200); - st_OuterEnergy = fs->make("st_OuterEnergy", "Tower OuterEnergy", 200, 0, 200); - st_Eta = fs->make("st_Eta", "Eta", 100, -4, 4); - st_Phi = fs->make("st_Phi", "Phi", 50, -M_PI, M_PI); - st_iEta = fs->make("st_iEta", "iEta", 60, -30, 30); - st_iPhi = fs->make("st_iPhi", "iPhi", 80, 0, 80); - st_Frac = fs->make("st_Frac", "Frac", 100, 0, 1); - - EBvHB = fs->make("EBvHB", "EB vs HB", 1000, 0, 4500000., 1000, 0, 1000000.); - EEvHE = fs->make("EEvHE", "EE vs HE", 1000, 0, 4500000., 1000, 0, 200000.); - - ECALvHCAL = fs->make("ECALvHCAL", "ECAL vs HCAL", 100, 0, 20000000., 100, -500000, 500000.); - ECALvHCALEta1 = fs->make("ECALvHCALEta1", "ECAL vs HCALEta1", 100, 0, 20000000., 100, -500000, 500000.); - ECALvHCALEta2 = fs->make("ECALvHCALEta2", "ECAL vs HCALEta2", 100, 0, 20000000., 100, -500000, 500000.); - ECALvHCALEta3 = fs->make("ECALvHCALEta3", "ECAL vs HCALEta3", 100, 0, 20000000., 100, -500000, 500000.); - - EMF_Eta = fs->make("EMF_Eta", "EMF Eta", 100, -50, 50, 0, 10); - EMF_Phi = fs->make("EMF_Phi", "EMF Phi", 100, 0, 100, 0, 10); - EMF_EtaX = fs->make("EMF_EtaX", "EMF EtaX", 100, -50, 50, 0, 10); - EMF_PhiX = fs->make("EMF_PhiX", "EMF PhiX", 100, 0, 100, 0, 10); - - HFTimeVsiEtaP = fs->make("HFTimeVsiEtaP", "HFTimeVsiEtaP", 13, 28.5, 41.5, -100, 100); - HFTimeVsiEtaM = fs->make("HFTimeVsiEtaM", "HFTimeVsiEtaM", 13, -41.5, -28.5, -100, 100); - - HFTimeVsiEtaP5 = fs->make("HFTimeVsiEtaP5", "HFTimeVsiEtaP5", 13, 28.5, 41.5, -100, 100); - HFTimeVsiEtaM5 = fs->make("HFTimeVsiEtaM5", "HFTimeVsiEtaM5", 13, -41.5, -28.5, -100, 100); - - HFTimeVsiEtaP20 = fs->make("HFTimeVsiEtaP20", "HFTimeVsiEtaP20", 13, 28.5, 41.5, -100, 100); - HFTimeVsiEtaM20 = fs->make("HFTimeVsiEtaM20", "HFTimeVsiEtaM20", 13, -41.5, -28.5, -100, 100); - - NPass = fs->make("NPass", "NPass", 3, -1, 1); - NTotal = fs->make("NTotal", "NTotal", 3, -1, 1); - NTime = fs->make("NTime", "NTime", 10, 0, 10); - - HFRecHitEne = fs->make("HFRecHitEne", "HFRecHitEne", 300, 0, 3000); - HFRecHitEneClean = fs->make("HFRecHitEneClean", "HFRecHitEneClean", 300, 0, 3000); - HFRecHitTime = fs->make("HFRecHitTime", "HFRecHitTime", 120, -60, 60); - - HFLongShortPhi = fs->make("HFLongShortPhi", "HFLongShortPhi", 73, 0, 73); - HFLongShortEta = fs->make("HFLongShortEta", "HFLongShortEta", 90, -45, 45); - HFLongShortEne = fs->make("HFLongShortEne", "HFLongShortEne", 300, 0, 3000); - HFLongShortTime = fs->make("HFLongShortTime", "HFLongShortTime", 120, -60, 60); - HFLongShortNHits = fs->make("HFLongShortNHits", "HFLongShortNHits", 30, 0, 30); - - HFDigiTimePhi = fs->make("HFDigiTimePhi", "HFDigiTimePhi", 73, 0, 73); - HFDigiTimeEta = fs->make("HFDigiTimeEta", "HFDigiTimeEta", 90, -45, 45); - HFDigiTimeEne = fs->make("HFDigiTimeEne", "HFDigiTimeEne", 300, 0, 3000); - HFDigiTimeTime = fs->make("HFDigiTimeTime", "HFDigiTimeTime", 120, -60, 60); - HFDigiTimeNHits = fs->make("HFDigiTimeNHits", "HFDigiTimeNHits", 30, 0, 30); - - totBNC = 0; - for (int i = 0; i < 4000; i++) - nBNC[i] = 0; -} - -// ************************ -// ************************ -void myJetAna::analyze(const edm::Event &evt, const edm::EventSetup &es) { - using namespace edm; - - bool Pass, Pass_HFTime, Pass_DiJet, Pass_BunchCrossing, Pass_Vertex; - - int EtaOk10, EtaOk13, EtaOk40; - - double LeadMass; - - double HFRecHit[100][100][2]; - int HFRecHitFlag[100][100][2]; - - double towerEtCut, towerECut, towerE; - - towerEtCut = 1.0; - towerECut = 1.0; - - unsigned int StableRun = 123732; - - double HBHEThreshold = 2.0; - double HFThreshold = 2.0; - double HOThreshold = 2.0; - double EBEEThreshold = 2.0; - - double HBHEThreshold1 = 4.0; - double HFThreshold1 = 4.0; - double HOThreshold1 = 4.0; - //double EBEEThreshold1 = 4.0; - - double HBHEThreshold2 = 10.0; - double HFThreshold2 = 10.0; - //double HOThreshold2 = 10.0; - //double EBEEThreshold2 = 10.0; - - double HBHEThreshold3 = 40.0; - double HFThreshold3 = 40.0; - //double HOThreshold3 = 40.0; - //double EBEEThreshold3 = 40.0; - - float minJetPt = 20.; - float minJetPt10 = 10.; - int jetInd, allJetInd; - - // Handle dcsStatus; - // evt.getByLabel("scalersRawToDigi", dcsStatus); - // std::cout << dcsStatus << std::endl; - // if (dcsStatus.isValid()) { - // } - - // DcsStatus dcsStatus; - // Handle dcsStatus; - // evt.getByLabel("dcsStatus", dcsStatus); - - math::XYZTLorentzVector p4tmp[2], p4cortmp[2]; - - // -------------------------------------------------------------- - // -------------------------------------------------------------- - - /*** - std::cout << ">>>> ANA: Run = " << evt.id().run() - << " Event = " << evt.id().event() - << " Bunch Crossing = " << evt.bunchCrossing() - << " Orbit Number = " << evt.orbitNumber() - << " Luminosity Block = " << evt.luminosityBlock() - << std::endl; - ***/ - - // ********************* - // *** Filter Event - // ********************* - Pass = false; - - /*** - if (evt.bunchCrossing()== 100) { - Pass = true; - } else { - Pass = false; - } - ***/ - - // *********************** - // *** Pass Trigger - // *********************** - - // **** Get the TriggerResults container - Handle triggerResults; - evt.getByLabel(theTriggerResultsLabel, triggerResults); - // evt.getByLabel("TriggerResults::HLT", triggerResults); - - if (triggerResults.isValid()) { - edm::LogInfo("myJetAna") << "trigger valid "; - // edm::TriggerNames triggerNames; // TriggerNames class - // triggerNames.init(*triggerResults); - unsigned int n = triggerResults->size(); - for (unsigned int i = 0; i != n; i++) { - /*** - std::cout << ">>> Trigger Name (" << i << ") = " << triggerNames.triggerName(i) - << " Accept = " << triggerResults->accept(i) - << std::endl; - ***/ - /**** - if (triggerResults->accept(i) == 1) { - std::cout << "+++ Trigger Name (" << i << ") = " << triggerNames.triggerName(i) - << " Accept = " << triggerResults->accept(i) - << std::endl; - } - ****/ - - // if (DEBUG) std::cout << triggerNames.triggerName(i) << std::endl; - - // if ( (triggerNames.triggerName(i) == "HLT_ZeroBias") || - // (triggerNames.triggerName(i) == "HLT_MinBias") || - // (triggerNames.triggerName(i) == "HLT_MinBiasHcal") ) { - } - - } else { - edm::Handle *tr = new edm::Handle; - triggerResults = (*tr); - - // std::cout << "triggerResults is not valid" << std::endl; - // std::cout << triggerResults << std::endl; - // std::cout << triggerResults.isValid() << std::endl; - - edm::LogInfo("myJetAna") << "trigger not valid " << std::endl; - edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, " - "automatically select events"; - - //return; - } - - /*** - Handle gtRecord; - evt.getByLabel("gtDigis",gtRecord); - const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord(); - - ***/ - - // ************************* - // *** Pass Bunch Crossing - // ************************* - - // *** Check Luminosity Section - if (evt.id().run() == 122294) - if ((evt.luminosityBlock() >= 37) && (evt.luminosityBlock() <= 43)) - Pass = true; - if (evt.id().run() == 122314) - if ((evt.luminosityBlock() >= 24) && (evt.luminosityBlock() <= 37)) - Pass = true; - if (evt.id().run() == 123575) - Pass = true; - if (evt.id().run() == 123596) - Pass = true; - - // *********** - if (evt.id().run() == 124009) { - if ((evt.bunchCrossing() == 51) || (evt.bunchCrossing() == 151) || (evt.bunchCrossing() == 2824)) { - Pass = true; - } - } - - if (evt.id().run() == 124020) { - if ((evt.bunchCrossing() == 51) || (evt.bunchCrossing() == 151) || (evt.bunchCrossing() == 2824)) { - Pass = true; - } - } - - if (evt.id().run() == 124024) { - if ((evt.bunchCrossing() == 51) || (evt.bunchCrossing() == 151) || (evt.bunchCrossing() == 2824)) { - Pass = true; - } - } - - if ((evt.bunchCrossing() == 51) || (evt.bunchCrossing() == 151) || (evt.bunchCrossing() == 2596) || - (evt.bunchCrossing() == 2724) || (evt.bunchCrossing() == 2824) || (evt.bunchCrossing() == 3487)) { - Pass_BunchCrossing = true; - } else { - Pass_BunchCrossing = false; - } - - // *********************** - // *** Pass HF Timing - // *********************** - - double HFM_ETime, HFP_ETime; - double HFM_E, HFP_E; - double HF_PMM; - - HFM_ETime = 0.; - HFM_E = 0.; - HFP_ETime = 0.; - HFP_E = 0.; - - for (int i = 0; i < 100; i++) { - for (int j = 0; j < 100; j++) { - HFRecHit[i][j][0] = -10.; - HFRecHit[i][j][1] = -10.; - HFRecHitFlag[i][j][0] = 0; - HFRecHitFlag[i][j][1] = 0; - } - } - - int nTime = 0; - int NHFLongShortHits; - int NHFDigiTimeHits; - NHFLongShortHits = 0; - NHFDigiTimeHits = 0; - - // edm::Handle vertexCollection; - - std::vector > colls; - evt.getManyByType(colls); - - std::vector >::iterator i; - for (i = colls.begin(); i != colls.end(); i++) { - for (HFRecHitCollection::const_iterator j = (*i)->begin(); j != (*i)->end(); j++) { - if (j->id().subdet() == HcalForward) { - HFRecHitEne->Fill(j->energy()); - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 0) && - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 0)) { - HFRecHitEneClean->Fill(j->energy()); - } - - HFRecHitTime->Fill(j->time()); - - int myFlag; - myFlag = j->flagField(HcalCaloFlagLabels::HFLongShort); - if (myFlag == 1) { - NHFLongShortHits++; - HFLongShortPhi->Fill(j->id().iphi()); - HFLongShortEta->Fill(j->id().ieta()); - HFLongShortEne->Fill(j->energy()); - HFLongShortTime->Fill(j->time()); - } - - myFlag = j->flagField(HcalCaloFlagLabels::HFDigiTime); - if (myFlag == 1) { - NHFDigiTimeHits++; - HFDigiTimePhi->Fill(j->id().iphi()); - HFDigiTimeEta->Fill(j->id().ieta()); - HFDigiTimeEne->Fill(j->energy()); - HFDigiTimeTime->Fill(j->time()); - } - - float en = j->energy(); - float time = j->time(); - if ((en > 20.) && (time > 20.)) { - HFoccTime->Fill(j->id().ieta(), j->id().iphi()); - nTime++; - } - HcalDetId id(j->detid().rawId()); - int ieta = id.ieta(); - int iphi = id.iphi(); - int depth = id.depth(); - - // Long: depth = 1 - // Short: depth = 2 - HFRecHit[ieta + 41][iphi][depth - 1] = en; - HFRecHitFlag[ieta + 41][iphi][depth - 1] = j->flagField(0); - - /**** - std::cout << "RecHit Flag = " - << j->flagField(0)a - << std::endl; - ***/ - - if (j->id().ieta() < 0) { - if (j->energy() > HFThreshold) { - HFM_ETime += j->energy() * j->time(); - HFM_E += j->energy(); - } - } else { - if (j->energy() > HFThreshold) { - HFP_ETime += j->energy() * j->time(); - HFP_E += j->energy(); - } - } - } - } - break; - } - - edm::LogInfo("myJetAna") << "N HF Hits" << NHFLongShortHits << " " << NHFDigiTimeHits; - HFLongShortNHits->Fill(NHFLongShortHits); - HFDigiTimeNHits->Fill(NHFDigiTimeHits); - - NTime->Fill(nTime); - - double OER = 0, OddEne, EvenEne; - int nOdd, nEven; - - for (int iphi = 0; iphi < 100; iphi++) { - OddEne = EvenEne = 0.; - nOdd = 0; - nEven = 0; - for (int ieta = 0; ieta < 100; ieta++) { - if (HFRecHit[ieta][iphi][0] > 1.0) { - if (ieta % 2 == 0) { - EvenEne += HFRecHit[ieta][iphi][0]; - nEven++; - } else { - OddEne += HFRecHit[ieta][iphi][0]; - nOdd++; - } - } - if (HFRecHit[ieta][iphi][1] > 1.0) { - if (ieta % 2 == 0) { - EvenEne += HFRecHit[ieta][iphi][1]; - nEven++; - } else { - OddEne += HFRecHit[ieta][iphi][1]; - nOdd++; - } - } - } - if (((OddEne + EvenEne) > 10.) && (nOdd > 1) && (nEven > 1)) { - OER = (OddEne - EvenEne) / (OddEne + EvenEne); - HFOERatio->Fill(OER); - } - } - - if ((HFP_E > 0.) && (HFM_E > 0.)) { - HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E); - HFTimePMa->Fill(HF_PMM); - } else { - HF_PMM = INVALID; - } - - if (fabs(HF_PMM) < 10.) { - Pass_HFTime = true; - } else { - Pass_HFTime = false; - } - - // ************************** - // *** Pass DiJet Criteria - // ************************** - double highestPt; - double nextPt; - // double dphi; - int nDiJet, nJet; - - nJet = 0; - nDiJet = 0; - - Handle caloJets; - evt.getByLabel(CaloJetAlgorithm, caloJets); - for (CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++cal) { - // TODO: verify first two jets are the leading jets - if (nJet == 0) - p4tmp[0] = cal->p4(); - if (nJet == 1) - p4tmp[1] = cal->p4(); - - if ((cal->pt() > 3.) && (fabs(cal->eta()) < 3.0)) { - nDiJet++; - } - nJet++; - } - - if (nDiJet > 1) { - //dphi = deltaPhi(p4tmp[0].phi(), p4tmp[1].phi()); - Pass_DiJet = true; - } else { - // dphi = INVALID; - Pass_DiJet = false; - } - - // ************************** - // *** Pass Vertex - // ************************** - double VTX = 0.; - int nVTX; - - edm::Handle vertexCollection; - evt.getByLabel("offlinePrimaryVertices", vertexCollection); - const reco::VertexCollection vC = *(vertexCollection.product()); - - // std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ; - - nVTX = vC.size(); - for (reco::VertexCollection::const_iterator vertex = vC.begin(); vertex != vC.end(); vertex++) { - VTX = vertex->z(); - } - - if ((fabs(VTX) < 20.) && (nVTX > 0)) { - Pass_Vertex = true; - } else { - Pass_Vertex = false; - } - - // *********************** - // *********************** - - nBNC[evt.bunchCrossing()]++; - totBNC++; - - // Pass = true; - - // *** Check for tracks - // edm::Handle trackCollection; - // evt.getByLabel("generalTracks", trackCollection); - // const reco::TrackCollection tC = *(trackCollection.product()); - // if ((Pass) && (tC.size()>1)) { - // } else { - // Pass = false; - // } - - // ******************************** - // *** Pixel Clusters - // ******************************** - edm::Handle > hClusterColl; - evt.getByLabel("siPixelClusters", hClusterColl); - auto const &clustColl = *(hClusterColl.product()); - - edm::Handle trackCollection; - evt.getByLabel("generalTracks", trackCollection); - auto const &tC = *(trackCollection.product()); - - // ************************** - // *** Event Passed Selection - // ************************** - - if (evt.id().run() == 1) { - if ((Pass_DiJet) && (Pass_Vertex)) { - Pass = true; - } else { - Pass = false; - } - //Pass = true; - - } else { - if ((Pass_BunchCrossing) && (Pass_HFTime) && (Pass_Vertex)) { - Pass = true; - } else { - Pass = false; - } - } - - /*** - std::cout << "+++ Result " - << " Event = " - << evt.id().run() - << " LS = " - << evt.luminosityBlock() - << " dphi = " - << dphi - << " Pass = " - << Pass - << std::endl; - ***/ - - NTotal->Fill(0); - - //Pass = false; - if ((tC.size() > 100) && (clustColl.size() > 1000)) - Pass = true; - //Pass = true; - - /**** - if (Pass_HFTime) { - Pass = true; - } else { - Pass = false; - } - ****/ - - // ************************** - // *** Noise Summary Object - // ************************** - - edm::Handle summary_h; - evt.getByLabel(hcalNoiseSummaryTag_, summary_h); - if (!summary_h.isValid()) { - throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseSummary.\n"; - // return true; - } - - const HcalNoiseSummary summary = *summary_h; - - bool Pass_NoiseSummary; - Pass_NoiseSummary = true; - if (summary.minE2Over10TS() < 0.7) { - Pass_NoiseSummary = false; - } - if (summary.maxE2Over10TS() > 0.96) { - Pass_NoiseSummary = false; - } - if (summary.maxHPDHits() >= 17) { - Pass_NoiseSummary = false; - } - if (summary.maxRBXHits() >= 999) { - Pass_NoiseSummary = false; - } - if (summary.maxHPDNoOtherHits() >= 10) { - Pass_NoiseSummary = false; - } - if (summary.maxZeros() >= 10) { - Pass_NoiseSummary = false; - } - if (summary.min25GeVHitTime() < -9999.0) { - Pass_NoiseSummary = false; - } - if (summary.max25GeVHitTime() > 9999.0) { - Pass_NoiseSummary = false; - } - if (summary.minRBXEMF() < 0.01) { - } - - if (Pass_NoiseSummary) { - Pass = false; - } else { - Pass = true; - } - - //Pass = true; - if (Pass) { - NPass->Fill(0); - - // ********************* - // *** Classify Event - // ********************* - int evtType = 0; - - Handle caloTowers; - evt.getByLabel("towerMaker", caloTowers); - - RBX RBXColl[36]; - HPD HPDColl[144]; - - for (int i = 0; i < 36; i++) { - RBXColl[i].et = 0; - RBXColl[i].hadEnergy = 0; - RBXColl[i].emEnergy = 0; - RBXColl[i].hcalTime = 0; - RBXColl[i].ecalTime = 0; - RBXColl[i].nTowers = 0; - } - for (int i = 0; i < 144; i++) { - HPDColl[i].et = 0; - HPDColl[i].hadEnergy = 0; - HPDColl[i].emEnergy = 0; - HPDColl[i].hcalTime = 0; - HPDColl[i].ecalTime = 0; - HPDColl[i].nTowers = 0; - } - - double ETotal, emFrac; - double HCALTotalCaloTowerE, ECALTotalCaloTowerE; - double HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1; - double HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2; - double HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3; - - ETotal = 0.; - emFrac = 0.; - - HCALTotalCaloTowerE = 0; - ECALTotalCaloTowerE = 0; - HCALTotalCaloTowerE_Eta1 = 0.; - ECALTotalCaloTowerE_Eta1 = 0.; - HCALTotalCaloTowerE_Eta2 = 0.; - ECALTotalCaloTowerE_Eta2 = 0.; - HCALTotalCaloTowerE_Eta3 = 0.; - ECALTotalCaloTowerE_Eta3 = 0.; - - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); tower != caloTowers->end(); tower++) { - ETotal += tower->hadEnergy(); - ETotal += tower->emEnergy(); - } - - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); tower != caloTowers->end(); tower++) { - // Raw tower energy without grouping or thresholds - if (abs(tower->ieta()) < 100) - EMF_Eta->Fill(tower->ieta(), emFrac); - - if (abs(tower->ieta()) < 15) { - towerHadEnHB->Fill(tower->hadEnergy()); - towerEmEnHB->Fill(tower->emEnergy()); - } - if ((abs(tower->ieta()) > 17) && ((abs(tower->ieta()) < 30))) { - towerHadEnHE->Fill(tower->hadEnergy()); - towerEmEnHE->Fill(tower->emEnergy()); - } - if (abs(tower->ieta()) > 29) { - towerHadEnHF->Fill(tower->hadEnergy()); - towerEmEnHF->Fill(tower->emEnergy()); - } - - towerHadEn->Fill(tower->hadEnergy()); - towerEmEn->Fill(tower->emEnergy()); - towerOuterEn->Fill(tower->outerEnergy()); - - // towerHadEt->Fill(tower->hadEt()); - // towerEmEt->Fill(tower->emEt()); - // towerOuterEt->Fill(tower->outerEt()); - - if ((tower->emEnergy() + tower->hadEnergy()) != 0) { - emFrac = tower->emEnergy() / (tower->emEnergy() + tower->hadEnergy()); - towerEmFrac->Fill(emFrac); - } else { - emFrac = 0.; - } - - /*** - std::cout << "ETotal = " << ETotal - << " EMF = " << emFrac - << " EM = " << tower->emEnergy() - << " Tot = " << tower->emEnergy()+tower->hadEnergy() - << " ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << std::endl; - ***/ - - if (abs(tower->iphi()) < 100) - EMF_Phi->Fill(tower->iphi(), emFrac); - if (abs(tower->ieta()) < 100) - EMF_Eta->Fill(tower->ieta(), emFrac); - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - edm::LogInfo("myJetAna") << "Bunch Crossing = " << evt.bunchCrossing() - << " Orbit Number = " << evt.orbitNumber(); - - if (abs(tower->iphi()) < 100) - EMF_PhiX->Fill(tower->iphi(), emFrac); - if (abs(tower->ieta()) < 100) - EMF_EtaX->Fill(tower->ieta(), emFrac); - } - - HCALTotalCaloTowerE += tower->hadEnergy(); - ECALTotalCaloTowerE += tower->emEnergy(); - - towerE = tower->hadEnergy() + tower->emEnergy(); - if (tower->et() > towerEtCut) - caloEtaEt->Fill(tower->eta()); - if (towerE > towerECut) - caloEta->Fill(tower->eta()); - caloPhi->Fill(tower->phi()); - - if (fabs(tower->eta()) < 1.3) { - HCALTotalCaloTowerE_Eta1 += tower->hadEnergy(); - ECALTotalCaloTowerE_Eta1 += tower->emEnergy(); - } - if ((fabs(tower->eta()) >= 1.3) && (fabs(tower->eta()) < 2.5)) { - HCALTotalCaloTowerE_Eta2 += tower->hadEnergy(); - ECALTotalCaloTowerE_Eta2 += tower->emEnergy(); - } - if (fabs(tower->eta()) > 2.5) { - HCALTotalCaloTowerE_Eta3 += tower->hadEnergy(); - ECALTotalCaloTowerE_Eta3 += tower->emEnergy(); - } - - /*** - std::cout << "had = " << tower->hadEnergy() - << " em = " << tower->emEnergy() - << " fabs(eta) = " << fabs(tower->eta()) - << " ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << std::endl; - ***/ - - if ((tower->hadEnergy() + tower->emEnergy()) > 2.0) { - int iRBX = tower->iphi(); - iRBX = iRBX - 2; - if (iRBX == 0) - iRBX = 17; - if (iRBX == -1) - iRBX = 18; - iRBX = (iRBX - 1) / 4; - - if (tower->ieta() < 0) - iRBX += 18; - if (iRBX < 36) { - RBXColl[iRBX].et += tower->et(); - RBXColl[iRBX].hadEnergy += tower->hadEnergy(); - RBXColl[iRBX].emEnergy += tower->emEnergy(); - RBXColl[iRBX].hcalTime += tower->hcalTime(); - RBXColl[iRBX].ecalTime += tower->ecalTime(); - RBXColl[iRBX].nTowers++; - } - /*** - std::cout << "iRBX = " << iRBX << " " - << "ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << " et = " << tower->et() - << std::endl; - ***/ - int iHPD = tower->iphi(); - if (tower->ieta() < 0) - iHPD = iHPD + 72; - if (iHPD < 144) { - HPDColl[iHPD].et += tower->et(); - HPDColl[iHPD].hadEnergy += tower->hadEnergy(); - HPDColl[iHPD].emEnergy += tower->emEnergy(); - HPDColl[iHPD].hcalTime += tower->hcalTime(); - HPDColl[iHPD].ecalTime += tower->ecalTime(); - HPDColl[iHPD].nTowers++; - } - /*** - std::cout << "iHPD = " << iHPD << " " - << "ieta/iphi = " << tower->ieta() << " / " << tower->iphi() - << " et = " << tower->et() - << std::endl; - ***/ - } - } - - ECALvHCAL->Fill(HCALTotalCaloTowerE, ECALTotalCaloTowerE); - ECALvHCALEta1->Fill(HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1); - ECALvHCALEta2->Fill(HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2); - ECALvHCALEta3->Fill(HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3); - - /*** - std::cout << " Total CaloTower Energy : " - << " ETotal= " << ETotal - << " HCAL= " << HCALTotalCaloTowerE - << " ECAL= " << ECALTotalCaloTowerE - << std::endl; - ***/ - - /*** - << " HCAL Eta1 = " << HCALTotalCaloTowerE_Eta1 - << " ECAL= " << ECALTotalCaloTowerE_Eta1 - << " HCAL Eta2 = " << HCALTotalCaloTowerE_Eta2 - << " ECAL= " << ECALTotalCaloTowerE_Eta2 - << " HCAL Eta3 = " << HCALTotalCaloTowerE_Eta3 - << " ECAL= " << ECALTotalCaloTowerE_Eta3 - << std::endl; - ***/ - - // Loop over the RBX Collection - int nRBX = 0; - int nTowers = 0; - for (int i = 0; i < 36; i++) { - RBX_et->Fill(RBXColl[i].et); - RBX_hadEnergy->Fill(RBXColl[i].hadEnergy); - RBX_hcalTime->Fill(RBXColl[i].hcalTime / RBXColl[i].nTowers); - RBX_nTowers->Fill(RBXColl[i].nTowers); - if (RBXColl[i].hadEnergy > 3.0) { - nRBX++; - nTowers = RBXColl[i].nTowers; - } - } - RBX_N->Fill(nRBX); - if ((nRBX == 1) && (nTowers > 24)) { - evtType = 1; - } - - // Loop over the HPD Collection - int nHPD = 0; - for (int i = 0; i < 144; i++) { - HPD_et->Fill(HPDColl[i].et); - HPD_hadEnergy->Fill(HPDColl[i].hadEnergy); - HPD_hcalTime->Fill(HPDColl[i].hcalTime / HPDColl[i].nTowers); - HPD_nTowers->Fill(HPDColl[i].nTowers); - if (HPDColl[i].hadEnergy > 3.0) { - nHPD++; - nTowers = HPDColl[i].nTowers; - } - } - HPD_N->Fill(nHPD); - if ((nHPD == 1) && (nTowers > 6)) { - evtType = 2; - edm::LogInfo("category") << " nHPD = " << nHPD << " Towers = " << nTowers << " Type = " << evtType; - } - - // ************************************************************** - // ** Access Trigger Information - // ************************************************************** - - // **** Get the TriggerResults container - Handle triggerResults; - evt.getByLabel(theTriggerResultsLabel, triggerResults); - - Int_t JetLoPass = 0; - - if (triggerResults.isValid()) { - edm::LogInfo("myJetAna") << "trigger valid "; - // edm::TriggerNames triggerNames; // TriggerNames class - // triggerNames.init(*triggerResults); - unsigned int n = triggerResults->size(); - for (unsigned int i = 0; i != n; i++) { - /*** - std::cout << " Trigger Name = " << triggerNames.triggerName(i) - << " Accept = " << triggerResults->accept(i) - << std::endl; - ***/ - - // if (DEBUG) std::cout << triggerNames.triggerName(i) << std::endl; - - /*** - if ( triggerNames.triggerName(i) == "HLT_Jet30" ) { - JetLoPass = triggerResults->accept(i); - if (DEBUG) std::cout << "Found HLT_Jet30 " - << JetLoPass - << std::endl; - } - ***/ - } - - } else { - edm::Handle *tr = new edm::Handle; - triggerResults = (*tr); - - // std::cout << "triggerResults is not valid" << std::endl; - // std::cout << triggerResults << std::endl; - // std::cout << triggerResults.isValid() << std::endl; - - edm::LogInfo("myJetAna") << "trigger not valid "; - edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, " - "automatically select events"; - //return; - } - - /**** - Handle gtRecord_h; - evt.getByType (gtRecord_h); // assume only one L1 trigger record here - const L1GlobalTriggerReadoutRecord* gtRecord = gtRecord_h.failedToGet () ? 0 : &*gtRecord_h; - - if (gtRecord) { // object is available - for (int l1bit = 0; l1bit < 128; ++l1bit) { - if (gtRecord->decisionWord() [l1bit]) h_L1TrigBit->Fill (l1bit); - } - } - ****/ - - // ************************************************************** - // ** Loop over the two leading CaloJets and fill some histograms - // ************************************************************** - Handle caloJets; - evt.getByLabel(CaloJetAlgorithm, caloJets); - - jetInd = 0; - allJetInd = 0; - - EtaOk10 = 0; - EtaOk13 = 0; - EtaOk40 = 0; - - // const JetCorrector* corrector = - // JetCorrector::getJetCorrector (JetCorrectionService, es); - - highestPt = 0.0; - nextPt = 0.0; - - for (CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++cal) { - // double scale = corrector->correction (*cal); - double scale = 1.0; - double corPt = scale * cal->pt(); - // double corPt = cal->pt(); - // cout << "Pt = " << cal->pt() << endl; - - if (corPt > highestPt) { - nextPt = highestPt; - p4cortmp[1] = p4cortmp[0]; - highestPt = corPt; - p4cortmp[0] = scale * cal->p4(); - } else if (corPt > nextPt) { - nextPt = corPt; - p4cortmp[1] = scale * cal->p4(); - } - - allJetInd++; - if (allJetInd == 1) { - h_jet1Pt->Fill(cal->pt()); - h_jet1Eta->Fill(cal->eta()); - if (JetLoPass != 0) - h_jet1PtHLT->Fill(cal->pt()); - p4tmp[0] = cal->p4(); - if (fabs(cal->eta()) < 1.0) - EtaOk10++; - if (fabs(cal->eta()) < 1.3) - EtaOk13++; - if (fabs(cal->eta()) < 4.0) - EtaOk40++; - } - if (allJetInd == 2) { - h_jet2Pt->Fill(cal->pt()); - h_jet2Eta->Fill(cal->eta()); - p4tmp[1] = cal->p4(); - if (fabs(cal->eta()) < 1.0) - EtaOk10++; - if (fabs(cal->eta()) < 1.3) - EtaOk13++; - if (fabs(cal->eta()) < 4.0) - EtaOk40++; - } - - if (cal->pt() > minJetPt) { - const std::vector jetCaloRefs = cal->getCaloConstituents(); - int nConstituents = jetCaloRefs.size(); - h_nTowersCal->Fill(nConstituents); - h_EMFracCal->Fill(cal->emEnergyFraction()); - h_ptCal->Fill(cal->pt()); - h_etaCal->Fill(cal->eta()); - h_phiCal->Fill(cal->phi()); - jetInd++; - } - } - - h_nCalJets->Fill(jetInd); - - if (jetInd > 1) { - LeadMass = (p4tmp[0] + p4tmp[1]).mass(); - dijetMass->Fill(LeadMass); - } - - // ****************** - // *** Jet Properties - // ****************** - - int nTow1, nTow2, nTow3, nTow4; - // Handle jets; - // evt.getByLabel( CaloJetAlgorithm, jets ); - - // ********************************************************* - // --- Loop over jets and make a list of all the used towers - int jjet = 0; - for (CaloJetCollection::const_iterator ijet = caloJets->begin(); ijet != caloJets->end(); ijet++) { - jjet++; - - float hadEne = ijet->hadEnergyInHB() + ijet->hadEnergyInHO() + ijet->hadEnergyInHE() + ijet->hadEnergyInHF(); - float emEne = ijet->emEnergyInEB() + ijet->emEnergyInEE() + ijet->emEnergyInHF(); - float had = ijet->energyFractionHadronic(); - float j_et = ijet->et(); - - // *** Barrel - if (fabs(ijet->eta()) < 1.3) { - totEneLeadJetEta1->Fill(hadEne + emEne); - hadEneLeadJetEta1->Fill(ijet->hadEnergyInHB()); - emEneLeadJetEta1->Fill(ijet->emEnergyInEB()); - if (ijet->pt() > minJetPt10) - hadFracEta1->Fill(had); - } - - // *** EndCap - if ((fabs(ijet->eta()) > 1.3) && (fabs(ijet->eta()) < 3.)) { - totEneLeadJetEta2->Fill(hadEne + emEne); - hadEneLeadJetEta2->Fill(ijet->hadEnergyInHE()); - emEneLeadJetEta2->Fill(ijet->emEnergyInEE()); - if (ijet->pt() > minJetPt10) - hadFracEta2->Fill(had); - } - - // *** Forward - if (fabs(ijet->eta()) > 3.) { - totEneLeadJetEta3->Fill(hadEne + emEne); - hadEneLeadJetEta3->Fill(hadEne); - emEneLeadJetEta3->Fill(emEne); - if (ijet->pt() > minJetPt10) - hadFracEta3->Fill(had); - } - - // *** CaloTowers in Jet - const std::vector jetCaloRefs = ijet->getCaloConstituents(); - int nConstituents = jetCaloRefs.size(); - NTowers->Fill(nConstituents); - - if (jjet == 1) { - nTow1 = nTow2 = nTow3 = nTow4 = 0; - for (int i = 0; i < nConstituents; i++) { - float et = jetCaloRefs[i]->et(); - - if (et > 0.5) - nTow1++; - if (et > 1.0) - nTow2++; - if (et > 1.5) - nTow3++; - if (et > 2.0) - nTow4++; - - hf_TowerJetEt->Fill(et / j_et); - } - - nTowersLeadJetPt1->Fill(nTow1); - nTowersLeadJetPt2->Fill(nTow2); - nTowersLeadJetPt3->Fill(nTow3); - nTowersLeadJetPt4->Fill(nTow4); - } - } - - // ********************** - // *** Unclustered Energy - // ********************** - - double SumPtJet(0); - - double SumEtNotJets(0); - double SumEtJets(0); - double SumEtTowers(0); - double TotalClusteredE(0); - double TotalUnclusteredE(0); - - double sumJetPx(0); - double sumJetPy(0); - - double sumTowerAllPx(0); - double sumTowerAllPy(0); - - double sumTowerAllEx(0); - double sumTowerAllEy(0); - - // double HCALTotalE; - double HBTotalE, HETotalE, HOTotalE, HFTotalE; - // double ECALTotalE; - double EBTotalE, EETotalE; - - std::vector UsedTowerList; - std::vector TowerUsedInJets; - std::vector TowerNotUsedInJets; - - // ********************* - // *** Hcal recHits - // ********************* - - edm::Handle spd; - - // HCALTotalE = 0.; - HBTotalE = HETotalE = HOTotalE = HFTotalE = 0.; - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i = colls.begin(); i != colls.end(); i++) { - for (HBHERecHitCollection::const_iterator j = (*i)->begin(); j != (*i)->end(); j++) { - // std::cout << *j << std::endl; - if (j->id().subdet() == HcalBarrel) { - HBEne->Fill(j->energy()); - HBTime->Fill(j->time()); - if (!Pass_NoiseSummary) - HBTimeFlagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HBTimeFlagged->Fill(j->time()); - HBTvsE->Fill(j->energy(), j->time()); - - if (j->time() > 20.) - HBEneTThr->Fill(j->energy()); - - if ((j->time() < -25.) || (j->time() > 75.)) { - HBEneOOT->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HBEneOOTTh->Fill(j->energy()); - if (j->energy() > HBHEThreshold1) - HBEneOOTTh1->Fill(j->energy()); - } - if (j->energy() > HBHEThreshold) { - HBEneTh->Fill(j->energy()); - HBTimeTh->Fill(j->time()); - if (!Pass_NoiseSummary) - HBTimeThFlagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HBTimeThFlagged->Fill(j->time()); - - if (evt.id().run() >= StableRun) - HBTimeThR->Fill(j->time()); - HBTotalE += j->energy(); - HBocc->Fill(j->id().ieta(), j->id().iphi()); - hitEta->Fill(j->id().ieta()); - hitPhi->Fill(j->id().iphi()); - } - if (j->energy() > HBHEThreshold1) { - HBEneTh1->Fill(j->energy()); - HBTimeTh1->Fill(j->time()); - if (!Pass_NoiseSummary) - HBTimeTh1Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HBTimeTh1Flagged->Fill(j->time()); - - if (evt.id().run() >= StableRun) - HBTimeTh1R->Fill(j->time()); - if ((j->time() < -25.) || (j->time() > 75.)) { - HBoccOOT->Fill(j->id().ieta(), j->id().iphi()); - } - } - if (j->energy() > HBHEThreshold2) { - HBTimeTh2->Fill(j->time()); - if (!Pass_NoiseSummary) - HBTimeTh2Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HBTimeTh2Flagged->Fill(j->time()); - - if (evt.id().run() >= StableRun) - HBTimeTh2R->Fill(j->time()); - } - if (j->energy() > HBHEThreshold3) { - HBTimeTh3->Fill(j->time()); - if (evt.id().run() >= StableRun) - HBTimeTh3R->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - HBEneX->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HBTimeX->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 457)) { - HBEneY->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HBTimeY->Fill(j->time()); - } - } - if (j->id().subdet() == HcalEndcap) { - HEEne->Fill(j->energy()); - HETime->Fill(j->time()); - if (!Pass_NoiseSummary) - HETimeFlagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HETimeFlagged->Fill(j->time()); - HETvsE->Fill(j->energy(), j->time()); - - if (j->time() > 20.) - HEEneTThr->Fill(j->energy()); - - if ((j->time() < -25.) || (j->time() > 75.)) { - HEEneOOT->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HEEneOOTTh->Fill(j->energy()); - if (j->energy() > HBHEThreshold1) - HEEneOOTTh1->Fill(j->energy()); - } - - if (j->energy() > HBHEThreshold) { - HEEneTh->Fill(j->energy()); - HETimeTh->Fill(j->time()); - if (!Pass_NoiseSummary) - HETimeThFlagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HETimeThFlagged->Fill(j->time()); - - if (evt.id().run() >= StableRun) - HETimeThR->Fill(j->time()); - HETotalE += j->energy(); - HEocc->Fill(j->id().ieta(), j->id().iphi()); - hitEta->Fill(j->id().ieta()); - hitPhi->Fill(j->id().iphi()); - } - if (j->energy() > HBHEThreshold1) { - HEEneTh1->Fill(j->energy()); - HETimeTh1->Fill(j->time()); - if (!Pass_NoiseSummary) - HETimeTh1Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HETimeTh1Flagged->Fill(j->time()); - if (evt.id().run() >= StableRun) - HETimeTh1R->Fill(j->time()); - if ((j->time() < -25.) || (j->time() > 75.)) { - HEoccOOT->Fill(j->id().ieta(), j->id().iphi()); - } - } - if (j->energy() > HBHEThreshold2) { - HETimeTh2->Fill(j->time()); - if (!Pass_NoiseSummary) - HETimeTh2Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) - HETimeTh2Flagged->Fill(j->time()); - if (evt.id().run() >= StableRun) - HETimeTh2R->Fill(j->time()); - } - if (j->energy() > HBHEThreshold3) { - HETimeTh3->Fill(j->time()); - if (evt.id().run() >= StableRun) - HETimeTh3R->Fill(j->time()); - } - - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - HEEneX->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HETimeX->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 457)) { - HEEneY->Fill(j->energy()); - if (j->energy() > HBHEThreshold) - HETimeY->Fill(j->time()); - } - - // Fill +-HE separately - if (j->id().ieta() < 0) { - HEnegEne->Fill(j->energy()); - if (j->energy() > HBHEThreshold) { - HEnegTime->Fill(j->time()); - } - } else { - HEposEne->Fill(j->energy()); - if (j->energy() > HBHEThreshold) { - HEposTime->Fill(j->time()); - } - } - } - - /*** - std::cout << j->id() << " " - << j->id().subdet() << " " - << j->id().ieta() << " " - << j->id().iphi() << " " - << j->id().depth() << " " - << j->energy() << " " - << j->time() << std::endl; - ****/ - } - } - - HFM_ETime = 0.; - HFM_E = 0.; - HFP_ETime = 0.; - HFP_E = 0.; - - int NPMTHits; - NPMTHits = 0; - std::vector > collsNPMT; - evt.getManyByType(collsNPMT); - std::vector >::iterator iNPMT; - for (iNPMT = collsNPMT.begin(); iNPMT != collsNPMT.end(); iNPMT++) { - for (HFRecHitCollection::const_iterator j = (*iNPMT)->begin(); j != (*iNPMT)->end(); j++) { - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - NPMTHits++; - } - } - break; - } - PMTHits->Fill(NPMTHits); - - std::vector > collsHFRecHit; - evt.getManyByType(collsHFRecHit); - std::vector >::iterator iHFRecHit; - for (iHFRecHit = collsHFRecHit.begin(); iHFRecHit != collsHFRecHit.end(); iHFRecHit++) { - for (HFRecHitCollection::const_iterator j = (*iHFRecHit)->begin(); j != (*iHFRecHit)->end(); j++) { - /**** - float en = j->energy(); - HcalDetId id(j->detid().rawId()); - int ieta = id.ieta(); - int iphi = id.iphi(); - int depth = id.depth(); - *****/ - - // std::cout << *j << std::endl; - - if (j->id().subdet() == HcalForward) { - if (NPMTHits == 1) { - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - HFEtaFlagged->Fill(j->id().ieta()); - if (j->id().depth() == 1) - HFEtaFlaggedL->Fill(j->id().ieta()); - if (j->id().depth() == 2) - HFEtaFlaggedS->Fill(j->id().ieta()); - } else { - HFEtaNFlagged->Fill(j->id().ieta(), j->energy()); - HFEtaPhiNFlagged->Fill(j->id().ieta(), j->id().iphi(), j->energy()); - } - } - if (j->energy() > 20.) { - if (NPMTHits == 0) { - HFEnePMT0->Fill(j->energy()); - HFTimePMT0->Fill(j->time()); - } - if (NPMTHits == 1) { - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - HFEnePMT1->Fill(j->energy()); - HFTimePMT1->Fill(j->time()); - } - } - if (NPMTHits > 1) { - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - HFEnePMT2->Fill(j->energy()); - HFTimePMT2->Fill(j->time()); - } - } - } - - HFTimeVsiEtaP->Fill(j->id().ieta(), j->time()); - HFTimeVsiEtaM->Fill(j->id().ieta(), j->time()); - - if (j->energy() > 5.) { - HFTimeVsiEtaP5->Fill(j->id().ieta(), j->time()); - HFTimeVsiEtaM5->Fill(j->id().ieta(), j->time()); - } - - if (j->energy() > 20.) { - HFTimeVsiEtaP20->Fill(j->id().ieta(), j->time()); - HFTimeVsiEtaM20->Fill(j->id().ieta(), j->time()); - } - - HFEne->Fill(j->energy()); - HFTime->Fill(j->time()); - HFTvsE->Fill(j->energy(), j->time()); - - if (j->time() > 20.) - HFEneTThr->Fill(j->energy()); - - if (j->energy() > 10.) - HFTvsEThr->Fill(j->energy(), j->time()); - - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - HFEneFlagged->Fill(j->energy()); - HFoccFlagged->Fill(j->id().ieta(), j->id().iphi()); - HFTimeFlagged->Fill(j->time()); - HFTvsEFlagged->Fill(j->energy(), j->time()); - - // std::cout << "Flagged: " << j->energy() << " " - // << j->time() - // << std::endl; - } - - if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) { - HFEneFlagged2->Fill(j->energy()); - HFoccFlagged2->Fill(j->id().ieta(), j->id().iphi()); - HFTimeFlagged2->Fill(j->time()); - HFTvsEFlagged2->Fill(j->energy(), j->time()); - if (j->energy() > 10.) - HFTvsEFlagged2Thr->Fill(j->energy(), j->time()); - } - - if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) { - HFTimeFlagged3->Fill(j->time()); - } - - if (j->energy() > HFThreshold) { - HFEneTh->Fill(j->energy()); - HFTimeTh->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) - HFTimeThFlagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) - HFTimeThFlagged3->Fill(j->time()); - - if (evt.id().run() >= StableRun) - HFTimeThR->Fill(j->time()); - if ((j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) || - (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1)) { - HFTimeThFlagged->Fill(j->time()); - - if (j->energy() > HFThreshold2) - HFTimeTh2Flagged->Fill(j->time()); - if (j->energy() > HFThreshold3) - HFTimeTh3Flagged->Fill(j->time()); - - if (evt.id().run() >= StableRun) { - HFTimeThFlaggedR->Fill(j->time()); - if (NPMTHits == 1) - HFTimeThFlaggedR1->Fill(j->time()); - if (NPMTHits == 2) - HFTimeThFlaggedR2->Fill(j->time()); - if (NPMTHits == 3) - HFTimeThFlaggedR3->Fill(j->time()); - if (NPMTHits == 4) - HFTimeThFlaggedR4->Fill(j->time()); - if (NPMTHits > 1) - HFTimeThFlaggedRM->Fill(j->time()); - } - } - HFTotalE += j->energy(); - HFocc->Fill(j->id().ieta(), j->id().iphi()); - hitEta->Fill(j->id().ieta()); - hitPhi->Fill(j->id().iphi()); - } - - if (j->energy() > HFThreshold1) { - HFEneTh1->Fill(j->energy()); - HFTimeTh1->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) - HFTimeTh1Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) - HFTimeTh1Flagged3->Fill(j->time()); - if (evt.id().run() >= StableRun) - HFTimeTh1R->Fill(j->time()); - if ((j->time() < -20.) || (j->time() > 20.)) { - HFoccOOT->Fill(j->id().ieta(), j->id().iphi()); - } - } - if (j->energy() > HFThreshold2) { - HFTimeTh2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) - HFTimeTh2Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) - HFTimeTh2Flagged3->Fill(j->time()); - if (evt.id().run() >= StableRun) - HFTimeTh2R->Fill(j->time()); - } - if (j->energy() > HFThreshold3) { - HFTimeTh3->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) - HFTimeTh3Flagged2->Fill(j->time()); - if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) - HFTimeTh3Flagged3->Fill(j->time()); - if (evt.id().run() >= StableRun) - HFTimeTh3R->Fill(j->time()); - } - - if (j->id().ieta() < 0) { - if (j->energy() > HFThreshold) { - // HFTimeM->Fill(j->time()); - HFEneM->Fill(j->energy()); - HFM_ETime += j->energy() * j->time(); - HFM_E += j->energy(); - } - } else { - if (j->energy() > HFThreshold) { - // HFTimeP->Fill(j->time()); - HFEneP->Fill(j->energy()); - HFP_ETime += j->energy() * j->time(); - HFP_E += j->energy(); - } - } - - // Long and short fibers - if (j->id().depth() == 1) { - HFLEne->Fill(j->energy()); - if (j->energy() > HFThreshold) - HFLTime->Fill(j->time()); - } else { - HFSEne->Fill(j->energy()); - if (j->energy() > HFThreshold) - HFSTime->Fill(j->time()); - } - } - } - break; - } - - for (int ieta = 0; ieta < 100; ieta++) { - for (int iphi = 0; iphi < 100; iphi++) { - double longF, shortF; - if (HFRecHit[ieta][iphi][0] == -10.) { - longF = 0.; - } else { - longF = HFRecHit[ieta][iphi][0]; - } - if (HFRecHit[ieta][iphi][1] == -10.) { - shortF = 0.; - } else { - shortF = HFRecHit[ieta][iphi][1]; - } - // if ((longF > HFThreshold) || (shortF > HFThreshold)) HFLSRatio->Fill((longF-shortF)/(longF+shortF)); - - if (longF > 0.) - HFLEneAll->Fill(longF); - if (shortF > 0.) - HFSEneAll->Fill(shortF); - - if ((longF > 20.) || (shortF > 20.)) { - double R = (longF - shortF) / (longF + shortF); - HFLSRatio->Fill(R); - if (fabs(R) > 0.995) { - // if (longF > 110.) { - // if (longF > 50.) { - if (longF > (162.4 - 10.19 * abs(ieta - 41) + .21 * abs(ieta - 41) * abs(ieta - 41))) { - HFEtaFlaggedLN->Fill(ieta - 41); - - HFLEneAllF->Fill(longF); - - if (shortF == 0.) - HFLEneNoSFlaggedN->Fill(longF); - } - // if (shortF > 70.) { - // if (shortF > 50.) { - if (shortF > (129.9 - 6.61 * abs(ieta - 41) + 0.1153 * abs(ieta - 41) * abs(ieta - 41))) { - HFEtaFlaggedSN->Fill(ieta - 41); - - HFSEneAllF->Fill(shortF); - - if (longF == 0.) - HFSEneNoLFlaggedN->Fill(shortF); - } - } - } - /*** - cout << "HF LS Ratio long= " - << longF - << " short= " - << shortF - << endl; - ***/ - - HFLvsS->Fill(HFRecHit[ieta][iphi][1], HFRecHit[ieta][iphi][0]); - if ((HFRecHit[ieta][iphi][1] == -10.) && (HFRecHit[ieta][iphi][0] != -10.)) { - HFLEneNoS->Fill(HFRecHit[ieta][iphi][0]); - if (HFRecHitFlag[ieta][iphi][0] != 0) - HFLEneNoSFlagged->Fill(HFRecHit[ieta][iphi][0]); - } - if ((HFRecHit[ieta][iphi][0] == -10.) && (HFRecHit[ieta][iphi][1] != -10.)) { - HFSEneNoL->Fill(HFRecHit[ieta][iphi][1]); - if (HFRecHitFlag[ieta][iphi][1] != 0) - HFSEneNoLFlagged->Fill(HFRecHit[ieta][iphi][1]); - } - } - } - - if (HFP_E > 0.) - HFTimeP->Fill(HFP_ETime / HFP_E); - if (HFM_E > 0.) - HFTimeM->Fill(HFM_ETime / HFM_E); - - if ((HFP_E > 0.) && (HFM_E > 0.)) { - HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E); - HFTimePM->Fill(HF_PMM); - } else { - HF_PMM = INVALID; - } - - std::vector > collsHORecHit; - evt.getManyByType(collsHORecHit); - std::vector >::iterator iHORecHit; - for (iHORecHit = collsHORecHit.begin(); iHORecHit != collsHORecHit.end(); iHORecHit++) { - for (HORecHitCollection::const_iterator j = (*iHORecHit)->begin(); j != (*iHORecHit)->end(); j++) { - if (j->id().subdet() == HcalOuter) { - HOEne->Fill(j->energy()); - HOTime->Fill(j->time()); - HOTvsE->Fill(j->energy(), j->time()); - if (j->energy() > HOThreshold1) { - HOEneTh1->Fill(j->energy()); - } - if (j->energy() > HOThreshold) { - HOEneTh->Fill(j->energy()); - HOTimeTh->Fill(j->time()); - HOTotalE += j->energy(); - HOocc->Fill(j->id().ieta(), j->id().iphi()); - } - - // Separate SiPMs and HPDs: - if (((j->id().iphi() >= 59 && j->id().iphi() <= 70 && j->id().ieta() >= 11 && j->id().ieta() <= 15) || - (j->id().iphi() >= 47 && j->id().iphi() <= 58 && j->id().ieta() >= 5 && j->id().ieta() <= 10))) { - HOSEne->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOSTime->Fill(j->time()); - } else if ((j->id().iphi() < 59 || j->id().iphi() > 70 || j->id().ieta() < 11 || j->id().ieta() > 15) && - (j->id().iphi() < 47 || j->id().iphi() > 58 || j->id().ieta() < 5 || j->id().ieta() > 10)) { - HOHEne->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHTime->Fill(j->time()); - // Separate rings -1,-2,0,1,2 in HPDs: - if (j->id().ieta() <= -11) { - HOHrm2Ene->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHrm2Time->Fill(j->time()); - } else if (j->id().ieta() >= -10 && j->id().ieta() <= -5) { - HOHrm1Ene->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHrm1Time->Fill(j->time()); - } else if (j->id().ieta() >= -4 && j->id().ieta() <= 4) { - HOHr0Ene->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHr0Time->Fill(j->time()); - } else if (j->id().ieta() >= 5 && j->id().ieta() <= 10) { - HOHrp1Ene->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHrp1Time->Fill(j->time()); - } else if (j->id().ieta() >= 11) { - HOHrp2Ene->Fill(j->energy()); - if (j->energy() > HOThreshold) - HOHrp2Time->Fill(j->time()); - } else { - edm::LogInfo("myJetAna") << "Finding events that are in no ring !?!"; - edm::LogInfo("myJetAna") << "eta = " << j->id().ieta(); - } - } else { - edm::LogInfo("myJetAna") << "Finding events that are neither SiPM nor HPD!?"; - } - } - // std::cout << *j << std::endl; - } - } - - // HCALTotalE = HBTotalE + HETotalE + HFTotalE + HOTotalE; - // ECALTotalE = 0.; - EBTotalE = EETotalE = 0.; - - std::vector > collsEcalRecHit; - evt.getManyByType(collsEcalRecHit); - std::vector >::iterator iEcalRecHit; - for (iEcalRecHit = collsEcalRecHit.begin(); iEcalRecHit != collsEcalRecHit.end(); iEcalRecHit++) { - for (EcalRecHitCollection::const_iterator j = (*iEcalRecHit)->begin(); j != (*iEcalRecHit)->end(); j++) { - if (j->id().subdetId() == EcalBarrel) { - EBEne->Fill(j->energy()); - EBTime->Fill(j->time()); - if (j->energy() > EBEEThreshold) { - EBEneTh->Fill(j->energy()); - EBTimeTh->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - EBEneX->Fill(j->energy()); - EBTimeX->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 457)) { - EBEneY->Fill(j->energy()); - EBTimeY->Fill(j->time()); - } - EBTotalE += j->energy(); - } - if (j->id().subdetId() == EcalEndcap) { - EEEne->Fill(j->energy()); - EETime->Fill(j->time()); - if (j->energy() > EBEEThreshold) { - EEEneTh->Fill(j->energy()); - EETimeTh->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 453)) { - EEEneX->Fill(j->energy()); - EETimeX->Fill(j->time()); - } - if ((evt.id().run() == 120020) && (evt.id().event() == 457)) { - EEEneY->Fill(j->energy()); - EETimeY->Fill(j->time()); - } - EETotalE += j->energy(); - } - // std::cout << *j << std::endl; - // std::cout << "EB ID = " << j->id().subdetId() << "/" << EcalBarrel << std::endl; - } - } - - EBvHB->Fill(HBTotalE, EBTotalE); - EEvHE->Fill(HETotalE, EETotalE); - - /***** - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - - for (i=colls.begin(); i!=colls.end(); i++) { - for (EBRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - // if (j->id().subdetId() == EcalBarrel) { - EBEne->Fill(j->energy()); - EBTime->Fill(j->time()); - // EBTotalE = j->energy(); - // } - // std::cout << *j << std::endl; - // std::cout << "EB ID = " << j->id().subdetId() << "/" << EcalBarrel << std::endl; - } - } - - std::vector > colls; - evt.getManyByType(colls); - std::vector >::iterator i; - for (i=colls.begin(); i!=colls.end(); i++) { - for (EERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) { - // if (j->id().subdetId() == EcalEndcap) { - EEEne->Fill(j->energy()); - EETime->Fill(j->time()); - // EETotalE = j->energy(); - // Separate +-EE; - EEDetId EEid = EEDetId(j->id()); - if (!EEid.positiveZ()) - { - EEnegEne->Fill(j->energy()); - EEnegTime->Fill(j->time()); - }else{ - EEposEne->Fill(j->energy()); - EEposTime->Fill(j->time()); - } - // } - // std::cout << *j << std::endl; - } - } - ******/ - - // ECALTotalE = EBTotalE + EETotalE; - - if ((EBTotalE > 320000) && (EBTotalE < 330000) && (HBTotalE > 2700000) && (HBTotalE < 2800000)) { - edm::LogInfo("myJetAna") << "Off Axis! "; - } - - /*** - std::cout << " Rechits: Total Energy : " - << " HCAL= " << HCALTotalE - << " ECAL= " << ECALTotalE - << " HB = " << HBTotalE - << " EB = " << EBTotalE - << std::endl; - ***/ - - // ********************* - // *** CaloTowers - // ********************* - // Handle caloTowers; - // evt.getByLabel( "towerMaker", caloTowers ); - - nTow1 = nTow2 = nTow3 = nTow4 = 0; - - double sum_et = 0.0; - double sum_ex = 0.0; - double sum_ey = 0.0; - - double HFsum_et = 0.0; - double HFsum_ex = 0.0; - double HFsum_ey = 0.0; - // double sum_ez = 0.0; - - // std::cout<<">>>> Run " << evt.id().run() << " Event " << evt.id().event() << std::endl; - // --- Loop over towers and make a lists of used and unused towers - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); tower != caloTowers->end(); tower++) { - Double_t et = tower->et(); - Double_t phix = tower->phi(); - - if (et > 0.5) - nTow1++; - if (et > 1.0) - nTow2++; - if (et > 1.5) - nTow3++; - if (et > 2.0) - nTow4++; - - // if ( (fabs(tower->ieta() > 42)) || (fabs(tower->iphi()) > 72) ) { - // std::cout << "ieta/iphi = " << tower->ieta() << " / " << tower->iphi() << std::endl; - // } - - if (tower->emEnergy() > 2.0) { - h_EmEnergy->Fill(tower->ieta(), tower->iphi(), tower->emEnergy()); - } - if (tower->hadEnergy() > 2.0) { - h_HadEnergy->Fill(tower->ieta(), tower->iphi(), tower->hadEnergy()); - } - - if (fabs(tower->ieta()) > 29) { - HFsum_et += et; - HFsum_ex += et * cos(phix); - HFsum_ey += et * sin(phix); - } - - if (et > 0.5) { - ETime->Fill(tower->ecalTime()); - HTime->Fill(tower->hcalTime()); - - // ******** - // double theta = tower->theta(); - // double e = tower->energy(); - // double et = e*sin(theta); - // double et = tower->emEt() + tower->hadEt(); - // sum_ez += e*cos(theta); - sum_et += et; - sum_ex += et * cos(phix); - sum_ey += et * sin(phix); - // ******** - - Double_t phi = tower->phi(); - SumEtTowers += tower->et(); - - sumTowerAllEx += et * cos(phi); - sumTowerAllEy += et * sin(phi); - } - } - - // SumEt->Fill(sum_et); - // MET->Fill(sqrt( sum_ex*sum_ex + sum_ey*sum_ey)); - - HFSumEt->Fill(HFsum_et); - HFMET->Fill(sqrt(HFsum_ex * HFsum_ex + HFsum_ey * HFsum_ey)); - - hf_sumTowerAllEx->Fill(sumTowerAllEx); - hf_sumTowerAllEy->Fill(sumTowerAllEy); - - nTowers1->Fill(nTow1); - nTowers2->Fill(nTow2); - nTowers3->Fill(nTow3); - nTowers4->Fill(nTow4); - - // ********************* - // ********************* - - UsedTowerList.clear(); - TowerUsedInJets.clear(); - TowerNotUsedInJets.clear(); - - // --- Loop over jets and make a list of all the used towers - // evt.getByLabel( CaloJetAlgorithm, jets ); - for (CaloJetCollection::const_iterator ijet = caloJets->begin(); ijet != caloJets->end(); ijet++) { - Double_t jetPt = ijet->pt(); - Double_t jetEta = ijet->eta(); - Double_t jetPhi = ijet->phi(); - - // if (jetPt>5.0) { - - Double_t jetPx = jetPt * cos(jetPhi); - Double_t jetPy = jetPt * sin(jetPhi); - - sumJetPx += jetPx; - sumJetPy += jetPy; - - const std::vector jetCaloRefs = ijet->getCaloConstituents(); - int nConstituents = jetCaloRefs.size(); - for (int i = 0; i < nConstituents; i++) { - UsedTowerList.push_back(jetCaloRefs[i]); - } - - SumPtJet += jetPt; - - // } - - if ((jetPt > 80.0) && (fabs(jetEta) < 1.3)) { - st_Pt->Fill(jetPt); - int nConstituents = ijet->getCaloConstituents().size(); - st_Constituents->Fill(nConstituents); - - float maxEne = 0.; - float totEne = 0.; - - for (unsigned twr = 0; twr < ijet->getCaloConstituents().size(); ++twr) { - CaloTowerPtr tower = (ijet->getCaloConstituents())[twr]; - // CaloTowerDetId id = tower->id(); - if (tower->et() > 0.) { - if (tower->energy() > maxEne) - maxEne = tower->energy(); - totEne += tower->energy(); - - st_Energy->Fill(tower->energy()); - st_EmEnergy->Fill(tower->emEnergy()); - st_HadEnergy->Fill(tower->hadEnergy()); - st_OuterEnergy->Fill(tower->outerEnergy()); - - st_Eta->Fill(tower->eta()); - st_Phi->Fill(tower->phi()); - - st_iEta->Fill(tower->ieta()); - st_iPhi->Fill(tower->iphi()); - - /**** - std::cout << ">>> Towers : " - << " " << tower->energy() - << " " << tower->emEnergy() - << " " << tower->hadEnergy() - << " " << tower->outerEnergy() - << " " << tower->et() - << " " << tower->emEt() - << " " << tower->hadEt() - << " " << tower->outerEt() - << " " << tower->eta() - << " " << tower->phi() - << std::endl; - ****/ - } - } - st_Frac->Fill(maxEne / totEne); - } - } - - int NTowersUsed = UsedTowerList.size(); - - // --- Loop over towers and make a lists of used and unused towers - for (CaloTowerCollection::const_iterator tower = caloTowers->begin(); tower != caloTowers->end(); tower++) { - CaloTower t = *tower; - Double_t et = tower->et(); - - if (et > 0) { - Double_t phi = tower->phi(); - SumEtTowers += tower->et(); - - sumTowerAllPx += et * cos(phi); - sumTowerAllPy += et * sin(phi); - - bool used = false; - - for (int i = 0; i < NTowersUsed; i++) { - if (tower->id() == UsedTowerList[i]->id()) { - used = true; - break; - } - } - - if (used) { - TowerUsedInJets.push_back(t); - } else { - TowerNotUsedInJets.push_back(t); - } - } - } - - int nUsed = TowerUsedInJets.size(); - int nNotUsed = TowerNotUsedInJets.size(); - - SumEtJets = 0; - SumEtNotJets = 0; - TotalClusteredE = 0; - TotalUnclusteredE = 0; - - for (int i = 0; i < nUsed; i++) { - SumEtJets += TowerUsedInJets[i].et(); - h_ClusteredE->Fill(TowerUsedInJets[i].energy()); - if (TowerUsedInJets[i].energy() > 1.0) - TotalClusteredE += TowerUsedInJets[i].energy(); - } - h_jetEt->Fill(SumEtJets); - - for (int i = 0; i < nNotUsed; i++) { - if (TowerNotUsedInJets[i].et() > 0.5) - SumEtNotJets += TowerNotUsedInJets[i].et(); - h_UnclusteredEt->Fill(TowerNotUsedInJets[i].et()); - h_UnclusteredEts->Fill(TowerNotUsedInJets[i].et()); - h_UnclusteredE->Fill(TowerNotUsedInJets[i].energy()); - if (TowerNotUsedInJets[i].energy() > 1.0) - TotalUnclusteredE += TowerNotUsedInJets[i].energy(); - } - - h_TotalClusteredE->Fill(TotalClusteredE); - h_TotalUnclusteredE->Fill(TotalUnclusteredE); - h_TotalUnclusteredEt->Fill(SumEtNotJets); - - // ******************************** - // *** CaloMET - // ******************************** - - edm::Handle calometcoll; - evt.getByLabel("met", calometcoll); - if (calometcoll.isValid()) { - const CaloMETCollection *calometcol = calometcoll.product(); - const CaloMET *calomet; - calomet = &(calometcol->front()); - - double caloSumET = calomet->sumEt(); - double caloMET = calomet->pt(); - double caloMETSig = calomet->mEtSig(); - double caloMEx = calomet->px(); - double caloMEy = calomet->py(); - double caloMETPhi = calomet->phi(); - - SumEt->Fill(caloSumET); - MET->Fill(caloMET); - if (std::abs(OER) > 0.8) - OERMET->Fill(caloMET); - - if (evtType == 0) - MET_Tower->Fill(caloMET); - if (evtType == 1) - MET_RBX->Fill(caloMET); - if (evtType == 2) - MET_HPD->Fill(caloMET); - METSig->Fill(caloMETSig); - MEx->Fill(caloMEx); - MEy->Fill(caloMEy); - METPhi->Fill(caloMETPhi); - - /*** - double caloEz = calomet->e_longitudinal(); - - double caloMaxEtInEMTowers = calomet->maxEtInEmTowers(); - double caloMaxEtInHadTowers = calomet->maxEtInHadTowers(); - double caloEtFractionHadronic = calomet->etFractionHadronic(); - double caloEmEtFraction = calomet->emEtFraction(); - - double caloHadEtInHB = calomet->hadEtInHB(); - double caloHadEtInHO = calomet->hadEtInHO(); - double caloHadEtInHE = calomet->hadEtInHE(); - double caloHadEtInHF = calomet->hadEtInHF(); - double caloEmEtInEB = calomet->emEtInEB(); - double caloEmEtInEE = calomet->emEtInEE(); - double caloEmEtInHF = calomet->emEtInHF(); - ****/ - } - - // ******************************** - // *** Vertex - // ******************************** - VTX = INVALID; - - edm::Handle vertexCollection; - evt.getByLabel("offlinePrimaryVertices", vertexCollection); - const reco::VertexCollection vC = *(vertexCollection.product()); - - // std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ; - nVTX = vC.size(); - //double vertex_numTrks; - for (reco::VertexCollection::const_iterator vertex = vC.begin(); vertex != vC.end(); vertex++) { - h_Vx->Fill(vertex->x()); - h_Vy->Fill(vertex->y()); - h_Vz->Fill(vertex->z()); - VTX = vertex->z(); - // vertex_numTrks = vertex->tracksSize(); - // h_VNTrks->Fill(vertex_numTrks); - } - - if ((HF_PMM != INVALID) || (nVTX > 0)) { - HFvsZ->Fill(HF_PMM, VTX); - } - - // ******************************** - // *** Pixel Clusters - // ******************************** - // edm::Handle< edmNew::DetSetVector > hClusterColl; - // evt.getByLabel("siPixelClusters", hClusterColl); - // const edmNew::DetSetVector clustColl = *(hClusterColl.product()); - - SiClusters->Fill(clustColl.size()); - - // ******************************** - // *** Tracks - // ******************************** - // edm::Handle trackCollection; - // evt.getByLabel("ctfWithMaterialTracks", trackCollection); - // evt.getByLabel("generalTracks", trackCollection); - // const reco::TrackCollection tC = *(trackCollection.product()); - - // std::cout << "ANA: Reconstructed "<< tC.size() << " tracks" << std::endl ; - - // ************************************* - /***** - //Get the Vertex Collection - edm::Handle > verticies; evt.getByLabel("offlinePrimaryVertices", verticies); - - //Fill the variables - int _ntracksw5 = 0; - for (std::vector::const_iterator it = verticies->begin(); it != verticies->end(); ++it) { - - // ntracks->push_back(int(it->tracksSize())); //all tracks considered for vertexing - // isvalid->push_back(int(it->isValid())); - // isfake->push_back(int(it->isFake())); - - if(it->tracksSize() > 0) { - std::vector::const_iterator trackIt; - for( trackIt = it->tracks_begin(); trackIt != it->tracks_end(); trackIt++) { - if(fabs((**trackIt).charge()) <= 1.) { - //tracks that contribute with more than 0.5 weight in vertex reconstruction - if (it->trackWeight(*trackIt) >= 0.5 ) - _ntracksw5++; - } - } - } - } - *****/ - // ************************************* - - h_Trk_NTrk->Fill(tC.size()); - if (NPMTHits == 0) - TrkMultFlagged0->Fill(tC.size()); - if (NPMTHits == 1) - TrkMultFlagged1->Fill(tC.size()); - if (NPMTHits == 2) - TrkMultFlagged2->Fill(tC.size()); - if (NPMTHits == 3) - TrkMultFlagged3->Fill(tC.size()); - if (NPMTHits == 4) - TrkMultFlagged4->Fill(tC.size()); - if (NPMTHits > 1) - TrkMultFlaggedM->Fill(tC.size()); - for (reco::TrackCollection::const_iterator track = tC.begin(); track != tC.end(); track++) { - h_Trk_pt->Fill(track->pt()); - } - - /**** - std::cout << "Track number "<< i << std::endl ; - std::cout << "\tmomentum: " << track->momentum()<< std::endl; - std::cout << "\tPT: " << track->pt()<< std::endl; - std::cout << "\tvertex: " << track->vertex()<< std::endl; - std::cout << "\timpact parameter: " << track->d0()<< std::endl; - std::cout << "\tcharge: " << track->charge()<< std::endl; - std::cout << "\tnormalizedChi2: " << track->normalizedChi2()<< std::endl; - - cout<<"\tFrom EXTRA : "<outerPt()<seedDirection() << std::endl; - ****/ - - // ******************************** - // *** Photons - // ******************************** - /*** - edm::Handle photonCollection; - evt.getByLabel("photons", photonCollection); - const reco::PhotonCollection pC = *(photonCollection.product()); - - std::cout << "Reconstructed "<< pC.size() << " photons" << std::endl ; - for (reco::PhotonCollection::const_iterator photon=pC.begin(); photon!=pC.end(); photon++){ - } - ***/ - - // ******************************** - // *** Muons - // ******************************** - /*** - edm::Handle muonCollection; - evt.getByLabel("muons", muonCollection); - - const reco::MuonCollection mC = *(muonCollection.product()); - - std::cout << "Reconstructed "<< mC.size() << " muons" << std::endl ; - for (reco::MuonCollection::const_iterator muon=mC.begin(); muon!=mC.end(); muon++){ - } - ***/ - - // ******************************** - // *** Events passing seletion cuts - // ******************************** - - // --- Cosmic Cleanup - // --- Vertex - // --- Eta - - int iJet; - iJet = 0; - for (CaloJetCollection::const_iterator ijet = caloJets->begin(); ijet != caloJets->end(); ++ijet) { - // if ( (fabs(ijet->eta()) < 1.3) && - // (fabs(ijet->pt()) > 20.) ) { - - // (ijet->emEnergyFraction() > 0.01) && - // (ijet->emEnergyFraction() > 0.99) ) { - - iJet++; - // if (iJet == 1) { - // cout << " CaloJet: Event Type = " << evtType - // << " pt = " << ijet->pt() - // << endl; - // } - h_pt->Fill(ijet->pt()); - if (evtType == 0) - h_ptTower->Fill(ijet->pt()); - if (evtType == 1) - h_ptRBX->Fill(ijet->pt()); - if (evtType == 2) - h_ptHPD->Fill(ijet->pt()); - h_et->Fill(ijet->et()); - h_eta->Fill(ijet->eta()); - h_phi->Fill(ijet->phi()); - - jetHOEne->Fill(ijet->hadEnergyInHO()); - jetEMFraction->Fill(ijet->emEnergyFraction()); - - // } - } - - //***************************** - //*** Get the GenJet collection - //***************************** - - /************** - Handle genJets; - evt.getByLabel( GenJetAlgorithm, genJets ); - - //Loop over the two leading GenJets and fill some histograms - jetInd = 0; - allJetInd = 0; - for( GenJetCollection::const_iterator gen = genJets->begin(); gen != genJets->end(); ++ gen ) { - allJetInd++; - if (allJetInd == 1) { - p4tmp[0] = gen->p4(); - } - if (allJetInd == 2) { - p4tmp[1] = gen->p4(); - } - - if ( (allJetInd == 1) || (allJetInd == 2) ) { - h_ptGenL->Fill( gen->pt() ); - h_etaGenL->Fill( gen->eta() ); - h_phiGenL->Fill( gen->phi() ); - } - - if ( gen->pt() > minJetPt) { - // std::cout << "GEN JET1 #" << jetInd << std::endl << gen->print() << std::endl; - h_ptGen->Fill( gen->pt() ); - h_etaGen->Fill( gen->eta() ); - h_phiGen->Fill( gen->phi() ); - jetInd++; - } - } - - h_nGenJets->Fill( jetInd ); - *******/ - } -} - -// *********************************** -// *********************************** -void myJetAna::endJob() { - for (int i = 0; i < 4000; i++) { - if (((float)nBNC[i] / (float)totBNC) > 0.05) { - edm::LogInfo("myJetAna") << "+++ " << i << " " << ((float)nBNC[i] / (float)totBNC) << " " << nBNC[i] << " " - << totBNC; - } - } -} -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(myJetAna); diff --git a/RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h b/RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h deleted file mode 100644 index bc04da2de59ec..0000000000000 --- a/RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitLeadingEdgeAlgo_HH -#define RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitLeadingEdgeAlgo_HH - -/** \class EcalUncalibRecHitLeadingEdgeAlgo - * Template used to compute amplitude using the leading edge sample - * - * $Id: EcalUncalibRecHitLeadingEdgeAlgo.h - * $Date: - * $Revision: - * \author F. Ferri, M. Malberti - */ - -#include "Math/SVector.h" -#include "Math/SMatrix.h" -#include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRecAbsAlgo.h" - -#include "DataFormats/EcalDetId/interface/EBDetId.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - - -template < class C > class EcalUncalibRecHitLeadingEdgeAlgo : public EcalUncalibRecHitRecAbsAlgo < C > { - public: - // destructor - EcalUncalibRecHitLeadingEdgeAlgo < C > () : leadingSample_(0), shape_(0) { }; - virtual ~ EcalUncalibRecHitLeadingEdgeAlgo < C > () { }; - - void setLeadingEdgeSample( int isample ) { leadingSample_ = isample; } - int getLeadingEdgeSample() { return leadingSample_; } - - void setPulseShape( std::vector & shape ) { shape_ = shape; } - std::vector & getPulseShape() { return shape_; } - - /// Compute parameters - virtual EcalUncalibratedRecHit makeRecHit(const C & dataFrame, - const double *pedestals, - const double *gainRatios, - const EcalWeightSet::EcalWeightMatrix** weights, - const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix - ) - { - double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.); - - // compute amplitude - amplitude_ = double (((double) (dataFrame.sample( leadingSample_ ).adc() - - pedestals[ dataFrame.sample( leadingSample_ ).gainId() - 1]) * - saturationCorrection( leadingSample_ ) * - gainRatios[ dataFrame.sample( leadingSample_ ).gainId() - 1] )); - - - - return EcalUncalibratedRecHit(dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_); - } - - // saturation correction - double saturationCorrection(int unsaturatedSample) - { - if ( unsaturatedSample > 0 && unsaturatedSample < (int)shape_.size() ) { - return 1./ shape_[ unsaturatedSample ]; - } else { - edm::LogError("EcalUncalibRecHitLeadingEdgeAlgo") << "Invalid sample " << unsaturatedSample - << " for a shape vector of size " << shape_.size(); - return 0; - } - } - - private: - int leadingSample_; - std::vector< double > shape_; -}; -#endif diff --git a/RecoMuon/TrackingTools/interface/MuonSeedDetLayer.h b/RecoMuon/TrackingTools/interface/MuonSeedDetLayer.h deleted file mode 100644 index ec7d35e185207..0000000000000 --- a/RecoMuon/TrackingTools/interface/MuonSeedDetLayer.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef TrackingTools_MuonSeedDetLayer_H -#define TrackingTools_MuonSeedDetLayer_H - -/** \class MuonSeedDetLayer - * - * Muon seed detector layer - * Helper class for seed generation - * - * - * - * \author N. Neumeister Purdue University - */ - -#include "TrackingTools/DetLayers/interface/DetLayer.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" - -// --------------------- -// -- Class Interface -- -// --------------------- - -class MuonSeedDetLayer { - - public: - - /// constructor - MuonSeedDetLayer(const DetLayer* layer, - GlobalPoint& point, - int id, - TrajectoryStateOnSurface& state) : - theLayer(layer), thePoint(point), theID(id), theState(state) {} - - /// destructor - virtual ~MuonSeedDetLayer() {} - - /// return layer - const DetLayer* layer() const { return theLayer; } - - /// return impact point - const GlobalPoint& point() const { return thePoint; } - - /// return layer identifyer - int id() const { return theID; } - - /// return trajectory state on layer - const TrajectoryStateOnSurface& state() const { return theState; } - - /// return radius of impact point - double radius() const { return sqrt(thePoint.x()*thePoint.x()+thePoint.y()*thePoint.y()); } - - /// return z coordinate of impact point - double z() const { return thePoint.z(); } - - /// sort - static bool getHigherR( const MuonSeedDetLayer first, const MuonSeedDetLayer second ) { - return first.radius() < second.radius(); - } - - /// sort - static bool getLowerR( const MuonSeedDetLayer first, const MuonSeedDetLayer second ) { - return first.radius() > second.radius(); - } - - private: - - const DetLayer* theLayer; - GlobalPoint thePoint; - int theID; - TrajectoryStateOnSurface theState; -}; -#endif - diff --git a/RecoTracker/SpecialSeedGenerators/interface/EtaPhiMeasurementEstimator.h b/RecoTracker/SpecialSeedGenerators/interface/EtaPhiMeasurementEstimator.h deleted file mode 100755 index 09c7cfafd0cb2..0000000000000 --- a/RecoTracker/SpecialSeedGenerators/interface/EtaPhiMeasurementEstimator.h +++ /dev/null @@ -1 +0,0 @@ -#error diff --git a/RecoTracker/TkMSParametrization/interface/rangesIntersect.h b/RecoTracker/TkMSParametrization/interface/rangesIntersect.h deleted file mode 100644 index e8ff66cc732ac..0000000000000 --- a/RecoTracker/TkMSParametrization/interface/rangesIntersect.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef rangesIntersect_H -#define rangesIntersect_H - -/** Utility for checking efficiently if two one-dimantional intervals - * intersect. - * Precondition: the intervals are not empty, i.e. for i in a,b - * i.first <= i.second. - * The Range template argument is expected to have the std::pair - * interface, i.e. for Range instance r r.first is the beginning of - * the interval and r.second is the end of the interval. - */ - -template -inline bool rangesIntersect( const Range& a, const Range& b) { - if ( a.first > b.second || b.first > a.second) return false; - else return true; -} - -template -inline bool rangesIntersect( const Range& a, const Range& b, - const Less& less) { - if ( less(b.second,a.first) || less(a.second,b.first)) return false; - else return true; -} -#endif diff --git a/RecoTracker/TrackProducer/interface/GsfTrackProducerAlgorithm.h b/RecoTracker/TrackProducer/interface/GsfTrackProducerAlgorithm.h deleted file mode 100644 index 8f3f2b08aa428..0000000000000 --- a/RecoTracker/TrackProducer/interface/GsfTrackProducerAlgorithm.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef GsfTrackProducerAlgorithm_h -#define GsfTrackProducerAlgorithm_h - -// -// Package: RecoTracker/TrackProducer -// Class: GsfTrackProducerAlgorithm -// -// -// Original Author: Giuseppe Cerati -// Created: Thu Mar 9 17:29:31 CET 2006 -// -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -// #include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/TrackExtra.h" -#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" -#include "DataFormats/GsfTrackReco/interface/GsfTrackExtra.h" -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" - -class MagneticField; -class TrackingGeometry; -class TrajectoryFitter; -class Propagator; -class Trajectory; -class TrajectoryStateOnSurface; -class TransientTrackingRecHitBuilder; - - -class GsfTrackProducerAlgorithm { - - public: - typedef std::pair > AlgoProduct; - typedef std::vector< AlgoProduct > AlgoProductCollection; - - GsfTrackProducerAlgorithm(const edm::ParameterSet& conf) : - conf_(conf) - { } - - ~GsfTrackProducerAlgorithm() {} - - void runWithCandidate(const TrackingGeometry *, - const MagneticField *, - const TrackCandidateCollection&, - const TrajectoryFitter *, - const Propagator *, - const TransientTrackingRecHitBuilder*, - AlgoProductCollection &); - - void runWithTrack(const TrackingGeometry *, - const MagneticField *, - const reco::TrackCollection&, - const TrajectoryFitter *, - const Propagator *, - const TransientTrackingRecHitBuilder*, - AlgoProductCollection &); - - bool buildTrack(const TrajectoryFitter *, - const Propagator *, - AlgoProductCollection& , - TransientTrackingRecHit::RecHitContainer&, - TrajectoryStateOnSurface& , - const TrajectorySeed&, - float); - - private: - edm::ParameterSet conf_; -}; - -#endif diff --git a/RecoTracker/TransientTrackingRecHit/interface/GSTransientTrackingRecHit.h b/RecoTracker/TransientTrackingRecHit/interface/GSTransientTrackingRecHit.h deleted file mode 100644 index 512cc7ffe9a9c..0000000000000 --- a/RecoTracker/TransientTrackingRecHit/interface/GSTransientTrackingRecHit.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef GSTransientTrackingRecHit_H -#define GSTransientTrackingRecHit_H - -#include "TrackingTools/TransientTrackingRecHit/interface/TValidTrackingRecHit.h" -#include "DataFormats/CLHEP/interface/AlgebraicObjects.h" - -#endif - diff --git a/RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromLinPtFinder.h b/RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromLinPtFinder.h deleted file mode 100644 index c1c0550c5c64d..0000000000000 --- a/RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromLinPtFinder.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _ReconstructorFromLinPtFinder_H_ -#define _ReconstructorFromLinPtFinder_H_ - -#include "RecoVertex/VertexPrimitives/interface/VertexReconstructor.h" -#include "RecoVertex/VertexTools/interface/LinearizationPointFinder.h" - -/** - * Wrap any LinearizationPointFinder into the VertexReconstructor interface - */ - -class ReconstructorFromLinPtFinder : public VertexReconstructor -{ - public: - ReconstructorFromLinPtFinder ( const LinearizationPointFinder &, int verbose=0 ); - ReconstructorFromLinPtFinder ( const ReconstructorFromLinPtFinder & o ); - ~ReconstructorFromLinPtFinder(); - std::vector < TransientVertex > vertices ( const std::vector < reco::TransientTrack > & ) const; - - ReconstructorFromLinPtFinder * clone () const; - - private: - const LinearizationPointFinder * theLinPtFinder; - int theVerbosity; -}; - -#endif diff --git a/RecoVertex/KinematicFit/interface/CombinedKinematicConstraintT.h b/RecoVertex/KinematicFit/interface/CombinedKinematicConstraintT.h deleted file mode 100644 index 6fd7f59075588..0000000000000 --- a/RecoVertex/KinematicFit/interface/CombinedKinematicConstraintT.h +++ /dev/null @@ -1,218 +0,0 @@ -#ifndef CombinedKinematicConstraintT_H -#define CombinedKinematicConstraintT_H - -#include "RecoVertex/KinematicFitPrimitives/interface/MultiTrackKinematicConstraintT.h" -#include "RecoVertex/KinematicFitPrimitives/interface/KinematicState.h" -#include "DataFormats/CLHEP/interface/AlgebraicObjects.h" -#include "RecoVertex/VertexPrimitives/interface/VertexException.h" - -// this is generic: to be moved elsewhere -#include -#include -#include -#include - -// run time iteration -template -struct do_iterate -{ - template - static void call(TupleType& t, F f) - { - f(std::get(t)); - do_iterate::call(t,f); - } - template - static void call(TupleType const & t, F f) - { - f(std::get(t)); - do_iterate::call(t,f); - } - - -}; - -template -struct do_iterate -{ - template - static void call(TupleType&, F) - {} - template - static void call(TupleType const &, F) - {} -}; - -template -void iterate_tuple(TupleType& t, F f) -{ - do_iterate::value>::call(t,f); -} - -template -void iterate_tuple(TupleType const& t, F f) -{ - do_iterate::value>::call(t,f); -} - - -namespace combinedConstraintHelpers { - - // a bit less generic - template::value> - struct totDim { - typedef typename std::tuple_element::type Elem; - enum { nDim = Elem::nDim + totDim::nDim}; - }; - - template - struct totDim { - enum { nDim=0}; - }; - - template - void sum2(T& x, T y) { x+=y;} - - // mind: iteration is backward... - template - struct Place { - int offset; - Place() : offset(DIM) {} - ~Place() { - assert(offset==DIM || offset==0); - } - }; - - template - struct PlaceValue : public Place { - PlaceValue(ROOT::Math::SVector & iret) : ret(iret){} - ROOT::Math::SVector & ret; - template - void operator()(C const & cs) { - this->offset -= C::nDim; - ret.Place_at(cs.value(),this->offset); - } - }; - - template - struct PlaceParDer : public Place { - PlaceParDer(ROOT::Math::SMatrix & iret) : ret(iret){} - ROOT::Math::SMatrix & ret; - template - void operator()(C const & cs) { - this->offset -= C::nDim; - ret.Place_at(cs.parametersDerivative(),this->offset,0); - } - }; - - template - struct PlacePosDer : public Place { - PlacePosDer(ROOT::Math::SMatrix & iret) : ret(iret){} - ROOT::Math::SMatrix & ret; - template - void operator()(C const & cs) { - this->offset -= C::nDim; - ret.Place_at(cs.positionDerivative(),this->offset,0); - } - }; - - -} - - -/** - * This class combines several user defined constraints (by expanding the vector d and the matrices D and E). - * Usage: - * Add each constraint to a std::tuple. - * This tuple has to be used in the constructor: - * - * The produced object can be used by KinematicConstrainedVertexFitter.fit() - * - * Lars Perchalla, Philip Sauerland, Dec 2009 - */ - -// maybe a variadic template will be better -template< class TupleType, int NTRK > -class CombinedKinematicConstraintT : public MultiTrackKinematicConstraintT::nDim>{ - - // need compile time assert on NTRK -public: - typedef MultiTrackKinematicConstraintBaseT base; - typedef MultiTrackKinematicConstraintT::nDim> super; - typedef typename super::valueType valueType; - typedef typename super::parametersDerivativeType parametersDerivativeType; - typedef typename super::positionDerivativeType positionDerivativeType; - - typedef TupleType Constraints; - - //FIXME - enum {DIM = super::nDim}; - - -public: - CombinedKinematicConstraintT(Constraints const & iconstraints): constraints(constraints){ - } - - // initialize the constraint so it can precompute common qualtities to the three next call - virtual void init(const std::vector& states, - const GlobalPoint& point, const GlobalVector& mf) { - iterate_tuple(constraints, - std::bind(&base::init,std::placeholders::_1,std::ref(states),std::ref(point), std::ref(mf))); - } - - -private: - /** - * fills a vector of values of the combined constraint - * equations at the point where the input - * particles are defined. - */ - void fillValue() const{ - combinedConstraintHelpers::PlaceValue helper(super::vl()); - iterate_tuple(constraints,std::ref(helper)); - } - - /** - * Returns a matrix of derivatives of the combined - * constraint equations w.r.t. - * particle parameters - */ - void fillParametersDerivative() const{ - combinedConstraintHelpers::PlaceParDer helper(super::jac_d()); - iterate_tuple(constraints,std::ref(helper)); - } - - /** - * Returns a matrix of derivatives of - * constraint equations w.r.t. - * vertex position - */ - void fillPositionDerivative() const{ - combinedConstraintHelpers::PlacePosDer helper(super::jac_e()); - iterate_tuple(constraints,std::ref(helper)); - } - -public: - /** - * Number of equations per track used for the combined fit - */ - virtual int numberOfEquations() const { - int tot=0; - iterate_tuple(constraints,std::bind(combinedConstraintHelpers::sum2,std::ref(tot), - std::bind(&base::numberOfEquations,std::placeholders::_1) - ) - ); - return tot; - } - - virtual CombinedKinematicConstraintT * clone() const - { - return new CombinedKinematicConstraintT(*this); - } - -private: - Constraints constraints; - -}; - -#endif diff --git a/RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h b/RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h deleted file mode 100644 index 2bf14e32ea432..0000000000000 --- a/RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef MonteCarloLinearizationPointFinder_H -#define MonteCarloLinearizationPointFinder_H - -#include "RecoVertex/VertexTools/interface/LinearizationPointFinder.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" - - /** - * A linearization point finder that can be fed with the result. - * Naturally, this is for debugging only. - */ - -class MonteCarloLinearizationPointFinder : public LinearizationPointFinder -{ -public: - MonteCarloLinearizationPointFinder(); - - /** - * The method that allows cheating - */ - void setPoint ( const GlobalPoint & pos ); - - virtual GlobalPoint getLinearizationPoint(const std::vector & ) const; - virtual GlobalPoint getLinearizationPoint(const std::vector & ) const; - - virtual MonteCarloLinearizationPointFinder * clone() const - { - return new MonteCarloLinearizationPointFinder ( * this ); - }; -private: - GlobalPoint thePt; -}; - -#endif diff --git a/RecoVertex/LinearizationPointFinders/src/MonteCarloLinearizationPointFinder.cc b/RecoVertex/LinearizationPointFinders/src/MonteCarloLinearizationPointFinder.cc deleted file mode 100644 index b8edf6ea962a0..0000000000000 --- a/RecoVertex/LinearizationPointFinders/src/MonteCarloLinearizationPointFinder.cc +++ /dev/null @@ -1,28 +0,0 @@ -#if 0 - -#include "RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" - -MonteCarloLinearizationPointFinder::MonteCarloLinearizationPointFinder() : - thePt ( GlobalPoint(0.,0.,0.) ) {} - -void MonteCarloLinearizationPointFinder::setPoint ( const GlobalPoint & pos ) -{ - thePt = pos; -} - -GlobalPoint MonteCarloLinearizationPointFinder::getLinearizationPoint( - const std::vector & tracks ) const -{ - return getLinearizationPoint ( std::vector < reco::TransientTrack > () ); -} - -GlobalPoint MonteCarloLinearizationPointFinder::getLinearizationPoint( - const std::vector & tracks ) const -{ - // std::cout << "[MonteCarloLinearizationPointFinder] point " << thePt << std::endl; - return thePt; -} - -#endif diff --git a/SimCalorimetry/CaloSimAlgos/interface/CaloVNoisifier.h b/SimCalorimetry/CaloSimAlgos/interface/CaloVNoisifier.h deleted file mode 100644 index 37930e78cc8fc..0000000000000 --- a/SimCalorimetry/CaloSimAlgos/interface/CaloVNoisifier.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CaloSimAlgos_CaloVNoisifier_h -#define CaloSimAlgos_CaloVNoisifier_h - -/** - \class CaloVNoisifier - - \brief adds noise to the given frame - -*/ - -class CaloSamples; - -class CaloVNoisifier -{ -public: - virtual void noisify(CaloSamples & frame) const=0; -}; - -#endif diff --git a/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLinkfwd.h b/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLinkfwd.h deleted file mode 100644 index b9579f5a5992b..0000000000000 --- a/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLinkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef RPCOBJECTS_RPCDIGISIMLINKFWD_H -#define RPCOBJECTS_RPCDIGISIMLINKFWD_H -class RPCDigiSimLink; -#endif // RPCOBJECTS_RPCDIGISIMLINKFWD_H diff --git a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkfwd.h b/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkfwd.h deleted file mode 100644 index 4616dda3dcef4..0000000000000 --- a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_PIXELDIGISIMLINKFWD_H -#define TRACKINGOBJECTS_PIXELDIGISIMLINKFWD_H -class PixelDigiSimLink; -#endif // TRACKINGOBJECTS_PIXELDIGISIMLINKFWD_H diff --git a/SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinksfwd.h b/SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinksfwd.h deleted file mode 100644 index 8f6512456343e..0000000000000 --- a/SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinksfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SimDataFormats_TrackerDigiSimLink_StripCompactDigiSimLinksfwd_h -#define SimDataFormats_TrackerDigiSimLink_StripCompactDigiSimLinksfwd_h -class StripCompactDigiSimLinks; -#endif diff --git a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkfwd.h b/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkfwd.h deleted file mode 100644 index a9c6e5113cac3..0000000000000 --- a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_STRIPDIGISIMLINKFWD_H -#define TRACKINGOBJECTS_STRIPDIGISIMLINKFWD_H -class StripDigiSimLink; -#endif // TRACKINGOBJECTS_STRIPDIGISIMLINKFWD_H diff --git a/SimG4CMS/Calo/interface/HcalTestHistoClass.h b/SimG4CMS/Calo/interface/HcalTestHistoClass.h deleted file mode 100644 index 37c51ed6ec083..0000000000000 --- a/SimG4CMS/Calo/interface/HcalTestHistoClass.h +++ /dev/null @@ -1 +0,0 @@ -#include "SimDataFormats/CaloTest/interface/HcalTestHistoClass.h" diff --git a/SimG4Core/Application/interface/DDDWorldObserver.h b/SimG4Core/Application/interface/DDDWorldObserver.h deleted file mode 100644 index 5a53aa9cef5e1..0000000000000 --- a/SimG4Core/Application/interface/DDDWorldObserver.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SimG4Core_DDDWorldObserver_H -#define SimG4Core_DDDWorldObserver_H - -#include "SimG4Core/Notification/interface/Observer.h" -#include "SimG4Core/Geometry/interface/DDDWorld.h" - -#include - -template -class DDDWorldObserver : public Observer -{ -public: - virtual void update(const DDDWorld * w) - { - std::cout << " DDDWorldObserver: in update " << std::endl; - if (w!=0) - std::cout << " DDDWorldObserver: got DDDWorld! " << std::endl; - } -}; - -#endif diff --git a/SimG4Core/Notification/interface/ComponentBuilder.h b/SimG4Core/Notification/interface/ComponentBuilder.h deleted file mode 100644 index 3ab73485c8161..0000000000000 --- a/SimG4Core/Notification/interface/ComponentBuilder.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SimG4Core_ComponentBuilder_H -#define SimG4Core_ComponentBuilder_H - -#include - -template class ComponentBuilder -{ -public: - virtual C * constructComponent(T) = 0; - virtual std::string myName() = 0; -}; - -#endif - diff --git a/SimG4Core/Notification/interface/ComponentFactoryByName.h b/SimG4Core/Notification/interface/ComponentFactoryByName.h deleted file mode 100644 index be6226ac0f08c..0000000000000 --- a/SimG4Core/Notification/interface/ComponentFactoryByName.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SimG4Core_ComponentFactoryByName_H -#define SimG4Core_ComponentFactoryByName_H - -#include "FWCore/Utilities/interface/Exception.h" - -#include -#include - -template -class ComponentFactoryByName -{ -public: - static B * getBuilder(const std::string & name) - { - if (myMap().size() == 0) { - throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::getBuilder: No Builder registered to the Factory."); - } - if (myMap().find(name) == myMap().end()) { - throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::getBuilder: The Component "+name+" is not registered to the Factory."); - } - return (myMap()[name]); - } - static void setBuilder(B * in , const std::string & name) - { - if (name.empty()) { - throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::setBuilder: The registration of Components without name is not allowed."); - } - myMap()[name] = in; - } - typedef std::map BuilderMapType; -protected: - static BuilderMapType & myMap() - { - static BuilderMapType me_; - return me_; - } -}; - -#endif - - - diff --git a/SimG4Core/Notification/interface/DispatchableG4Step.h b/SimG4Core/Notification/interface/DispatchableG4Step.h deleted file mode 100644 index 297b5f6d17d0e..0000000000000 --- a/SimG4Core/Notification/interface/DispatchableG4Step.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SimG4Core_DispatchableG4Step_H -#define SimG4Core_DispatchableG4Step_H - -#include "G4Step.hh" - -typedef G4Step DispatchableG4Step; - -#endif diff --git a/SimG4Core/Notification/interface/OwnIt.h b/SimG4Core/Notification/interface/OwnIt.h deleted file mode 100644 index 9ea056188d008..0000000000000 --- a/SimG4Core/Notification/interface/OwnIt.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef OwnIt_H -#define OwnIt_H -/** a very very simple auto_ptr. - if static get destrying at the end avoiding - fake memory leaks... - */ -template -class OwnIt { -public: - typedef OwnIt self; - OwnIt(T * p=0) : it(p){} - - ~OwnIt() { reset();} - inline self& operator=(T * p) { if (it) delete it; it=p; return * this;} - inline T * get() const { return it;} - inline void reset() { if (it) { delete it; it=0; } } - -private: - T * it; - -}; - -#endif // OwnIt_H From 2a451f80e589f709a6e78f9e93b1b3103b3f9ffe Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 6 Sep 2021 16:57:39 +0200 Subject: [PATCH 424/923] Remove boost lexical_cast dependency --- EventFilter/L1TRawToDigi/src/MP7FileReader.cc | 9 +++--- EventFilter/Utilities/src/EvFDaqDirector.cc | 31 +++++++++---------- .../Utilities/src/FedRawDataInputSource.cc | 8 ++--- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc index 2427fcf26c9a7..5ddf8096390e6 100644 --- a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc +++ b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc @@ -5,7 +5,6 @@ #include #include -#include #include #include @@ -165,9 +164,9 @@ std::vector MP7FileReader::searchLinks() { boost::split(tokens, tmp, boost::is_any_of(" \t"), boost::token_compress_on); // Convert it into uint32 s std::vector links; - std::transform( - tokens.begin(), tokens.end(), std::back_inserter(links), boost::lexical_cast); - return links; + std::transform(tokens.begin(), tokens.end(), std::back_inserter(links), [](const std::string& str) { + return std::stoul(str); + }); } else { throw std::logic_error("Unexpected line found!"); } @@ -201,7 +200,7 @@ std::vector > MP7FileReader::readRows() { if (boost::regex_match(line, what, reFrame_)) { // check frame number - uint32_t n = boost::lexical_cast(what[1].str()); + uint32_t n = std::stoul(what[1].str()); if (n != data.size()) { std::stringstream ss; diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 1a8aa796e8ed5..96efa07cad33c 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include //using boost::asio::ip::tcp; @@ -84,10 +83,10 @@ namespace evf { char* fuLockPollIntervalPtr = std::getenv("FFF_LOCKPOLLINTERVAL"); if (fuLockPollIntervalPtr) { try { - fuLockPollInterval_ = boost::lexical_cast(std::string(fuLockPollIntervalPtr)); + fuLockPollInterval_ = std::stoul(std::string(fuLockPollIntervalPtr)); edm::LogInfo("EvFDaqDirector") << "Setting fu lock poll interval by environment string: " << fuLockPollInterval_ << " us"; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fuLockPollIntervalPtr); } } @@ -96,9 +95,9 @@ namespace evf { char* fileBrokerParamPtr = std::getenv("FFF_USEFILEBROKER"); if (fileBrokerParamPtr) { try { - useFileBroker_ = (boost::lexical_cast(std::string(fileBrokerParamPtr))) > 0; + useFileBroker_ = (std::stoul(std::string(fileBrokerParamPtr))) > 0; edm::LogInfo("EvFDaqDirector") << "Setting useFileBroker parameter by environment string: " << useFileBroker_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fileBrokerParamPtr); } } @@ -126,9 +125,9 @@ namespace evf { char* startFromLSPtr = std::getenv("FFF_START_LUMISECTION"); if (startFromLSPtr) { try { - startFromLS_ = boost::lexical_cast(std::string(startFromLSPtr)); + startFromLS_ = std::stoul(std::string(startFromLSPtr)); edm::LogInfo("EvFDaqDirector") << "Setting start from LS by environment string: " << startFromLS_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(startFromLSPtr); } } @@ -137,10 +136,10 @@ namespace evf { char* fileBrokerUseLockParamPtr = std::getenv("FFF_FILEBROKERUSELOCALLOCK"); if (fileBrokerUseLockParamPtr) { try { - fileBrokerUseLocalLock_ = (boost::lexical_cast(std::string(fileBrokerUseLockParamPtr))) > 0; + fileBrokerUseLocalLock_ = (std::stoul(std::string(fileBrokerUseLockParamPtr))) > 0; edm::LogInfo("EvFDaqDirector") << "Setting fileBrokerUseLocalLock parameter by environment string: " << fileBrokerUseLocalLock_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fileBrokerUseLockParamPtr); } } @@ -773,7 +772,7 @@ namespace evf { edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile; return -1; } - return boost::lexical_cast(data); + return std::stoi(data); } bool EvFDaqDirector::bumpFile(unsigned int& ls, @@ -1326,8 +1325,8 @@ namespace evf { if (i < dp.getData().size()) { std::string dataSize = dp.getData()[i]; try { - fileSizeFromJson = boost::lexical_cast(dataSize); - } catch (boost::bad_lexical_cast const&) { + fileSizeFromJson = std::stol(dataSize); + } catch (const std::exception&) { //non-fatal currently, processing can continue without this value edm::LogWarning("EvFDaqDirector") << "grabNextJsonFile - error parsing number of Bytes from BU JSON. " << "Input value is -: " << dataSize; @@ -1336,8 +1335,8 @@ namespace evf { } } } - return boost::lexical_cast(data); - } catch (boost::bad_lexical_cast const& e) { + return std::stoi(data); + } catch (const std::exception& e) { edm::LogError("EvFDaqDirector") << "grabNextJsonFile - error parsing number of events from BU JSON. " << "Input value is -: " << data; } catch (std::runtime_error const& e) { @@ -1423,7 +1422,7 @@ namespace evf { throw cms::Exception("EvFDaqDirector::grabNextJsonFileUnlock") << " error reading number of events from BU JSON -: No input value " << data; } - return boost::lexical_cast(data); + return std::stoi(data); } catch (std::filesystem::filesystem_error const& ex) { // Input dir gone? unlockFULocal(); @@ -1432,7 +1431,7 @@ namespace evf { // Another process grabbed the file and NFS did not register this unlockFULocal(); edm::LogError("EvFDaqDirector") << "grabNextFile runtime Exception -: " << e.what(); - } catch (boost::bad_lexical_cast const&) { + } catch (const std::out_of_range&) { edm::LogError("EvFDaqDirector") << "grabNextFile error parsing number of events from BU JSON. " << "Input value is -: " << data; } catch (std::exception const& e) { diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index 486b11633c15a..c56f363639e97 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -46,8 +46,6 @@ //JSON file reader #include "EventFilter/Utilities/interface/reader.h" -#include - using namespace evf::FastMonState; FedRawDataInputSource::FedRawDataInputSource(edm::ParameterSet const& pset, edm::InputSourceDescription const& desc) @@ -1556,10 +1554,10 @@ long FedRawDataInputSource::initFileList() { std::string runStr = fileStem.substr(3, end - 3); try { //get long to support test run numbers < 2^32 - long rval = boost::lexical_cast(runStr); + long rval = std::stol(runStr); edm::LogInfo("FedRawDataInputSource") << "Autodetected run number in fileListMode -: " << rval; return rval; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("FedRawDataInputSource") << "Unable to autodetect run number in fileListMode from file -: " << fileName; } @@ -1586,7 +1584,7 @@ evf::EvFDaqDirector::FileStatus FedRawDataInputSource::getFile(unsigned int& ls, fileStem = fileStem.substr(0, fileStem.find('_')); if (!fileListLoopMode_) - ls = boost::lexical_cast(fileStem); + ls = std::stoul(fileStem); else //always starting from LS 1 in loop mode ls = 1 + loopModeIterationInc_; From 969bc11d330eac1a52b1e89b649c31627f2459de Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 6 Sep 2021 18:22:22 +0200 Subject: [PATCH 425/923] Removed lexical_cast boost dependency --- DQM/HcalCommon/interface/HcalCommonHeaders.h | 1 - DQM/L1TMonitor/interface/L1ExtraDQM.h | 1 - DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc | 2 -- .../plugins/SiStripBadComponentsDQMServiceReader.cc | 6 ++---- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/DQM/HcalCommon/interface/HcalCommonHeaders.h b/DQM/HcalCommon/interface/HcalCommonHeaders.h index a6031be0f859d..bee231c8dda9a 100644 --- a/DQM/HcalCommon/interface/HcalCommonHeaders.h +++ b/DQM/HcalCommon/interface/HcalCommonHeaders.h @@ -56,7 +56,6 @@ #include "DQM/HcalCommon/interface/Constants.h" -#include "boost/lexical_cast.hpp" #include #include #include diff --git a/DQM/L1TMonitor/interface/L1ExtraDQM.h b/DQM/L1TMonitor/interface/L1ExtraDQM.h index 69311a3f12f00..ca298444d70fd 100644 --- a/DQM/L1TMonitor/interface/L1ExtraDQM.h +++ b/DQM/L1TMonitor/interface/L1ExtraDQM.h @@ -65,7 +65,6 @@ #include "DQMServices/Core/interface/DQMStore.h" -#include "boost/lexical_cast.hpp" #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" // forward declarations diff --git a/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc b/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc index 5137b2f3adc64..b2c6bc2e97dd6 100644 --- a/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc +++ b/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc @@ -9,8 +9,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "boost/lexical_cast.hpp" - // ----------------------------------------------------------------------------- // PedsFullNoiseTask::PedsFullNoiseTask(DQMStore* dqm, const FedChannelConnection& conn, const edm::ParameterSet& pset) diff --git a/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc b/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc index 7ae8d30dc2db6..9b1364f291d6a 100644 --- a/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc +++ b/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc @@ -8,8 +8,6 @@ #include #include -#include - using namespace std; SiStripBadComponentsDQMServiceReader::SiStripBadComponentsDQMServiceReader(const edm::ParameterSet& iConfig) @@ -47,7 +45,7 @@ void SiStripBadComponentsDQMServiceReader::analyze(const edm::Event& e, const ed unsigned int value = (*(range.first + it)); ss << detIdToString(detid[id], tTopo) << "\t" << detid[id] << "\t"; - uint32_t flag = boost::lexical_cast(siStripBadStrip.decode(value).flag); + uint32_t flag = static_cast(siStripBadStrip.decode(value).flag); printError(ss, ((flag & FedErrorMask) == FedErrorMask), "Fed error, "); printError(ss, ((flag & DigiErrorMask) == DigiErrorMask), "Digi error, "); @@ -120,7 +118,7 @@ string SiStripBadComponentsDQMServiceReader::detIdToString(DetId detid, const Tr name += "+"; } // if( side != -1 ) { - // name += boost::lexical_cast(side); + // name += std::to_string(side); // } return name; From 97ce6ad107dbbc61dd4049bd4fc6666ded2fe5c1 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Mon, 6 Sep 2021 19:04:44 +0200 Subject: [PATCH 426/923] added appropriate std catch --- EventFilter/Utilities/src/EvFDaqDirector.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 96efa07cad33c..7a21cb8ca27a7 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -1336,9 +1336,12 @@ namespace evf { } } return std::stoi(data); - } catch (const std::exception& e) { + } catch (const std::out_of_range& e) { edm::LogError("EvFDaqDirector") << "grabNextJsonFile - error parsing number of events from BU JSON. " << "Input value is -: " << data; + } catch (const std::invalid_argument& e) { + edm::LogError("EvFDaqDirector") << "grabNextJsonFile - argument error parsing events from BU JSON. " + << "Input value is -: " << data; } catch (std::runtime_error const& e) { //Can be thrown by Json parser edm::LogError("EvFDaqDirector") << "grabNextJsonFile - std::runtime_error exception -: " << e.what(); @@ -1434,6 +1437,9 @@ namespace evf { } catch (const std::out_of_range&) { edm::LogError("EvFDaqDirector") << "grabNextFile error parsing number of events from BU JSON. " << "Input value is -: " << data; + } catch (const std::invalid_argument&) { + edm::LogError("EvFDaqDirector") << "grabNextFile argument error parsing events from BU JSON. " + << "Input value is -: " << data; } catch (std::exception const& e) { // BU run directory disappeared? unlockFULocal(); From b0a572a629ba0a6719f975024f69357475c89959 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Mon, 6 Sep 2021 20:37:23 +0200 Subject: [PATCH 427/923] Fixed typos and improved << operators. --- CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc index d0f07be384426..1e3db71078b63 100644 --- a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc @@ -151,9 +151,9 @@ std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Sect os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n"; os << std::setprecision(3); os << " slope = " << sc.slope_ << "\n"; - os << " cut_h: apply = " << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_ + os << " cut_h: apply = " << std::boolalpha << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_ << ", si = " << sc.cut_h_si_ << "\n"; - os << " cut_v: apply = " << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_ + os << " cut_v: apply = " << std::boolalpha << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_ << ", si = " << sc.cut_v_si_ << "\n"; return os; @@ -171,7 +171,7 @@ std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binn << "\n"; os << " n_bins_x = " << b.slice_n_bins_x_ << ", x_min = " << b.slice_x_min_ << ", x_max = " << b.slice_x_max_ << "\n"; - os << " n_bins_y = " << b.slice_n_bins_x_ << ", y_min = " << b.slice_x_min_ << ", y_max = " << b.slice_x_max_; + os << " n_bins_y = " << b.slice_n_bins_y_ << ", y_min = " << b.slice_y_min_ << ", y_max = " << b.slice_y_max_; return os; } @@ -233,7 +233,7 @@ std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c) { os << "\n" << "* alignment_x_relative\n"; for (const auto& p : c.alignment_x_relative_ranges_) - if (rpTags[p.first][2] == '1') { // only near RPs + if (p.first == c.sectorConfig45_.rp_N_.id_ || p.first == c.sectorConfig56_.rp_N_.id_) { // only near RPs os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ << ", sh_max = " << p.second.x_max_ << "\n"; } From 9f84df088e66bd81dbfd6a0bdb110d56a50f4fc4 Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 6 Sep 2021 21:23:22 +0200 Subject: [PATCH 428/923] applying code-format --- .../HGCalSimAlgos/src/HGCalRadiationMap.cc | 3 +- .../test/HGCHEbackSignalScalerAnalyzer.cc | 36 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc b/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc index 50059996c0415..a515705faf61a 100644 --- a/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc +++ b/SimCalorimetry/HGCalSimAlgos/src/HGCalRadiationMap.cc @@ -56,7 +56,8 @@ double HGCalRadiationMap::getFluenceValue(const int subdet, const int layer, con } // -std::map, HGCalRadiationMap::DoseParameters> HGCalRadiationMap::readDosePars(const std::string& fullpath) { +std::map, HGCalRadiationMap::DoseParameters> HGCalRadiationMap::readDosePars( + const std::string& fullpath) { doseParametersMap result; //no dose file means no aging diff --git a/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc b/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc index 5e2f8e544e797..0c7181e150dad 100644 --- a/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc +++ b/SimCalorimetry/HGCalSimAlgos/test/HGCHEbackSignalScalerAnalyzer.cc @@ -58,7 +58,7 @@ class HGCHEbackSignalScalerAnalyzer : public edm::one::EDAnalyzer allLayers_, allIeta_; //allIphi_ + std::set allLayers_, allIeta_; //allIphi_ const HGCalGeometry* gHGCal_; const HGCalDDDConstants* hgcCons_; @@ -71,7 +71,7 @@ class HGCHEbackSignalScalerAnalyzer : public edm::one::EDAnalyzer("doseMap")), + : doseMap_(iConfig.getParameter("doseMap")), sipmMap_(iConfig.getParameter("sipmMap")), nPEperMIP_(iConfig.getParameter("nPEperMIP")) { usesResource("TFileService"); @@ -108,11 +108,11 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: //setup maps createBinning(detIdVec); - int minLayer( *std::min_element(allLayers_.begin(),allLayers_.end()) ); - int maxLayer( *std::max_element(allLayers_.begin(),allLayers_.end()) ); + int minLayer(*std::min_element(allLayers_.begin(), allLayers_.end())); + int maxLayer(*std::max_element(allLayers_.begin(), allLayers_.end())); int nLayers(maxLayer - minLayer + 1); - int minIeta( *std::min_element(allIeta_.begin(),allIeta_.end()) ); - int maxIeta( *std::max_element(allIeta_.begin(),allIeta_.end()) ); + int minIeta(*std::min_element(allIeta_.begin(), allIeta_.end())); + int maxIeta(*std::max_element(allIeta_.begin(), allIeta_.end())); int nIeta(maxIeta - minIeta + 1); //int minIphi( *std::min_element(allIphi_.begin(),allIphi_.end()) ); //int maxIphi( *std::max_element(allIphi_.begin(),allIphi_.end()) ); @@ -167,17 +167,17 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: double radius = std::sqrt(std::pow(global.x(), 2) + std::pow(global.y(), 2)); double dose = scal.getDoseValue(DetId::HGCalHSc, layer, radius); double fluence = scal.getFluenceValue(DetId::HGCalHSc, layer, radius); - + auto dosePair = scal.scaleByDose(scId, radius); float scaleFactorBySipmArea = scal.scaleBySipmArea(scId, radius); float scaleFactorByTileArea = scal.scaleByTileArea(scId, radius); float scaleFactorByDose = dosePair.first; float noiseByFluence = dosePair.second; - + float lysf = scaleFactorByTileArea * scaleFactorBySipmArea * scaleFactorByDose; - float s=nPEperMIP_ * lysf; - float n=noiseByFluence*sqrt(scaleFactorBySipmArea); - float sn=s/n; + float s = nPEperMIP_ * lysf; + float n = noiseByFluence * sqrt(scaleFactorBySipmArea); + float sn = s / n; histos_["count_ieta"]->Fill(layer, ieta, 1); //histos_["count_iphi"]->Fill(layer, iphi, 1); @@ -219,24 +219,24 @@ void HGCHEbackSignalScalerAnalyzer::analyze(const edm::Event& iEvent, const edm: //layerHistos_[layer]["lysf_iphi"]->Fill(iphi, lysf); } - //for all (except count histograms) normalize by the number of sensors - for(auto &lit : layerHistos_) { - for(auto &hit : lit.second) { + for (auto& lit : layerHistos_) { + for (auto& hit : lit.second) { TString name(hit.first); - if(name.Contains("count_")) continue; + if (name.Contains("count_")) + continue; TString count_name(name.Contains("_ieta") ? "count_ieta" : "count_iphi"); hit.second->Divide(lit.second[count_name]); } } - for(auto &hit : histos_) { + for (auto& hit : histos_) { TString name(hit.first); - if(name.Contains("count_")) continue; + if (name.Contains("count_")) + continue; TString count_name(name.Contains("_ieta") ? "count_ieta" : "count_iphi"); hit.second->Divide(histos_[count_name]); } - } // From 044ec3bc9dc04bd63d76d5814e4161f177fb1405 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Tue, 7 Sep 2021 06:42:52 +0200 Subject: [PATCH 429/923] Removed boost lexical_cast dependency --- OnlineDB/EcalCondDB/src/RunCrystalErrorsDat.cc | 3 +-- OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc | 3 +-- OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc | 3 +-- OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc | 3 +-- OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/OnlineDB/EcalCondDB/src/RunCrystalErrorsDat.cc b/OnlineDB/EcalCondDB/src/RunCrystalErrorsDat.cc index 371d94c5fd0c9..59bfd649e871c 100644 --- a/OnlineDB/EcalCondDB/src/RunCrystalErrorsDat.cc +++ b/OnlineDB/EcalCondDB/src/RunCrystalErrorsDat.cc @@ -1,7 +1,6 @@ #include #include #include "OnlineDB/Oracle/interface/Oracle.h" -#include #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h" #include "OnlineDB/EcalCondDB/interface/RunIOV.h" @@ -93,7 +92,7 @@ void RunCrystalErrorsDat::fetchData(map* fillM rset->getInt(5), // id3 rset->getString(6)); // maps_to - dat.setErrorBits(boost::lexical_cast(rset->getString(7))); + dat.setErrorBits(std::stoul(rset->getString(7))); p.second = dat; fillMap->insert(p); diff --git a/OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc b/OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc index 6d4b30ef5fd38..b3f62100f5a42 100644 --- a/OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc +++ b/OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc @@ -1,7 +1,6 @@ #include #include #include "OnlineDB/Oracle/interface/Oracle.h" -#include #include "OnlineDB/EcalCondDB/interface/RunMemChErrorsDat.h" #include "OnlineDB/EcalCondDB/interface/RunIOV.h" @@ -91,7 +90,7 @@ void RunMemChErrorsDat::fetchData(map* fillMap, rset->getInt(5), // id3 rset->getString(6)); // maps_to - dat.setErrorBits(boost::lexical_cast(rset->getString(7))); + dat.setErrorBits(std::stoul(rset->getString(7))); p.second = dat; fillMap->insert(p); diff --git a/OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc b/OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc index 094d17f5a0197..c442a219ee45f 100644 --- a/OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc +++ b/OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc @@ -1,7 +1,6 @@ #include #include #include "OnlineDB/Oracle/interface/Oracle.h" -#include #include "OnlineDB/EcalCondDB/interface/RunMemTTErrorsDat.h" #include "OnlineDB/EcalCondDB/interface/RunIOV.h" @@ -92,7 +91,7 @@ void RunMemTTErrorsDat::fetchData(map* fillMap, rset->getInt(5), // id3 rset->getString(6)); // maps_to - dat.setErrorBits(boost::lexical_cast(rset->getString(7))); + dat.setErrorBits(std::stoul(rset->getString(7))); p.second = dat; fillMap->insert(p); diff --git a/OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc b/OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc index 1d3095f95f012..aad4f2bb0895a 100644 --- a/OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc +++ b/OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc @@ -1,7 +1,6 @@ #include #include #include "OnlineDB/Oracle/interface/Oracle.h" -#include #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h" #include "OnlineDB/EcalCondDB/interface/RunIOV.h" @@ -92,7 +91,7 @@ void RunPNErrorsDat::fetchData(map* fillMap, RunIOV rset->getInt(5), // id3 rset->getString(6)); // maps_to - dat.setErrorBits(boost::lexical_cast(rset->getString(7))); + dat.setErrorBits(std::stoul(rset->getString(7))); p.second = dat; fillMap->insert(p); diff --git a/OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc b/OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc index 0980b84fe6e86..69220111e7d1a 100644 --- a/OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc +++ b/OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc @@ -1,7 +1,6 @@ #include #include #include "OnlineDB/Oracle/interface/Oracle.h" -#include #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h" #include "OnlineDB/EcalCondDB/interface/RunIOV.h" @@ -92,7 +91,7 @@ void RunTTErrorsDat::fetchData(map* fillMap, RunIOV rset->getInt(5), // id3 rset->getString(6)); // maps_to - dat.setErrorBits(boost::lexical_cast(rset->getString(7))); + dat.setErrorBits(std::stoul(rset->getString(7))); p.second = dat; fillMap->insert(p); From 2698506adb68a81503769ceb892b0ff476ff0941 Mon Sep 17 00:00:00 2001 From: Suchandra Date: Tue, 7 Sep 2021 08:55:21 +0200 Subject: [PATCH 430/923] removed unwanted newlines --- .../SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index 192f1e3be8dff..5625d077c38af 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -1,5 +1,3 @@ - - #ifndef __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizerAlgorithm_h #define __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizerAlgorithm_h From b015d986be07fc62009ddc00320f66a50d8441fa Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Tue, 7 Sep 2021 09:38:15 +0200 Subject: [PATCH 431/923] removed boost lexical_cast dependency in CalibTracker --- .../SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc | 3 +-- CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc | 3 +-- CalibTracker/SiStripLorentzAngle/src/LA_Results.cc | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc index 48a1576d89a40..fd11c5fddda3e 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc +++ b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc @@ -3,7 +3,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include #include -#include #include #include @@ -64,7 +63,7 @@ namespace sistrip { if (std::regex_match(ensemble.first, format)) { const bool TIB = "TIB" == std::regex_replace(ensemble.first, format, "\\1"); const bool stereo = "s" == std::regex_replace(ensemble.first, format, "\\3"); - const unsigned layer = boost::lexical_cast(std::regex_replace(ensemble.first, format, "\\2")); + const unsigned layer = std::stoul(std::regex_replace(ensemble.first, format, "\\2")); label = std::regex_replace(ensemble.first, format, "\\4"); index = LA_Filler_Fitter::layer_index(TIB, stereo, layer); diff --git a/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc b/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc index 2e6bd68da8909..cf1f860066349 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc +++ b/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc @@ -3,7 +3,6 @@ #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h" -#include #include #include #include @@ -184,7 +183,7 @@ namespace sistrip { std::regex format(".*(T[IO]B)_layer(\\d)([as]).*"); const bool isTIB = "TIB" == std::regex_replace(layer, format, "\\1"); const bool stereo = "s" == std::regex_replace(layer, format, "\\3"); - const unsigned layerNum = boost::lexical_cast(std::regex_replace(layer, format, "\\2")); + const unsigned layerNum = std::stoul(std::regex_replace(layer, format, "\\2")); return std::make_pair(LA_Filler_Fitter::layer_index(isTIB, stereo, layerNum), method); } diff --git a/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc b/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc index ebdff1c20c389..b9ce21ae6e018 100644 --- a/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc +++ b/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -60,8 +59,8 @@ LA_Filler_Fitter::Result LA_Filler_Fitter::result(Method m, const std::string na std::map LA_Filler_Fitter::module_results(const Book& book, const Method m) { std::map results; for (Book::const_iterator it = book.begin(".*_module\\d*" + method(m)); it != book.end(); ++it) { - const uint32_t detid = boost::lexical_cast( - std::regex_replace(it->first, std::regex(".*_module(\\d*)_.*"), std::string("\\1"))); + const uint32_t detid = + std::stoul(std::regex_replace(it->first, std::regex(".*_module(\\d*)_.*"), std::string("\\1"))); results[detid] = result(m, it->first, book); } return results; From e670b0419e6bb596a2ed886fd58f7e67d3ca4cbf Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 6 Sep 2021 12:19:13 +0200 Subject: [PATCH 432/923] esConsumes migration EcalSignalGenerator. --- .../interface/EcalSignalGenerator.h | 128 +++++++++--------- .../plugins/PreMixingEcalWorker.cc | 13 +- 2 files changed, 65 insertions(+), 76 deletions(-) diff --git a/SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h b/SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h index c6ea2e46708a8..4ee72404d7be8 100644 --- a/SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h +++ b/SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h @@ -2,7 +2,7 @@ #define EcalSimAlgos_EcalSignalGenerator_h #include "SimCalorimetry/EcalSimAlgos/interface/EcalBaseSignalGenerator.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventPrincipal.h" @@ -42,7 +42,7 @@ * as noise */ -#include +//#include #include #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -61,45 +61,54 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { EcalSignalGenerator() : EcalBaseSignalGenerator() {} - EcalSignalGenerator(const edm::InputTag& inputTag, - const edm::EDGetTokenT& t, + EcalSignalGenerator(edm::ConsumesCollector& cc, + const edm::InputTag& inputTag, const double EBs25notCont, const double EEs25notCont, const double peToABarrel, const double peToAEndcap, const bool timeDependent = false) - : EcalBaseSignalGenerator(), theEvent(nullptr), theEventPrincipal(nullptr), theInputTag(inputTag), tok_(t) { + : EcalBaseSignalGenerator(), + m_gainRatiosToken(cc.esConsumes()), + m_interCalibConstantsMCToken(cc.esConsumes()), + m_adcToGeVConstantToken(cc.esConsumes()), + m_esGainToken(cc.esConsumes()), + m_esMIPToGeVConstantToken(cc.esConsumes()), + m_esIntercalibConstantsToken(cc.esConsumes()), + theEvent(nullptr), + theEventPrincipal(nullptr), + theInputTag(inputTag), + m_tok(cc.consumes(inputTag)), + m_EBs25notCont(EBs25notCont), + m_EEs25notCont(EEs25notCont), + m_peToABarrel(peToABarrel), + m_peToAEndcap(peToAEndcap), + m_timeDependent(timeDependent) { EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); theDefaultGains[2] = defaultRatios->gain6Over1(); theDefaultGains[1] = theDefaultGains[2] * (defaultRatios->gain12Over6()); - m_EBs25notCont = EBs25notCont; - m_EEs25notCont = EEs25notCont; - m_peToABarrel = peToABarrel; - m_peToAEndcap = peToAEndcap; - m_timeDependent = timeDependent; + + if (m_timeDependent) { + m_laserDbToken = cc.esConsumes(); + m_laserDbMCToken = cc.esConsumes(); + } } ~EcalSignalGenerator() override {} void initializeEvent(const edm::Event* event, const edm::EventSetup* eventSetup) { theEvent = event; - eventSetup->get().get(grHandle); // find the gains + m_gainRatios = &eventSetup->getData(m_gainRatiosToken); // find the gains // Ecal Intercalibration Constants - eventSetup->get().get(pIcal); - ical = pIcal.product(); + ical = &eventSetup->getData(m_interCalibConstantsMCToken); // adc to GeV - eventSetup->get().get(pAgc); - agc = pAgc.product(); + agc = &eventSetup->getData(m_adcToGeVConstantToken); m_maxEneEB = (agc->getEBValue()) * theDefaultGains[1] * MAXADC * m_EBs25notCont; m_maxEneEE = (agc->getEEValue()) * theDefaultGains[1] * MAXADC * m_EEs25notCont; if (m_timeDependent) { //---- - // Ecal LaserCorrection Constants for laser correction ratio - edm::ESHandle laser; - eventSetup->get().get(laser); - // const edm::TimeValue_t eventTimeValue = theEvent->getRun().runAuxiliary().beginTime().value(); // @@ -108,7 +117,8 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { // m_iTime = eventTimeValue; - m_lasercals = laser.product(); + // Ecal LaserCorrection Constants for laser correction ratio + m_lasercals = &eventSetup->getData(m_laserDbToken); // // the "prime" is exactly the same as the usual laser service, BUT @@ -116,25 +126,18 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { // NB: in the creation of the tag make sure the "prime" (MC) tag is prepared properly! // NB again: if many IOVs also in "MC" tag, then fancy things could be perfomed ... left for the future // - edm::ESHandle laser_prime; - eventSetup->get().get(laser_prime); - m_lasercals_prime = laser_prime.product(); + m_lasercals_prime = &eventSetup->getData(m_laserDbMCToken); //clear the laser cache for each event time CalibCache().swap(m_valueLCCache_LC); CalibCache().swap(m_valueLCCache_LC_prime); //--- also the "prime" ... yes - //---- } //ES - eventSetup->get().get(hesgain); - eventSetup->get().get(hesMIPToGeV); - eventSetup->get().get(hesMIPs); - - esgain = hesgain.product(); - esmips = hesMIPs.product(); - esMipToGeV = hesMIPToGeV.product(); + esgain = &eventSetup->getData(m_esGainToken); + esmips = &eventSetup->getData(m_esIntercalibConstantsToken); + esMipToGeV = &eventSetup->getData(m_esMIPToGeVConstantToken); if (1.1 > esgain->getESGain()) ESgain = 1; else @@ -148,21 +151,16 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { /// some users use EventPrincipals, not Events. We support both void initializeEvent(const edm::EventPrincipal* eventPrincipal, const edm::EventSetup* eventSetup) { theEventPrincipal = eventPrincipal; - eventSetup->get().get(grHandle); // find the gains + m_gainRatios = &eventSetup->getData(m_gainRatiosToken); // find the gains // Ecal Intercalibration Constants - eventSetup->get().get(pIcal); - ical = pIcal.product(); + ical = &eventSetup->getData(m_interCalibConstantsMCToken); // adc to GeV - eventSetup->get().get(pAgc); - agc = pAgc.product(); + agc = &eventSetup->getData(m_adcToGeVConstantToken); m_maxEneEB = (agc->getEBValue()) * theDefaultGains[1] * MAXADC * m_EBs25notCont; m_maxEneEE = (agc->getEEValue()) * theDefaultGains[1] * MAXADC * m_EEs25notCont; if (m_timeDependent) { //---- - // Ecal LaserCorrection Constants for laser correction ratio - edm::ESHandle laser; - eventSetup->get().get(laser); edm::TimeValue_t eventTimeValue = 0; if (theEventPrincipal) { // @@ -175,11 +173,10 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { edm::LogError("EcalSignalGenerator") << " theEventPrincipal not defined??? " << std::endl; } m_iTime = eventTimeValue; - m_lasercals = laser.product(); - edm::ESHandle laser_prime; - eventSetup->get().get(laser_prime); - m_lasercals_prime = laser_prime.product(); + // Ecal LaserCorrection Constants for laser correction ratio + m_lasercals = &eventSetup->getData(m_laserDbToken); + m_lasercals_prime = &eventSetup->getData(m_laserDbMCToken); //clear the laser cache for each event time CalibCache().swap(m_valueLCCache_LC); @@ -188,13 +185,9 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { } //ES - eventSetup->get().get(hesgain); - eventSetup->get().get(hesMIPToGeV); - eventSetup->get().get(hesMIPs); - - esgain = hesgain.product(); - esmips = hesMIPs.product(); - esMipToGeV = hesMIPToGeV.product(); + esgain = &eventSetup->getData(m_esGainToken); + esmips = &eventSetup->getData(m_esIntercalibConstantsToken); + esMipToGeV = &eventSetup->getData(m_esMIPToGeVConstantToken); if (1.1 > esgain->getESGain()) ESgain = 1; else @@ -211,7 +204,7 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { const COLLECTION* digis = nullptr; // try accessing by whatever is set, Event or EventPrincipal if (theEvent) { - if (theEvent->getByToken(tok_, pDigis)) { + if (theEvent->getByToken(m_tok, pDigis)) { digis = pDigis.product(); // get a ptr to the product } else { throw cms::Exception("EcalSignalGenerator") << "Cannot find input data " << theInputTag; @@ -278,7 +271,7 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { const std::vector GetGainRatios(const DetId& detid) { std::vector gainRatios(4); // get gain ratios - EcalMGPAGainRatio theRatio = (*grHandle)[detid]; + EcalMGPAGainRatio theRatio = (*m_gainRatios)[detid]; gainRatios[0] = 0.; gainRatios[3] = 1.; @@ -294,21 +287,24 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { return detId.subdetId() == EcalBarrel ? m_peToABarrel : m_peToAEndcap; } + const edm::ESGetToken m_gainRatiosToken; + const edm::ESGetToken m_interCalibConstantsMCToken; + const edm::ESGetToken m_adcToGeVConstantToken; + edm::ESGetToken m_laserDbToken; + edm::ESGetToken m_laserDbMCToken; + const edm::ESGetToken m_esGainToken; + const edm::ESGetToken m_esMIPToGeVConstantToken; + const edm::ESGetToken m_esIntercalibConstantsToken; + /// these fields are set in initializeEvent() const edm::Event* theEvent; const edm::EventPrincipal* theEventPrincipal; - edm::ESHandle grHandle; - edm::ESHandle pIcal; - edm::ESHandle pAgc; + const EcalGainRatios* m_gainRatios; /// these come from the ParameterSet - edm::InputTag theInputTag; - edm::EDGetTokenT tok_; - - edm::ESHandle hesgain; - edm::ESHandle hesMIPToGeV; - edm::ESHandle hesMIPs; + const edm::InputTag theInputTag; + const edm::EDGetTokenT m_tok; const ESGain* esgain; const ESIntercalibConstants* esmips; @@ -316,11 +312,11 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { int ESgain; double ESMIPToGeV; - double m_EBs25notCont; - double m_EEs25notCont; + const double m_EBs25notCont; + const double m_EEs25notCont; - double m_peToABarrel; - double m_peToAEndcap; + const double m_peToABarrel; + const double m_peToAEndcap; double m_maxEneEB; // max attainable energy in the ecal barrel double m_maxEneEE; // max attainable energy in the ecal endcap @@ -328,7 +324,7 @@ class EcalSignalGenerator : public EcalBaseSignalGenerator { const EcalADCToGeVConstant* agc; const EcalIntercalibConstantsMC* ical; - bool m_timeDependent; + const bool m_timeDependent; edm::TimeValue_t m_iTime; CalibCache m_valueLCCache_LC; CalibCache m_valueLCCache_LC_prime; diff --git a/SimCalorimetry/EcalSimProducers/plugins/PreMixingEcalWorker.cc b/SimCalorimetry/EcalSimProducers/plugins/PreMixingEcalWorker.cc index cfe528757c688..ac2ba542bebe4 100644 --- a/SimCalorimetry/EcalSimProducers/plugins/PreMixingEcalWorker.cc +++ b/SimCalorimetry/EcalSimProducers/plugins/PreMixingEcalWorker.cc @@ -41,10 +41,6 @@ class PreMixingEcalWorker : public PreMixingWorker { std::string EEDigiCollectionDM_; // secondary name to be given to collection of digis std::string ESDigiCollectionDM_; // secondary name to be given to collection of digis - edm::EDGetTokenT tok_eb_; - edm::EDGetTokenT tok_ee_; - edm::EDGetTokenT tok_es_; - const double m_EBs25notCont; const double m_EEs25notCont; const double m_peToABarrel; @@ -64,19 +60,16 @@ PreMixingEcalWorker::PreMixingEcalWorker(const edm::ParameterSet &ps, : EBPileInputTag_(ps.getParameter("EBPileInputTag")), EEPileInputTag_(ps.getParameter("EEPileInputTag")), ESPileInputTag_(ps.getParameter("ESPileInputTag")), - tok_eb_(iC.consumes(EBPileInputTag_)), - tok_ee_(iC.consumes(EEPileInputTag_)), - tok_es_(iC.consumes(ESPileInputTag_)), m_EBs25notCont(ps.getParameter("EBs25notContainment")), m_EEs25notCont(ps.getParameter("EEs25notContainment")), m_peToABarrel(ps.getParameter("photoelectronsToAnalogBarrel")), m_peToAEndcap(ps.getParameter("photoelectronsToAnalogEndcap")), m_timeDependent(ps.getParameter("timeDependent")), theEBSignalGenerator( - EBPileInputTag_, tok_eb_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap, m_timeDependent), + iC, EBPileInputTag_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap, m_timeDependent), theEESignalGenerator( - EEPileInputTag_, tok_ee_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap, m_timeDependent), - theESSignalGenerator(ESPileInputTag_, tok_es_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + iC, EEPileInputTag_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap, m_timeDependent), + theESSignalGenerator(iC, ESPileInputTag_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), myEcalDigitizer_(ps, iC) { EBDigiCollectionDM_ = ps.getParameter("EBDigiCollectionDM"); EEDigiCollectionDM_ = ps.getParameter("EEDigiCollectionDM"); From 13c86d88ad96ad46c5f029e6f9ae1fcd6e2a180b Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 7 Sep 2021 10:23:04 +0200 Subject: [PATCH 433/923] Improve code readability --- RecoHGCal/TICL/plugins/SimTrackstersProducer.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 229491ec75785..89e77348d9bea 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -1,4 +1,4 @@ -// Author: Leonardo Cristella - leonardo.cristella@cern.ch +// Author: Felice Pantaleo, Leonardo Cristella - felice.pantaleo@cern.ch, leonardo.cristella@cern.ch // Date: 09/2021 // user include files @@ -104,7 +104,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto output_mask = std::make_unique>(); auto result_fromCP = std::make_unique(); auto output_mask_fromCP = std::make_unique>(); - auto cpToSc_STS = std::make_unique>>(); + auto cpToSc_SimTrackstersMap = 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_); @@ -119,9 +119,9 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) const auto& geom = es.getData(geom_token_); rhtools_.setGeometry(geom); - auto num_simclusters = simclusters.size(); + const auto num_simclusters = simclusters.size(); result->reserve(num_simclusters); // Conservative size, will call shrink_to_fit later - auto num_caloparticles = caloparticles.size(); + const auto num_caloparticles = caloparticles.size(); result_fromCP->reserve(num_caloparticles); for (const auto& [key, lcVec] : caloParticlesToRecoColl) { @@ -129,7 +129,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto cpIndex = &cp - &caloparticles[0]; auto regr_energy = cp.energy(); - std::vector scSTS; + std::vector scSimTracksterIdx; // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { @@ -164,7 +164,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) scRef.id(), *output_mask, *result); - scSTS.push_back(result->size() - 1); + scSimTracksterIdx.push_back(result->size() - 1); } } @@ -179,7 +179,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) key.id(), *output_mask_fromCP, *result_fromCP); - (*cpToSc_STS)[result_fromCP->size() - 1] = scSTS; + (*cpToSc_SimTrackstersMap)[result_fromCP->size() - 1] = scSimTracksterIdx; } ticl::assignPCAtoTracksters( @@ -193,5 +193,5 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) evt.put(std::move(output_mask)); evt.put(std::move(result_fromCP), "fromCPs"); evt.put(std::move(output_mask_fromCP), "fromCPs"); - evt.put(std::move(cpToSc_STS)); + evt.put(std::move(cpToSc_SimTrackstersMap)); } From 02254017c8596e90de469a9d65a1cf7b2d5a45a6 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 7 Sep 2021 11:23:06 +0200 Subject: [PATCH 434/923] Reserve vector --- .../TICL/plugins/SimTrackstersProducer.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 89e77348d9bea..3ef1172a049d5 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -130,6 +130,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto regr_energy = cp.energy(); std::vector scSimTracksterIdx; + scSimTracksterIdx.reserve(cp.simClusters()); // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { @@ -164,8 +165,15 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) scRef.id(), *output_mask, *result); - scSimTracksterIdx.push_back(result->size() - 1); + + if (result->size() < 1) + continue; + const auto index = result->size() - 1; + if (std::find(scSimTracksterIdx.begin(), scSimTracksterIdx.end(), index) == scSimTracksterIdx.end()) { + scSimTracksterIdx.emplace_back(index); + } } + scSimTracksterIdx.shrink_to_fit(); } // Create a Trackster from any CP @@ -179,7 +187,13 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) key.id(), *output_mask_fromCP, *result_fromCP); - (*cpToSc_SimTrackstersMap)[result_fromCP->size() - 1] = scSimTracksterIdx; + + if (result_fromCP->size() < 1) + continue; + const auto index = result_fromCP->size() - 1; + if (cpToSc_SimTrackstersMap->find(index) == cpToSc_SimTrackstersMap->end()) { + (*cpToSc_SimTrackstersMap)[index] = scSimTracksterIdx; + } } ticl::assignPCAtoTracksters( From 65b85ce5ce3880f87068945ef47c3bf9595e61a8 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 7 Sep 2021 11:33:48 +0200 Subject: [PATCH 435/923] Forgotten .size() --- RecoHGCal/TICL/plugins/SimTrackstersProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 3ef1172a049d5..5656d91b99151 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -130,7 +130,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) auto regr_energy = cp.energy(); std::vector scSimTracksterIdx; - scSimTracksterIdx.reserve(cp.simClusters()); + scSimTracksterIdx.reserve(cp.simClusters().size()); // Create a Trackster from the object entering HGCal if (cp.g4Tracks()[0].crossedBoundary()) { From 59798029dec3a7d7af720f0923be565561baeaaa Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 7 Sep 2021 11:53:59 +0200 Subject: [PATCH 436/923] code-checks --- RecoHGCal/TICL/plugins/SimTrackstersProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 5656d91b99151..2e7151b29090d 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -166,7 +166,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) *output_mask, *result); - if (result->size() < 1) + if (result->empty()) continue; const auto index = result->size() - 1; if (std::find(scSimTracksterIdx.begin(), scSimTracksterIdx.end(), index) == scSimTracksterIdx.end()) { @@ -188,7 +188,7 @@ void SimTrackstersProducer::produce(edm::Event& evt, const edm::EventSetup& es) *output_mask_fromCP, *result_fromCP); - if (result_fromCP->size() < 1) + if (result_fromCP->empty()) continue; const auto index = result_fromCP->size() - 1; if (cpToSc_SimTrackstersMap->find(index) == cpToSc_SimTrackstersMap->end()) { From c392a9c4fae66c9805f228ecaa7ff28defba8c57 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 7 Sep 2021 12:10:48 +0200 Subject: [PATCH 437/923] esConsumes migration EcalZeroSuppressionProducer. --- .../interface/EcalZeroSuppressionProducer.h | 23 ++++---- .../src/EcalZeroSuppressionProducer.cc | 56 ++++++++----------- 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/interface/EcalZeroSuppressionProducer.h b/SimCalorimetry/EcalZeroSuppressionProducers/interface/EcalZeroSuppressionProducer.h index 87eec5fa8512c..6f9325bafe5dd 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/interface/EcalZeroSuppressionProducer.h +++ b/SimCalorimetry/EcalZeroSuppressionProducers/interface/EcalZeroSuppressionProducer.h @@ -9,7 +9,6 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/Provenance/interface/Provenance.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -22,9 +21,6 @@ class EcalZeroSuppressionProducer : public edm::stream::EDProducer<> { public: - // The following is not yet used, but will be the primary - // constructor when the parameter set system is available. - // explicit EcalZeroSuppressionProducer(const edm::ParameterSet ¶ms); ~EcalZeroSuppressionProducer() override; @@ -34,20 +30,21 @@ class EcalZeroSuppressionProducer : public edm::stream::EDProducer<> { void initCalibrations(const edm::EventSetup &eventSetup); private: - double glbBarrelThreshold_; - double glbEndcapThreshold_; + const double glbBarrelThreshold_; + const double glbEndcapThreshold_; - std::string digiProducer_; // name of module/plugin/producer making digis - std::string EBdigiCollection_; // secondary name given to collection of digis - std::string EEdigiCollection_; // secondary name given to collection of digis - std::string EBZSdigiCollection_; // secondary name given to collection of digis - std::string EEZSdigiCollection_; // secondary name given to collection of digis + const std::string digiProducer_; // name of module/plugin/producer making digis + const std::string ebDigiCollection_; // secondary name given to collection of digis + const std::string eeDigiCollection_; // secondary name given to collection of digis + const std::string ebZSdigiCollection_; // secondary name given to collection of digis + const std::string eeZSdigiCollection_; // secondary name given to collection of digis EcalZeroSuppressor theBarrelZeroSuppressor_; EcalZeroSuppressor theEndcapZeroSuppressor_; - edm::EDGetTokenT EB_token; - edm::EDGetTokenT EE_token; + const edm::EDGetTokenT ebToken_; + const edm::EDGetTokenT eeToken_; + const edm::ESGetToken pedestalToken_; }; #endif diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc b/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc index 1c207d6ed0fe7..7874f92f77eb6 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc +++ b/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc @@ -1,24 +1,19 @@ #include "SimCalorimetry/EcalZeroSuppressionProducers/interface/EcalZeroSuppressionProducer.h" -EcalZeroSuppressionProducer::EcalZeroSuppressionProducer(const edm::ParameterSet ¶ms) { - digiProducer_ = params.getParameter("digiProducer"); - EBdigiCollection_ = params.getParameter("EBdigiCollection"); - EEdigiCollection_ = params.getParameter("EEdigiCollection"); - EBZSdigiCollection_ = params.getParameter("EBZSdigiCollection"); - EEZSdigiCollection_ = params.getParameter("EEZSdigiCollection"); - - // initialize the default values for the thresholds in number of noise sigmas - - glbBarrelThreshold_ = params.getUntrackedParameter("glbBarrelThreshold", 0.2); - glbEndcapThreshold_ = params.getUntrackedParameter("glbEndcapThreshold", 0.4); - - produces(EBZSdigiCollection_); - produces(EEZSdigiCollection_); - - EB_token = consumes(edm::InputTag(digiProducer_)); - EE_token = consumes(edm::InputTag(digiProducer_)); - ; +EcalZeroSuppressionProducer::EcalZeroSuppressionProducer(const edm::ParameterSet ¶ms) + : glbBarrelThreshold_(params.getUntrackedParameter("glbBarrelThreshold", 0.2)), + glbEndcapThreshold_(params.getUntrackedParameter("glbEndcapThreshold", 0.4)), + digiProducer_(params.getParameter("digiProducer")), + ebDigiCollection_(params.getParameter("EBdigiCollection")), + eeDigiCollection_(params.getParameter("EEdigiCollection")), + ebZSdigiCollection_(params.getParameter("EBZSdigiCollection")), + eeZSdigiCollection_(params.getParameter("EEZSdigiCollection")), + ebToken_(consumes(edm::InputTag(digiProducer_))), + eeToken_(consumes(edm::InputTag(digiProducer_))), + pedestalToken_(esConsumes()) { + produces(ebZSdigiCollection_); + produces(eeZSdigiCollection_); } EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer() {} @@ -34,26 +29,26 @@ void EcalZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSet const EBDigiCollection *fullBarrelDigis = nullptr; const EEDigiCollection *fullEndcapDigis = nullptr; - event.getByToken(EB_token, pEBDigis); + event.getByToken(ebToken_, pEBDigis); if (pEBDigis.isValid()) { fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size(); } else { - edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str(); + edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ebDigiCollection_.c_str(); } - event.getByToken(EE_token, pEEDigis); + event.getByToken(eeToken_, pEEDigis); if (pEEDigis.isValid()) { fullEndcapDigis = pEEDigis.product(); // get a ptr to the product edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size(); } else { - edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str(); + edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << eeDigiCollection_.c_str(); } // collection of zero suppressed digis to put in the event - std::unique_ptr gzsBarrelDigis(new EBDigiCollection()); - std::unique_ptr gzsEndcapDigis(new EEDigiCollection()); + auto gzsBarrelDigis = std::make_unique(); + auto gzsEndcapDigis = std::make_unique(); CaloDigiCollectionSorter sorter(5); @@ -99,17 +94,14 @@ void EcalZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSet // } } // Step D: Put outputs into event - event.put(std::move(gzsBarrelDigis), EBZSdigiCollection_); - event.put(std::move(gzsEndcapDigis), EEZSdigiCollection_); + event.put(std::move(gzsBarrelDigis), ebZSdigiCollection_); + event.put(std::move(gzsEndcapDigis), eeZSdigiCollection_); } void EcalZeroSuppressionProducer::initCalibrations(const edm::EventSetup &eventSetup) { // Pedestals from event setup + const auto& thePedestals = eventSetup.getData(pedestalToken_); - edm::ESHandle dbPed; - eventSetup.get().get(dbPed); - const EcalPedestals *thePedestals = dbPed.product(); - - theBarrelZeroSuppressor_.setPedestals(thePedestals); - theEndcapZeroSuppressor_.setPedestals(thePedestals); + theBarrelZeroSuppressor_.setPedestals(&thePedestals); + theEndcapZeroSuppressor_.setPedestals(&thePedestals); } From 506797a6171a821fc4986349186a6dee94196c56 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Tue, 7 Sep 2021 12:21:41 +0200 Subject: [PATCH 438/923] Apply code-checks and code-format. --- .../EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc | 5 +---- .../src/EcalZeroSuppressionProducer.cc | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc index 2fb1d24fc0629..b962dac29815f 100644 --- a/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc +++ b/SimCalorimetry/EcalSelectiveReadoutProducers/src/EcalSRCondTools.cc @@ -53,10 +53,7 @@ constexpr int dccNum[12][12] = { using namespace std; EcalSRCondTools::EcalSRCondTools(const edm::ParameterSet& ps) - : ps_(ps), - mode_(ps.getParameter("mode")), - iomode_write_(true), - done_(false) { + : ps_(ps), mode_(ps.getParameter("mode")), iomode_write_(true), done_(false) { if (mode_ == "read") { iomode_write_ = false; hSrToken_ = esConsumes(); diff --git a/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc b/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc index 7874f92f77eb6..7646572a6ba65 100644 --- a/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc +++ b/SimCalorimetry/EcalZeroSuppressionProducers/src/EcalZeroSuppressionProducer.cc @@ -100,7 +100,7 @@ void EcalZeroSuppressionProducer::produce(edm::Event &event, const edm::EventSet void EcalZeroSuppressionProducer::initCalibrations(const edm::EventSetup &eventSetup) { // Pedestals from event setup - const auto& thePedestals = eventSetup.getData(pedestalToken_); + const auto &thePedestals = eventSetup.getData(pedestalToken_); theBarrelZeroSuppressor_.setPedestals(&thePedestals); theEndcapZeroSuppressor_.setPedestals(&thePedestals); From e31f76d8b4a52d77aae2477466dade61842cd02d Mon Sep 17 00:00:00 2001 From: Martin Grunewald Date: Tue, 7 Sep 2021 14:36:46 +0200 Subject: [PATCH 439/923] HLT menu migration to 12_1_0_pre2 template --- .../Configuration/python/HLT_FULL_cff.py | 26 +++++++++++++------ .../Configuration/python/HLT_Fake1_cff.py | 6 ++--- .../Configuration/python/HLT_Fake2_cff.py | 6 ++--- .../Configuration/python/HLT_Fake_cff.py | 6 ++--- .../Configuration/python/HLT_GRun_cff.py | 26 +++++++++++++------ .../Configuration/python/HLT_HIon_cff.py | 18 ++++++++----- .../Configuration/python/HLT_PIon_cff.py | 6 ++--- .../Configuration/python/HLT_PRef_cff.py | 18 ++++++++----- .../python/HLTrigger_Datasets_GRun_cff.py | 2 +- .../python/HLTrigger_Datasets_HIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PRef_cff.py | 2 +- .../python/customizeHLTforCMSSW.py | 18 ------------- HLTrigger/Configuration/tables/makeSubTables | 4 +-- .../Configuration/test/OnLine_HLT_FULL.py | 26 +++++++++++++------ .../Configuration/test/OnLine_HLT_Fake.py | 6 ++--- .../Configuration/test/OnLine_HLT_Fake1.py | 6 ++--- .../Configuration/test/OnLine_HLT_Fake2.py | 6 ++--- .../Configuration/test/OnLine_HLT_GRun.py | 26 +++++++++++++------ .../Configuration/test/OnLine_HLT_HIon.py | 18 ++++++++----- .../Configuration/test/OnLine_HLT_PIon.py | 6 ++--- .../Configuration/test/OnLine_HLT_PRef.py | 18 ++++++++----- HLTrigger/Configuration/test/cmsDriver.csh | 2 +- HLTrigger/Configuration/test/getFrozenHLT.sh | 6 ++--- HLTrigger/Configuration/test/getHLT.sh | 4 +-- 25 files changed, 156 insertions(+), 110 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_FULL_cff.py b/HLTrigger/Configuration/python/HLT_FULL_cff.py index 5b4580f8a598e..521200a36b2fd 100644 --- a/HLTrigger/Configuration/python/HLT_FULL_cff.py +++ b/HLTrigger/Configuration/python/HLT_FULL_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HLT --type FULL +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/HLT --type FULL -# /dev/CMSSW_12_0_0/HLT/V8 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/HLT/V3 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V8') + tableName = cms.string('/dev/CMSSW_12_1_0/HLT/V3') ) fragment.transferSystem = cms.PSet( @@ -8974,7 +8974,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -9009,7 +9011,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -9042,7 +9046,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), @@ -44032,7 +44038,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -44065,7 +44073,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/python/HLT_Fake1_cff.py b/HLTrigger/Configuration/python/HLT_Fake1_cff.py index 82a303167cc05..e0377ebc022c4 100644 --- a/HLTrigger/Configuration/python/HLT_Fake1_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake1_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake1 --type Fake1 +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/Fake1 --type Fake1 -# /dev/CMSSW_12_0_0/Fake1/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake1/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake1/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake2_cff.py b/HLTrigger/Configuration/python/HLT_Fake2_cff.py index f8b93f6dca7c9..f9f2d9bae8171 100644 --- a/HLTrigger/Configuration/python/HLT_Fake2_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake2_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake2 --type Fake2 +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/Fake2 --type Fake2 -# /dev/CMSSW_12_0_0/Fake2/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake2/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake2/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake_cff.py b/HLTrigger/Configuration/python/HLT_Fake_cff.py index 5ff5332957f07..f0adf2e1307f0 100644 --- a/HLTrigger/Configuration/python/HLT_Fake_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake --type Fake +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/Fake --type Fake -# /dev/CMSSW_12_0_0/Fake/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_GRun_cff.py b/HLTrigger/Configuration/python/HLT_GRun_cff.py index 98ecafb08a7a2..847960b671114 100644 --- a/HLTrigger/Configuration/python/HLT_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLT_GRun_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/GRun --type GRun +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/GRun --type GRun -# /dev/CMSSW_12_0_0/GRun/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/GRun/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/GRun/V1') ) fragment.transferSystem = cms.PSet( @@ -7614,7 +7614,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -7649,7 +7651,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -7682,7 +7686,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), @@ -42202,7 +42208,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -42235,7 +42243,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/python/HLT_HIon_cff.py b/HLTrigger/Configuration/python/HLT_HIon_cff.py index df69c66724c8a..c6b5dd6ee6e3c 100644 --- a/HLTrigger/Configuration/python/HLT_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_HIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HIon --type HIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/HIon --type HIon -# /dev/CMSSW_12_0_0/HIon/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/HIon/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/HIon/V1') ) fragment.transferSystem = cms.PSet( @@ -6374,7 +6374,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -6409,7 +6411,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -6442,7 +6446,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/python/HLT_PIon_cff.py b/HLTrigger/Configuration/python/HLT_PIon_cff.py index e0fd7e44c150e..bef79e419742d 100644 --- a/HLTrigger/Configuration/python/HLT_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_PIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PIon --type PIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/PIon --type PIon -# /dev/CMSSW_12_0_0/PIon/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/PIon/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/PIon/V1') ) fragment.transferSystem = cms.PSet( diff --git a/HLTrigger/Configuration/python/HLT_PRef_cff.py b/HLTrigger/Configuration/python/HLT_PRef_cff.py index cc28b493c22d3..4fdb372019b0a 100644 --- a/HLTrigger/Configuration/python/HLT_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLT_PRef_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PRef --type PRef +# hltGetConfiguration --cff --data /dev/CMSSW_12_1_0/PRef --type PRef -# /dev/CMSSW_12_0_0/PRef/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/PRef/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/PRef/V1') ) fragment.transferSystem = cms.PSet( @@ -6092,7 +6092,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -6127,7 +6129,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -6160,7 +6164,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py index 2a3014456bf92..7776918bce6e6 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_12_0_0/GRun +# /dev/CMSSW_12_1_0/GRun import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py index d32b5a2c63310..b5e5eb442cd73 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_12_0_0/HIon +# /dev/CMSSW_12_1_0/HIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py index d9f1def779f35..6bee3e95ed259 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_12_0_0/PIon +# /dev/CMSSW_12_1_0/PIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py index da4a12b0ee026..fd219e6504c17 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_12_0_0/PRef +# /dev/CMSSW_12_1_0/PRef import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 33f789a000eb3..2abc5cce7e82c 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -17,21 +17,6 @@ # 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""" @@ -150,7 +135,4 @@ 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/tables/makeSubTables b/HLTrigger/Configuration/tables/makeSubTables index cfd09b91f2e3b..3614ff2829d2d 100755 --- a/HLTrigger/Configuration/tables/makeSubTables +++ b/HLTrigger/Configuration/tables/makeSubTables @@ -3,8 +3,8 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_12_0_0/HLT" # no version, take the latest one -TARGET="/dev/CMSSW_12_0_0/TABLE" # directory where to store the sub-tables +MASTER="/dev/CMSSW_12_1_0/HLT" # no version, take the latest one +TARGET="/dev/CMSSW_12_1_0/TABLE" # directory where to store the sub-tables TABLES="GRun HIon PIon PRef" # which sub-tables to create source subtables.sh diff --git a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py index 487d9e336b0ce..6ad88adeb8a5b 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run3_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run3_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root -# /dev/CMSSW_12_0_0/HLT/V8 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/HLT/V3 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFULL" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V8') + tableName = cms.string('/dev/CMSSW_12_1_0/HLT/V3') ) process.transferSystem = cms.PSet( @@ -9231,7 +9231,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -9266,7 +9268,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -9299,7 +9303,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), @@ -44289,7 +44295,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -44322,7 +44330,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py index f51d4740afba8..cd37e7c2c440f 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root -# /dev/CMSSW_12_0_0/Fake/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py index 76a53fbf3f2bf..11526f6a0f468 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root -# /dev/CMSSW_12_0_0/Fake1/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake1/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake1" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake1/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py index 870da09717e7c..4c38c491a0464 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root -# /dev/CMSSW_12_0_0/Fake2/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/Fake2/V2 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake2" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/Fake2/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index cdb5db2c49fad..f388bc447d86e 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run3_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run3_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root -# /dev/CMSSW_12_0_0/GRun/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/GRun/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTGRun" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/GRun/V1') ) process.transferSystem = cms.PSet( @@ -7871,7 +7871,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -7906,7 +7908,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -7939,7 +7943,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), @@ -42459,7 +42465,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -42492,7 +42500,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py index f49ea9be77752..d4beb4aa4930e 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run3_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run3_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root -# /dev/CMSSW_12_0_0/HIon/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/HIon/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTHIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/HIon/V1') ) process.transferSystem = cms.PSet( @@ -6631,7 +6631,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -6666,7 +6668,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -6699,7 +6703,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py index 1b5088bd5160b..3e23983d79c56 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run3_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run3_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root -# /dev/CMSSW_12_0_0/PIon/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/PIon/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/PIon/V1') ) process.transferSystem = cms.PSet( diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py index 090cd884fad83..25ffdb2fe8c67 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_1_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root -# /dev/CMSSW_12_0_0/PRef/V5 (CMSSW_12_0_0_pre5) +# /dev/CMSSW_12_1_0/PRef/V1 (CMSSW_12_1_0_pre2) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPRef" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V5') + tableName = cms.string('/dev/CMSSW_12_1_0/PRef/V1') ) process.transferSystem = cms.PSet( @@ -6349,7 +6349,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), recAlgo = cms.string( "DTLinearDriftFromDBAlgo" ), debug = cms.untracked.bool( False ), @@ -6384,7 +6386,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), MaxAllowedHits = cms.uint32( 50 ), nUnSharedHitsMin = cms.int32( 2 ), @@ -6417,7 +6421,9 @@ useUncertDB = cms.bool( True ), doVdriftCorr = cms.bool( True ), minTime = cms.double( -3.0 ), - tTrigMode = cms.string( "DTTTrigSyncFromDB" ) + tTrigMode = cms.string( "DTTTrigSyncFromDB" ), + readLegacyTTrigDB = cms.bool( True ), + readLegacyVDriftDB = cms.bool( True ) ), nUnSharedHitsMin = cms.int32( 2 ), nSharedHitsMax = cms.int32( 2 ), diff --git a/HLTrigger/Configuration/test/cmsDriver.csh b/HLTrigger/Configuration/test/cmsDriver.csh index 333f240b76858..0f77ce781877a 100755 --- a/HLTrigger/Configuration/test/cmsDriver.csh +++ b/HLTrigger/Configuration/test/cmsDriver.csh @@ -221,7 +221,7 @@ foreach gtag ( MC DATA ) set Era = $EraRun3HI set Custom = " " set L1REPACK = L1REPACK:Full - set DIGI = DIGI:pdigi_hi + set DIGI = DIGI:pdigi_hi_nogen else if ( $table == PIon ) then set XL1T = $XL1TPI set XHLT = HLT:PIon diff --git a/HLTrigger/Configuration/test/getFrozenHLT.sh b/HLTrigger/Configuration/test/getFrozenHLT.sh index 7e402f7a0033f..ae051b4a15328 100755 --- a/HLTrigger/Configuration/test/getFrozenHLT.sh +++ b/HLTrigger/Configuration/test/getFrozenHLT.sh @@ -2,9 +2,9 @@ # ConfDB configurations to use TABLES="Fake Fake1 Fake2" -HLT_Fake="/dev/CMSSW_12_0_0/Fake" -HLT_Fake1="/dev/CMSSW_12_0_0/Fake1" -HLT_Fake2="/dev/CMSSW_12_0_0/Fake2" +HLT_Fake="/dev/CMSSW_12_1_0/Fake" +HLT_Fake1="/dev/CMSSW_12_1_0/Fake1" +HLT_Fake2="/dev/CMSSW_12_1_0/Fake2" # print extra messages ? VERBOSE=false diff --git a/HLTrigger/Configuration/test/getHLT.sh b/HLTrigger/Configuration/test/getHLT.sh index ecf99d55dcdfd..5e7e8e4f6c2b4 100755 --- a/HLTrigger/Configuration/test/getHLT.sh +++ b/HLTrigger/Configuration/test/getHLT.sh @@ -1,8 +1,8 @@ #! /bin/bash # ConfDB configurations to use -MASTER="/dev/CMSSW_12_0_0/HLT" # no explicit version, take the most recent -TARGET="/dev/CMSSW_12_0_0/\$TABLE" # no explicit version, take the most recent +MASTER="/dev/CMSSW_12_1_0/HLT" # no explicit version, take the most recent +TARGET="/dev/CMSSW_12_1_0/\$TABLE" # no explicit version, take the most recent TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES From f58ca818ed5ce311a44b0ddfdbbfd25475ada3b5 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 7 Sep 2021 14:38:02 +0200 Subject: [PATCH 440/923] rename file to satisfy code check --- Validation/CTPPS/alignment/{2022.xml => alignment_2022.xml} | 0 Validation/CTPPS/python/simu_config/profile_2022_default_cff.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename Validation/CTPPS/alignment/{2022.xml => alignment_2022.xml} (100%) diff --git a/Validation/CTPPS/alignment/2022.xml b/Validation/CTPPS/alignment/alignment_2022.xml similarity index 100% rename from Validation/CTPPS/alignment/2022.xml rename to Validation/CTPPS/alignment/alignment_2022.xml diff --git a/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py b/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py index 803fcf0e286dd..18aa8d5171815 100644 --- a/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py +++ b/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py @@ -2,7 +2,7 @@ from Validation.CTPPS.simu_config.year_2022_cff import * -alignmentFile = "Validation/CTPPS/alignment/2022.xml" +alignmentFile = "Validation/CTPPS/alignment/alignment_2022.xml" profile_2022_default = profile_base_2022.clone( L_int = 1, From 41457af4b3cbd2581a04bc3d9577d0065ffdff1c Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Tue, 7 Sep 2021 14:45:26 +0200 Subject: [PATCH 441/923] adjust horizontal RP position --- Validation/CTPPS/alignment/alignment_2022.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Validation/CTPPS/alignment/alignment_2022.xml b/Validation/CTPPS/alignment/alignment_2022.xml index a715768fe083b..7aa2e5b685761 100644 --- a/Validation/CTPPS/alignment/alignment_2022.xml +++ b/Validation/CTPPS/alignment/alignment_2022.xml @@ -1,13 +1,13 @@ - + - + - + - + From 61e040fefed490434c3f2dcd203a2d3f83487759 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Tue, 7 Sep 2021 11:57:36 +0200 Subject: [PATCH 442/923] BuildFiles cleaning --- CalibMuon/DTDigiSync/BuildFile.xml | 1 - DQM/Physics/BuildFile.xml | 1 - DataFormats/L1THGCal/BuildFile.xml | 1 - FastSimulation/Utilities/BuildFile.xml | 1 - L1Trigger/L1THGCal/BuildFile.xml | 2 +- L1Trigger/L1THGCal/test/BuildFile.xml | 2 -- L1Trigger/L1TTrackMatch/plugins/BuildFile.xml | 2 +- .../SiPixelDigiReProducers/plugins/BuildFile.xml | 5 ++++- RecoMuon/GlobalMuonProducer/test/BuildFile.xml | 2 -- SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml | 3 --- SimG4CMS/EcalTestBeam/BuildFile.xml | 6 ------ SimG4CMS/EcalTestBeam/plugins/BuildFile.xml | 6 ++++++ SimG4CMS/FP420/BuildFile.xml | 1 - SimG4CMS/FP420/plugins/BuildFile.xml | 1 + SimG4CMS/Forward/BuildFile.xml | 2 -- SimG4CMS/Forward/plugins/BuildFile.xml | 1 + SimG4CMS/ShowerLibraryProducer/BuildFile.xml | 2 -- SimG4CMS/ShowerLibraryProducer/plugins/BuildFile.xml | 2 ++ SimGeneral/TrackingAnalysis/BuildFile.xml | 1 - SimGeneral/TrackingAnalysis/plugins/BuildFile.xml | 1 + SimMuon/MCTruth/test/BuildFile.xml | 1 - SimTracker/TrackAssociation/BuildFile.xml | 1 - 22 files changed, 17 insertions(+), 28 deletions(-) diff --git a/CalibMuon/DTDigiSync/BuildFile.xml b/CalibMuon/DTDigiSync/BuildFile.xml index 6a6a31a2e8e80..930081092d6b5 100644 --- a/CalibMuon/DTDigiSync/BuildFile.xml +++ b/CalibMuon/DTDigiSync/BuildFile.xml @@ -1,5 +1,4 @@ - diff --git a/DQM/Physics/BuildFile.xml b/DQM/Physics/BuildFile.xml index 5d68d7f2833d8..5fda1b5441f7b 100644 --- a/DQM/Physics/BuildFile.xml +++ b/DQM/Physics/BuildFile.xml @@ -24,5 +24,4 @@ - diff --git a/DataFormats/L1THGCal/BuildFile.xml b/DataFormats/L1THGCal/BuildFile.xml index a81d1b9fd188b..aaba3b9a72339 100644 --- a/DataFormats/L1THGCal/BuildFile.xml +++ b/DataFormats/L1THGCal/BuildFile.xml @@ -4,7 +4,6 @@ - diff --git a/FastSimulation/Utilities/BuildFile.xml b/FastSimulation/Utilities/BuildFile.xml index 6cf11edfdbbda..13a0ff56a36dd 100644 --- a/FastSimulation/Utilities/BuildFile.xml +++ b/FastSimulation/Utilities/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/L1Trigger/L1THGCal/BuildFile.xml b/L1Trigger/L1THGCal/BuildFile.xml index 1e9dbfa2bc3a8..ac1f64cda7e43 100644 --- a/L1Trigger/L1THGCal/BuildFile.xml +++ b/L1Trigger/L1THGCal/BuildFile.xml @@ -1,9 +1,9 @@ + - diff --git a/L1Trigger/L1THGCal/test/BuildFile.xml b/L1Trigger/L1THGCal/test/BuildFile.xml index 70a9e12ee8810..57bd9e315cde6 100644 --- a/L1Trigger/L1THGCal/test/BuildFile.xml +++ b/L1Trigger/L1THGCal/test/BuildFile.xml @@ -2,8 +2,6 @@ - - diff --git a/L1Trigger/L1TTrackMatch/plugins/BuildFile.xml b/L1Trigger/L1TTrackMatch/plugins/BuildFile.xml index 9df04b788760c..577495943b1e0 100644 --- a/L1Trigger/L1TTrackMatch/plugins/BuildFile.xml +++ b/L1Trigger/L1TTrackMatch/plugins/BuildFile.xml @@ -7,7 +7,7 @@ - + diff --git a/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml b/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml index 14f9cb309eb7b..601e368ae04d0 100644 --- a/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml +++ b/RecoLocalTracker/SiPixelDigiReProducers/plugins/BuildFile.xml @@ -1,7 +1,10 @@ + + + + - diff --git a/RecoMuon/GlobalMuonProducer/test/BuildFile.xml b/RecoMuon/GlobalMuonProducer/test/BuildFile.xml index 6706c613eebf5..95c39e7b4a41e 100644 --- a/RecoMuon/GlobalMuonProducer/test/BuildFile.xml +++ b/RecoMuon/GlobalMuonProducer/test/BuildFile.xml @@ -1,10 +1,8 @@ - - diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml b/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml index e395591715b27..5c34f82bdabf5 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml +++ b/SimCalorimetry/HcalZeroSuppressionProducers/BuildFile.xml @@ -1,8 +1,5 @@ - - - diff --git a/SimG4CMS/EcalTestBeam/BuildFile.xml b/SimG4CMS/EcalTestBeam/BuildFile.xml index 0c6f2559656a3..492c09a7d7d2a 100644 --- a/SimG4CMS/EcalTestBeam/BuildFile.xml +++ b/SimG4CMS/EcalTestBeam/BuildFile.xml @@ -1,16 +1,10 @@ - - - - - - diff --git a/SimG4CMS/EcalTestBeam/plugins/BuildFile.xml b/SimG4CMS/EcalTestBeam/plugins/BuildFile.xml index 44aeab43798e7..27bfa2587adf8 100644 --- a/SimG4CMS/EcalTestBeam/plugins/BuildFile.xml +++ b/SimG4CMS/EcalTestBeam/plugins/BuildFile.xml @@ -1,3 +1,9 @@ + + + + + + diff --git a/SimG4CMS/FP420/BuildFile.xml b/SimG4CMS/FP420/BuildFile.xml index 6bb0f469ff4a7..633f4f1a1a3dd 100644 --- a/SimG4CMS/FP420/BuildFile.xml +++ b/SimG4CMS/FP420/BuildFile.xml @@ -1,4 +1,3 @@ - diff --git a/SimG4CMS/FP420/plugins/BuildFile.xml b/SimG4CMS/FP420/plugins/BuildFile.xml index 846f06ba29668..cf50783837342 100644 --- a/SimG4CMS/FP420/plugins/BuildFile.xml +++ b/SimG4CMS/FP420/plugins/BuildFile.xml @@ -1,4 +1,5 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/TrackerCommonData/data/trackermaterial/2026/v1/trackermaterial.xml b/Geometry/TrackerCommonData/data/trackermaterial/2026/v1/trackermaterial.xml new file mode 100644 index 0000000000000..5cb050e0b453b --- /dev/null +++ b/Geometry/TrackerCommonData/data/trackermaterial/2026/v1/trackermaterial.xml @@ -0,0 +1,563 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py index 4571d9f669537..74e3b80025565 100644 --- a/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -2,10 +2,10 @@ XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring( - 'Geometry/CMSCommonData/data/materials/2021/v2/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml', 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/v2/cmsextent.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', @@ -23,7 +23,7 @@ '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/v2/pixfwdMaterials.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', @@ -37,7 +37,7 @@ '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/v3/pixbarmaterial.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladder.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull0.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbarladderfull1.xml', @@ -51,8 +51,8 @@ '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/tibtidcommonmaterial/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial/2021/v2/tibmaterial.xml', 'Geometry/TrackerCommonData/data/tibmodpar.xml', 'Geometry/TrackerCommonData/data/tibmodule0.xml', 'Geometry/TrackerCommonData/data/tibmodule0a.xml', @@ -85,7 +85,7 @@ '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/tidmaterial/2021/v2/tidmaterial.xml', 'Geometry/TrackerCommonData/data/tidmodpar.xml', 'Geometry/TrackerCommonData/data/tidmodule0.xml', 'Geometry/TrackerCommonData/data/tidmodule0r.xml', @@ -108,7 +108,7 @@ '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/tobmaterial/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/tobmodpar.xml', 'Geometry/TrackerCommonData/data/tobmodule0.xml', 'Geometry/TrackerCommonData/data/tobmodule2.xml', @@ -136,7 +136,7 @@ '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/tecmaterial/2021/v2/tecmaterial.xml', 'Geometry/TrackerCommonData/data/tecmodpar.xml', 'Geometry/TrackerCommonData/data/tecmodule0.xml', 'Geometry/TrackerCommonData/data/tecmodule0r.xml', @@ -206,19 +206,19 @@ 'Geometry/TrackerCommonData/data/trackerother.xml', 'Geometry/TrackerCommonData/data/PhaseI/trackerStructureTopology.xml', 'Geometry/TrackerSimData/data/PhaseI/trackersens.xml', - 'Geometry/TrackerRecoData/data/PhaseI/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI.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/ebcon.xml', 'Geometry/EcalCommonData/data/ebrot.xml', - 'Geometry/EcalCommonData/data/eecon.xml', 'Geometry/EcalCommonData/data/eefixed/2021/v1/eefixed.xml', 'Geometry/EcalCommonData/data/eehier.xml', 'Geometry/EcalCommonData/data/eealgo.xml', - 'Geometry/EcalCommonData/data/escon.xml', 'Geometry/EcalCommonData/data/esalgo.xml', 'Geometry/EcalCommonData/data/eeF.xml', 'Geometry/EcalCommonData/data/eeB.xml', @@ -228,68 +228,66 @@ 'Geometry/HcalCommonData/data/hcalcablealgo.xml', 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', 'Geometry/HcalCommonData/data/hcalendcap/PhaseI/hcalendcapalgo.xml', - 'Geometry/HcalCommonData/data/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', - 'Geometry/HcalCommonData/data/hcalSimNumbering/2021/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/2021/v1/hcalSimNumbering.xml', 'Geometry/HcalCommonData/data/hcalRecNumbering/2021/hcalRecNumbering.xml', - 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', - 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', - 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', - 'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.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/v3/muonYoke.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/v2/csc.xml', + 'Geometry/MuonCommonData/data/csc/2021/v3/csc.xml', 'Geometry/MuonCommonData/data/mfshield/2017/v2/mfshield.xml', )+ cms.vstring( - 'Geometry/MuonCommonData/data/muonNumbering/2021/v2/muonNumbering.xml', + '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.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/v1/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials.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', @@ -299,7 +297,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', @@ -309,24 +306,22 @@ '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.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.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_Materials.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.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', @@ -339,27 +334,28 @@ '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.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/ppstrackerMaterials/v1/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v1/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v1/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/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/hcalsenspmf.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.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', @@ -370,11 +366,11 @@ 'Geometry/ForwardCommonData/data/brmsens.xml', 'Geometry/ForwardSimData/data/totemsensT2/2021/totemsensT2.xml', 'Geometry/ForwardSimData/data/zdcsens.xml', - 'Geometry/HcalSimData/data/HcalProdCuts.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.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', 'Geometry/CMSCommonData/data/FieldParameters.xml', ), diff --git a/Geometry/TrackerCommonData/python/cmsExtendedGeometry2026D77XML_cfi.py b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2026D77XML_cfi.py new file mode 100644 index 0000000000000..30b00f5004b01 --- /dev/null +++ b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2026D77XML_cfi.py @@ -0,0 +1,127 @@ +import FWCore.ParameterSet.Config as cms + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2026/v5/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2026/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/PhaseII/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/pixbar.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2026/v1/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/otst.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/tracker.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixel.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerStructureTopology.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelsens.xml', + 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerRecoMaterial.xml', + 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseII/v1/trackingMaterialGroups_ForPhaseII.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixelProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v2/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v14/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v14/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v14/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v14/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v14/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v13/hgcalConsData.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2026/v1/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2026/v7/mf.xml', + 'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml', + 'Geometry/MuonCommonData/data/rpcf/2026/v3/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/gem21/TDR_Eta16/gem21.xml', + 'Geometry/MuonCommonData/data/mfshield/2026/v5/mfshield.xml', + 'Geometry/MuonCommonData/data/ge0/TDR_Dev/v3/ge0.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm/2026/v1/brm.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/MTDCommonData/data/mtdMaterial/v2/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v1/btl.xml', + 'Geometry/MTDCommonData/data/etl/v5/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v3/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v5/muonNumbering.xml', + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2026/v2c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv9.xml', + 'Geometry/MuonSimData/data/PhaseII/v2/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/2026/v1/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecsFilter.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/MTDSimData/data/v2/mtdsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2021/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv9.xml', + 'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/MTDSimData/data/v2/mtdProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) From 1852c695a45dee1ba170b69cb5d7cdd837e89302 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Thu, 9 Sep 2021 15:26:24 +0200 Subject: [PATCH 498/923] removed boost lexical_cast dependency --- Fireworks/Core/src/FWGeometryTableManagerBase.cc | 7 ++----- MagneticField/Engine/test/testMagneticField.cc | 6 ++---- MagneticField/GeomBuilder/src/volumeHandle.cc | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Fireworks/Core/src/FWGeometryTableManagerBase.cc b/Fireworks/Core/src/FWGeometryTableManagerBase.cc index 8769954bf96df..b46fd417b0095 100644 --- a/Fireworks/Core/src/FWGeometryTableManagerBase.cc +++ b/Fireworks/Core/src/FWGeometryTableManagerBase.cc @@ -34,7 +34,6 @@ #include "TVirtualX.h" #include "TGFrame.h" #include "TEveUtil.h" -#include "boost/lexical_cast.hpp" const char* FWGeometryTableManagerBase::NodeInfo::name() const { return m_node->GetName(); } @@ -224,10 +223,8 @@ void FWGeometryTableManagerBase::showEditor(int row) { void FWGeometryTableManagerBase::applyTransparencyFromEditor() { printf("transparency idx %d opaci %s \n", m_editTransparencyIdx, m_editor->GetText()); if (m_editTransparencyIdx >= 0) { - using boost::bad_lexical_cast; - using boost::lexical_cast; try { - int t = lexical_cast(m_editor->GetText()); + int t = std::stoi(m_editor->GetText()); if (t > 100 || t < 0) { fwLog(fwlog::kError) << "Transparency must be set in procentage [0-100]."; return; @@ -235,7 +232,7 @@ void FWGeometryTableManagerBase::applyTransparencyFromEditor() { m_entries[m_editTransparencyIdx].m_transparency = 100 - t; printf("SET !! \n"); cancelEditor(true); - } catch (bad_lexical_cast&) { + } catch (const std::exception&) { fwLog(fwlog::kError) << "Bad Lexical cast. Transparency must be set in procentage [0-100]."; } } diff --git a/MagneticField/Engine/test/testMagneticField.cc b/MagneticField/Engine/test/testMagneticField.cc index b7385b5a8f79a..88bde438d9550 100644 --- a/MagneticField/Engine/test/testMagneticField.cc +++ b/MagneticField/Engine/test/testMagneticField.cc @@ -47,7 +47,6 @@ #include #include #include -#include using namespace edm; using namespace Geom; @@ -272,7 +271,6 @@ void testMagneticField::validate(string filename, string type) { void testMagneticField::parseTOSCATablePath(string filename, int& volNo, int& sector, string& type) { // Determine volume number, type, and sector from filename, assumed to be like: // [path]/s01_1/v-xyz-1156.table - using boost::lexical_cast; char buf[512]; strcpy(buf, filename.c_str()); @@ -286,11 +284,11 @@ void testMagneticField::parseTOSCATablePath(string filename, int& volNo, int& se // Find volume number string::size_type iext = table.rfind('.'); // last occurence of "." - volNo = boost::lexical_cast(table.substr(iend + 1, iext - iend - 1)); + volNo = std::stoi(table.substr(iend + 1, iext - iend - 1)); // Find sector number if (ssector[0] == 's') { - sector = boost::lexical_cast(ssector.substr(1, 2)); + sector = std::stoi(ssector.substr(1, 2)); } else { cout << "Can not determine sector number, assuming 1" << endl; sector = 1; diff --git a/MagneticField/GeomBuilder/src/volumeHandle.cc b/MagneticField/GeomBuilder/src/volumeHandle.cc index 97d6877a3b8c8..4c1853e81b645 100644 --- a/MagneticField/GeomBuilder/src/volumeHandle.cc +++ b/MagneticField/GeomBuilder/src/volumeHandle.cc @@ -22,7 +22,6 @@ #include #include #include -#include using namespace SurfaceOrientation; using namespace std; @@ -48,7 +47,7 @@ MagGeoBuilderFromDDD::volumeHandle::volumeHandle(const DDExpandedView &fv, bool // ASSUMPTION: volume names ends with "_NUM" where NUM is the volume number string volName = name; volName.erase(0, volName.rfind('_') + 1); - volumeno = boost::lexical_cast(volName); + volumeno = std::stoul(volName); for (int i = 0; i < 6; ++i) { isAssigned[i] = false; From 2e405058521470d740b8193573a43211371def79 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 9 Sep 2021 09:14:32 -0500 Subject: [PATCH 499/923] Revert "Have embedded root files send close reports" --- IOPool/Input/src/RootEmbeddedFileSequence.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/IOPool/Input/src/RootEmbeddedFileSequence.cc b/IOPool/Input/src/RootEmbeddedFileSequence.cc index b0b3d66c41f56..27b57de0c36a5 100644 --- a/IOPool/Input/src/RootEmbeddedFileSequence.cc +++ b/IOPool/Input/src/RootEmbeddedFileSequence.cc @@ -16,7 +16,6 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Utilities/StorageFactory/interface/StatisticsSenderService.h" #include "CLHEP/Random/RandFlat.h" @@ -127,10 +126,6 @@ namespace edm { void RootEmbeddedFileSequence::closeFile_() { // delete the RootFile object. if (rootFile()) { - edm::Service service; - if (service.isAvailable()) { - service->filePreCloseEvent(lfn(), usedFallback()); - } rootFile().reset(); } } From 5753ffda59dfb01fa9e1e9afb1c5736ee567a3f4 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 9 Sep 2021 10:21:51 -0500 Subject: [PATCH 500/923] Handle std::terminate and early exit calls --- .../Core/bin/externalGenerator.cc | 46 +++++++++++++++++-- .../Core/test/FailingGeneratorFilter.cc | 22 +++++++-- .../Core/test/test_FailingGeneratorFilter.sh | 21 +++++++++ .../test/test_FailingGeneratorFilter_cfg.py | 2 +- 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/GeneratorInterface/Core/bin/externalGenerator.cc b/GeneratorInterface/Core/bin/externalGenerator.cc index c48f60eb2cc96..fb8722415842d 100644 --- a/GeneratorInterface/Core/bin/externalGenerator.cc +++ b/GeneratorInterface/Core/bin/externalGenerator.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include "FWCore/TestProcessor/interface/TestProcessor.h" @@ -75,6 +76,18 @@ class Harness { template using Serializer = ROOTSerializer; +namespace { + //needed for atexit handling + boost::interprocess::scoped_lock* s_sharedLock = nullptr; + + void atexit_handler() { + if (s_sharedLock) { + std::cerr << "early exit called: unlock\n"; + s_sharedLock->unlock(); + } + } +} // namespace + int main(int argc, char* argv[]) { std::string descString(argv[0]); descString += " [--"; @@ -83,10 +96,9 @@ int main(int argc, char* argv[]) { boost::program_options::options_description desc(descString); desc.add_options()(kHelpCommandOpt, "produce help message")( - kMemoryNameCommandOpt, - boost::program_options::value(), - "memory name")(kUniqueIDCommandOpt, boost::program_options::value(), "unique id")(kVerboseCommandOpt, - "verbose output"); + kMemoryNameCommandOpt, boost::program_options::value(), "memory name")( + kUniqueIDCommandOpt, boost::program_options::value(), "unique id")(kVerboseCommandOpt, + "verbose output"); boost::program_options::positional_options_description p; p.add(kMemoryNameOpt, 1); @@ -142,6 +154,7 @@ int main(int argc, char* argv[]) { //The lock must be released if there is a catastrophic signal auto lockPtr = communicationChannel.accessLock(); + monitorThread.setAction([lockPtr]() { if (lockPtr) { std::cerr << "SIGNAL CAUGHT: unlock\n"; @@ -149,6 +162,28 @@ int main(int argc, char* argv[]) { } }); + //be sure to unset the address of the shared lock before the lock goes away + s_sharedLock = lockPtr; + auto unsetLockPtr = [](void*) { s_sharedLock = nullptr; }; + std::unique_ptr sharedLockGuard{&s_sharedLock, unsetLockPtr}; + std::atexit(atexit_handler); + auto releaseLock = []() { + if (s_sharedLock) { + std::cerr << "terminate called: unlock\n"; + s_sharedLock->unlock(); + s_sharedLock = nullptr; + //deactivate the abort signal + + struct sigaction act; + act.sa_sigaction = nullptr; + act.sa_flags = SA_SIGINFO; + sigemptyset(&act.sa_mask); + sigaction(SIGABRT, &act, nullptr); + std::abort(); + } + }; + std::set_terminate(releaseLock); + Serializer serializer(sm_buffer); Serializer bl_serializer(sm_buffer); Serializer el_serializer(sm_buffer); @@ -175,8 +210,9 @@ int main(int argc, char* argv[]) { edm::ServiceRegistry::createContaining(std::unique_ptr(randomService)); Harness harness(configuration, serviceToken); - //Either ROOT or the Framework are overriding the signal handlers + //Some generator libraries override the signal handlers monitorThread.setupSignalHandling(); + std::set_terminate(releaseLock); if (verbose) { std::cerr << uniqueID << " process: done initializing" << std::endl; diff --git a/GeneratorInterface/Core/test/FailingGeneratorFilter.cc b/GeneratorInterface/Core/test/FailingGeneratorFilter.cc index 85b786882441d..0717a728a199d 100644 --- a/GeneratorInterface/Core/test/FailingGeneratorFilter.cc +++ b/GeneratorInterface/Core/test/FailingGeneratorFilter.cc @@ -22,7 +22,7 @@ namespace test { class FailingHad { public: FailingHad(const edm::ParameterSet& iPSet) - : failAt_(iPSet.getParameter("failAt")), useException_(iPSet.getParameter("useException")) {} + : failAt_(iPSet.getParameter("failAt")), failureType_(iPSet.getParameter("failureType")) {} std::vector sharedResources() const { if (failAt_ == 0) { @@ -84,14 +84,26 @@ namespace test { private: void fail(std::string const& iName) const { - if (useException_) { - throw cms::Exception(iName); + switch (failureType_) { + case 0: { + throw cms::Exception(iName); + } + case 1: { + std::raise(SIGSEGV); + break; + } + case 2: { + std::terminate(); + break; + } + default: { + std::exit(-1); + } } - std::raise(SIGSEGV); } std::unique_ptr event_; int failAt_; - bool useException_; + int failureType_; }; class DummyDec { diff --git a/GeneratorInterface/Core/test/test_FailingGeneratorFilter.sh b/GeneratorInterface/Core/test/test_FailingGeneratorFilter.sh index f555abb6f0717..2473d46bbbcee 100755 --- a/GeneratorInterface/Core/test/test_FailingGeneratorFilter.sh +++ b/GeneratorInterface/Core/test/test_FailingGeneratorFilter.sh @@ -23,4 +23,25 @@ echo "******************" echo "Exception in event" (cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 2 0) && die "exception in event didn't fail" 1 +echo "******************" +echo "terminate in constructor" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 0 2) && die "signal in constructor didn't fail" 1 +echo "******************" +echo "terminate in beginLumi" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 1 2) && die "signal in begin lumi didn't fail" 1 +echo "******************" +echo "terminate in event" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 2 2) && die "signal in event didn't fail" 1 + +echo "******************" +echo "exit in constructor" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 0 3) && die "signal in constructor didn't fail" 1 +echo "******************" +echo "exit in beginLumi" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 1 3) && die "signal in begin lumi didn't fail" 1 +echo "******************" +echo "exit in event" +(cmsRun ${LOCALTOP}/src/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py 2 3) && die "signal in event didn't fail" 1 + + exit 0 diff --git a/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py b/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py index 8431ddc55e487..489285dcb58de 100644 --- a/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py +++ b/GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py @@ -11,7 +11,7 @@ process.generator = ExternalGeneratorFilter( cms.EDFilter("FailingGeneratorFilter", failAt=cms.int32(int(sys.argv[2])), - useException = cms.bool(0 == int(sys.argv[3]))), + failureType = cms.int32(int(sys.argv[3]))), _external_process_waitTime_ = cms.untracked.uint32(5), _external_process_verbose_ = cms.untracked.bool(True), _external_process_components_ =cms.vstring() From 75e6d27e837a878f75fb6f6f8efdc95e402953de Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 9 Sep 2021 11:21:31 -0500 Subject: [PATCH 501/923] Use correct label when getting DTT0 Found by @makortel --- CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc index 0f992bbb8d1c3..e4813002c30e0 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc @@ -134,7 +134,7 @@ DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config, edm::ConsumesCo thetTrigLabel(config.getParameter("tTrigLabel")), thet0Label(config.getParameter("t0Label")) { if (doT0Correction) { - t0Token_ = cc.esConsumes(); + t0Token_ = cc.esConsumes(edm::ESInputTag("", thet0Label)); } } From 79a4c26c91f2bf5d23014a99457154d1a00fe670 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 9 Sep 2021 11:27:14 -0500 Subject: [PATCH 502/923] removed commented out code --- CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc index 267a7ceec4cf4..e056c2affac2b 100644 --- a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc +++ b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc @@ -24,7 +24,6 @@ class DTTPAnalyzer : public edm::EDAnalyzer { DTTPAnalyzer(const edm::ParameterSet&); ~DTTPAnalyzer() override; - //void beginJob(); void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; @@ -35,7 +34,6 @@ class DTTPAnalyzer : public edm::EDAnalyzer { edm::InputTag digiLabel_; TFile* rootFile_; - //const DTT0* tZeroMap_; edm::ESHandle dtGeom_; const edm::ESGetToken dtGeomToken_; std::unique_ptr tTrigSync_; @@ -44,8 +42,6 @@ class DTTPAnalyzer : public edm::EDAnalyzer { std::map nDigisPerWire_; std::map sumWPerWire_; std::map sumW2PerWire_; - //std::map meanHistoMap_; - //std::map sigmaHistoMap_; }; #include "FWCore/Framework/interface/Event.h" From edee1ac3da3ae8208e8084d9e2d5b6dee1f46881 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 9 Sep 2021 11:35:20 -0500 Subject: [PATCH 503/923] Switched to edm::LogPrint --- .../DTDigiSync/plugins/DTTTrigSyncT0Only.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc index a366df296d2ed..ad70418b72bf5 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc @@ -11,6 +11,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "CondFormats/DTObjects/interface/DTT0.h" #include "CondFormats/DataRecord/interface/DTT0Rcd.h" @@ -71,7 +72,7 @@ void DTTTrigSyncT0Only::setES(const EventSetup& setup) { tZeroMap = &setup.getData(t0Token_); if (debug) { - cout << "[DTTTrigSyncT0Only] T0 version: " << tZeroMap->version() << endl; + edm::LogPrint("[DTTTrigSyncT0Only]") << "T0 version: " << tZeroMap->version() << endl; } } @@ -86,13 +87,13 @@ double DTTTrigSyncT0Only::offset(const DTLayer* layer, tofCorr = 0; if (debug) { - cout << "[DTTTrigSyncT0Only] Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl - << " various contributions are: " - << endl - //<< " tZero (ns): " << t0 << endl - << " Propagation along wire delay (ns): " << wirePropCorr << endl - << " TOF correction (ns): " << tofCorr << endl - << endl; + edm::LogPrint("[DTTTrigSyncT0Only]") << "Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl + << " various contributions are: " + << endl + //<< " tZero (ns): " << t0 << endl + << " Propagation along wire delay (ns): " << wirePropCorr << endl + << " TOF correction (ns): " << tofCorr << endl + << endl; } //The global offset is the sum of various contributions return tTrig + wirePropCorr - tofCorr; From 62d25a3e532af0fc81017b121b0a45e5c6199024 Mon Sep 17 00:00:00 2001 From: francescobrivio Date: Thu, 9 Sep 2021 19:47:34 +0200 Subject: [PATCH 504/923] update run3_data GT --- Configuration/AlCa/python/autoCond.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 94900bb291696..478988a65b5a0 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -40,7 +40,7 @@ # GlobalTag for Run3 data relvals 'run3_data_prompt' : '113X_dataRun3_Prompt_v3', # GlobalTag for Run3 offline data reprocessing - 'run3_data' : '113X_dataRun3_v1', + 'run3_data' : '113X_dataRun3_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '120X_mc2017_design_v1', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector From 63cbeb47418cae28a165820fb769b76905faaa94 Mon Sep 17 00:00:00 2001 From: Purva-Chaudhari Date: Thu, 9 Sep 2021 19:50:27 +0200 Subject: [PATCH 505/923] Clear unrequired headers of boost lexical_cast --- .../AMPTInterface/src/AMPTHadronizer.cc | 2 - .../HijingInterface/src/HijingHadronizer.cc | 2 - .../Hydjet2Interface/src/Hydjet2Hadronizer.cc | 1 - .../HydjetInterface/src/HydjetHadronizer.cc | 2 - .../CommonTopologies/test/ValidateRadial.cc | 1 - HLTriggerOffline/Egamma/interface/EmDQM.h | 1 - HLTriggerOffline/Egamma/src/EmDQM.cc | 2 +- .../test/Macros/CompareRecoGenPt.C | 139 ++++++++---------- .../bin/testSelection_wplusjets.C | 2 - 9 files changed, 62 insertions(+), 90 deletions(-) diff --git a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc index 4a18e8ca5f48c..5ac1499f42c5c 100644 --- a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc +++ b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc @@ -1,8 +1,6 @@ #include #include -#include "boost/lexical_cast.hpp" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/GeneratorInterface/HijingInterface/src/HijingHadronizer.cc b/GeneratorInterface/HijingInterface/src/HijingHadronizer.cc index b2ddcb856aeb8..9b7eb31613573 100644 --- a/GeneratorInterface/HijingInterface/src/HijingHadronizer.cc +++ b/GeneratorInterface/HijingInterface/src/HijingHadronizer.cc @@ -1,8 +1,6 @@ #include #include -#include "boost/lexical_cast.hpp" - #include "FWCore/Concurrency/interface/SharedResourceNames.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Run.h" diff --git a/GeneratorInterface/Hydjet2Interface/src/Hydjet2Hadronizer.cc b/GeneratorInterface/Hydjet2Interface/src/Hydjet2Hadronizer.cc index a3afdb504d6ce..e79c20562f6af 100644 --- a/GeneratorInterface/Hydjet2Interface/src/Hydjet2Hadronizer.cc +++ b/GeneratorInterface/Hydjet2Interface/src/Hydjet2Hadronizer.cc @@ -52,7 +52,6 @@ #include #include #include -#include "boost/lexical_cast.hpp" #include "FWCore/Concurrency/interface/SharedResourceNames.h" #include "FWCore/Framework/interface/Event.h" diff --git a/GeneratorInterface/HydjetInterface/src/HydjetHadronizer.cc b/GeneratorInterface/HydjetInterface/src/HydjetHadronizer.cc index 33c045cce71eb..a391d67780ef9 100644 --- a/GeneratorInterface/HydjetInterface/src/HydjetHadronizer.cc +++ b/GeneratorInterface/HydjetInterface/src/HydjetHadronizer.cc @@ -7,8 +7,6 @@ #include #include -#include "boost/lexical_cast.hpp" - #include "FWCore/Concurrency/interface/SharedResourceNames.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Run.h" diff --git a/Geometry/CommonTopologies/test/ValidateRadial.cc b/Geometry/CommonTopologies/test/ValidateRadial.cc index f23d65b092620..eb811cdd98ddf 100644 --- a/Geometry/CommonTopologies/test/ValidateRadial.cc +++ b/Geometry/CommonTopologies/test/ValidateRadial.cc @@ -7,7 +7,6 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/TrackerGeometryBuilder/interface/ProxyStripTopology.h" #include "Geometry/CommonTopologies/interface/TkRadialStripTopology.h" -#include "boost/lexical_cast.hpp" #include "TFile.h" #include "TProfile.h" diff --git a/HLTriggerOffline/Egamma/interface/EmDQM.h b/HLTriggerOffline/Egamma/interface/EmDQM.h index 0e222cd97de72..b81aac0219e35 100644 --- a/HLTriggerOffline/Egamma/interface/EmDQM.h +++ b/HLTriggerOffline/Egamma/interface/EmDQM.h @@ -29,7 +29,6 @@ #include "HepMC/GenParticle.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include #include #include "TDirectory.h" diff --git a/HLTriggerOffline/Egamma/src/EmDQM.cc b/HLTriggerOffline/Egamma/src/EmDQM.cc index 56b74445cc52a..0a1fb605a98f2 100644 --- a/HLTriggerOffline/Egamma/src/EmDQM.cc +++ b/HLTriggerOffline/Egamma/src/EmDQM.cc @@ -1215,7 +1215,7 @@ double EmDQM::getPrimaryEtCut(const std::string &path) { boost::smatch what; if (boost::regex_match(path, what, reg, boost::match_extra)) { - minEt = boost::lexical_cast(what[2]); + minEt = std::stod(what[2]); } return minEt; diff --git a/MuonAnalysis/MomentumScaleCalibration/test/Macros/CompareRecoGenPt.C b/MuonAnalysis/MomentumScaleCalibration/test/Macros/CompareRecoGenPt.C index baee02a796600..1b1a5aeaa5c40 100644 --- a/MuonAnalysis/MomentumScaleCalibration/test/Macros/CompareRecoGenPt.C +++ b/MuonAnalysis/MomentumScaleCalibration/test/Macros/CompareRecoGenPt.C @@ -19,23 +19,20 @@ #include #include -// #include "boost/lexical_cast.hpp" - /// Helper function getting the histogram from file. -TProfile * getHistogram( const TString & fileName ) -{ - TFile * file = new TFile(fileName, "READ"); - if( file == 0 ) { +TProfile *getHistogram(const TString &fileName) { + TFile *file = new TFile(fileName, "READ"); + if (file == 0) { std::cout << "Wrong file: " << fileName << std::endl; exit(1); } - TDirectory * dir = (TDirectory*) file->Get("hPtRecoVsPtGen"); - if( dir == 0 ) { + TDirectory *dir = (TDirectory *)file->Get("hPtRecoVsPtGen"); + if (dir == 0) { std::cout << "Wrong directory for file: " << fileName << std::endl; exit(1); } - TProfile * profile = (TProfile*) dir->Get("hPtRecoVsPtGenProf"); - if( profile == 0 ) { + TProfile *profile = (TProfile *)dir->Get("hPtRecoVsPtGenProf"); + if (profile == 0) { std::cout << "Wrong histogram for file: " << fileName << std::endl; exit(1); } @@ -43,79 +40,68 @@ TProfile * getHistogram( const TString & fileName ) } /// Helper function building the histogram from the TProfile settings. -TH1F * makeHistogram( const TProfile * profile, const TString & name ) -{ - return new TH1F(TString(profile->GetName())+name, TString(profile->GetTitle())+" "+name, profile->GetNbinsX(), profile->GetXaxis()->GetXmin(), profile->GetXaxis()->GetXmax()); +TH1F *makeHistogram(const TProfile *profile, const TString &name) { + return new TH1F(TString(profile->GetName()) + name, + TString(profile->GetTitle()) + " " + name, + profile->GetNbinsX(), + profile->GetXaxis()->GetXmin(), + profile->GetXaxis()->GetXmax()); } /// Helper function to write the histograms to file. -void saveHistograms( TH1 * histo1, TH1 * histo2 ) -{ +void saveHistograms(TH1 *histo1, TH1 *histo2) { histo1->Draw(); histo2->SetLineColor(kRed); histo2->Draw("Same"); - TLegend *leg = new TLegend(0.65,0.85,1,1); + TLegend *leg = new TLegend(0.65, 0.85, 1, 1); leg->SetFillColor(0); - leg->AddEntry(histo1,"before calibration","L"); - leg->AddEntry(histo2,"after calibration","L"); + leg->AddEntry(histo1, "before calibration", "L"); + leg->AddEntry(histo2, "after calibration", "L"); leg->Draw("same"); } #include "TPaveText.h" /// Helper class holding a TPaveText for better formatting and predefined options -class PaveText -{ - public: - PaveText(const double & textX = 0.7, const double & textY = 0.4 ) - { - paveText_ = new TPaveText(textX, textY, textX+0.2, textY+0.17, "NDC"); - } - void AddText(const TString & text) - { - paveText_->AddText(text); +class PaveText { +public: + PaveText(const double &textX = 0.7, const double &textY = 0.4) { + paveText_ = new TPaveText(textX, textY, textX + 0.2, textY + 0.17, "NDC"); } - void Draw(const TString & option) - { - paveText_->SetFillColor(0); // text is black on white + void AddText(const TString &text) { paveText_->AddText(text); } + void Draw(const TString &option) { + paveText_->SetFillColor(0); // text is black on white paveText_->SetTextSize(0.03); paveText_->SetBorderSize(0); paveText_->SetTextAlign(12); paveText_->Draw(option); } - void SetTextColor(const int color) - { - paveText_->SetTextColor(color); - } - protected: - TPaveText * paveText_; + void SetTextColor(const int color) { paveText_->SetTextColor(color); } + +protected: + TPaveText *paveText_; }; /** * Compute the precision to give to the stream operator so that the passed number * will be printed with two significant figures. */ -int precision( const double & value ) -{ +int precision(const double &value) { // Counter gives the precision int precision = 1; - int k=1; - while( int(value*k) == 0 ) { - k*=10; + int k = 1; + while (int(value * k) == 0) { + k *= 10; ++precision; } return precision; } /// Helper function to extract and format the text for the fitted parameters -void getParameters( const TF1 * func, TString & fit1, TString & fit2, TString & fit3 ) -{ - - +void getParameters(const TF1 *func, TString &fit1, TString &fit2, TString &fit3) { std::stringstream a; double error = func->GetParError(0); a << std::setprecision(precision(error)) << std::fixed << func->GetParameter(0); - // fit1 += boost::lexical_cast(1); fit1 += a.str() + "+-"; a.str(""); a << error; @@ -137,18 +123,16 @@ void getParameters( const TF1 * func, TString & fit1, TString & fit2, TString & fit3 += a.str(); } -void CompareRecoGenPt( const TString & fileNum1 = "0", - const TString & fileNum2 = "1" ) -{ - TFile * outputFile = new TFile("CompareRecoGenPt.root", "RECREATE"); +void CompareRecoGenPt(const TString &fileNum1 = "0", const TString &fileNum2 = "1") { + TFile *outputFile = new TFile("CompareRecoGenPt.root", "RECREATE"); - TProfile * profile1 = getHistogram( fileNum1+"_MuScleFit.root" ); + TProfile *profile1 = getHistogram(fileNum1 + "_MuScleFit.root"); profile1->SetXTitle("gen muon Pt (GeV)"); profile1->SetYTitle("reco muon Pt (GeV)"); - TProfile * profile2 = getHistogram( fileNum2+"_MuScleFit.root" ); + TProfile *profile2 = getHistogram(fileNum2 + "_MuScleFit.root"); int xBins = profile1->GetNbinsX(); - if( xBins != profile2->GetNbinsX() ) { + if (xBins != profile2->GetNbinsX()) { std::cout << "Wrong number of bins" << std::endl; exit(1); } @@ -158,40 +142,40 @@ void CompareRecoGenPt( const TString & fileNum1 = "0", outputFile->cd(); - TH1F * meanHisto1 = makeHistogram(profile1, "mean"); - TH1F * meanHisto2 = makeHistogram(profile2, "mean"); - TH1F * rmsHisto1 = makeHistogram(profile1, "rms"); - TH1F * rmsHisto2 = makeHistogram(profile2, "rms"); - for( int iBin = 1; iBin <= xBins; ++iBin ) { -// if( profile1->GetBinError(iBin) != 0 ) { - meanHisto1->SetBinContent( iBin, profile1->GetBinContent(iBin) ); - meanHisto1->SetBinError( iBin, profile1->GetBinError(iBin) ); -// } -// if( profile2->GetBinError(iBin) ) { - meanHisto2->SetBinContent( iBin, profile2->GetBinContent(iBin) ); - meanHisto2->SetBinError( iBin, profile2->GetBinError(iBin) ); -// } - rmsHisto1->SetBinContent( iBin, profile1->GetBinError(iBin) ); - rmsHisto2->SetBinContent( iBin, profile2->GetBinError(iBin) ); + TH1F *meanHisto1 = makeHistogram(profile1, "mean"); + TH1F *meanHisto2 = makeHistogram(profile2, "mean"); + TH1F *rmsHisto1 = makeHistogram(profile1, "rms"); + TH1F *rmsHisto2 = makeHistogram(profile2, "rms"); + for (int iBin = 1; iBin <= xBins; ++iBin) { + // if( profile1->GetBinError(iBin) != 0 ) { + meanHisto1->SetBinContent(iBin, profile1->GetBinContent(iBin)); + meanHisto1->SetBinError(iBin, profile1->GetBinError(iBin)); + // } + // if( profile2->GetBinError(iBin) ) { + meanHisto2->SetBinContent(iBin, profile2->GetBinContent(iBin)); + meanHisto2->SetBinError(iBin, profile2->GetBinError(iBin)); + // } + rmsHisto1->SetBinContent(iBin, profile1->GetBinError(iBin)); + rmsHisto2->SetBinContent(iBin, profile2->GetBinError(iBin)); } // Setting all weigths to 1 ("W" option) because of Profile errors for low statistics bins biasing the fit // meanHisto1->Fit("pol1", "W", "", 2, 1000); profile1->Fit("pol1", "W", "", 0, 1000); - TF1 * func1 = profile1->GetFunction("pol1"); + TF1 *func1 = profile1->GetFunction("pol1"); // TF1 * func1 = meanHisto1->GetFunction("pol1"); func1->SetLineWidth(1); func1->SetLineColor(kBlack); profile2->Fit("pol1", "W", "", 0, 1000); // meanHisto2->Fit("pol1", "W", "", 2, 1000); - TF1 * func2 = profile2->GetFunction("pol1"); + TF1 *func2 = profile2->GetFunction("pol1"); // TF1 * func2 = meanHisto2->GetFunction("pol1"); func2->SetLineWidth(1); func2->SetLineColor(kRed); - TCanvas * canvas = new TCanvas("before", "before corrections", 1000, 800); + TCanvas *canvas = new TCanvas("before", "before corrections", 1000, 800); // canvas->Divide(2); canvas->cd(); // canvas->cd(1); @@ -231,10 +215,9 @@ void CompareRecoGenPt( const TString & fileNum1 = "0", outputFile->Write(); outputFile->Close(); -// TLegend *leg = new TLegend(0.2,0.4,0.4,0.6); -// leg->SetFillColor(0); -// leg->AddEntry(func1,"fit of before","L"); -// leg->AddEntry(func2,"fit of after","L"); -// leg->Draw("same"); + // TLegend *leg = new TLegend(0.2,0.4,0.4,0.6); + // leg->SetFillColor(0); + // leg->AddEntry(func1,"fit of before","L"); + // leg->AddEntry(func2,"fit of after","L"); + // leg->Draw("same"); } - diff --git a/PhysicsTools/SelectorUtils/bin/testSelection_wplusjets.C b/PhysicsTools/SelectorUtils/bin/testSelection_wplusjets.C index 33fd7ed7e3005..0cd0d27307c1a 100644 --- a/PhysicsTools/SelectorUtils/bin/testSelection_wplusjets.C +++ b/PhysicsTools/SelectorUtils/bin/testSelection_wplusjets.C @@ -13,8 +13,6 @@ #include #include //necessary for absolute function fabs() -#include - //Root includes #include "TROOT.h" #include "TFile.h" From aa32f7a36577c8d034517fa00508dcedea48a119 Mon Sep 17 00:00:00 2001 From: Srecko Morovic Date: Thu, 9 Sep 2021 15:34:17 +0200 Subject: [PATCH 506/923] * use a shared file lock instead of exclusive lock. Only EoLS takes exclusive lock, so it is ensured to be written in the same order as notified from the file broker service. Creation of EoLS was moved out of the shared section. Check of directory existing was moved out of the critical section * silence warnings of TCDS FED mismatch when using test TCDS range * set file locking monitoring state at the correct location --- .../Utilities/interface/AuxiliaryMakers.h | 3 +- .../Utilities/interface/EvFDaqDirector.h | 3 +- .../interface/FedRawDataInputSource.h | 2 +- EventFilter/Utilities/src/AuxiliaryMakers.cc | 5 +- EventFilter/Utilities/src/EvFDaqDirector.cc | 58 ++++++++++++++----- .../Utilities/src/FedRawDataInputSource.cc | 14 +++-- 6 files changed, 61 insertions(+), 24 deletions(-) diff --git a/EventFilter/Utilities/interface/AuxiliaryMakers.h b/EventFilter/Utilities/interface/AuxiliaryMakers.h index 00d15bc0081b1..39cee97ed042f 100644 --- a/EventFilter/Utilities/interface/AuxiliaryMakers.h +++ b/EventFilter/Utilities/interface/AuxiliaryMakers.h @@ -12,7 +12,8 @@ namespace evf { bool isRealData, const edm::EventAuxiliary::ExperimentType&, const std::string& processGUID, - bool verifyLumiSection); + bool verifyLumiSection, + bool suppressWarning); } } // namespace evf #endif diff --git a/EventFilter/Utilities/interface/EvFDaqDirector.h b/EventFilter/Utilities/interface/EvFDaqDirector.h index 2043ce884727e..1c78cfa0c4be6 100644 --- a/EventFilter/Utilities/interface/EvFDaqDirector.h +++ b/EventFilter/Utilities/interface/EvFDaqDirector.h @@ -127,7 +127,8 @@ namespace evf { void createBoLSFile(const uint32_t lumiSection, bool checkIfExists) const; void createLumiSectionFiles(const uint32_t lumiSection, const uint32_t currentLumiSection, - bool doCreateBoLS = true); + bool doCreateBoLS, + bool doCreateEoLS); static int parseFRDFileHeader(std::string const& rawSourcePath, int& rawFd, uint16_t& rawHeaderSize, diff --git a/EventFilter/Utilities/interface/FedRawDataInputSource.h b/EventFilter/Utilities/interface/FedRawDataInputSource.h index b68c98ca9a624..005e103daa8e8 100644 --- a/EventFilter/Utilities/interface/FedRawDataInputSource.h +++ b/EventFilter/Utilities/interface/FedRawDataInputSource.h @@ -60,7 +60,7 @@ class FedRawDataInputSource : public edm::RawInputSource { void maybeOpenNewLumiSection(const uint32_t lumiSection); evf::EvFDaqDirector::FileStatus nextEvent(); evf::EvFDaqDirector::FileStatus getNextEvent(); - edm::Timestamp fillFEDRawDataCollection(FEDRawDataCollection&); + edm::Timestamp fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool& tcdsInRange); void readSupervisor(); void readWorker(unsigned int tid); diff --git a/EventFilter/Utilities/src/AuxiliaryMakers.cc b/EventFilter/Utilities/src/AuxiliaryMakers.cc index a11ccd229fa09..5886700681e86 100644 --- a/EventFilter/Utilities/src/AuxiliaryMakers.cc +++ b/EventFilter/Utilities/src/AuxiliaryMakers.cc @@ -12,7 +12,8 @@ namespace evf { bool isRealData, const edm::EventAuxiliary::ExperimentType& eventType, const std::string& processGUID, - bool verifyLumiSection) { + bool verifyLumiSection, + bool suppressWarning) { edm::EventID eventId(runNumber, // check that runnumber from record is consistent lumiSection, tcds->header.eventNumber); @@ -29,7 +30,7 @@ namespace evf { const uint64_t orbitnr = ((uint64_t)tcds->header.orbitHigh << 16) | tcds->header.orbitLow; const uint32_t recordLumiSection = tcds->header.lumiSection; - if (isRealData) { + if (isRealData && !suppressWarning) { //warnings are disabled for generated data if (verifyLumiSection && recordLumiSection != lumiSection) edm::LogWarning("AuxiliaryMakers") diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 1a8aa796e8ed5..a04aa88104c02 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -942,14 +942,17 @@ namespace evf { void EvFDaqDirector::createLumiSectionFiles(const uint32_t lumiSection, const uint32_t currentLumiSection, - bool doCreateBoLS) { + bool doCreateBoLS, + bool doCreateEoLS) { if (currentLumiSection > 0) { const std::string fuEoLS = getEoLSFilePathOnFU(currentLumiSection); struct stat buf; bool found = (stat(fuEoLS.c_str(), &buf) == 0); if (!found) { - int eol_fd = open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - close(eol_fd); + if (doCreateEoLS) { + int eol_fd = open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + close(eol_fd); + } if (doCreateBoLS) createBoLSFile(lumiSection, false); } @@ -1677,8 +1680,10 @@ namespace evf { serverError = true; } } + break; } + } catch (std::exception const& e) { edm::LogWarning("EvFDaqDirector") << "Exception in socket handling"; serverError = true; @@ -1704,6 +1709,7 @@ namespace evf { fileStatus = noFile; sleep(1); //back-off if error detected } + return fileStatus; } @@ -1760,7 +1766,7 @@ namespace evf { //local lock to force index json and EoLS files to appear in order if (fileBrokerUseLocalLock_) - lockFULocal2(); + lockFULocal(); int maxLS = stopFileLS < 0 ? -1 : std::max(stopFileLS, (int)currentLumiSection); bool rawHeader = false; @@ -1770,22 +1776,22 @@ namespace evf { if (serverError) { //do not update anything if (fileBrokerUseLocalLock_) - unlockFULocal2(); + unlockFULocal(); return noFile; + } - //handle creation of EoLS and BoLS files if lumisection has changed + //handle creation of BoLS files if lumisection has changed if (currentLumiSection == 0) { - if (fileStatus == runEnded) { - createLumiSectionFiles(closedServerLS, 0); - createLumiSectionFiles(serverLS, closedServerLS, false); // +1 - } else - createLumiSectionFiles(serverLS, 0); + if (fileStatus == runEnded) + createLumiSectionFiles(closedServerLS, 0, true, false); + else + createLumiSectionFiles(serverLS, 0, true, false); } else { - //loop over and create any EoLS files missing if (closedServerLS >= currentLumiSection) { + //only BoLS files for (uint32_t i = std::max(currentLumiSection, 1U); i <= closedServerLS; i++) - createLumiSectionFiles(i + 1, i); + createLumiSectionFiles(i + 1, i, true, false); } } @@ -1803,6 +1809,11 @@ namespace evf { close(rawFd); rawFd = -1; } + + //can unlock because all files have been created locally + if (fileBrokerUseLocalLock_) + unlockFULocal(); + if (!fileFound) { //catch condition where directory got deleted fileStatus = noFile; @@ -1813,9 +1824,26 @@ namespace evf { } } - //can unlock because all files have been created locally - if (fileBrokerUseLocalLock_) + //handle creation of EoLS files if lumisection has changed, this needs to be locked exclusively + //so that EoLS files can not appear locally before index files + if (currentLumiSection == 0) { + lockFULocal2(); + if (fileStatus == runEnded) { + createLumiSectionFiles(closedServerLS, 0, false, true); + createLumiSectionFiles(serverLS, closedServerLS, false, true); // +1 + } else { + createLumiSectionFiles(serverLS, 0, false, true); + } unlockFULocal2(); + } else { + if (closedServerLS >= currentLumiSection) { + //lock exclusive to create EoLS files + lockFULocal2(); + for (uint32_t i = std::max(currentLumiSection, 1U); i <= closedServerLS; i++) + createLumiSectionFiles(i + 1, i, false, true); + unlockFULocal2(); + } + } if (fileStatus == runEnded) ls = std::max(currentLumiSection, serverLS); diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index 486b11633c15a..9384e504f66a3 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -613,7 +613,8 @@ inline evf::EvFDaqDirector::FileStatus FedRawDataInputSource::getNextEvent() { void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { setMonState(inReadEvent); std::unique_ptr rawData(new FEDRawDataCollection); - edm::Timestamp tstamp = fillFEDRawDataCollection(*rawData); + bool tcdsInRange; + edm::Timestamp tstamp = fillFEDRawDataCollection(*rawData, tcdsInRange); if (useL1EventID_) { eventID_ = edm::EventID(eventRunNumber_, currentLumiSection_, L1EventID_); @@ -639,7 +640,8 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { event_->isRealData(), static_cast(fedHeader.triggerType()), processGUID(), - !fileListLoopMode_); + !fileListLoopMode_, + !tcdsInRange); aux.setProcessHistoryID(processHistoryID_); makeEvent(eventPrincipal, aux); } @@ -684,7 +686,7 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { return; } -edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData) { +edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool &tcdsInRange) { edm::TimeValue_t time; timeval stv; gettimeofday(&stv, nullptr); @@ -696,6 +698,7 @@ edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollect unsigned char* event = (unsigned char*)event_->payload(); GTPEventID_ = 0; tcds_pointer_ = nullptr; + tcdsInRange = false; uint16_t selectedTCDSFed = 0; while (eventSize > 0) { assert(eventSize >= FEDTrailer::length); @@ -712,6 +715,9 @@ edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollect if (!selectedTCDSFed) { selectedTCDSFed = fedId; tcds_pointer_ = event + eventSize; + if (fedId >= FEDNumbering::MINTCDSuTCAFEDID && fedId <= FEDNumbering::MAXTCDSuTCAFEDID) { + tcdsInRange = true; + } } else throw cms::Exception("FedRawDataInputSource::fillFEDRawDataCollection") << "Second TCDS FED ID " << fedId << " found. First ID: " << selectedTCDSFed; @@ -810,7 +816,6 @@ void FedRawDataInputSource::readSupervisor() { if (fms_) { setMonStateSup(inSupBusy); fms_->startedLookingForFile(); - setMonStateSup(inSupLockPolling); } evf::EvFDaqDirector::FileStatus status = evf::EvFDaqDirector::noFile; @@ -830,6 +835,7 @@ void FedRawDataInputSource::readSupervisor() { assert(rawFd == -1); uint64_t thisLockWaitTimeUs = 0.; + setMonStateSup(inSupLockPolling); if (fileListMode_) { //return LS if LS not set, otherwise return file status = getFile(ls, nextFile, fileSizeIndex, thisLockWaitTimeUs); From 7050b9ae6db088b76b2e7a0de6e86aca26830cbc Mon Sep 17 00:00:00 2001 From: Srecko Morovic Date: Thu, 9 Sep 2021 19:19:53 +0200 Subject: [PATCH 507/923] implement filling random FED data in the fake raw data generator --- .../Utilities/plugins/DaqFakeReader.cc | 32 +++++++++++++++++++ EventFilter/Utilities/plugins/DaqFakeReader.h | 4 +++ EventFilter/Utilities/test/LocalRunBUFU.sh | 2 +- EventFilter/Utilities/test/startBU.py | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/EventFilter/Utilities/plugins/DaqFakeReader.cc b/EventFilter/Utilities/plugins/DaqFakeReader.cc index 7bc931d1658a2..f1ed5cb8d56c4 100644 --- a/EventFilter/Utilities/plugins/DaqFakeReader.cc +++ b/EventFilter/Utilities/plugins/DaqFakeReader.cc @@ -20,6 +20,8 @@ #include #include #include +#include +#include using namespace std; using namespace edm; @@ -33,6 +35,7 @@ DaqFakeReader::DaqFakeReader(const edm::ParameterSet& pset) : runNum(1), eventNum(1), empty_events(pset.getUntrackedParameter("emptyEvents", false)), + fillRandom_(pset.getUntrackedParameter("fillRandom", false)), meansize(pset.getUntrackedParameter("meanSize", 1024)), width(pset.getUntrackedParameter("width", 1024)), injected_errors_per_million_events(pset.getUntrackedParameter("injectErrPpm", 0)), @@ -43,6 +46,11 @@ DaqFakeReader::DaqFakeReader(const edm::ParameterSet& pset) if (tcdsFEDID_ < FEDNumbering::MINTCDSuTCAFEDID) throw cms::Exception("DaqFakeReader::DaqFakeReader") << " TCDS FED ID lower than " << FEDNumbering::MINTCDSuTCAFEDID; + if (fillRandom_) { + //intialize random seed + auto time_count = static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count()); + srand(time_count & 0xffffffff); + } produces(); } @@ -102,6 +110,18 @@ void DaqFakeReader::fillFEDs( // Allocate space for header+trailer+payload feddata.resize(size + 16); + if (fillRandom_) { + //fill FED with random values + size_t size_ui = size - size % sizeof(unsigned int); + for (size_t i=0; i < size_ui; i += sizeof(unsigned int)) { + *((unsigned int*)(feddata.data() + i)) = (unsigned int)rand(); + } + //remainder + for (size_t i = size_ui; i < size; i++) { + *(feddata.data() + i) = rand() & 0xff; + } + } + // Generate header FEDHeader::set(feddata.data(), 1, // Trigger type @@ -164,3 +184,15 @@ void DaqFakeReader::beginLuminosityBlock(LuminosityBlock const& iL, EventSetup c std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl; fakeLs_ = iL.luminosityBlock(); } + +void DaqFakeReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Injector of generated raw FED data for DAQ testing"); + desc.addUntracked("emptyEvents", false); + desc.addUntracked("fillRandom", false); + desc.addUntracked("meanSize", 1024); + desc.addUntracked("width", 1024); + desc.addUntracked("injectErrPpm", 1024); + desc.addUntracked("tcdsFEDID", 1024); + descriptions.add("DaqFakeReader", desc); +} diff --git a/EventFilter/Utilities/plugins/DaqFakeReader.h b/EventFilter/Utilities/plugins/DaqFakeReader.h index 94d9d6d79bd4b..33152b790c686 100644 --- a/EventFilter/Utilities/plugins/DaqFakeReader.h +++ b/EventFilter/Utilities/plugins/DaqFakeReader.h @@ -7,6 +7,7 @@ * \author N. Amapane - CERN */ +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -33,6 +34,8 @@ class DaqFakeReader : public edm::one::EDProducer<> { void produce(edm::Event&, edm::EventSetup const&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + private: // // private member functions @@ -48,6 +51,7 @@ class DaqFakeReader : public edm::one::EDProducer<> { edm::RunNumber_t runNum; edm::EventNumber_t eventNum; bool empty_events; + bool fillRandom_; unsigned int meansize; // in bytes unsigned int width; unsigned int injected_errors_per_million_events; diff --git a/EventFilter/Utilities/test/LocalRunBUFU.sh b/EventFilter/Utilities/test/LocalRunBUFU.sh index 156521aca2c45..8497d1cce955e 100755 --- a/EventFilter/Utilities/test/LocalRunBUFU.sh +++ b/EventFilter/Utilities/test/LocalRunBUFU.sh @@ -19,7 +19,7 @@ RC=0 P=$$ PREFIX=results_${USER}${P} OUTDIR=${LOCAL_TMP_DIR}/${PREFIX} - +echo "Output will be temporarily written to ${OUTDIR}" mkdir ${OUTDIR} cp ${SCRIPTDIR}/startBU.py ${OUTDIR} diff --git a/EventFilter/Utilities/test/startBU.py b/EventFilter/Utilities/test/startBU.py index c827a6e5d3022..c4825646fbaaa 100644 --- a/EventFilter/Utilities/test/startBU.py +++ b/EventFilter/Utilities/test/startBU.py @@ -121,6 +121,7 @@ defaultQualifier = cms.untracked.int32(0)) process.s = cms.EDProducer("DaqFakeReader", + fillRandom = cms.untracked.bool(True), meanSize = cms.untracked.uint32(options.fedMeanSize), width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))), tcdsFEDID = cms.untracked.uint32(1024), From 0e52df28d74b6b98e0cfc1c5e282e6d5833ae621 Mon Sep 17 00:00:00 2001 From: Srecko Morovic Date: Thu, 9 Sep 2021 20:15:24 +0200 Subject: [PATCH 508/923] code-format --- EventFilter/Utilities/plugins/DaqFakeReader.cc | 5 +++-- EventFilter/Utilities/src/EvFDaqDirector.cc | 4 ++-- EventFilter/Utilities/src/FedRawDataInputSource.cc | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/EventFilter/Utilities/plugins/DaqFakeReader.cc b/EventFilter/Utilities/plugins/DaqFakeReader.cc index f1ed5cb8d56c4..60fd1ace513ea 100644 --- a/EventFilter/Utilities/plugins/DaqFakeReader.cc +++ b/EventFilter/Utilities/plugins/DaqFakeReader.cc @@ -48,7 +48,8 @@ DaqFakeReader::DaqFakeReader(const edm::ParameterSet& pset) << " TCDS FED ID lower than " << FEDNumbering::MINTCDSuTCAFEDID; if (fillRandom_) { //intialize random seed - auto time_count = static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count()); + auto time_count = + static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count()); srand(time_count & 0xffffffff); } produces(); @@ -113,7 +114,7 @@ void DaqFakeReader::fillFEDs( if (fillRandom_) { //fill FED with random values size_t size_ui = size - size % sizeof(unsigned int); - for (size_t i=0; i < size_ui; i += sizeof(unsigned int)) { + for (size_t i = 0; i < size_ui; i += sizeof(unsigned int)) { *((unsigned int*)(feddata.data() + i)) = (unsigned int)rand(); } //remainder diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index a04aa88104c02..415a630e265a0 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -950,7 +950,8 @@ namespace evf { bool found = (stat(fuEoLS.c_str(), &buf) == 0); if (!found) { if (doCreateEoLS) { - int eol_fd = open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + int eol_fd = + open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); close(eol_fd); } if (doCreateBoLS) @@ -1778,7 +1779,6 @@ namespace evf { if (fileBrokerUseLocalLock_) unlockFULocal(); return noFile; - } //handle creation of BoLS files if lumisection has changed diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index 9384e504f66a3..78332f0f8502e 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -686,7 +686,7 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { return; } -edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool &tcdsInRange) { +edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool& tcdsInRange) { edm::TimeValue_t time; timeval stv; gettimeofday(&stv, nullptr); @@ -716,7 +716,7 @@ edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollect selectedTCDSFed = fedId; tcds_pointer_ = event + eventSize; if (fedId >= FEDNumbering::MINTCDSuTCAFEDID && fedId <= FEDNumbering::MAXTCDSuTCAFEDID) { - tcdsInRange = true; + tcdsInRange = true; } } else throw cms::Exception("FedRawDataInputSource::fillFEDRawDataCollection") From cd65d216ae1fb95142d8f8812c20aa053f7e9d69 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Thu, 9 Sep 2021 14:01:10 -0500 Subject: [PATCH 509/923] check tp channel params to use new filter in LUT coder --- .../HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 12 +++++++++--- .../src/HcalTrigPrimDigiProducer.cc | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index 3009cc3b1d9a8..d7f084e10cfd0 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -361,15 +361,21 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { continue; int aieta = abs(hcalTTDetId.ieta()); - int tp_version = hcalTTDetId.version(); + + // The absence of TT channels in the HcalTPChannelParameters + // is intepreted as to not use the new filter + int weight = -1.0; + auto tpParam = conditions.getHcalTPChannelParameter(hcalTTDetId, false); + if (tpParam) + weight = tpParam->getauxi1(); if (aieta <= lastHBRing) { foundHB = true; - if (tp_version > 1) + if (weight != -1.0) newHBtp = true; } else if (aieta > lastHBRing and aieta < lastHERing) { foundHE = true; - if (tp_version > 1) + if (weight != -1.0) newHEtp = true; } } diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index c07ac6bee032b..548d79517a598 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -119,7 +119,7 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet // The absence of TT channels in the HcalTPChannelParameters // is intepreted as to not use the new filter - auto tpParam = db->getHcalTPChannelParameter(hcalTTDetId); + auto tpParam = db->getHcalTPChannelParameter(hcalTTDetId, false); if (tpParam) fixedPointWeight = tpParam->getauxi1(); From a8d64f02fb66ab5dd6f4161957435c127f09a1a9 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Thu, 9 Sep 2021 14:09:42 -0500 Subject: [PATCH 510/923] run code checks --- CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 2 +- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index d7f084e10cfd0..3815c61147cbb 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -367,7 +367,7 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { int weight = -1.0; auto tpParam = conditions.getHcalTPChannelParameter(hcalTTDetId, false); if (tpParam) - weight = tpParam->getauxi1(); + weight = tpParam->getauxi1(); if (aieta <= lastHBRing) { foundHB = true; diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 548d79517a598..7d653fceb74e5 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -104,7 +104,6 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet std::vector vIds = emap->allElectronicsIdTrigger(); for (std::vector::const_iterator eId = vIds.begin(); eId != vIds.end(); eId++) { - HcalTrigTowerDetId hcalTTDetId(emap->lookupTrigger(*eId)); if (hcalTTDetId.null()) continue; @@ -120,7 +119,7 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet // The absence of TT channels in the HcalTPChannelParameters // is intepreted as to not use the new filter auto tpParam = db->getHcalTPChannelParameter(hcalTTDetId, false); - if (tpParam) + if (tpParam) fixedPointWeight = tpParam->getauxi1(); if (aieta <= lastHBRing) { From 5299229cd681e3731ec0993bfc40be7f628336b1 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 9 Sep 2021 18:20:17 -0500 Subject: [PATCH 511/923] Remove throwing of test Exception --- GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc b/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc index b9c032396926b..ba1b488d80f36 100644 --- a/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc +++ b/GeneratorInterface/SherpaInterface/src/SherpaHadronizer.cc @@ -218,7 +218,6 @@ SherpaHadronizer::~SherpaHadronizer() { bool SherpaHadronizer::initializeForInternalPartons() { //initialize Sherpa but only once - throw cms::Exception("TEST"); if (!isInitialized) { int argc = arguments.size(); char *argv[argc]; From 01c1b2cf0b419758d9ea438f9a2c24d28257d1f9 Mon Sep 17 00:00:00 2001 From: "Ian J. Watson" Date: Fri, 10 Sep 2021 13:17:14 +0900 Subject: [PATCH 512/923] Fix layer Co-authored-by: Slava Krutelyov --- DataFormats/TrackReco/interface/HitPattern.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataFormats/TrackReco/interface/HitPattern.h b/DataFormats/TrackReco/interface/HitPattern.h index 4633313cecf75..79986ae55005b 100644 --- a/DataFormats/TrackReco/interface/HitPattern.h +++ b/DataFormats/TrackReco/interface/HitPattern.h @@ -781,8 +781,8 @@ namespace reco { inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) { uint16_t sss = getSubSubStructure(pattern); if (sss & 0b1000) - return sss & 0b0111; - return sss & 0b11; + return (sss & 0b0111) + 1; + return (sss & 0b11) + 1; } inline bool HitPattern::validHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::VALID; } From 81bad2500f9c71476a275cae90bec586e1d5011c Mon Sep 17 00:00:00 2001 From: "Ian J. Watson" Date: Fri, 10 Sep 2021 13:22:53 +0900 Subject: [PATCH 513/923] Update comments, printHitPattern --- DataFormats/TrackReco/interface/HitPattern.h | 4 ++-- DataFormats/TrackReco/src/HitPattern.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DataFormats/TrackReco/interface/HitPattern.h b/DataFormats/TrackReco/interface/HitPattern.h index 79986ae55005b..c565f07938135 100644 --- a/DataFormats/TrackReco/interface/HitPattern.h +++ b/DataFormats/TrackReco/interface/HitPattern.h @@ -214,7 +214,7 @@ namespace reco { /// GEM station: 1,2. Only valid for muon GEM patterns, of course. static uint16_t getGEMStation(uint16_t pattern); - /// GEM layer: 1,2. Only valid for muon GEM patterns, of course. + /// GEM layer: 1-6 for station 0, 1-2 for stations 1 and 2. Only valid for muon GEM patterns, of course. static uint16_t getGEMLayer(uint16_t pattern); /// BTL Module type: 1,2,3. Only valid for BTL patterns of course. @@ -746,7 +746,7 @@ namespace reco { return ((pattern >> HitTypeOffset) & HitTypeMask); } - inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { return (getSubSubStructure(pattern) >> 2) + 1; } + inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1; } inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); } diff --git a/DataFormats/TrackReco/src/HitPattern.cc b/DataFormats/TrackReco/src/HitPattern.cc index 58de435a2f021..da653fb9dfade 100644 --- a/DataFormats/TrackReco/src/HitPattern.cc +++ b/DataFormats/TrackReco/src/HitPattern.cc @@ -827,7 +827,7 @@ void HitPattern::printHitPattern(HitCategory category, int position, std::ostrea } else if (muonRPCHitFilter(pattern)) { stream << "\trpc " << (getRPCregion(pattern) ? "endcaps" : "barrel") << ", layer " << getRPCLayer(pattern); } else if (muonGEMHitFilter(pattern)) { - stream << "\tgem " << (getGEMLayer(pattern) ? "layer1" : "layer2") << ", station " << getGEMStation(pattern); + stream << "\tgem " << " station " << getGEMStation(pattern) << ", layer" << getGEMLayer(pattern); } else if (muonME0HitFilter(pattern)) { stream << "\tme0 "; } else { From 42d511bacaf9e9e514b7d76adadb427844ac2835 Mon Sep 17 00:00:00 2001 From: "Ian J. Watson" Date: Fri, 10 Sep 2021 17:13:53 +0900 Subject: [PATCH 514/923] Code format --- DataFormats/TrackReco/interface/HitPattern.h | 4 +++- DataFormats/TrackReco/src/HitPattern.cc | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DataFormats/TrackReco/interface/HitPattern.h b/DataFormats/TrackReco/interface/HitPattern.h index c565f07938135..cb36daa3d16de 100644 --- a/DataFormats/TrackReco/interface/HitPattern.h +++ b/DataFormats/TrackReco/interface/HitPattern.h @@ -746,7 +746,9 @@ namespace reco { return ((pattern >> HitTypeOffset) & HitTypeMask); } - inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1; } + inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { + return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1; + } inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); } diff --git a/DataFormats/TrackReco/src/HitPattern.cc b/DataFormats/TrackReco/src/HitPattern.cc index da653fb9dfade..6431408cfd4e9 100644 --- a/DataFormats/TrackReco/src/HitPattern.cc +++ b/DataFormats/TrackReco/src/HitPattern.cc @@ -827,7 +827,8 @@ void HitPattern::printHitPattern(HitCategory category, int position, std::ostrea } else if (muonRPCHitFilter(pattern)) { stream << "\trpc " << (getRPCregion(pattern) ? "endcaps" : "barrel") << ", layer " << getRPCLayer(pattern); } else if (muonGEMHitFilter(pattern)) { - stream << "\tgem " << " station " << getGEMStation(pattern) << ", layer" << getGEMLayer(pattern); + stream << "\tgem " + << " station " << getGEMStation(pattern) << ", layer" << getGEMLayer(pattern); } else if (muonME0HitFilter(pattern)) { stream << "\tme0 "; } else { From 78c24e2f5befed3137eb478e59d3600956e8f1ba Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 19 Aug 2021 10:41:47 +0200 Subject: [PATCH 515/923] miscellaneous payload inspector fixes --- .../plugins/TrackerAlignment_PayloadInspector.cc | 8 ++++---- CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc index 0bee612603bf5..1633380424575 100644 --- a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc +++ b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc @@ -995,10 +995,10 @@ namespace { final->SetMarkerSize(2.5); t1.SetTextColor(kRed); initial->Draw(); - t1.DrawLatex(x0i, y0i - 0.5, Form("(%.2f,%.2f)", x0i, y0i)); + t1.DrawLatex(x0i, y0i + (y0i > y0f ? 0.3 : -0.5), Form("(%.2f,%.2f)", x0i, y0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(x0f, y0f + 0.3, Form("(%.2f,%.2f)", x0f, y0f)); + t1.DrawLatex(x0f, y0f + (y0i > y0f ? -0.5 : 0.3), Form("(%.2f,%.2f)", x0f, y0f)); } // fourth pad is a special case for the z coordinate @@ -1032,10 +1032,10 @@ namespace { final->SetMarkerSize(2.5); initial->Draw(); t1.SetTextColor(kRed); - t1.DrawLatex(c - 1, z0i - 1.5, Form("(%.2f)", z0i)); + t1.DrawLatex(c - 1, z0i + (z0i > z0f ? 1. : -1.5), Form("(%.2f)", z0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(c - 1, z0f + 1., Form("(%.2f)", z0f)); + t1.DrawLatex(c - 1, z0f + (z0i > z0f ? -1.5 : 1), Form("(%.2f)", z0f)); } std::string fileName(this->m_imageFileName); diff --git a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h index 7cf6dd251a897..873856e23addc 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h @@ -242,7 +242,10 @@ namespace templateHelper { h2_Header->GetXaxis()->SetBinLabel(idx, ""); for (unsigned int iy = 1; iy <= 12; iy++) { - if (tempValue.head.Dtype != 0 || uH < 0) { + // Some of the Phase-2 templates have DType = 0 for all partitions (TBPX, TEPX, TFPX) + // so they are distinguished by the uH strength value (<0). + // To avoid changing the behaviour of 0T payload (uH=-99) that case is treated separately + if (tempValue.head.Dtype != 0 || (uH < 0 && uH > -99)) { h2_ghost->SetBinContent(idx, iy, 1); } else { h2_ghost->SetBinContent(idx, iy, -1); From fd973b3df962131a22f91bfb39bac57b761337b0 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 9 Sep 2021 18:12:36 +0200 Subject: [PATCH 516/923] Rearrange all plugins to the plugins directory in Calibration/HcalAlCaRecoProducers Small changes Code check small fix code check Code check make track_ instead of Track_ --- .../HcalAlCaRecoProducers/BuildFile.xml | 30 ------ .../interface/AlCaEcalHcalReadoutsProducer.h | 51 ---------- .../interface/AlCaHcalNoiseProducer.h | 72 -------------- .../{src => plugins}/AlCaDiJetsProducer.cc | 0 .../plugins/AlCaEcalHcalReadoutsProducer.cc | 92 ++++++++++++++++++ .../{src => plugins}/AlCaGammaJetProducer.cc | 0 .../{src => plugins}/AlCaHBHEMuonProducer.cc | 1 + .../{src => plugins}/AlCaHOCalibProducer.cc | 0 .../{src => plugins}/AlCaHcalNoiseProducer.cc | 85 +++++++++++++++-- .../{src => plugins}/AlCaIsoTracksProducer.cc | 1 + .../plugins/AlCaIsoTracksProducerFilter.cc | 8 +- .../plugins/BuildFile.xml | 27 +++++- .../{src => plugins}/ProducerAnalyzer.cc | 95 ++++++++++++++++--- .../src/AlCaEcalHcalReadoutsProducer.cc | 44 --------- .../src/ProducerAnalyzer.h | 82 ---------------- .../HcalAlCaRecoProducers/src/SealModule.cc | 9 -- 16 files changed, 286 insertions(+), 311 deletions(-) delete mode 100644 Calibration/HcalAlCaRecoProducers/BuildFile.xml delete mode 100644 Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h delete mode 100644 Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaDiJetsProducer.cc (100%) create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaGammaJetProducer.cc (100%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHBHEMuonProducer.cc (99%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHOCalibProducer.cc (100%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHcalNoiseProducer.cc (78%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaIsoTracksProducer.cc (99%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/ProducerAnalyzer.cc (76%) delete mode 100644 Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc delete mode 100644 Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h delete mode 100644 Calibration/HcalAlCaRecoProducers/src/SealModule.cc diff --git a/Calibration/HcalAlCaRecoProducers/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/BuildFile.xml deleted file mode 100644 index 70a45f24766ba..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/BuildFile.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h deleted file mode 100644 index 71980b641a95c..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- - -// system include files -#include -#include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -// -// class decleration -// - -class AlCaEcalHcalReadoutsProducer : public edm::global::EDProducer<> { -public: - explicit AlCaEcalHcalReadoutsProducer(const edm::ParameterSet &); - - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - -private: - // ----------member data --------------------------- - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::EDPutTokenT put_hbhe_; - edm::EDPutTokenT put_ho_; - edm::EDPutTokenT put_hf_; -}; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h deleted file mode 100644 index f1c5d19926916..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -// system include files -#include -#include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" - -// -// class decleration -// - -class AlCaHcalNoiseProducer : public edm::EDProducer { -public: - explicit AlCaHcalNoiseProducer(const edm::ParameterSet &); - ~AlCaHcalNoiseProducer() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - // ----------member data --------------------------- - - bool useMet_; - bool useJet_; - double MetCut_; - double JetMinE_; - double JetHCALminEnergyFraction_; - int nAnomalousEvents; - int nEvents; - - std::vector ecalLabels_; - - edm::EDGetTokenT tok_jets_; - edm::EDGetTokenT tok_met_; - edm::EDGetTokenT tok_tower_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::EDGetTokenT tok_ps_; - edm::EDGetTokenT tok_raw_; - std::vector > toks_ecal_; -}; diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaDiJetsProducer.cc similarity index 100% rename from Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaDiJetsProducer.cc diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc new file mode 100644 index 0000000000000..7d7d636267716 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc @@ -0,0 +1,92 @@ +// -*- C++ -*- + +// system include files +#include +#include +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.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 "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/DetId/interface/DetId.h" + +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" + +// +// class decleration +// + +class AlCaEcalHcalReadoutsProducer : public edm::global::EDProducer<> { +public: + explicit AlCaEcalHcalReadoutsProducer(const edm::ParameterSet&); + + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + +private: + // ----------member data --------------------------- + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDPutTokenT put_hbhe_; + edm::EDPutTokenT put_ho_; + edm::EDPutTokenT put_hf_; +}; + +AlCaEcalHcalReadoutsProducer::AlCaEcalHcalReadoutsProducer(const edm::ParameterSet& iConfig) { + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + + //register your products + put_hbhe_ = produces("HBHERecHitCollection"); + put_ho_ = produces("HORecHitCollection"); + put_hf_ = produces("HFRecHitCollection"); +} + +// ------------ method called to produce the data ------------ +void AlCaEcalHcalReadoutsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + using namespace edm; + using namespace std; + + edm::Handle hbhe; + edm::Handle ho; + edm::Handle hf; + + iEvent.getByToken(tok_hbhe_, hbhe); + if (!hbhe.isValid()) { + LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hbhe product!" << std::endl; + return; + } + + iEvent.getByToken(tok_ho_, ho); + if (!ho.isValid()) { + LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get ho product!" << std::endl; + } + + iEvent.getByToken(tok_hf_, hf); + if (!hf.isValid()) { + LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hf product!" << std::endl; + } + + //Put selected information in the event + iEvent.emplace(put_hbhe_, *hbhe); + iEvent.emplace(put_ho_, *ho); + iEvent.emplace(put_hf_, *hf); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaEcalHcalReadoutsProducer); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetProducer.cc similarity index 100% rename from Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetProducer.cc diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc similarity index 99% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc index 9a556e426f578..41a728411843d 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc @@ -33,6 +33,7 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/VertexReco/interface/Vertex.h" +//#define EDM_ML_DEBUG // // class declaration // diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc similarity index 100% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc similarity index 78% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc index 294aa251650f3..3c2c29b1b82e0 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc @@ -8,19 +8,88 @@ Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc */ -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h" +// -*- C++ -*- + +// system include files +#include +#include +// user include files + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/DetId/interface/DetId.h" -#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/CaloTowers/interface/CaloTower.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" + +// +// class decleration +// + +class AlCaHcalNoiseProducer : public edm::one::EDProducer<> { +public: + explicit AlCaHcalNoiseProducer(const edm::ParameterSet&); + ~AlCaHcalNoiseProducer() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + // ----------member data --------------------------- + + bool useMet_; + bool useJet_; + double MetCut_; + double JetMinE_; + double JetHCALminEnergyFraction_; + int nAnomalousEvents; + int nEvents; + + std::vector ecalLabels_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_met_; + edm::EDGetTokenT tok_tower_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_ps_; + edm::EDGetTokenT tok_raw_; + std::vector > toks_ecal_; +}; AlCaHcalNoiseProducer::AlCaHcalNoiseProducer(const edm::ParameterSet& iConfig) { tok_jets_ = consumes(iConfig.getParameter("JetSource")); @@ -240,3 +309,7 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i iEvent.put(std::move(outputESColl), "PSEcalRecHitCollectionFHN"); iEvent.put(std::move(outputFEDs), "HcalFEDsFHN"); } + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalNoiseProducer); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc similarity index 99% rename from Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc index 1bf027d6c1cfc..c4ddcfe929362 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc @@ -71,6 +71,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" +//#define EDM_ML_DEBUG // // class declaration // diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc index a0521f4d4f885..5d0bef19f4847 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc @@ -23,6 +23,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -101,8 +102,10 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con int hlt = triggerResults->accept(iHLT); for (unsigned int i = 0; i < trigNames_.size(); ++i) { if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) { +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") - << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << triggerSatisfied << std::endl; + << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << triggerSatisfied; +#endif if (hlt > 0) { triggerSatisfied = true; break; @@ -114,6 +117,9 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con } } } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksProducerFilter:: triggerSatisfied: " << triggerSatisfied; +#endif if (triggerSatisfied) ++nGood_; return triggerSatisfied; diff --git a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml index 32d601e1f18a7..fff6c2671b4ce 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml +++ b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml @@ -1,10 +1,33 @@ + + + + + + + + + + + + + + + + + + - - + + + + + + + diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc b/Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc similarity index 76% rename from Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc index fadac8bf6beb7..a6d35c010e047 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc @@ -1,20 +1,87 @@ // system include files +#include +#include +#include // user include files -#include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" #include "DataFormats/Provenance/interface/StableProvenance.h" #include "DataFormats/MuonReco/interface/Muon.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/TrackReco/interface/TrackExtraFwd.h" +// collections +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" + #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" + +namespace cms { + + // + // class declaration + // + + class ProducerAnalyzer : public edm::one::EDAnalyzer<> { + public: + explicit ProducerAnalyzer(const edm::ParameterSet&); + ~ProducerAnalyzer() override; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + void beginJob() override {} + void endJob() override {} + + private: + // ----------member data --------------------------- + std::string nameProd_; + std::string jetCalo_; + std::string gammaClus_; + std::string ecalInput_; + std::string hbheInput_; + std::string hoInput_; + std::string hfInput_; + std::string tracks_; + + edm::EDGetTokenT tok_hovar_; + edm::EDGetTokenT tok_horeco_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hoProd_; + + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_gamma_; + edm::EDGetTokenT tok_muons_; + edm::EDGetTokenT tok_ecal_; + edm::EDGetTokenT tok_tracks_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hbheProd_; + + edm::ESGetToken tok_geom_; + }; +} // end namespace cms using namespace reco; @@ -33,7 +100,7 @@ namespace cms { hbheInput_ = iConfig.getUntrackedParameter("hbheInput"); hoInput_ = iConfig.getUntrackedParameter("hoInput"); hfInput_ = iConfig.getUntrackedParameter("hfInput"); - Tracks_ = iConfig.getUntrackedParameter("Tracks", "GammaJetTracksCollection"); + tracks_ = iConfig.getUntrackedParameter("Tracks", "GammaJetTracksCollection"); tok_hovar_ = consumes(edm::InputTag(nameProd_, hoInput_)); tok_horeco_ = consumes(edm::InputTag("horeco")); @@ -46,7 +113,7 @@ namespace cms { tok_gamma_ = consumes(edm::InputTag(nameProd_, gammaClus_)); tok_muons_ = consumes(edm::InputTag(nameProd_, "SelectedMuons")); tok_ecal_ = consumes(edm::InputTag(nameProd_, ecalInput_)); - tok_tracks_ = consumes(edm::InputTag(nameProd_, Tracks_)); + tok_tracks_ = consumes(edm::InputTag(nameProd_, tracks_)); tok_hbheProd_ = consumes(edm::InputTag(nameProd_, hbheInput_)); tok_hbhe_ = consumes(edm::InputTag(hbheInput_)); @@ -59,10 +126,6 @@ namespace cms { // (e.g. close files, deallocate resources etc.) } - void ProducerAnalyzer::beginJob() {} - - void ProducerAnalyzer::endJob() {} - // // member functions // @@ -193,6 +256,10 @@ namespace cms { } } } - //define this as a plug-in - //DEFINE_FWK_MODULE(ProducerAnalyzer) } // namespace cms + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +using cms::ProducerAnalyzer; +DEFINE_FWK_MODULE(ProducerAnalyzer); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc deleted file mode 100644 index f2792c3ee36d9..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc +++ /dev/null @@ -1,44 +0,0 @@ -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -AlCaEcalHcalReadoutsProducer::AlCaEcalHcalReadoutsProducer(const edm::ParameterSet& iConfig) { - tok_ho_ = consumes(iConfig.getParameter("hoInput")); - tok_hf_ = consumes(iConfig.getParameter("hfInput")); - tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); - - //register your products - put_hbhe_ = produces("HBHERecHitCollection"); - put_ho_ = produces("HORecHitCollection"); - put_hf_ = produces("HFRecHitCollection"); -} - -// ------------ method called to produce the data ------------ -void AlCaEcalHcalReadoutsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; - using namespace std; - - edm::Handle hbhe; - edm::Handle ho; - edm::Handle hf; - - iEvent.getByToken(tok_hbhe_, hbhe); - if (!hbhe.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hbhe product!" << std::endl; - return; - } - - iEvent.getByToken(tok_ho_, ho); - if (!ho.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get ho product!" << std::endl; - } - - iEvent.getByToken(tok_hf_, hf); - if (!hf.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hf product!" << std::endl; - } - - //Put selected information in the event - iEvent.emplace(put_hbhe_, *hbhe); - iEvent.emplace(put_ho_, *ho); - iEvent.emplace(put_hf_, *hf); -} diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h deleted file mode 100644 index 05cb0dfc7966a..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CalibrationHcalAlCaRecoProducersProducerAnalyzer_h -#define CalibrationHcalAlCaRecoProducersProducerAnalyzer_h - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -// collections -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -namespace cms { - - // - // class declaration - // - - class ProducerAnalyzer : public edm::EDAnalyzer { - public: - explicit ProducerAnalyzer(const edm::ParameterSet&); - ~ProducerAnalyzer() override; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - void beginJob() override; - void endJob() override; - - private: - // ----------member data --------------------------- - std::string nameProd_; - std::string jetCalo_; - std::string gammaClus_; - std::string ecalInput_; - std::string hbheInput_; - std::string hoInput_; - std::string hfInput_; - std::string Tracks_; - - edm::EDGetTokenT tok_hovar_; - edm::EDGetTokenT tok_horeco_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hoProd_; - - edm::EDGetTokenT tok_hf_; - - edm::EDGetTokenT tok_jets_; - edm::EDGetTokenT tok_gamma_; - edm::EDGetTokenT tok_muons_; - edm::EDGetTokenT tok_ecal_; - edm::EDGetTokenT tok_tracks_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_hbheProd_; - - edm::ESGetToken tok_geom_; - }; -} // end namespace cms -#endif diff --git a/Calibration/HcalAlCaRecoProducers/src/SealModule.cc b/Calibration/HcalAlCaRecoProducers/src/SealModule.cc deleted file mode 100644 index ced88749c125e..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/SealModule.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h" -#include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" - -using cms::ProducerAnalyzer; - -DEFINE_FWK_MODULE(AlCaEcalHcalReadoutsProducer); -DEFINE_FWK_MODULE(ProducerAnalyzer); From c87cf4bd003a9706ac80d458c3b0005d5128caa6 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 10 Sep 2021 09:17:34 -0500 Subject: [PATCH 517/923] Missed used of label 'tTrigLabel' in esConsumes call --- CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc index e4813002c30e0..807fcd98c4c4f 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc @@ -108,16 +108,13 @@ class DTTTrigSyncFromDB : public DTTTrigBaseSync { int theWirePropCorrType; // spacing of BX in ns double theBXspace; - - std::string thetTrigLabel; - std::string thet0Label; }; using namespace std; using namespace edm; DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config, edm::ConsumesCollector cc) - : ttrigToken_(cc.esConsumes()), + : ttrigToken_(cc.esConsumes(edm::ESInputTag("", config.getParameter("tTrigLabel")))), debug(config.getUntrackedParameter("debug")), // The velocity of signal propagation along the wire (cm/ns) theVPropWire(config.getParameter("vPropWire")), @@ -130,11 +127,9 @@ DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config, edm::ConsumesCo doWirePropCorrection(config.getParameter("doWirePropCorrection")), theWirePropCorrType(config.getParameter("wirePropCorrType")), // spacing of BX in ns - theBXspace(config.getUntrackedParameter("bxSpace", 25.)), - thetTrigLabel(config.getParameter("tTrigLabel")), - thet0Label(config.getParameter("t0Label")) { + theBXspace(config.getUntrackedParameter("bxSpace", 25.)) { if (doT0Correction) { - t0Token_ = cc.esConsumes(edm::ESInputTag("", thet0Label)); + t0Token_ = cc.esConsumes(edm::ESInputTag("", config.getParameter("t0Label"))); } } From 9114727d5653839e79131b4bced96fde1ecef975 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 10 Sep 2021 16:29:53 +0200 Subject: [PATCH 518/923] improve AlCaRecoTriggerBits_PayloadInspector and tests --- .../AlCaRecoTriggerBits_PayloadInspector.cc | 64 ++++++++++--------- CondCore/HLTPlugins/test/test.sh | 15 ++++- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc index 70096f1615be2..2a19317a2f8c1 100644 --- a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc +++ b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc @@ -3,6 +3,7 @@ #include "CondCore/CondDB/interface/Time.h" #include "CondFormats/HLTObjects/interface/AlCaRecoTriggerBits.h" +#include #include #include #include @@ -12,13 +13,14 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ Display AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_Display : public cond::payloadInspector::PlotImage { + class AlCaRecoTriggerBits_Display : public PlotImage { public: - AlCaRecoTriggerBits_Display() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits") { + AlCaRecoTriggerBits_Display() : PlotImage("Table of AlCaRecoTriggerBits") { setSingleIov(true); } @@ -127,24 +129,33 @@ namespace { /************************************************ Compare AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_CompareBase : public cond::payloadInspector::PlotImage { + template + class AlCaRecoTriggerBits_CompareBase : public PlotImage { public: AlCaRecoTriggerBits_CompareBase() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits comparison") {} - - bool fill(const std::vector > &iovs) override { - std::vector > sorted_iovs = iovs; - - // make absolute sure the IOVs are sortd by since - std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) { - return std::get<0>(t1) < std::get<0>(t2); - }); - - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + : PlotImage("Table of AlCaRecoTriggerBits comparison") {} + + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = PlotBase::getTag<0>().iovs; + auto f_tagname = PlotBase::getTag<0>().name; + std::string l_tagname = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; + + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); + + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = PlotBase::getTag<1>().iovs; + l_tagname = PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); + } - std::shared_ptr last_payload = fetchPayload(std::get<1>(lastiov)); - std::shared_ptr first_payload = fetchPayload(std::get<1>(firstiov)); + std::shared_ptr last_payload = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); std::string lastIOVsince = std::to_string(std::get<0>(lastiov)); std::string firstIOVsince = std::to_string(std::get<0>(firstiov)); @@ -195,9 +206,9 @@ namespace { y_x1.push_back(y); s_x1.push_back("#scale[1.2]{Key}"); y_x2.push_back(y); - s_x2.push_back("#scale[1.2]{in IOV: " + firstIOVsince + "}"); + s_x2.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", f_tagname, firstIOVsince)); y_x3.push_back(y); - s_x3.push_back("#scale[1.2]{in IOV: " + lastIOVsince + "}"); + s_x3.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", l_tagname, lastIOVsince)); y -= pitch / 3; // print the ones missing in the last key @@ -391,21 +402,14 @@ namespace { } //canvas.SetCanvasSize(2000,(1-y)*1000); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; } }; - class AlCaRecoTriggerBits_Compare : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_Compare() : AlCaRecoTriggerBits_CompareBase() { this->setSingleIov(false); } - }; - - class AlCaRecoTriggerBits_CompareTwoTags : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_CompareTwoTags() : AlCaRecoTriggerBits_CompareBase() { this->setTwoTags(true); } - }; + using AlCaRecoTriggerBits_Compare = AlCaRecoTriggerBits_CompareBase; + using AlCaRecoTriggerBits_CompareTwoTags = AlCaRecoTriggerBits_CompareBase; } // namespace diff --git a/CondCore/HLTPlugins/test/test.sh b/CondCore/HLTPlugins/test/test.sh index 739e1cceed0b6..e9d1d5ca299cd 100755 --- a/CondCore/HLTPlugins/test/test.sh +++ b/CondCore/HLTPlugins/test/test.sh @@ -38,4 +38,17 @@ getPayloadData.py \ --db Prod \ --test; -mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png \ No newline at end of file +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png + +getPayloadData.py \ + --plugin pluginAlCaRecoTriggerBits_PayloadInspector \ + --plot plot_AlCaRecoTriggerBits_CompareTwoTags \ + --tag AlCaRecoTriggerBits_TrackerDQM_v2_prompt \ + --tagtwo AlCaRecoTriggerBits_TrackerDQM_v6_offline \ + --time_type Run \ + --iovs '{"start_iov": "325492", "end_iov": "325492"}' \ + --iovstwo '{"start_iov": "304738", "end_iov": "304738"}' \ + --db Prod \ + --test; + +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_CompareTwoTags.png From bf7b42d2caa6cce79cff096c4db8bf91f68d4ddd Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 10 Sep 2021 10:37:20 -0500 Subject: [PATCH 519/923] Added esConsumes to HBHERecHitProducerGPU --- .../src/HBHERecHitProducerGPU.cc | 114 ++++++++++-------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HBHERecHitProducerGPU.cc b/RecoLocalCalo/HcalRecProducers/src/HBHERecHitProducerGPU.cc index d6f0d1a998a64..4909dfeb7ff11 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HBHERecHitProducerGPU.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HBHERecHitProducerGPU.cc @@ -33,6 +33,25 @@ class HBHERecHitProducerGPU : public edm::stream::EDProducer using OProductType = cms::cuda::Product; edm::EDPutTokenT rechitsM0Token_; + const edm::ESGetToken recoParamsToken_; + const edm::ESGetToken gainWidthsToken_; + const edm::ESGetToken gainsToken_; + const edm::ESGetToken lutCorrsToken_; + const edm::ESGetToken pedestalWidthsToken_; + const edm::ESGetToken + effectivePedestalWidthsToken_; + const edm::ESGetToken pedestalsToken_; + edm::ESGetToken effectivePedestalsToken_; + const edm::ESGetToken qieCodersToken_; + const edm::ESGetToken respCorrsToken_; + const edm::ESGetToken timeCorrsToken_; + const edm::ESGetToken qieTypesToken_; + const edm::ESGetToken topologyToken_; + const edm::ESGetToken recConstantsToken_; + const edm::ESGetToken sipmParametersToken_; + const edm::ESGetToken sipmCharacteristicsToken_; + const edm::ESGetToken pulseOffsetsToken_; + hcal::reconstruction::ConfigParameters configParameters_; hcal::reconstruction::OutputDataGPU outputGPU_; cms::cuda::ContextState cudaState_; @@ -42,7 +61,23 @@ HBHERecHitProducerGPU::HBHERecHitProducerGPU(edm::ParameterSet const& ps) : digisTokenF01HE_{consumes(ps.getParameter("digisLabelF01HE"))}, digisTokenF5HB_{consumes(ps.getParameter("digisLabelF5HB"))}, digisTokenF3HB_{consumes(ps.getParameter("digisLabelF3HB"))}, - rechitsM0Token_{produces(ps.getParameter("recHitsLabelM0HBHE"))} { + rechitsM0Token_{produces(ps.getParameter("recHitsLabelM0HBHE"))}, + recoParamsToken_{esConsumes()}, + gainWidthsToken_{esConsumes()}, + gainsToken_{esConsumes()}, + lutCorrsToken_{esConsumes()}, + pedestalWidthsToken_{esConsumes()}, + effectivePedestalWidthsToken_{esConsumes()}, + pedestalsToken_{esConsumes()}, + qieCodersToken_{esConsumes()}, + respCorrsToken_{esConsumes()}, + timeCorrsToken_{esConsumes()}, + qieTypesToken_{esConsumes()}, + topologyToken_{esConsumes()}, + recConstantsToken_{esConsumes()}, + sipmParametersToken_{esConsumes()}, + sipmCharacteristicsToken_{esConsumes()}, + pulseOffsetsToken_{esConsumes()} { configParameters_.maxChannels = ps.getParameter("maxChannels"); configParameters_.maxTimeSamples = ps.getParameter("maxTimeSamples"); configParameters_.kprep1dChannelsPerBlock = ps.getParameter("kprep1dChannelsPerBlock"); @@ -50,6 +85,9 @@ HBHERecHitProducerGPU::HBHERecHitProducerGPU(edm::ParameterSet const& ps) configParameters_.sipmQNTStoSum = ps.getParameter("sipmQNTStoSum"); configParameters_.firstSampleShift = ps.getParameter("firstSampleShift"); configParameters_.useEffectivePedestals = ps.getParameter("useEffectivePedestals"); + if (configParameters_.useEffectivePedestals) { + effectivePedestalsToken_ = esConsumes(); + } configParameters_.meanTime = ps.getParameter("meanTime"); configParameters_.timeSigmaSiPM = ps.getParameter("timeSigmaSiPM"); @@ -120,72 +158,44 @@ void HBHERecHitProducerGPU::acquire(edm::Event const& event, hcal::reconstruction::InputDataGPU inputGPU{f01HEDigis, f5HBDigis, f3HBDigis}; // conditions - edm::ESHandle recoParamsHandle; - setup.get().get(recoParamsHandle); - auto const& recoParamsProduct = recoParamsHandle->getProduct(ctx.stream()); + auto const& recoParamsProduct = setup.getData(recoParamsToken_).getProduct(ctx.stream()); - edm::ESHandle gainWidthsHandle; - setup.get().get(gainWidthsHandle); - auto const& gainWidthsProduct = gainWidthsHandle->getProduct(ctx.stream()); + auto const& gainWidthsProduct = setup.getData(gainWidthsToken_).getProduct(ctx.stream()); - edm::ESHandle gainsHandle; - setup.get().get(gainsHandle); - auto const& gainsProduct = gainsHandle->getProduct(ctx.stream()); + auto const& gainsProduct = setup.getData(gainsToken_).getProduct(ctx.stream()); - edm::ESHandle lutCorrsHandle; - setup.get().get(lutCorrsHandle); - auto const& lutCorrsProduct = lutCorrsHandle->getProduct(ctx.stream()); + auto const& lutCorrsProduct = setup.getData(lutCorrsToken_).getProduct(ctx.stream()); // use only 1 depending on useEffectivePedestals - edm::ESHandle pedestalWidthsHandle; - edm::ESHandle effectivePedestalWidthsHandle; - setup.get().get(effectivePedestalWidthsHandle); - setup.get().get(pedestalWidthsHandle); - auto const& pedestalWidthsProduct = pedestalWidthsHandle->getProduct(ctx.stream()); - auto const& effectivePedestalWidthsProduct = effectivePedestalWidthsHandle->getProduct(ctx.stream()); + auto const& pedestalWidthsProduct = setup.getData(pedestalWidthsToken_).getProduct(ctx.stream()); + auto const& effectivePedestalWidthsProduct = setup.getData(effectivePedestalWidthsToken_).getProduct(ctx.stream()); - edm::ESHandle pedestalsHandle; - setup.get().get(pedestalsHandle); - auto const& pedestalsProduct = pedestalsHandle->getProduct(ctx.stream()); + auto const& pedestals = setup.getData(pedestalsToken_); + auto const& pedestalsProduct = pedestals.getProduct(ctx.stream()); edm::ESHandle effectivePedestalsHandle; if (configParameters_.useEffectivePedestals) - setup.get().get(effectivePedestalsHandle); + effectivePedestalsHandle = setup.getHandle(effectivePedestalsToken_); auto const* effectivePedestalsProduct = configParameters_.useEffectivePedestals ? &effectivePedestalsHandle->getProduct(ctx.stream()) : nullptr; - edm::ESHandle qieCodersHandle; - setup.get().get(qieCodersHandle); - auto const& qieCodersProduct = qieCodersHandle->getProduct(ctx.stream()); + auto const& qieCodersProduct = setup.getData(qieCodersToken_).getProduct(ctx.stream()); - edm::ESHandle respCorrsHandle; - setup.get().get(respCorrsHandle); - auto const& respCorrsProduct = respCorrsHandle->getProduct(ctx.stream()); + auto const& respCorrsProduct = setup.getData(respCorrsToken_).getProduct(ctx.stream()); - edm::ESHandle timeCorrsHandle; - setup.get().get(timeCorrsHandle); - auto const& timeCorrsProduct = timeCorrsHandle->getProduct(ctx.stream()); + auto const& timeCorrsProduct = setup.getData(timeCorrsToken_).getProduct(ctx.stream()); - edm::ESHandle qieTypesHandle; - setup.get().get(qieTypesHandle); - auto const& qieTypesProduct = qieTypesHandle->getProduct(ctx.stream()); + auto const& qieTypesProduct = setup.getData(qieTypesToken_).getProduct(ctx.stream()); - edm::ESHandle topologyHandle; - setup.get().get(topologyHandle); - edm::ESHandle recConstantsHandle; - setup.get().get(recConstantsHandle); + HcalTopology const& topology = setup.getData(topologyToken_); + HcalDDDRecConstants const& recConstants = setup.getData(recConstantsToken_); - edm::ESHandle sipmParametersHandle; - setup.get().get(sipmParametersHandle); - auto const& sipmParametersProduct = sipmParametersHandle->getProduct(ctx.stream()); + auto const& sipmParametersProduct = setup.getData(sipmParametersToken_).getProduct(ctx.stream()); - edm::ESHandle sipmCharacteristicsHandle; - setup.get().get(sipmCharacteristicsHandle); - auto const& sipmCharacteristicsProduct = sipmCharacteristicsHandle->getProduct(ctx.stream()); + auto const& sipmCharacteristicsProduct = setup.getData(sipmCharacteristicsToken_).getProduct(ctx.stream()); - edm::ESHandle pulseOffsetsHandle; - setup.get().get(pulseOffsetsHandle); - auto const& pulseOffsetsProduct = pulseOffsetsHandle->getProduct(ctx.stream()); + auto const& pulseOffsets = setup.getData(pulseOffsetsToken_); + auto const& pulseOffsetsProduct = pulseOffsets.getProduct(ctx.stream()); // bundle up conditions hcal::reconstruction::ConditionsProducts conditions{gainWidthsProduct, @@ -202,11 +212,11 @@ void HBHERecHitProducerGPU::acquire(edm::Event const& event, sipmParametersProduct, sipmCharacteristicsProduct, effectivePedestalsProduct, - topologyHandle.product(), - recConstantsHandle.product(), - pedestalsHandle->offsetForHashes(), + &topology, + &recConstants, + pedestals.offsetForHashes(), pulseOffsetsProduct, - pulseOffsetsHandle->getValues()}; + pulseOffsets.getValues()}; // scratch mem on device hcal::reconstruction::ScratchDataGPU scratchGPU = { From 0876c9127cb7a5ce2978a8f790435dfd126bad68 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 27 Aug 2021 21:07:03 +0200 Subject: [PATCH 520/923] Add base classes of producers to list of producers for a module --- .../StaticAnalyzers/scripts/callgraph.py | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index cd8c4c80f27ab..59c4c37718737 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,11 +12,14 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder))\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource)\b" baseclassre = re.compile(baseclass) assert(baseclassre.match('edm::global::EDFilter::filter() virtual')) assert(topfuncre.search('edm::global::EDFilterBase::filter(&) const virtual')) - +assert(not baseclassre.match('edm::BaseFlatGunProducer')) +assert(not baseclassre.match('edm::FlatRandomEGunProducer')) +assert(baseclassre.match('edm::ProducerSourceBase')) +assert(baseclassre.match('edm::one::OutputModuleBase')) farg = re.compile(r"\(.*?\)") tmpl = re.compile(r'<.*?>') toplevelfuncs = set() @@ -66,6 +69,27 @@ for k in module2package.keys(): module2package[k]=sorted(set(module2package[k])) + +class2base = dict() +mbcl = re.compile("(base|data) class") +with open('classes.txt.dumperall') as f: + for line in f: + if mbcl.search(line): + fields = line.split("'") + if fields[2] == ' base class ' and not baseclassre.search(fields[3]): + class2base.setdefault(fields[1], []).append(fields[3]) + +assert(class2base['edm::FlatRandomEGunProducer']==['edm::BaseFlatGunProducer']) + +for cl, basecls in class2base.items(): + for package, modules in module2package.items(): + for module in modules: + if module==cl.split('::')[-1]: + print(cl, basecls, package, module) + for basecl in basecls: + if not basecl in set(module2package[package]): + module2package[package].append(basecl) + G = nx.DiGraph() with open('function-calls-db.txt') as f: for line in f: From 82963a40f7cdf3f32d1988b0f21b4c3939ca5bf2 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 27 Aug 2021 21:41:37 +0200 Subject: [PATCH 521/923] Add base class name without namespace --- Utilities/StaticAnalyzers/scripts/callgraph.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index 59c4c37718737..80d16aa8e4f31 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -82,13 +82,14 @@ assert(class2base['edm::FlatRandomEGunProducer']==['edm::BaseFlatGunProducer']) for cl, basecls in class2base.items(): + clname=cl.split('::')[-1]: for package, modules in module2package.items(): for module in modules: - if module==cl.split('::')[-1]: - print(cl, basecls, package, module) + if module == clname + print(clname, basecls, package, module) for basecl in basecls: if not basecl in set(module2package[package]): - module2package[package].append(basecl) + module2package[package].append(basecl.split('::')[-1]) G = nx.DiGraph() with open('function-calls-db.txt') as f: From 2bb81287c5c87dde8977fd69068361faac78d00f Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 27 Aug 2021 21:54:32 +0200 Subject: [PATCH 522/923] Fix misplaced:, add new top level function. --- Utilities/StaticAnalyzers/scripts/callgraph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index 80d16aa8e4f31..3e930dfbfb680 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,8 +12,9 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource)\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher)\b" baseclassre = re.compile(baseclass) +assert(baseclassre.match('edm::one::impl::RunWatcher')) assert(baseclassre.match('edm::global::EDFilter::filter() virtual')) assert(topfuncre.search('edm::global::EDFilterBase::filter(&) const virtual')) assert(not baseclassre.match('edm::BaseFlatGunProducer')) @@ -82,11 +83,10 @@ assert(class2base['edm::FlatRandomEGunProducer']==['edm::BaseFlatGunProducer']) for cl, basecls in class2base.items(): - clname=cl.split('::')[-1]: + clname=cl.split('::')[-1] for package, modules in module2package.items(): for module in modules: - if module == clname - print(clname, basecls, package, module) + if module == clname: for basecl in basecls: if not basecl in set(module2package[package]): module2package[package].append(basecl.split('::')[-1]) From edd4ae5726cf07db9139d9a8cee7744d98bccb0d Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 27 Aug 2021 21:58:27 +0200 Subject: [PATCH 523/923] Another top level function --- Utilities/StaticAnalyzers/scripts/callgraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index 3e930dfbfb680..46d2263698b53 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,7 +12,7 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher)\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer')) assert(baseclassre.match('edm::global::EDFilter::filter() virtual')) From 274b3b2f95d8f5870f31679fcabd4f15b8dbbaca Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 27 Aug 2021 23:09:06 +0200 Subject: [PATCH 524/923] Add regex for base classes added --- .../StaticAnalyzers/scripts/callgraph.py | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index 46d2263698b53..bb539e1585fda 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -9,10 +9,10 @@ except ImportError: from yaml import Loader, Dumper -topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endLuminosityBlock)\(" +topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endRunProduce|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|impl::EndRunProducer)\b" baseclassre = re.compile(baseclass) assert(baseclassre.match('edm::one::impl::RunWatcher')) assert(baseclassre.match('edm::global::EDFilter::filter() virtual')) @@ -82,14 +82,25 @@ assert(class2base['edm::FlatRandomEGunProducer']==['edm::BaseFlatGunProducer']) -for cl, basecls in class2base.items(): - clname=cl.split('::')[-1] - for package, modules in module2package.items(): - for module in modules: + +bmodules=[] +for package, modules in module2package.items(): + for module in modules: + for cl in class2base.keys(): + clname=cl.split('::')[-1] if module == clname: - for basecl in basecls: + for basecl in class2base[cl]: if not basecl in set(module2package[package]): - module2package[package].append(basecl.split('::')[-1]) + module2package[package].append(basecl) + if not basecl in set(bmodules): + bmodules.append(basecl) + + +bmods='|'.join(bmodules) +bmods_regex=r'\b(' + bmods+ r'QQQQQQQQ)\b' +comp_bmods_regex=re.compile(bmods_regex) +n=comp_bmods_regex.search("function 'edm::BaseFlatGunProducer::beginRun(const edm::Run &, const class edm::EventSetup &)' calls function 'edm::EventSetup::getData>(class edm::ESHandle &) const'") +assert(n) G = nx.DiGraph() with open('function-calls-db.txt') as f: @@ -104,7 +115,7 @@ if fields[2] == ' overrides function ': if baseclassre.match(fields[3]): G.add_edge(fields[1], fields[3], kind=' overrides function ') - if topfuncre.search(fields[1]) and comp_mods_regex.search(fields[1]): + if topfuncre.search(fields[1]) and (comp_mods_regex.search(fields[1]) or comp_bmods_regex.search(fields[1])): toplevelfuncs.add(fields[1]) else: G.add_edge(fields[3], fields[1], kind=' overriden function calls function ') @@ -132,7 +143,7 @@ report = dict() for key in sorted(set(module2package.keys())): for value in sorted(set(module2package[key])): - if comp_mods_regex.match(value): + if comp_mods_regex.match(value) or comp_bmods_regex.match(value): regex_str = r'\b%s\b'%value vre=re.compile(regex_str) for callstack in sorted(callstacks): From dd17b74cf36e1df4de295ba6e48b1151aa29326e Mon Sep 17 00:00:00 2001 From: bainbrid Date: Fri, 10 Sep 2021 19:25:02 +0200 Subject: [PATCH 525/923] slava review --- .../plugins/LowPtGsfElectronIDProducer.cc | 19 +++++++------ .../src/LowPtGsfElectronFeatures.cc | 27 +++++-------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc index 8a19ab90c4c11..d39b5f53434ec 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc @@ -156,17 +156,16 @@ void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const }, [&](auto const& ele) { // trkFunctor ... if (useGsfToTrack_) { - const edm::Ptr* ptr1 = - ele.hasUserData("ele2packed") ? ele.template userData>("ele2packed") - : nullptr; - const edm::Ptr* ptr2 = - ele.hasUserData("ele2lost") ? ele.template userData>("ele2lost") - : nullptr; - if (ptr1 != nullptr && ptr1->isNonnull() && ptr1->isAvailable() && ptr1->get() != nullptr && - ptr1->get()->bestTrack() != nullptr) { + using PackedPtr = edm::Ptr; + const PackedPtr* ptr1 = ele.template userData("ele2packed"); + const PackedPtr* ptr2 = ele.template userData("ele2lost"); + auto hasBestTrack = [](const PackedPtr* ptr) { + return ptr != nullptr && ptr->isNonnull() && ptr->isAvailable() && ptr->get() != nullptr && + ptr->get()->bestTrack() != nullptr; + }; + if (hasBestTrack(ptr1)) { return ptr1->get()->bestTrack(); - } else if (ptr2 != nullptr && ptr2->isNonnull() && ptr2->isAvailable() && ptr2->get() != nullptr && - ptr2->get()->bestTrack() != nullptr) { + } else if (hasBestTrack(ptr2)) { return ptr2->get()->bestTrack(); } } else { diff --git a/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc index 2a6a0914c1495..8a947f2bda6e0 100644 --- a/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc +++ b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc @@ -169,29 +169,16 @@ namespace lowptgsfeleid { float sc_clus2_E_ov_p = -999.; // KF tracks - if (trk != nullptr) { - eid_trk_p = (float)trk->p(); - eid_trk_nhits = (float)trk->found(); - eid_trk_chi2red = (float)trk->normalizedChi2(); + if (trk != nullptr || (ele.core().isNonnull() && ele.closestCtfTrackRef().isNonnull())) { + const reco::Track* tk = trk ? trk : &*ele.closestCtfTrackRef(); + eid_trk_p = tk->p(); + eid_trk_nhits = tk->found(); + eid_trk_chi2red = tk->normalizedChi2(); TVector3 trkTV3(0, 0, 0); - trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi()); + trkTV3.SetPtEtaPhi(tk->pt(), tk->eta(), tk->phi()); TVector3 eleTV3(0, 0, 0); eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi()); - trk_dr = eleTV3.DeltaR(trkTV3); - } else { - if (ele.core().isNonnull()) { - reco::TrackRef trk = ele.closestCtfTrackRef(); - if (trk.isNonnull()) { - eid_trk_p = (float)trk->p(); - eid_trk_nhits = (float)trk->found(); - eid_trk_chi2red = (float)trk->normalizedChi2(); - TVector3 trkTV3(0, 0, 0); - trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi()); - TVector3 eleTV3(0, 0, 0); - eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi()); - trk_dr = eleTV3.DeltaR(trkTV3); - } - } + trk_dr = reco::deltaR(*tk, ele); } // GSF tracks From ae2e8968b3776a63d0be9d61ba114a0f429c09c2 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 10 Sep 2021 21:44:07 +0200 Subject: [PATCH 526/923] Add DQMEDHarvester as top level class --- Utilities/StaticAnalyzers/scripts/callgraph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index bb539e1585fda..f6866731c6728 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,8 +12,9 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endRunProduce|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer)\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|DQMEDHarvester)\b" baseclassre = re.compile(baseclass) +assert(baseclassre.match('DQMEDHarvester')) assert(baseclassre.match('edm::one::impl::RunWatcher')) assert(baseclassre.match('edm::global::EDFilter::filter() virtual')) assert(topfuncre.search('edm::global::EDFilterBase::filter(&) const virtual')) From 5ce5958ab0b831db3b62cc63e1ef6b1e2e0e72cb Mon Sep 17 00:00:00 2001 From: Helena Date: Fri, 10 Sep 2021 22:05:25 +0200 Subject: [PATCH 527/923] add updated 2021 mcRun3 GTs --- Configuration/AlCa/python/autoCond.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index dad86350fa96b..d232751decac8 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -66,11 +66,11 @@ # GlobalTag for MC production with perfectly aligned and calibrated detector 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' : '121X_mcRun3_2021_realistic_v1', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_Candidate_2021_09_10_15_39_01', # 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' : '121X_mcRun3_2021cosmics_realistic_deco_v1', + 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_Candidate_2021_09_10_15_41_04', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v1', + 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_Candidate_2021_09_10_15_36_57', # GlobalTag for MC production with 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 From 6a982388a464c0db1aff10a27a61a6f9fae20f1c Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 10 Sep 2021 22:15:52 +0200 Subject: [PATCH 528/923] Add more top level classes --- Utilities/StaticAnalyzers/scripts/callgraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index f6866731c6728..faeeca5fa8a97 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,7 +12,7 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endRunProduce|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|DQMEDHarvester)\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|DQMEDHarvester|AlignmentProducerBase|BMixingModule|TrackProducerBase|TauDiscriminationProducerBase|cms::CkfTrackCandidateMakerBase)\b" baseclassre = re.compile(baseclass) assert(baseclassre.match('DQMEDHarvester')) assert(baseclassre.match('edm::one::impl::RunWatcher')) From 3a67ae8d95034de9baf857c5681b1ce783c1583d Mon Sep 17 00:00:00 2001 From: Helena Date: Fri, 10 Sep 2021 22:23:47 +0200 Subject: [PATCH 529/923] add updated 2021 mcRun3 GTs --- Configuration/AlCa/python/autoCond.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index d232751decac8..8e29438684e57 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -66,11 +66,11 @@ # GlobalTag for MC production with perfectly aligned and calibrated detector 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' : '121X_mcRun3_2021_realistic_Candidate_2021_09_10_15_39_01', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v2', # 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' : '121X_mcRun3_2021cosmics_realistic_deco_Candidate_2021_09_10_15_41_04', + 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v2', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_Candidate_2021_09_10_15_36_57', + 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v2', # GlobalTag for MC production with 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 From ebadb3b92c49a5d7c2bfca1d1e78bcd7ad1b2f2e Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 10 Sep 2021 22:40:56 +0200 Subject: [PATCH 530/923] Remove TauDiscriminationProducerBase --- Utilities/StaticAnalyzers/scripts/callgraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/StaticAnalyzers/scripts/callgraph.py b/Utilities/StaticAnalyzers/scripts/callgraph.py index faeeca5fa8a97..4603a9a8cdf13 100755 --- a/Utilities/StaticAnalyzers/scripts/callgraph.py +++ b/Utilities/StaticAnalyzers/scripts/callgraph.py @@ -12,7 +12,7 @@ topfunc = r"::(accumulate|acquire|startingNewLoop|duringLoop|endOfLoop|beginOfJob|endOfJob|produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream|streamBeginRun|streamBeginLuminosityBlock|streamEndRun|streamEndLuminosityBlock|globalBeginRun|globalEndRun|globalBeginLuminosityBlock|globalEndLuminosityBlock|endRun|endRunProduce|endLuminosityBlock)\(" topfuncre = re.compile(topfunc) -baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|DQMEDHarvester|AlignmentProducerBase|BMixingModule|TrackProducerBase|TauDiscriminationProducerBase|cms::CkfTrackCandidateMakerBase)\b" +baseclass = r"\b(edm::)?(one::|stream::|global::)?((DQM)?(Global|One)?ED(Producer|Filter|Analyzer|(IterateNTimes|NavigateEvents)?Looper)(Base)?|impl::(ExternalWork|Accumulator|RunWatcher|RunCacheHolder)|FromFiles|ProducerSourceBase|OutputModuleBase|InputSource|ProducerSourceFromFiles|ProducerBase|PuttableSourceBase|OutputModule|RawOutput|RawInputSource|impl::RunWatcher|impl::EndRunProducer|DQMEDHarvester|AlignmentProducerBase|BMixingModule|TrackProducerBase|cms::CkfTrackCandidateMakerBase)\b" baseclassre = re.compile(baseclass) assert(baseclassre.match('DQMEDHarvester')) assert(baseclassre.match('edm::one::impl::RunWatcher')) From 9c24980c34b08e3846c896cd7bf21a9c1eab372a Mon Sep 17 00:00:00 2001 From: Slava Krutelyov Date: Fri, 10 Sep 2021 19:47:27 -0700 Subject: [PATCH 531/923] add 11634.7 wf for 2021 ttbar mkFit --- Configuration/PyReleaseValidation/scripts/runTheMatrix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 263b5f8106724..c3d0723c5e829 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -90,6 +90,7 @@ def runSelected(opt): 11634.911, #2021 DD4hep ttbar reading geometry from XML 11634.912, #2021 DD4hep ttbar reading geometry from the DB 11634.0, #2021 ttbar + 11634.7, #2021 ttbar mkFit 12434.0, #2023 ttbar 23234.0, #2026D49 ttbar (HLT TDR baseline w/ HGCal v11) 28234.0, #2026D60 (exercise HF nose) From a3703b4800e4d0caf2708cc059023cdae6f0d8ab Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 11 Sep 2021 11:19:54 -0500 Subject: [PATCH 532/923] Properly set L1 and L2 values in CSCL1TPLookupTableEP An apparent cut-n-paste error was resetting the L1 values to empty instead of setting the L2 values. --- CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc index ae9c79fcaa9d1..5b904cb010978 100644 --- a/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc +++ b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc @@ -179,13 +179,13 @@ std::unique_ptr CSCL1TPLookupTableEP::produceME11ILT( lut->set_CSC_slope_cosi_corr_L1_ME11_even(std::move(CSC_slope_cosi_corr_L1_ME11_even_)); lut->set_CSC_slope_cosi_corr_L1_ME11_odd(std::move(CSC_slope_cosi_corr_L1_ME11_odd_)); - lut->set_CSC_slope_cosi_corr_L1_ME11_even(std::move(CSC_slope_cosi_corr_L1_ME11_even_)); - lut->set_CSC_slope_cosi_corr_L1_ME11_odd(std::move(CSC_slope_cosi_corr_L1_ME11_odd_)); + lut->set_CSC_slope_cosi_corr_L2_ME11_even(std::move(CSC_slope_cosi_corr_L2_ME11_even_)); + lut->set_CSC_slope_cosi_corr_L2_ME11_odd(std::move(CSC_slope_cosi_corr_L2_ME11_odd_)); lut->set_CSC_slope_corr_L1_ME11_even(std::move(CSC_slope_corr_L1_ME11_even_)); lut->set_CSC_slope_corr_L1_ME11_odd(std::move(CSC_slope_corr_L1_ME11_odd_)); - lut->set_CSC_slope_corr_L1_ME11_even(std::move(CSC_slope_corr_L1_ME11_even_)); - lut->set_CSC_slope_corr_L1_ME11_odd(std::move(CSC_slope_corr_L1_ME11_odd_)); + lut->set_CSC_slope_corr_L2_ME11_even(std::move(CSC_slope_corr_L2_ME11_even_)); + lut->set_CSC_slope_corr_L2_ME11_odd(std::move(CSC_slope_corr_L2_ME11_odd_)); // GEM-CSC trigger: 1/8-strip difference to slope lut->set_es_diff_slope_L1_ME1a_even(std::move(es_diff_slope_L1_ME1a_even_)); From 993a9a6f408ce9b9588eebd3844f0397530548b9 Mon Sep 17 00:00:00 2001 From: mmusich Date: Sat, 11 Sep 2021 13:52:54 +0200 Subject: [PATCH 533/923] moderninze RecoVertex/BeamSpotProducer --- .../interface/BeamSpotAnalyzer.h | 57 ------- .../interface/BeamSpotFromDB.h | 38 ----- .../interface/BeamSpotWrite2DB.h | 43 ------ .../plugins/BeamSpotAnalyzer.cc | 143 +++++++++++------- .../plugins/BeamSpotFromDB.cc | 52 ++++--- .../plugins/BeamSpotWrite2DB.cc | 97 +++++++----- 6 files changed, 182 insertions(+), 248 deletions(-) delete mode 100644 RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h diff --git a/RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h b/RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h deleted file mode 100644 index 838183fc4bc1f..0000000000000 --- a/RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef BeamSpotProducer_BeamSpotAnalyzer_h -#define BeamSpotProducer_BeamSpotAnalyzer_h - -/**_________________________________________________________________ - class: BeamSpotAnalyzer.h - package: RecoVertex/BeamSpotProducer - - - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) - - -________________________________________________________________**/ - -// C++ standard -#include -// CMS -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "RecoVertex/BeamSpotProducer/interface/BeamFitter.h" - -class BeamSpotAnalyzer : public edm::EDAnalyzer { -public: - explicit BeamSpotAnalyzer(const edm::ParameterSet&); - ~BeamSpotAnalyzer() override; - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override; - void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override; - - int ftotalevents; - int fitNLumi_; - int resetFitNLumi_; - // int countEvt_; //counter - int countLumi_; //counter - int Org_resetFitNLumi_; - int previousLumi_; - int previousRun_; - int ftmprun0, ftmprun; - int beginLumiOfBSFit_; - int endLumiOfBSFit_; - std::time_t refBStime[2]; - - bool write2DB_; - bool runbeamwidthfit_; - bool runallfitters_; - // double inputBeamWidth_; - - BeamFitter* theBeamFitter; -}; - -#endif diff --git a/RecoVertex/BeamSpotProducer/interface/BeamSpotFromDB.h b/RecoVertex/BeamSpotProducer/interface/BeamSpotFromDB.h index 1b16c78db4b35..8b137891791fe 100644 --- a/RecoVertex/BeamSpotProducer/interface/BeamSpotFromDB.h +++ b/RecoVertex/BeamSpotProducer/interface/BeamSpotFromDB.h @@ -1,39 +1 @@ -#ifndef BeamSpotProducer_BeamSpotFromDB_h -#define BeamSpotProducer_BeamSpotFromDB_h -/**_________________________________________________________________ - class: BeamSpotFromDB.h - package: RecoVertex/BeamSpotProducer - - - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) - - -________________________________________________________________**/ - -// C++ standard -#include -// CMS -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h" -#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" - -class BeamSpotFromDB : public edm::EDAnalyzer { -public: - explicit BeamSpotFromDB(const edm::ParameterSet&); - ~BeamSpotFromDB() override; - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - edm::ESGetToken m_beamToken; -}; - -#endif diff --git a/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h b/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h index 6aceefc976129..8b137891791fe 100644 --- a/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h +++ b/RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h @@ -1,44 +1 @@ -#ifndef BeamSpotProducer_BeamSpotWrite2DB_h -#define BeamSpotProducer_BeamSpotWrite2DB_h -/**_________________________________________________________________ - class: BeamSpotWrite2DB.h - package: RecoVertex/BeamSpotProducer - - - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) - - -________________________________________________________________**/ - -// C++ standard -#include -// CMS -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "RecoVertex/BeamSpotProducer/interface/BSTrkParameters.h" - -// ROOT -#include "TFile.h" -#include "TTree.h" - -#include - -class BeamSpotWrite2DB : public edm::EDAnalyzer { -public: - explicit BeamSpotWrite2DB(const edm::ParameterSet&); - ~BeamSpotWrite2DB() override; - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - std::ifstream fasciiFile; - std::string fasciiFileName; -}; - -#endif diff --git a/RecoVertex/BeamSpotProducer/plugins/BeamSpotAnalyzer.cc b/RecoVertex/BeamSpotProducer/plugins/BeamSpotAnalyzer.cc index 88dac4b622288..ad400a010d90d 100644 --- a/RecoVertex/BeamSpotProducer/plugins/BeamSpotAnalyzer.cc +++ b/RecoVertex/BeamSpotProducer/plugins/BeamSpotAnalyzer.cc @@ -2,28 +2,60 @@ class: BeamSpotAnalyzer.cc package: RecoVertex/BeamSpotProducer - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) Geng-Yuan Jeng, UC Riverside (Geng-Yuan.Jeng@cern.ch) - ________________________________________________________________**/ // C++ standard #include +#include + // CMS #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h" -#include "RecoVertex/BeamSpotProducer/interface/BSFitter.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RecoVertex/BeamSpotProducer/interface/BeamFitter.h" #include "TMath.h" +class BeamSpotAnalyzer : public edm::one::EDAnalyzer { +public: + explicit BeamSpotAnalyzer(const edm::ParameterSet&); + ~BeamSpotAnalyzer() override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override; + void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override; + + int ftotalevents; + int fitNLumi_; + int resetFitNLumi_; + int countLumi_; //counter + int org_resetFitNLumi_; + int previousLumi_; + int previousRun_; + int ftmprun0, ftmprun; + int beginLumiOfBSFit_; + int endLumiOfBSFit_; + std::time_t refBStime[2]; + + bool write2DB_; + bool runbeamwidthfit_; + bool runallfitters_; + + BeamFitter* theBeamFitter; +}; + BeamSpotAnalyzer::BeamSpotAnalyzer(const edm::ParameterSet& iConfig) { // get parameter write2DB_ = iConfig.getParameter("BSAnalyzerParameters").getParameter("WriteToDB"); @@ -47,7 +79,7 @@ BeamSpotAnalyzer::BeamSpotAnalyzer(const edm::ParameterSet& iConfig) { countLumi_ = 0; beginLumiOfBSFit_ = endLumiOfBSFit_ = -1; previousLumi_ = previousRun_ = 0; - Org_resetFitNLumi_ = resetFitNLumi_; + org_resetFitNLumi_ = resetFitNLumi_; } BeamSpotAnalyzer::~BeamSpotAnalyzer() { delete theBeamFitter; } @@ -58,8 +90,6 @@ void BeamSpotAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& ftmprun = iEvent.id().run(); } -void BeamSpotAnalyzer::beginJob() {} - //-------------------------------------------------------- void BeamSpotAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) { const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value(); @@ -73,7 +103,6 @@ void BeamSpotAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, } countLumi_++; - //std::cout << "Lumi # " << countLumi_ << std::endl; if (ftmprun == previousRun_) { if ((previousLumi_ + 1) != int(lumiSeg.luminosityBlock())) edm::LogWarning("BeamSpotAnalyzer") << "LUMI SECTIONS ARE NOT SORTED!"; @@ -82,12 +111,10 @@ void BeamSpotAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, //-------------------------------------------------------- void BeamSpotAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) { - //LogDebug("BeamSpotAnalyzer") << - std::cout << "for lumis " << beginLumiOfBSFit_ << " - " << endLumiOfBSFit_ << std::endl - << "number of selected tracks = " << theBeamFitter->getNTracks() << std::endl; - std::cout << "number of selected PVs = " << theBeamFitter->getNPVs() << std::endl; - //std::cout << "number of selected PVs per bx: " << std::endl; - //theBeamFitter->getNPVsperBX(); + edm::LogPrint("BeamSpotAnalyzer") << "for lumis " << beginLumiOfBSFit_ << " - " << endLumiOfBSFit_ << std::endl + << "number of selected tracks = " << theBeamFitter->getNTracks(); + edm::LogPrint("BeamSpotAnalyzer") << "number of selected PVs = " << theBeamFitter->getNPVs(); + //edm::LogPrint("BeamSpotAnalyzer") << "number of selected PVs per bx: " << theBeamFitter->getNPVsperBX() std::endl; const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value(); const std::time_t fendtime = fendtimestamp >> 32; @@ -110,31 +137,31 @@ void BeamSpotAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, c if (theBeamFitter->runPVandTrkFitter()) { reco::BeamSpot bs = theBeamFitter->getBeamSpot(); - std::cout << "\n RESULTS OF DEFAULT FIT " << std::endl; - std::cout << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl; - std::cout << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl; - std::cout << " lumi counter # " << countLumi_ << std::endl; - std::cout << bs << std::endl; - std::cout << "[BeamFitter] fit done. \n" << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "\n RESULTS OF DEFAULT FIT "; + edm::LogPrint("BeamSpotAnalyzer") << " for runs: " << ftmprun0 << " - " << ftmprun; + edm::LogPrint("BeamSpotAnalyzer") << " for lumi blocks : " << LSRange.first << " - " << LSRange.second; + edm::LogPrint("BeamSpotAnalyzer") << " lumi counter # " << countLumi_; + edm::LogPrint("BeamSpotAnalyzer") << bs; + edm::LogPrint("BeamSpotAnalyzer") << "[BeamFitter] fit done. \n"; } else { // Fill in empty beam spot if beamfit fails reco::BeamSpot bs; bs.setType(reco::BeamSpot::Fake); - std::cout << "\n Empty Beam spot fit" << std::endl; - std::cout << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl; - std::cout << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl; - std::cout << " lumi counter # " << countLumi_ << std::endl; - std::cout << bs << std::endl; - std::cout << "[BeamFitter] fit failed \n" << std::endl; - //accumulate more events - // dissable this for the moment + edm::LogPrint("BeamSpotAnalyzer") << "\n Empty Beam spot fit"; + edm::LogPrint("BeamSpotAnalyzer") << " for runs: " << ftmprun0 << " - " << ftmprun; + edm::LogPrint("BeamSpotAnalyzer") << " for lumi blocks : " << LSRange.first << " - " << LSRange.second; + edm::LogPrint("BeamSpotAnalyzer") << " lumi counter # " << countLumi_; + edm::LogPrint("BeamSpotAnalyzer") << bs; + edm::LogPrint("BeamSpotAnalyzer") << "[BeamFitter] fit failed \n"; + // accumulate more events + // disable this for the moment //resetFitNLumi_ += 1; - //std::cout << "reset fitNLumi " << resetFitNLumi_ << std::endl; + //edm::LogPrint("BeamSpotAnalyzer") << "reset fitNLumi " << resetFitNLumi_ ; } if (resetFitNLumi_ > 0 && countLumi_ % resetFitNLumi_ == 0) { std::vector theBSvector = theBeamFitter->getBSvector(); - std::cout << "Total number of tracks accumulated = " << theBSvector.size() << std::endl; - std::cout << "Reset track collection for beam fit" << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "Total number of tracks accumulated = " << theBSvector.size(); + edm::LogPrint("BeamSpotAnalyzer") << "Reset track collection for beam fit"; theBeamFitter->resetTrkVector(); theBeamFitter->resetLSRange(); theBeamFitter->resetCutFlow(); @@ -142,29 +169,29 @@ void BeamSpotAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, c theBeamFitter->resetPVFitter(); countLumi_ = 0; // reset counter to orginal - resetFitNLumi_ = Org_resetFitNLumi_; + resetFitNLumi_ = org_resetFitNLumi_; } } void BeamSpotAnalyzer::endJob() { - std::cout << "\n-------------------------------------\n" << std::endl; - std::cout << "\n Total number of events processed: " << ftotalevents << std::endl; - std::cout << "\n-------------------------------------\n\n" << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "\n-------------------------------------\n"; + edm::LogPrint("BeamSpotAnalyzer") << "\n Total number of events processed: " << ftotalevents; + edm::LogPrint("BeamSpotAnalyzer") << "\n-------------------------------------\n\n"; if (fitNLumi_ == -1 && resetFitNLumi_ == -1) { if (theBeamFitter->runPVandTrkFitter()) { reco::BeamSpot beam_default = theBeamFitter->getBeamSpot(); std::pair LSRange = theBeamFitter->getFitLSRange(); - std::cout << "\n RESULTS OF DEFAULT FIT:" << std::endl; - std::cout << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl; - std::cout << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl; - std::cout << " lumi counter # " << countLumi_ << std::endl; - std::cout << beam_default << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "\n RESULTS OF DEFAULT FIT:"; + edm::LogPrint("BeamSpotAnalyzer") << " for runs: " << ftmprun0 << " - " << ftmprun; + edm::LogPrint("BeamSpotAnalyzer") << " for lumi blocks : " << LSRange.first << " - " << LSRange.second; + edm::LogPrint("BeamSpotAnalyzer") << " lumi counter # " << countLumi_; + edm::LogPrint("BeamSpotAnalyzer") << beam_default; if (write2DB_) { - std::cout << "\n-------------------------------------\n\n" << std::endl; - std::cout << " write results to DB..." << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "\n-------------------------------------\n\n"; + edm::LogPrint("BeamSpotAnalyzer") << " write results to DB..."; theBeamFitter->write2DB(); } @@ -175,14 +202,28 @@ void BeamSpotAnalyzer::endJob() { if ((runbeamwidthfit_)) { theBeamFitter->runBeamWidthFitter(); reco::BeamSpot beam_width = theBeamFitter->getBeamWidth(); - std::cout << beam_width << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << beam_width; + } else { + edm::LogPrint("BeamSpotAnalyzer") << "[BeamSpotAnalyzer] beamfit fails !!!"; } - - else - std::cout << "[BeamSpotAnalyzer] beamfit fails !!!" << std::endl; } - std::cout << "[BeamSpotAnalyzer] endJob done \n" << std::endl; + edm::LogPrint("BeamSpotAnalyzer") << "[BeamSpotAnalyzer] endJob done \n"; +} + +void BeamSpotAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Analyzer of BeamSpot Objects"); + + edm::ParameterSetDescription bsAnalyzerParamsDesc; + std::vector bsAnaDefaults(1); + bsAnaDefaults[0].addParameter("WriteToDB", false); + bsAnaDefaults[0].addParameter("RunAllFitters", false); + bsAnaDefaults[0].addUntrackedParameter("fitEveryNLumi", -1); + bsAnaDefaults[0].addUntrackedParameter("resetEveryNLumi", -1); + bsAnaDefaults[0].addParameter("RunBeamWidthFit", false); + desc.addVPSet("BSAnalyzerParameters", bsAnalyzerParamsDesc, bsAnaDefaults); + descriptions.addWithDefaultLabel(desc); } //define this as a plug-in diff --git a/RecoVertex/BeamSpotProducer/plugins/BeamSpotFromDB.cc b/RecoVertex/BeamSpotProducer/plugins/BeamSpotFromDB.cc index dadfecf9a9d2b..3fc54dd7f1cc9 100644 --- a/RecoVertex/BeamSpotProducer/plugins/BeamSpotFromDB.cc +++ b/RecoVertex/BeamSpotProducer/plugins/BeamSpotFromDB.cc @@ -1,47 +1,49 @@ /**_________________________________________________________________ - class: BeamSpotFromDB.cc + class: BeamSpotFromDB.h package: RecoVertex/BeamSpotProducer - - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) - - + author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) ________________________________________________________________**/ // C++ standard #include + // CMS +#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" +#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "RecoVertex/BeamSpotProducer/interface/BeamSpotFromDB.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/IOVSyncValue.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ServiceRegistry/interface/Service.h" +class BeamSpotFromDB : public edm::one::EDAnalyzer<> { +public: + explicit BeamSpotFromDB(const edm::ParameterSet&); + ~BeamSpotFromDB() override; -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/IOVSyncValue.h" +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + edm::ESGetToken m_beamToken; +}; BeamSpotFromDB::BeamSpotFromDB(const edm::ParameterSet& iConfig) : m_beamToken(esConsumes()) {} -BeamSpotFromDB::~BeamSpotFromDB() {} +BeamSpotFromDB::~BeamSpotFromDB() = default; void BeamSpotFromDB::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle beamhandle = iSetup.getHandle(m_beamToken); - const BeamSpotObjects* mybeamspot = beamhandle.product(); - - std::cout << " for runs: " << iEvent.id().run() << " - " << iEvent.id().run() << std::endl; - //std::cout << iEvent.getRun().beginTime().value() << std::endl; - //std::cout << iEvent.time().value() << std::endl; - std::cout << *mybeamspot << std::endl; + const BeamSpotObjects* mybeamspot = &iSetup.getData(m_beamToken); + edm::LogPrint("BeamSpotFromDB") << " for runs: " << iEvent.id().run() << " - " << iEvent.id().run(); + //edm::LogPrint("BeamSpotFromDB") << iEvent.getRun().beginTime().value(); + //edm::LogPrint("BeamSpotFromDB") << iEvent.time().value(); + edm::LogPrint("BeamSpotFromDB") << *mybeamspot; } -void BeamSpotFromDB::beginJob() {} - -void BeamSpotFromDB::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(BeamSpotFromDB); diff --git a/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc b/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc index dc93071733afd..77ad5650576aa 100644 --- a/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc +++ b/RecoVertex/BeamSpotProducer/plugins/BeamSpotWrite2DB.cc @@ -1,53 +1,75 @@ /**_________________________________________________________________ - class: BeamSpotWrite2DB.cc + class: BeamSpotWrite2DB.h package: RecoVertex/BeamSpotProducer - - - - author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) - + author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) ________________________________________________________________**/ // C++ standard #include +#include + // CMS +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.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 "RecoVertex/BeamSpotProducer/interface/BSFitter.h" +#include "RecoVertex/BeamSpotProducer/interface/BSTrkParameters.h" +#include "RecoVertex/BeamSpotProducer/interface/BeamSpotWrite2DB.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +// ROOT +#include "TFile.h" +#include "TTree.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" +class BeamSpotWrite2DB : public edm::one::EDAnalyzer { +public: + explicit BeamSpotWrite2DB(const edm::ParameterSet&); + ~BeamSpotWrite2DB() override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + std::ifstream fasciiFile; + std::string fasciiFileName; +}; BeamSpotWrite2DB::BeamSpotWrite2DB(const edm::ParameterSet& iConfig) { + usesResource("PoolDBOutputService"); fasciiFileName = iConfig.getUntrackedParameter("OutputFileName"); - - fasciiFile.open(fasciiFileName.c_str()); + if (!fasciiFileName.empty()) { + fasciiFile.open(fasciiFileName.c_str()); + } else { + throw cms::Exception("Inconsistent Data") << " expected input file name is null\n"; + } } -BeamSpotWrite2DB::~BeamSpotWrite2DB() {} +BeamSpotWrite2DB::~BeamSpotWrite2DB() = default; void BeamSpotWrite2DB::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {} -void BeamSpotWrite2DB::beginJob() {} - void BeamSpotWrite2DB::endJob() { - std::cout << " Read beam spot data from text file: " << fasciiFileName << std::endl; - std::cout << " please see plugins/BeamSpotWrite2DB.cc for format of text file." << std::endl; - /* - std::cout << " Content of the file is expected to have this format with the first column as a keyword:" << std::endl; - std::cout << " x\n y\n z\n sigmaZ\n dxdz\n dydz\n beamWidthX\n beamWidthY" << std::endl; - for (int i =0; i<7; i++) { - for (int j=0; j<7; j++ ) { - - std::cout << " cov["< poolDbService; if (poolDbService.isAvailable()) { - std::cout << "poolDBService available" << std::endl; + edm::LogPrint("BeamSpotWrite2DB") << "poolDBService available"; if (poolDbService->isNewTagRequest("BeamSpotObjectsRcd")) { - std::cout << "new tag requested" << std::endl; + edm::LogPrint("BeamSpotWrite2DB") << "new tag requested"; poolDbService->createNewIOV( abeam, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotObjectsRcd"); } else { - std::cout << "no new tag requested" << std::endl; + edm::LogPrint("BeamSpotWrite2DB") << "no new tag requested"; poolDbService->appendSinceTime(abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd"); } } + edm::LogPrint("BeamSpotWrite2DB") << "[BeamSpotWrite2DB] endJob done \n"; +} - std::cout << "[BeamSpotWrite2DB] endJob done \n" << std::endl; +void BeamSpotWrite2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment( + "Writes out a DB file containing a BeamSpotObjects payload, according to parameters defined in ASCII file"); + desc.addUntracked("OutputFileName", {}); + descriptions.addWithDefaultLabel(desc); } //define this as a plug-in From 2b0e56b11779e73e40b008cfe267927bdae58b66 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Sun, 12 Sep 2021 13:06:53 +0200 Subject: [PATCH 534/923] updates on RelVal and matbdg --- .../Geometry/python/plot_hgcal_utils.py | 15 ++++--- ...FromVertexUpToInFrontOfMuonStations_cfg.py | 42 ++++++++----------- Validation/HGCalValidation/python/html.py | 2 +- .../scripts/hgcalPerformanceValidation.py | 26 +++++++++--- 4 files changed, 48 insertions(+), 37 deletions(-) diff --git a/Validation/Geometry/python/plot_hgcal_utils.py b/Validation/Geometry/python/plot_hgcal_utils.py index 79ed5122d4f8b..e46dda576dc66 100644 --- a/Validation/Geometry/python/plot_hgcal_utils.py +++ b/Validation/Geometry/python/plot_hgcal_utils.py @@ -34,16 +34,19 @@ plots.setdefault('x_over_l_vs_phi', Plot_params(20, '#varphi [rad]', '(x/X_{0})/(x/#lambda_{I})', 0., 0., 0., 0., '', 0, -1, -1, 0, 0)) # Conversion name from the label (key) to the components in CMSSW/Geometry -_LABELS2COMPS = {'BeamPipe': 'BEAM', +_LABELS2COMPS = {'BeamPipe': 'BEAM', #There are other BEAM volumes but there are behind the region of our interest. 'Tracker': 'Tracker', - 'EndcapTimingLayer + Thermal Screen': 'CALOECTSFront', - 'Neutron Moderator + Thermal Screen' : 'CALOECTSMiddle', + #CALOECTSFront contains both CALOECTSModerator and EndcapTimingLayer plus + #thermal screen but I want to split those. + #In V16(D86) there is no CALOECTSMiddle. + 'EndcapTimingLayer': 'EndcapTimingLayer', + 'Neutron Moderator + Thermal Screen' : 'CALOECTSModerator', 'HGCal + HGCal Service + Thermal Screen' : 'CALOECTSRear', 'Solenoid Magnet' : 'MGNT', 'Muon Wheels and Cables' : 'MB', 'ECAL': 'ECAL', 'HCal': 'HCal', - 'FromVertexToBackOfHGCal' : ['BEAM','Tracker','ECAL','HCal','CALOECTSFront','CALOECTSMiddle','CALOECTSRear','MGNT','MB'], + 'FromVertexToBackOfHGCal' : ['BEAM','Tracker','ECAL','HCal','EndcapTimingLayer','CALOECTSModerator','CALOECTSRear','MGNT','MB'], 'HGCal': 'HGCal', 'HGCalEE': 'HGCalEE', 'HGCalHE': ['HGCalHEsil', 'HGCalHEmix'] @@ -60,7 +63,7 @@ COMPOUNDS["HGCal"] = ["HGCal"] COMPOUNDS["HGCalEE"] = ["HGCalEE"] COMPOUNDS["HGCalHE"] = ["HGCalHEsil", "HGCalHEmix"] -COMPOUNDS["FromVertexToBackOfHGCal"] = ["BeamPipe","Tracker","ECAL","HCal","EndcapTimingLayer + Thermal Screen","Neutron Moderator + Thermal Screen","HGCal + HGCal Service + Thermal Screen","Solenoid Magnet","Muon Wheels and Cables"] +COMPOUNDS["FromVertexToBackOfHGCal"] = ["BeamPipe","Tracker","ECAL","HCal","EndcapTimingLayer","Neutron Moderator + Thermal Screen","HGCal + HGCal Service + Thermal Screen","Solenoid Magnet","Muon Wheels and Cables"] # The DETECTORS must be the single component of the HGCal for which # the user can ask for the corresponding material description. @@ -74,7 +77,7 @@ DETECTORS["Tracker"] = 9 #kAzure-5 DETECTORS["ECAL"] = 2 #kOrange+10 DETECTORS["HCal"] = 6 #kMagenta-2 -DETECTORS["EndcapTimingLayer + Thermal Screen"] = 7#kAzure-9 +DETECTORS["EndcapTimingLayer"] = 7#kAzure-9 DETECTORS["Neutron Moderator + Thermal Screen"] = 46#kOrange+5 DETECTORS["HGCal + HGCal Service + Thermal Screen"] = 5#kOrange-2 DETECTORS["Solenoid Magnet"] = 4#kGray+5 diff --git a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py index 371d27a6114d2..6da86108ae37b 100644 --- a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py +++ b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py @@ -1,31 +1,19 @@ -from __future__ import print_function -# In order to produce what you need (or in a loop) -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=BeamPipe -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=Tracker -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=ECAL -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=HCal -##EndcapTimingLayer + Thermal Screen (Barrel Timing Layer is included in the Tracker) -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label='EndcapTimingLayer + Thermal Screen' -##Neutron Moderator + Thermal Screen -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label='Neutron Moderator + Thermal Screen' -##HGCal + HGCal Service + Thermal Screen -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label='HGCal + HGCal Service + Thermal Screen' -##Solenoid Magnet -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label='Solenoid Magnet' -##Muon Wheels and Cables -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label='Muon Wheels and Cables' -##Finally, all together -#time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=FromVertexToBackOfHGCal +#Check the material bugdet sections of the HGCAL DPG website for the recipe. Namely, +#HGCAL only: https://hgcal.web.cern.ch/MaterialBudget/MaterialBudget/ +#From vertex: https://hgcal.web.cern.ch/MaterialBudget/MaterialBudgetFromVertexUpToInfrontOfMuonStations/ import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing import sys, re -process = cms.Process("PROD") +from FWCore.PythonFramework.CmsRun import CmsRun +from Configuration.Eras.Era_Phase2_cff import Phase2 + +process = cms.Process("PROD", Phase2) process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") -# The default geometry is Extended2026D77Reco. If a different geoemtry +# The default geometry is Extended2023D86Reco. If a different geoemtry # is needed, the appropriate flag has to be passed at command line, # e.g.: cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom="XYZ" @@ -40,7 +28,7 @@ options = VarParsing('analysis') options.register('geom', #name - 'Extended2026D77Reco', #default value + 'Extended2023D86', #default value VarParsing.multiplicity.singleton, # kind of options VarParsing.varType.string, # type of option "Select the geometry to be studied" # help message @@ -67,7 +55,7 @@ _components = _LABELS2COMPS[options.label] # Load geometry either from the Database of from files -process.load("Configuration.Geometry.Geometry%s_cff" % options.geom) +process.load("Configuration.Geometry.Geometry%sReco_cff" % options.geom) # #Magnetic Field @@ -112,10 +100,10 @@ # TextFile = cms.string("matbdg_HGCal.txt") TextFile = cms.string('None'), #Setting ranges for histos - #Make z 2mm per bin. Be careful this could lead to memory crashes if too low. + #Make z 4mm per bin. Be careful this could lead to memory crashes if too low. minZ = cms.double(-7000.), maxZ = cms.double(7000.), - nintZ = cms.int32(7000), + nintZ = cms.int32(3500), # Make r 1cm per bin rMin = cms.double(-50.), rMax = cms.double(8000.), @@ -135,3 +123,9 @@ ) )) + + +cmsRun = CmsRun(process) +cmsRun.run() + + diff --git a/Validation/HGCalValidation/python/html.py b/Validation/HGCalValidation/python/html.py index 9e786845e31a0..c1499319ae089 100644 --- a/Validation/HGCalValidation/python/html.py +++ b/Validation/HGCalValidation/python/html.py @@ -47,7 +47,7 @@ "RelValH125GGgluonfusion" : "Higgs to gamma gamma", "RelValNuGun" : "Neutrino gun", "RelValZpTT_1500" : "Z prime with 1500 GeV nominal mass", - "RelValTenTau_15_500" : "Ten Taus with energy from 15 GeV to 500 GeV" + "RelValTenTau_15_500_Eta3p1" : "Ten Taus with energy from 15 GeV to 500 GeV" } _sampleFileName = { diff --git a/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py b/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py index 2fd92688cd7f0..1f7793dc0f8eb 100755 --- a/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py +++ b/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py @@ -83,7 +83,12 @@ def putype(t): #------------------------------------------------------------------------------------------ #thereleases = { "CMSSW 11_1_X" : ["CMSSW_11_1_0_pre4_GEANT4","CMSSW_11_1_0_pre3","CMSSW_11_1_0_pre2"] } thereleases = OrderedDict() -thereleases = { "CMSSW 12_0_X" : [ +thereleases = { "CMSSW 12_1_X" : [ + "CMSSW_12_1_0_pre2_vs_CMSSW_12_0_0_pre6", + "CMSSW_12_1_0_pre2_D77_vs_CMSSW_12_1_0_pre2_D76" + ], + "CMSSW 12_0_X" : [ + "CMSSW_12_0_0_pre6_vs_CMSSW_12_0_0_pre4", "CMSSW_12_0_0_pre4_vs_CMSSW_12_0_0_pre3", "CMSSW_12_0_0_pre3_vs_CMSSW_12_0_0_pre2", "CMSSW_12_0_0_pre2_vs_CMSSW_12_0_0_pre1", @@ -136,18 +141,20 @@ def putype(t): geometryTests = { "Material budget" : [ #"Extended2026D49_vs_Extended2026D71", "Extended2026D49_vs_Extended2026D76", - "Extended2026D76_vs_Extended2026D83" + "Extended2026D76_vs_Extended2026D83", + "Extended2026D83_vs_Extended2026D86" ] } -GeoScenario = "Extended2026D76_vs_Extended2026D83" +GeoScenario = "Extended2026D83_vs_Extended2026D86" -RefRelease='CMSSW_12_0_0_pre3' +RefRelease='CMSSW_12_0_0_pre6' -NewRelease='CMSSW_12_0_0_pre4' +NewRelease='CMSSW_12_1_0_pre2' NotNormalRelease = "normal" NotNormalRefRelease = "normal" +#NotNormalRefRelease = "raw" if ( os.path.isdir('%s/%s' %(opt.WWWAREA, NewRelease))) : print("The campaign you are trying to validate has already an existing validation folder in the official www area.") @@ -162,6 +169,7 @@ def putype(t): else: # appendglobaltag = "_2026D49noPU" appendglobaltag = "_2026D76noPU" + # appendglobaltag = "_2026D77noPU" #Until the final list of RelVals settles down the following sample list is under constant review ''' @@ -234,9 +242,10 @@ def putype(t): #Sample("RelValZpTT_1500", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValZTT", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValZMM", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), + #Sample("RelValZMM", midfix="14", scenario="2026D49", dqmVersion="0002", appendGlobalTag=appendglobaltag ), Sample("RelValZEE", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), #Sample("RelValTenTau_15_500_Eta3p1", scenario="2026D49", appendGlobalTag=appendglobaltag ), - Sample("RelValTenTau_15_500", scenario="2026D49", appendGlobalTag=appendglobaltag ), + #Sample("RelValTenTau_15_500", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValTTbar", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValQCD_Pt15To7000_Flat", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), #Sample("RelValQCD_Pt15To7000_Flat", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ), @@ -406,6 +415,9 @@ def putype(t): elif "raw" in NotNormalRelease and "normal" in NotNormalRefRelease: cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).replace("mcRun4_realistic_v3_2026D76noPU-v1","mcRun4_realistic_v3_2026D49noPU-v1") + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) #cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).replace("mcRun4_realistic_v3_2026D49noPU_raw1100_rsb-v1","mcRun4_realistic_v3_2026D49noPU-v1") + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) + elif "normal" in NotNormalRelease and "raw" in NotNormalRefRelease: + cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).replace("mcRun4_realistic_v7_2026D77noPU-v1","mcRun4_realistic_v7_2026D76noPU-v1") + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) + #cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).replace("mcRun4_realistic_v3_2026D49noPU_raw1100_rsb-v1","mcRun4_realistic_v3_2026D49noPU-v1") + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) elif "raw" in NotNormalRelease and "raw" in NotNormalRefRelease: #cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease) + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) cmd = 'python3 Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).replace("_raw1100","_raw1100_rsb") + ' ' + inputpathNew + infi.filename(NewRelease) + ' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) + ' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) + ' plots_%s' % (samplename) + ' --collection %s' %(opt.HTMLVALNAME) @@ -910,6 +922,8 @@ def putype(t): #We need the directory for the geometry related results if (not os.path.isdir('%s/%s/%s' %(opt.WWWAREA,GeoScenario,obj))): processCmd('mkdir -p %s/%s/%s' %(opt.WWWAREA,GeoScenario,obj) ) + processCmd('mkdir -p %s/%s' %(GeoScenario,obj) ) + index_file.write('
\n' ) index_file.write('

    \n' ) index_file.write('
  • %s
  • \n' %(obj, _geoPageNameMap[obj] ) ) From 829d8d30a5ad8e5514aefb51a5a76c1f4393fbc9 Mon Sep 17 00:00:00 2001 From: Andreas Psallidas Date: Sun, 12 Sep 2021 13:16:57 +0200 Subject: [PATCH 535/923] enable tau sample --- .../HGCalValidation/scripts/hgcalPerformanceValidation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py b/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py index 1f7793dc0f8eb..52057507bf960 100755 --- a/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py +++ b/Validation/HGCalValidation/scripts/hgcalPerformanceValidation.py @@ -244,7 +244,7 @@ def putype(t): Sample("RelValZMM", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), #Sample("RelValZMM", midfix="14", scenario="2026D49", dqmVersion="0002", appendGlobalTag=appendglobaltag ), Sample("RelValZEE", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), - #Sample("RelValTenTau_15_500_Eta3p1", scenario="2026D49", appendGlobalTag=appendglobaltag ), + Sample("RelValTenTau_15_500_Eta3p1", scenario="2026D49", appendGlobalTag=appendglobaltag ), #Sample("RelValTenTau_15_500", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValTTbar", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ), Sample("RelValQCD_Pt15To7000_Flat", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ), From a90d27c2f9655183c020f81cb12caedb8e696c7c Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 12 Sep 2021 21:43:42 +0200 Subject: [PATCH 536/923] Use of ESGetToken in RecoLocalCalo/HcalRecAlgos (replacing #35234) --- .../src/HBHEIsolatedNoiseAlgos.cc | 1 - .../HcalRecAlgos/test/HcalRecHitReflagger.cc | 29 ++++++++----------- .../HcalRecAlgos/test/HcalSevLvlAnalyzer.cc | 29 ++++++++++--------- .../HcalRecAlgos/test/MahiDebugger.cc | 8 ++--- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/RecoLocalCalo/HcalRecAlgos/src/HBHEIsolatedNoiseAlgos.cc b/RecoLocalCalo/HcalRecAlgos/src/HBHEIsolatedNoiseAlgos.cc index 91aaba0ff9399..235f462dce0c2 100644 --- a/RecoLocalCalo/HcalRecAlgos/src/HBHEIsolatedNoiseAlgos.cc +++ b/RecoLocalCalo/HcalRecAlgos/src/HBHEIsolatedNoiseAlgos.cc @@ -16,7 +16,6 @@ Original Author: John Paul Chou (Brown University) #include "RecoLocalCalo/HcalRecAlgos/interface/HBHEIsolatedNoiseAlgos.h" #include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/METReco/interface/CaloMETCollection.h" #include "DataFormats/METReco/interface/CaloMET.h" diff --git a/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc b/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc index 68ad99ea76d71..20e23397b8335 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc @@ -20,7 +20,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -37,7 +37,6 @@ #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" using namespace std; using namespace edm; @@ -46,16 +45,15 @@ using namespace edm; // class declaration // -class HcalRecHitReflagger : public edm::EDProducer { +class HcalRecHitReflagger : public edm::one::EDProducer<> { public: explicit HcalRecHitReflagger(const edm::ParameterSet&); ~HcalRecHitReflagger(); private: - virtual void beginJob() override; - virtual void produce(edm::Event&, const edm::EventSetup&) override; - virtual void endJob() override; - virtual void beginRun(const Run& r, const EventSetup& c) override; + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; // Threshold function gets values from polynomial-parameterized functions double GetThreshold(const int base, const std::vector& params); @@ -73,6 +71,8 @@ class HcalRecHitReflagger : public edm::EDProducer { double GetSlope(const int ieta, const std::vector& params); // ----------member data --------------------------- + const edm::ESGetToken tokTopo_; + const edm::ESGetToken tokChan_; const HcalTopology* topo; edm::InputTag hfInputLabel_; edm::EDGetTokenT tok_hf_; @@ -115,7 +115,9 @@ class HcalRecHitReflagger : public edm::EDProducer { // // constructors and destructor // -HcalRecHitReflagger::HcalRecHitReflagger(const edm::ParameterSet& ps) { +HcalRecHitReflagger::HcalRecHitReflagger(const edm::ParameterSet& ps) + : tokTopo_(esConsumes()), + tokChan_(esConsumes(edm::ESInputTag("", "withTopo"))) { //register your products produces(); @@ -158,9 +160,6 @@ HcalRecHitReflagger::~HcalRecHitReflagger() { // // member functions // - -void HcalRecHitReflagger::beginRun(const Run& r, const EventSetup& c) {} - // ------------ method called to produce the data ------------ void HcalRecHitReflagger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // read HF RecHits @@ -171,14 +170,10 @@ void HcalRecHitReflagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe } //get the hcal topology - edm::ESHandle topo_; - iSetup.get().get(topo_); - topo = &*topo_; + topo = &iSetup.getData(tokTopo_); //get channel quality conditions - edm::ESHandle p; - iSetup.get().get("withTopo", p); - const HcalChannelQuality& chanquality_(*p.product()); + const HcalChannelQuality& chanquality_ = iSetup.getData(tokChan_); std::vector mydetids = chanquality_.getAllChannels(); for (std::vector::const_iterator i = mydetids.begin(); i != mydetids.end(); ++i) { diff --git a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc index ae9d743d8387c..20347703b3ced 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc @@ -22,13 +22,12 @@ // 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 "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h" @@ -37,17 +36,21 @@ // class decleration // -class HcalSevLvlAnalyzer : public edm::EDAnalyzer { +class HcalSevLvlAnalyzer : public edm::one::EDAnalyzer<> { public: explicit HcalSevLvlAnalyzer(const edm::ParameterSet&); ~HcalSevLvlAnalyzer(); private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; // ----------member data --------------------------- +#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE + const edm::ESGetToken totkSet_; +#endif + const edm::ESGetToken tokSev_; }; // @@ -62,8 +65,11 @@ class HcalSevLvlAnalyzer : public edm::EDAnalyzer { // constructors and destructor // HcalSevLvlAnalyzer::HcalSevLvlAnalyzer(const edm::ParameterSet& iConfig) - -{ + : +#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE + totkSet_(esConsumes()), +#endif + tokSev_(esConsumes()) { //now do what ever initialization is needed // initialize the severity level code @@ -88,14 +94,11 @@ void HcalSevLvlAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup #endif #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - ESHandle pSetup; - iSetup.get().get(pSetup); + auto pSetup = &iSetup.getData(tokSet_); #endif // here's how to access the severity level computer: - ESHandle mycomputer; - iSetup.get().get(mycomputer); - const HcalSeverityLevelComputer* myProd = mycomputer.product(); + const HcalSeverityLevelComputer* myProd = &iSetup.getData(tokSev_); // create some example cases: std::cout << std::showbase; diff --git a/RecoLocalCalo/HcalRecAlgos/test/MahiDebugger.cc b/RecoLocalCalo/HcalRecAlgos/test/MahiDebugger.cc index a3418399e2802..17ab74f8c7ca0 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/MahiDebugger.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/MahiDebugger.cc @@ -121,6 +121,7 @@ class MahiDebugger : public edm::one::EDAnalyzer { std::unique_ptr mahi_; edm::EDGetTokenT token_ChannelInfo_; + const edm::ESGetToken tokDelay_; const HcalTimeSlew* hcalTimeSlewDelay; @@ -181,7 +182,8 @@ MahiDebugger::MahiDebugger(const edm::ParameterSet& iConfig) nMaxItersMin_(iConfig.getParameter("nMaxItersMin")), nMaxItersNNLS_(iConfig.getParameter("nMaxItersNNLS")), deltaChiSqThresh_(iConfig.getParameter("deltaChiSqThresh")), - nnlsThresh_(iConfig.getParameter("nnlsThresh")) { + nnlsThresh_(iConfig.getParameter("nnlsThresh")), + tokDelay_(esConsumes(edm::ESInputTag("", "HBHE"))) { usesResource("TFileService"); mahi_ = std::make_unique(); @@ -214,9 +216,7 @@ MahiDebugger::~MahiDebugger() {} void MahiDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle delay; - iSetup.get().get("HBHE", delay); - hcalTimeSlewDelay = &*delay; + hcalTimeSlewDelay = &iSetup.getData(tokDelay_); run = iEvent.id().run(); evt = iEvent.id().event(); From a1db46ba2703f4236d6d6a50519742d761434fbd Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 12 Sep 2021 22:54:20 +0200 Subject: [PATCH 537/923] Get rid of commented code --- .../HcalRecAlgos/test/HcalSevLvlAnalyzer.cc | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc index 20347703b3ced..c1862a8c2ffee 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc @@ -47,9 +47,6 @@ class HcalSevLvlAnalyzer : public edm::one::EDAnalyzer<> { void endJob() override; // ----------member data --------------------------- -#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - const edm::ESGetToken totkSet_; -#endif const edm::ESGetToken tokSev_; }; @@ -65,11 +62,7 @@ class HcalSevLvlAnalyzer : public edm::one::EDAnalyzer<> { // constructors and destructor // HcalSevLvlAnalyzer::HcalSevLvlAnalyzer(const edm::ParameterSet& iConfig) - : -#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - totkSet_(esConsumes()), -#endif - tokSev_(esConsumes()) { + : tokSev_(esConsumes()) { //now do what ever initialization is needed // initialize the severity level code @@ -86,17 +79,6 @@ HcalSevLvlAnalyzer::~HcalSevLvlAnalyzer() { // ------------ method called to for each event ------------ void HcalSevLvlAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; - -#ifdef THIS_IS_AN_EVENT_EXAMPLE - Handle pIn; - iEvent.getByLabel("example", pIn); -#endif - -#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - auto pSetup = &iSetup.getData(tokSet_); -#endif - // here's how to access the severity level computer: const HcalSeverityLevelComputer* myProd = &iSetup.getData(tokSev_); From cfaf1bae18289ae1d7f60c4d1c7e233231543c1d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 13 Sep 2021 02:45:24 +0200 Subject: [PATCH 538/923] Code check --- RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc index c1862a8c2ffee..90f1b6e0ec8d8 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/HcalSevLvlAnalyzer.cc @@ -61,8 +61,7 @@ class HcalSevLvlAnalyzer : public edm::one::EDAnalyzer<> { // // constructors and destructor // -HcalSevLvlAnalyzer::HcalSevLvlAnalyzer(const edm::ParameterSet& iConfig) - : tokSev_(esConsumes()) { +HcalSevLvlAnalyzer::HcalSevLvlAnalyzer(const edm::ParameterSet& iConfig) : tokSev_(esConsumes()) { //now do what ever initialization is needed // initialize the severity level code From 2bc1b70cb91fd6e875dff4c9a72ebf4a3a111b8b Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Thu, 26 Aug 2021 05:30:07 +0200 Subject: [PATCH 539/923] update plugins --- CondTools/DT/plugins/DTKeyedConfigDBDump.cc | 71 ++++++++++++------- CondTools/DT/plugins/DTKeyedConfigDBDump.h | 54 -------------- .../DT/plugins/DTKeyedConfigPopConAnalyzer.cc | 16 ++--- .../DTUserKeyedConfigPopConAnalyzer.cc | 14 ++-- 4 files changed, 59 insertions(+), 96 deletions(-) delete mode 100644 CondTools/DT/plugins/DTKeyedConfigDBDump.h diff --git a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc index fb9a62d4b1db8..7459cd4e7e254 100644 --- a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc +++ b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc @@ -7,11 +7,16 @@ * */ -//----------------------- -// This Class' Header -- -//----------------------- -#include "CondTools/DT/plugins/DTKeyedConfigDBDump.h" - +//---------------------- +// Base Class Headers -- +//---------------------- +#include "FWCore/Framework/interface/EDAnalyzer.h" +//------------------------------------ +// Collaborating Class Declarations -- +//------------------------------------ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" //------------------------------- // Collaborating Class Headers -- //------------------------------- @@ -21,12 +26,28 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" -//--------------- -// C++ Headers -- -//--------------- -#include -#include +//----------------------- +// This Class' Header -- +//----------------------- +class DTKeyedConfigDBDump : public edm::EDAnalyzer { +public: + /** Constructor + */ + explicit DTKeyedConfigDBDump(const edm::ParameterSet& ps); + + /** Destructor + */ + ~DTKeyedConfigDBDump() override; + + /** Operations + */ + /// + void beginJob() override; + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; +private: + edm::ESGetToken perskeylistToken_; +}; //------------------- // Initializations -- //------------------- @@ -34,7 +55,7 @@ //---------------- // Constructors -- //---------------- -DTKeyedConfigDBDump::DTKeyedConfigDBDump(const edm::ParameterSet& ps) {} +DTKeyedConfigDBDump::DTKeyedConfigDBDump(const edm::ParameterSet& ps) : perskeylistToken_(esConsumes()) {} //-------------- // Destructor -- @@ -46,28 +67,28 @@ DTKeyedConfigDBDump::~DTKeyedConfigDBDump() {} //-------------- void DTKeyedConfigDBDump::beginJob() { return; } -void DTKeyedConfigDBDump::analyze(const edm::Event& e, const edm::EventSetup& c) { +void DTKeyedConfigDBDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DTKeyedConfigListRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"DTKeyedConfigListRcd " - << "\" does not exist " << std::endl; + edm::LogWarning("DTKeyedConfigDBDump") << "Record \"DTKeyedConfigListRcd " + << "\" does not exist " << std::endl; } - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - c.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); - cond::persistency::KeyList const* kp = &kl; - std::cout << "now load and get" << std::endl; + //edm::ESHandle klh; + //std::cout << "got eshandle" << std::endl; + //iSetup.get().get(klh); + //std::cout << "got context" << std::endl; + //cond::persistency::KeyList const& kl = *klh.product(); + cond::persistency::KeyList const* kp = &iSetup.getData(perskeylistToken_); + edm::LogInfo("DTKeyedConfigDBDump") << "now load and get" << std::endl; auto pkc = kp->getUsingKey(999999999); - std::cout << "now check" << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << "now check" << std::endl; if (pkc.get()) - std::cout << pkc->getId() << " " << *(pkc->dataBegin()) << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << pkc->getId() << " " << *(pkc->dataBegin()) << std::endl; else - std::cout << "not found" << std::endl; - std::cout << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << "not found" << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << std::endl; return; } diff --git a/CondTools/DT/plugins/DTKeyedConfigDBDump.h b/CondTools/DT/plugins/DTKeyedConfigDBDump.h deleted file mode 100644 index fd3b2efc752c0..0000000000000 --- a/CondTools/DT/plugins/DTKeyedConfigDBDump.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef DTKeyedConfigDBDump_H -#define DTKeyedConfigDBDump_H -/** \class DTKeyedConfigDBDump - * - * Description: - * - * - * $Date: 2010/03/18 16:07:59 $ - * $Revision: 1.1.2.1 $ - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -//--------------- -// C++ Headers -- -//--------------- -#include - -// --------------------- -// -- Class Interface -- -// --------------------- - -class DTKeyedConfigDBDump : public edm::EDAnalyzer { -public: - /** Constructor - */ - explicit DTKeyedConfigDBDump(const edm::ParameterSet& ps); - - /** Destructor - */ - ~DTKeyedConfigDBDump() override; - - /** Operations - */ - /// - void beginJob() override; - void analyze(const edm::Event& e, const edm::EventSetup& c) override; - -private: -}; - -#endif // DTKeyedConfigDBDump_H diff --git a/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc b/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc index 58d3b3854a4c4..0f63bdb4bbdfe 100644 --- a/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc +++ b/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc @@ -13,27 +13,25 @@ class DTKeyedConfigPopConAnalyzer : public popcon::PopConAnalyzer(pset), - copyData(pset.getParameter("Source").getUntrackedParameter("copyData", true)) {} + copyData(pset.getParameter("Source").getUntrackedParameter("copyData", true)), + perskeylistToken_(esConsumes()) {} ~DTKeyedConfigPopConAnalyzer() override {} - void analyze(const edm::Event& e, const edm::EventSetup& s) override { + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override { if (!copyData) return; - - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - s.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); + edm::LogInfo("DTKeyedConfigPopConAnalyzer") << "got context" << std::endl; + cond::persistency::KeyList const& kl = iSetup.getData(perskeylistToken_); for (size_t i = 0; i < kl.size(); i++) { std::shared_ptr kelem = kl.getUsingIndex(i); if (kelem.get()) - std::cout << kelem->getId() << std::endl; + edm::LogInfo("DTKeyedConfigPopConAnalyzer") << kelem->getId() << std::endl; } source().setList(&kl); } private: bool copyData; + edm::ESGetToken perskeylistToken_; }; DEFINE_FWK_MODULE(DTKeyedConfigPopConAnalyzer); diff --git a/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc b/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc index 2087b2dbbf1a7..a8d8d06b92c55 100644 --- a/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc +++ b/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc @@ -12,23 +12,21 @@ class DTUserKeyedConfigPopConAnalyzer : public popcon::PopConAnalyzer { public: DTUserKeyedConfigPopConAnalyzer(const edm::ParameterSet& pset) - : popcon::PopConAnalyzer(pset) {} + : popcon::PopConAnalyzer(pset), perskeylistToken_(esConsumes()) {} ~DTUserKeyedConfigPopConAnalyzer() override {} - void analyze(const edm::Event& e, const edm::EventSetup& s) override { - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - s.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override { + edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << "got eSdata" << std::endl; + cond::persistency::KeyList const& kl = iSetup.getData(perskeylistToken_); for (size_t i = 0; i < kl.size(); i++) { std::shared_ptr kentry = kl.getUsingIndex(i); if (kentry.get()) - std::cout << kentry->getId() << std::endl; + edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << kentry->getId() << std::endl; } source().setList(&kl); } private: + edm::ESGetToken perskeylistToken_; }; DEFINE_FWK_MODULE(DTUserKeyedConfigPopConAnalyzer); From 8ecff49a12d2e78139d044975f2dc6c9d8835e1e Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Thu, 26 Aug 2021 05:31:04 +0200 Subject: [PATCH 540/923] update standalone analyzers --- CondTools/DT/test/stubs/DTGeometryDump.cc | 8 +++----- CondTools/DT/test/stubs/DTGeometryDump.h | 3 +++ CondTools/DT/test/stubs/DTHVDump.cc | 8 +++----- CondTools/DT/test/stubs/DTHVDump.h | 4 +++- .../DT/test/validate/DTCCBConfigValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTCCBConfigValidateDBRead.h | 6 +++--- .../DT/test/validate/DTCompMapValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTCompMapValidateDBRead.h | 3 +++ .../DT/test/validate/DTDeadFlagValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTDeadFlagValidateDBRead.h | 4 +++- .../DT/test/validate/DTHVStatusValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTHVStatusValidateDBRead.h | 4 +++- .../DT/test/validate/DTLVStatusValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTLVStatusValidateDBRead.h | 3 +++ .../DT/test/validate/DTMtimeValidateDBRead.cc | 15 ++++++++------- .../DT/test/validate/DTMtimeValidateDBRead.h | 6 ++++++ .../test/validate/DTPerformanceValidateDBRead.cc | 9 +++++---- .../test/validate/DTPerformanceValidateDBRead.h | 3 +++ .../DT/test/validate/DTROMapValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTROMapValidateDBRead.h | 4 ++++ .../DT/test/validate/DTRangeT0ValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTRangeT0ValidateDBRead.h | 4 ++++ .../test/validate/DTStatusFlagValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTStatusFlagValidateDBRead.h | 3 +++ CondTools/DT/test/validate/DTT0ValidateDBRead.cc | 9 +++++---- CondTools/DT/test/validate/DTT0ValidateDBRead.h | 3 +++ .../validate/DTTPGParametersValidateDBRead.cc | 9 +++++---- .../test/validate/DTTPGParametersValidateDBRead.h | 3 +++ .../DT/test/validate/DTTtrigValidateDBRead.cc | 9 +++++---- .../DT/test/validate/DTTtrigValidateDBRead.h | 3 +++ 30 files changed, 124 insertions(+), 71 deletions(-) diff --git a/CondTools/DT/test/stubs/DTGeometryDump.cc b/CondTools/DT/test/stubs/DTGeometryDump.cc index de2a6d9a18a83..58c91d90e5546 100644 --- a/CondTools/DT/test/stubs/DTGeometryDump.cc +++ b/CondTools/DT/test/stubs/DTGeometryDump.cc @@ -18,17 +18,15 @@ Toy EDAnalyzer for testing purposes only. namespace edmtest { - DTGeometryDump::DTGeometryDump(edm::ParameterSet const& p) {} + DTGeometryDump::DTGeometryDump(edm::ParameterSet const& p) : dtgeomToken_(esConsumes()) {} - DTGeometryDump::DTGeometryDump(int i) {} + DTGeometryDump::DTGeometryDump(int i) : dtgeomToken_(esConsumes()) {} DTGeometryDump::~DTGeometryDump() {} void DTGeometryDump::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm::eventsetup; - edm::ESHandle muonGeom; - context.get().get(muonGeom); - + auto muonGeom = context.getHandle(dtgeomToken_); const std::vector& ch_cont = muonGeom->chambers(); std::vector::const_iterator ch_iter = ch_cont.begin(); std::vector::const_iterator ch_iend = ch_cont.end(); diff --git a/CondTools/DT/test/stubs/DTGeometryDump.h b/CondTools/DT/test/stubs/DTGeometryDump.h index 1fffd243055f1..fbc1c7519b80c 100644 --- a/CondTools/DT/test/stubs/DTGeometryDump.h +++ b/CondTools/DT/test/stubs/DTGeometryDump.h @@ -12,6 +12,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/ParameterSet/interface/ParameterSet.h" #include +class DTGeometry; +class MuonGeometryRecord; namespace edmtest { class DTGeometryDump : public edm::EDAnalyzer { @@ -22,5 +24,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken dtgeomToken_; }; } // namespace edmtest diff --git a/CondTools/DT/test/stubs/DTHVDump.cc b/CondTools/DT/test/stubs/DTHVDump.cc index 8eab8714f2626..503a426170f04 100644 --- a/CondTools/DT/test/stubs/DTHVDump.cc +++ b/CondTools/DT/test/stubs/DTHVDump.cc @@ -12,7 +12,6 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CoralBase/TimeStamp.h" - #include "CondTools/DT/test/stubs/DTHVDump.h" #include "CondFormats/DTObjects/interface/DTHVStatus.h" #include "CondFormats/DataRecord/interface/DTHVStatusRcd.h" @@ -21,11 +20,11 @@ Toy EDAnalyzer for testing purposes only. namespace edmtest { - DTHVDump::DTHVDump(edm::ParameterSet const& p) { + DTHVDump::DTHVDump(edm::ParameterSet const& p) : dthvstatusToken_(esConsumes()) { // parameters to setup } - DTHVDump::DTHVDump(int i) {} + DTHVDump::DTHVDump(int i) : dthvstatusToken_(esConsumes()) {} DTHVDump::~DTHVDump() {} @@ -36,8 +35,7 @@ namespace edmtest { std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; // get configuration for current run - edm::ESHandle hv; - context.get().get(hv); + auto hv = context.getHandle(dthvstatusToken_); std::cout << hv->version() << std::endl; std::cout << std::distance(hv->begin(), hv->end()) << " data in the container" << std::endl; edm::ValidityInterval iov(context.get().validityInterval()); diff --git a/CondTools/DT/test/stubs/DTHVDump.h b/CondTools/DT/test/stubs/DTHVDump.h index 5210572bd92dc..3f512bbe6d87d 100644 --- a/CondTools/DT/test/stubs/DTHVDump.h +++ b/CondTools/DT/test/stubs/DTHVDump.h @@ -12,7 +12,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/ParameterSet/interface/ParameterSet.h" #include - +class DTHVStatus; +class DTHVStatusRcd; namespace edmtest { class DTHVDump : public edm::EDAnalyzer { public: @@ -22,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken dthvstatusToken_; }; } // namespace edmtest diff --git a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc index 6bb4b9f30ab39..eea3710803c09 100644 --- a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTCCBConfigRcd.h" DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtccbToken_(esConsumes()) {} -DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(int i) {} +DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(int i) : dtccbToken_(esConsumes()) {} DTCCBConfigValidateDBRead::~DTCCBConfigValidateDBRead() {} @@ -40,8 +42,7 @@ void DTCCBConfigValidateDBRead::analyze(const edm::Event& e, const edm::EventSet 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 conf; - context.get().get(conf); + auto conf = context.getHandle(dtccbToken_); std::cout << conf->version() << std::endl; std::cout << std::distance(conf->begin(), conf->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h index 2a32d7606ad91..7150f5c315431 100644 --- a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h +++ b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h @@ -1,4 +1,3 @@ - /*---------------------------------------------------------------------- Toy EDAnalyzer for testing purposes only. @@ -11,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" class DTConfigKey; - +class DTCCBConfig; +class DTCCBConfigRcd; class DTCCBConfigValidateDBRead : public edm::EDAnalyzer { public: explicit DTCCBConfigValidateDBRead(edm::ParameterSet const& p); @@ -23,7 +23,7 @@ class DTCCBConfigValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; - + edm::ESGetToken dtccbToken_; static bool cfrDiff(const std::vector& l_conf, const std::vector& r_conf); static bool cfrDiff(const std::vector& l_conf, const std::vector& r_conf); }; diff --git a/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc b/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc index 6464a23e32591..d5058ff51b376 100644 --- a/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" DTCompMapValidateDBRead::DTCompMapValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtreadoutmappingToken_(esConsumes()) {} -DTCompMapValidateDBRead::DTCompMapValidateDBRead(int i) {} +DTCompMapValidateDBRead::DTCompMapValidateDBRead(int i) : dtreadoutmappingToken_(esConsumes()) {} DTCompMapValidateDBRead::~DTCompMapValidateDBRead() {} @@ -41,8 +43,7 @@ void DTCompMapValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup // std::ifstream chkFile( run_fn.str().c_str() ); std::ifstream chkFile(dataFileName.c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle ro; - context.get().get(ro); + auto ro = context.getHandle(dtreadoutmappingToken_); std::cout << ro->mapRobRos() << " " << ro->mapCellTdc() << std::endl; std::cout << std::distance(ro->begin(), ro->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTCompMapValidateDBRead.h b/CondTools/DT/test/validate/DTCompMapValidateDBRead.h index 932e4f7a7a538..c83caa8c71498 100644 --- a/CondTools/DT/test/validate/DTCompMapValidateDBRead.h +++ b/CondTools/DT/test/validate/DTCompMapValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTReadOutMapping; +class DTReadOutMappingRcd; class DTCompMapValidateDBRead : public edm::EDAnalyzer { public: explicit DTCompMapValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTCompMapValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtreadoutmappingToken_; }; diff --git a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc index 2333fb3a7bd94..f5989f5870c50 100644 --- a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtdeadflagToken_(esConsumes()) {} -DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(int i) {} +DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(int i) : dtdeadflagToken_(esConsumes()) {} DTDeadFlagValidateDBRead::~DTDeadFlagValidateDBRead() {} @@ -40,8 +42,7 @@ void DTDeadFlagValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu 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 df; - context.get().get(df); + auto df = context.getHandle(dtdeadflagToken_); std::cout << df->version() << std::endl; std::cout << std::distance(df->begin(), df->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h index 160b4015c65d7..1255f9b7457f0 100644 --- a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h +++ b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h @@ -10,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +class DTDeadFlag; +class DTDeadFlagRcd; class DTDeadFlagValidateDBRead : public edm::EDAnalyzer { public: explicit DTDeadFlagValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +23,5 @@ class DTDeadFlagValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtdeadflagToken_; }; diff --git a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc index e69811d95a74f..14fc6d432fd59 100644 --- a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTHVStatusRcd.h" DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dthvstatusToken_(esConsumes()) {} -DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(int i) {} +DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(int i) : dthvstatusToken_(esConsumes()) {} DTHVStatusValidateDBRead::~DTHVStatusValidateDBRead() {} @@ -40,8 +42,7 @@ void DTHVStatusValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu 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 hv; - context.get().get(hv); + auto hv = context.getHandle(dthvstatusToken_); std::cout << hv->version() << std::endl; std::cout << std::distance(hv->begin(), hv->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h index 04578b31a2a1c..7d22769134d31 100644 --- a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h +++ b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h @@ -10,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +class DTHVStatus; +class DTHVStatusRcd; class DTHVStatusValidateDBRead : public edm::EDAnalyzer { public: explicit DTHVStatusValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +23,5 @@ class DTHVStatusValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dthvstatusToken_; }; diff --git a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc index 5f934e1615fc0..f4d54eba544d8 100644 --- a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTLVStatusRcd.h" DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtlvstatusToken_(esConsumes()) {} -DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(int i) {} +DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(int i) : dtlvstatusToken_(esConsumes()) {} DTLVStatusValidateDBRead::~DTLVStatusValidateDBRead() {} @@ -40,8 +42,7 @@ void DTLVStatusValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu 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 lv; - context.get().get(lv); + auto lv = context.getHandle(dtlvstatusToken_); std::cout << lv->version() << std::endl; std::cout << std::distance(lv->begin(), lv->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h index 27230c325f28c..8f24277d50ffe 100644 --- a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h +++ b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTLVStatus; +class DTLVStatusRcd; class DTLVStatusValidateDBRead : public edm::EDAnalyzer { public: explicit DTLVStatusValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTLVStatusValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtlvstatusToken_; }; diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc index 39e3fbf6c5ea5..eb37bffff8cf5 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc @@ -29,9 +29,11 @@ Toy EDAnalyzer for testing purposes only. DTMtimeValidateDBRead::DTMtimeValidateDBRead(edm::ParameterSet const& p) : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")), - readLegacyVDriftDB(p.getParameter("readLegacyVDriftDB")) {} + readLegacyVDriftDB(p.getParameter("readLegacyVDriftDB")), + dtmtTimeToken_(esConsumes()), + dtrecoCondToken_(esConsumes()) {} -DTMtimeValidateDBRead::DTMtimeValidateDBRead(int i) {} +DTMtimeValidateDBRead::DTMtimeValidateDBRead(int i) : dtmtTimeToken_(esConsumes()), dtrecoCondToken_(esConsumes()) {} DTMtimeValidateDBRead::~DTMtimeValidateDBRead() {} @@ -54,8 +56,7 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& float ckmt; float ckrms; if (readLegacyVDriftDB) { //legacy format - edm::ESHandle mT; - context.get().get(mT); + auto mT = context.getHandle(dtmtTimeToken_); std::cout << mT->version() << std::endl; std::cout << std::distance(mT->begin(), mT->end()) << " data in the container" << std::endl; @@ -83,9 +84,9 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& << ckmt << " " << ckrms << " -> " << mTime << " " << mTrms << std::endl; } } else { - edm::ESHandle hVdrift; - context.get().get(hVdrift); - const DTRecoConditions* vDriftMap_ = &*hVdrift; + //hVdrift; + //context.get().get(hVdrift); + const DTRecoConditions* vDriftMap_ = &context.getData(dtrecoCondToken_); // Consistency check: no parametrization is implemented for the time being int version = vDriftMap_->version(); if (version != 1) { diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h index d59c29e7bae6c..ce81cccf8c893 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h @@ -11,6 +11,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTMtime; +class DTMtimeRcd; +class DTRecoConditions; +class DTRecoConditionsVdriftRcd; class DTMtimeValidateDBRead : public edm::EDAnalyzer { public: explicit DTMtimeValidateDBRead(edm::ParameterSet const& p); @@ -23,4 +27,6 @@ class DTMtimeValidateDBRead : public edm::EDAnalyzer { std::string dataFileName; std::string elogFileName; bool readLegacyVDriftDB; // which DB to use + edm::ESGetToken dtmtTimeToken_; + edm::ESGetToken dtrecoCondToken_; }; diff --git a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc index 9f90dc769dd25..7ea71c56d5cab 100644 --- a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTPerformanceRcd.h" DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtperfToken_(esConsumes()) {} -DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(int i) {} +DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(int i) : dtperfToken_(esConsumes()) {} DTPerformanceValidateDBRead::~DTPerformanceValidateDBRead() {} @@ -40,8 +42,7 @@ void DTPerformanceValidateDBRead::analyze(const edm::Event& e, const edm::EventS 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 mP; - context.get().get(mP); + auto mP = context.getHandle(dtperfToken_); std::cout << mP->version() << std::endl; std::cout << std::distance(mP->begin(), mP->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h index cd73087147c17..f789eb17f8dec 100644 --- a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h +++ b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTPerformance; +class DTPerformanceRcd; class DTPerformanceValidateDBRead : public edm::EDAnalyzer { public: explicit DTPerformanceValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTPerformanceValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtperfToken_; }; diff --git a/CondTools/DT/test/validate/DTROMapValidateDBRead.cc b/CondTools/DT/test/validate/DTROMapValidateDBRead.cc index a74ec0259a57a..7896e6c993b5e 100644 --- a/CondTools/DT/test/validate/DTROMapValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTROMapValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" DTROMapValidateDBRead::DTROMapValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtreadoutmappingToken_(esConsumes()) {} -DTROMapValidateDBRead::DTROMapValidateDBRead(int i) {} +DTROMapValidateDBRead::DTROMapValidateDBRead(int i) : dtreadoutmappingToken_(esConsumes()) {} DTROMapValidateDBRead::~DTROMapValidateDBRead() {} @@ -41,8 +43,7 @@ void DTROMapValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& // std::ifstream chkFile( run_fn.str().c_str() ); std::ifstream chkFile(dataFileName.c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle ro; - context.get().get(ro); + auto ro = context.getHandle(dtreadoutmappingToken_); std::cout << ro->mapRobRos() << " " << ro->mapCellTdc() << std::endl; std::cout << std::distance(ro->begin(), ro->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTROMapValidateDBRead.h b/CondTools/DT/test/validate/DTROMapValidateDBRead.h index 754c0cb9aa5cf..ef436d1fe2ec2 100644 --- a/CondTools/DT/test/validate/DTROMapValidateDBRead.h +++ b/CondTools/DT/test/validate/DTROMapValidateDBRead.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTReadOutMapping; +class DTReadOutMappingRcd; + class DTROMapValidateDBRead : public edm::EDAnalyzer { public: explicit DTROMapValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +25,5 @@ class DTROMapValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtreadoutmappingToken_; }; diff --git a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc index 532371c0ad27b..9d435269d3df3 100644 --- a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTRangeT0Rcd.h" DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtrangeToken_(esConsumes()) {} -DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(int i) {} +DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(int i) : dtrangeToken_(esConsumes()) {} DTRangeT0ValidateDBRead::~DTRangeT0ValidateDBRead() {} @@ -40,8 +42,7 @@ void DTRangeT0ValidateDBRead::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 tR; - context.get().get(tR); + auto tR = context.getHandle(dtrangeToken_); std::cout << tR->version() << std::endl; std::cout << std::distance(tR->begin(), tR->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h index 6b7beeca7a50b..baf4ec326da8c 100644 --- a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h +++ b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTRangeT0; +class DTRangeT0Rcd; + class DTRangeT0ValidateDBRead : public edm::EDAnalyzer { public: explicit DTRangeT0ValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +25,5 @@ class DTRangeT0ValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtrangeToken_; }; diff --git a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc index 58b752d5ea0f4..b617adcacfea9 100644 --- a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtstatusFlagToken_(esConsumes()) {} -DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(int i) {} +DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(int i) : dtstatusFlagToken_(esConsumes()) {} DTStatusFlagValidateDBRead::~DTStatusFlagValidateDBRead() {} @@ -40,8 +42,7 @@ void DTStatusFlagValidateDBRead::analyze(const edm::Event& e, const edm::EventSe 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 sf; - context.get().get(sf); + auto sf = context.getHandle(dtstatusFlagToken_); std::cout << sf->version() << std::endl; std::cout << std::distance(sf->begin(), sf->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h index 02297c20d470c..fb8527f7b97b8 100644 --- a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h +++ b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTStatusFlag; +class DTStatusFlagRcd; class DTStatusFlagValidateDBRead : public edm::EDAnalyzer { public: explicit DTStatusFlagValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTStatusFlagValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtstatusFlagToken_; }; diff --git a/CondTools/DT/test/validate/DTT0ValidateDBRead.cc b/CondTools/DT/test/validate/DTT0ValidateDBRead.cc index 00d999dd38d88..325343d771175 100644 --- a/CondTools/DT/test/validate/DTT0ValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTT0ValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTT0Rcd.h" DTT0ValidateDBRead::DTT0ValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtT0Token_(esConsumes()) {} -DTT0ValidateDBRead::DTT0ValidateDBRead(int i) {} +DTT0ValidateDBRead::DTT0ValidateDBRead(int i) : dtT0Token_(esConsumes()) {} DTT0ValidateDBRead::~DTT0ValidateDBRead() {} @@ -40,8 +42,7 @@ void DTT0ValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& con 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 t0; - context.get().get(t0); + auto t0 = context.getHandle(dtT0Token_); std::cout << t0->version() << std::endl; std::cout << std::distance(t0->begin(), t0->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTT0ValidateDBRead.h b/CondTools/DT/test/validate/DTT0ValidateDBRead.h index 753563393a680..a99961d48f21f 100644 --- a/CondTools/DT/test/validate/DTT0ValidateDBRead.h +++ b/CondTools/DT/test/validate/DTT0ValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTT0; +class DTT0Rcd; class DTT0ValidateDBRead : public edm::EDAnalyzer { public: explicit DTT0ValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTT0ValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtT0Token_; }; diff --git a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc index 72e2ec817b12b..a208bb23ad85f 100644 --- a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTTPGParametersRcd.h" DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dttpgPramToken_(esConsumes()) {} -DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(int i) {} +DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(int i) : dttpgPramToken_(esConsumes()) {} DTTPGParametersValidateDBRead::~DTTPGParametersValidateDBRead() {} @@ -40,8 +42,7 @@ void DTTPGParametersValidateDBRead::analyze(const edm::Event& e, const edm::Even 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 tpg; - context.get().get(tpg); + auto tpg = context.getHandle(dttpgPramToken_); std::cout << tpg->version() << std::endl; std::cout << std::distance(tpg->begin(), tpg->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h index 0e9ec5cc5a137..6c6082d92154f 100644 --- a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h +++ b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTTPGParameters; +class DTTPGParametersRcd; class DTTPGParametersValidateDBRead : public edm::EDAnalyzer { public: explicit DTTPGParametersValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTTPGParametersValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dttpgPramToken_; }; diff --git a/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc b/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc index 2875b3da47988..bd9917d6f8d58 100644 --- a/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTTtrigRcd.h" DTTtrigValidateDBRead::DTTtrigValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtTrigToken_(esConsumes()) {} -DTTtrigValidateDBRead::DTTtrigValidateDBRead(int i) {} +DTTtrigValidateDBRead::DTTtrigValidateDBRead(int i) : dtTrigToken_(esConsumes()) {} DTTtrigValidateDBRead::~DTTtrigValidateDBRead() {} @@ -40,8 +42,7 @@ void DTTtrigValidateDBRead::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 tT; - context.get().get(tT); + auto tT = context.getHandle(dtTrigToken_); std::cout << tT->version() << std::endl; std::cout << std::distance(tT->begin(), tT->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTTtrigValidateDBRead.h b/CondTools/DT/test/validate/DTTtrigValidateDBRead.h index 02c2a2938a160..925d47d137728 100644 --- a/CondTools/DT/test/validate/DTTtrigValidateDBRead.h +++ b/CondTools/DT/test/validate/DTTtrigValidateDBRead.h @@ -10,6 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTTtrig; +class DTTtrigRcd; class DTTtrigValidateDBRead : public edm::EDAnalyzer { public: @@ -22,4 +24,5 @@ class DTTtrigValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtTrigToken_; }; From 690103a24d45b682f3db0ee362c1528e22a510de Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 13 Sep 2021 05:50:51 +0200 Subject: [PATCH 541/923] make modules thread safe --- CondTools/DT/plugins/DTKeyedConfigDBDump.cc | 9 ++------- CondTools/DT/plugins/DTKeyedConfigDBInit.h | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc index 7459cd4e7e254..0f850e975616e 100644 --- a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc +++ b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc @@ -10,7 +10,7 @@ //---------------------- // Base Class Headers -- //---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ @@ -29,7 +29,7 @@ //----------------------- // This Class' Header -- //----------------------- -class DTKeyedConfigDBDump : public edm::EDAnalyzer { +class DTKeyedConfigDBDump : public edm::one::EDAnalyzer<> { public: /** Constructor */ @@ -75,11 +75,6 @@ void DTKeyedConfigDBDump::analyze(const edm::Event& iEvent, const edm::EventSetu edm::LogWarning("DTKeyedConfigDBDump") << "Record \"DTKeyedConfigListRcd " << "\" does not exist " << std::endl; } - //edm::ESHandle klh; - //std::cout << "got eshandle" << std::endl; - //iSetup.get().get(klh); - //std::cout << "got context" << std::endl; - //cond::persistency::KeyList const& kl = *klh.product(); cond::persistency::KeyList const* kp = &iSetup.getData(perskeylistToken_); edm::LogInfo("DTKeyedConfigDBDump") << "now load and get" << std::endl; auto pkc = kp->getUsingKey(999999999); diff --git a/CondTools/DT/plugins/DTKeyedConfigDBInit.h b/CondTools/DT/plugins/DTKeyedConfigDBInit.h index 3ba081d05ce4c..acd8c9a26af5b 100644 --- a/CondTools/DT/plugins/DTKeyedConfigDBInit.h +++ b/CondTools/DT/plugins/DTKeyedConfigDBInit.h @@ -14,7 +14,7 @@ //---------------------- // Base Class Headers -- //---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" //------------------------------------ // Collaborating Class Declarations -- @@ -32,7 +32,7 @@ // -- Class Interface -- // --------------------- -class DTKeyedConfigDBInit : public edm::EDAnalyzer { +class DTKeyedConfigDBInit : public edm::one::EDAnalyzer<> { public: /** Constructor */ From f78051b11097369949c9ae221fb4410b4d439136 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 30 Aug 2021 20:55:09 +0200 Subject: [PATCH 542/923] migrate modules to use esconsumes --- CondTools/Ecal/interface/EcalDBCopy.h | 114 ++++++- CondTools/Ecal/interface/EcalGetLaserData.h | 24 +- .../interface/EcalPFRecHitThresholdsMaker.h | 14 +- .../plugins/TestEcalChannelStatusAnalyzer.cc | 8 +- CondTools/Ecal/src/EcalDBCopy.cc | 298 +++++++----------- CondTools/Ecal/src/EcalGetLaserData.cc | 126 ++++---- .../Ecal/src/EcalPFRecHitThresholdsMaker.cc | 118 ++----- 7 files changed, 334 insertions(+), 368 deletions(-) diff --git a/CondTools/Ecal/interface/EcalDBCopy.h b/CondTools/Ecal/interface/EcalDBCopy.h index 2b638b44db3dd..c52267ba35f76 100644 --- a/CondTools/Ecal/interface/EcalDBCopy.h +++ b/CondTools/Ecal/interface/EcalDBCopy.h @@ -5,7 +5,28 @@ #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" - +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" +#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" +#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" +#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" #include #include @@ -15,6 +36,53 @@ namespace edm { class EventSetup; } // namespace edm +class EcalADCToGeVConstant; +class EcalTPGTowerStatus; +class EcalTBWeights; +class EcalLaserAPDPNRatios; +class Alignments; +class EcalTimeOffsetConstant; +class EcalSampleMask; +class EcalSimPulseShape; +class EcalTimeBiasCorrections; +class EcalSamplesCorrelation; + +class EcalPedestalsRcd; +class EcalADCToGeVConstantRcd; +class EcalTimeCalibConstantsRcd; +class EcalChannelStatusRcd; +class EcalDQMChannelStatusRcd; +class EcalDQMTowerStatusRcd; +class EcalDCSTowerStatusRcd; +class EcalTPGCrystalStatusRcd; +class EcalDAQTowerStatusRcd; +class EcalTPGTowerStatusRcd; +class EcalTPGTowerStatusRcd; +class EcalIntercalibConstantsRcd; +class EcalLinearCorrectionsRcd; +class EcalIntercalibConstantsMCRcd; +class EcalIntercalibErrorsRcd; +class EcalGainRatiosRcd; +class EcalWeightXtalGroupsRcd; +class EcalTBWeightsRcd; +class EcalLaserAlphasRcd; +class EcalLaserAPDPNRatiosRcd; +class EcalLaserAPDPNRatiosRefRcd; +class EcalClusterCrackCorrParametersRcd; +class EcalPFRecHitThresholdsRcd; +class EcalClusterEnergyUncertaintyParametersRcd; +class EcalClusterEnergyCorrectionParametersRcd; +class EcalClusterEnergyCorrectionObjectSpecificParametersRcd; +class EcalClusterLocalContCorrParametersRcd; +class EBAlignmentRcd; +class EEAlignmentRcd; +class ESAlignmentRcd; +class EcalTimeOffsetConstantRcd; +class EcalSampleMaskRcd; +class EcalSimPulseShapeRcd; +class EcalTimeBiasCorrectionsRcd; +class EcalSamplesCorrelationRcd; + class EcalDBCopy : public edm::EDAnalyzer { public: explicit EcalDBCopy(const edm::ParameterSet& iConfig); @@ -23,12 +91,52 @@ class EcalDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + edm::ESGetToken ecalPedestalToken_; + edm::ESGetToken ecalADCtoGeVToken_; + edm::ESGetToken ecalTimeCalibToken_; + edm::ESGetToken ecalChannelStatusToken_; + edm::ESGetToken ecalDQMChannelStatusToken_; + edm::ESGetToken ecalDQMTowerStatusToken_; + edm::ESGetToken ecalDCSTowerStatusToken_; + edm::ESGetToken ecalDAQTowerStatusToken_; + edm::ESGetToken ecalTPGCrystalStatusToken_; + edm::ESGetToken ecalTPGTowerStatusToken_; + edm::ESGetToken ecalIntercalibConstantsToken_; + edm::ESGetToken ecalLinearCorrectionsToken_; + edm::ESGetToken ecalIntercalibConstantsMCToken_; + edm::ESGetToken ecalIntercalibErrorsToken_; + edm::ESGetToken ecalGainRatiosToken_; + edm::ESGetToken ecalWeightXtalGroupsToken_; + edm::ESGetToken ecalTBWeightsToken_; + edm::ESGetToken ecalLaserAlphasToken_; + edm::ESGetToken ecalLaserAPDPNRatiosToken_; + edm::ESGetToken ecalLaserAPDPNRatiosRefToken_; + edm::ESGetToken + ecalClusterCrackCorrParametersToken_; + edm::ESGetToken ecalPFRecHitThresholdsToken_; + edm::ESGetToken + ecalClusterEnergyUncertaintyParametersToken_; + edm::ESGetToken + ecalClusterEnergyCorrectionParametersToken_; + edm::ESGetToken + ecalClusterEnergyCorrectionObjectSpecificParametersToken_; + edm::ESGetToken + ecalClusterLocalContCorrParametersToken_; + edm::ESGetToken ebAlignmentToken_; + edm::ESGetToken eeAlignmentToken_; + edm::ESGetToken esAlignmentToken_; + edm::ESGetToken ecalTimeOffsetConstantToken_; + edm::ESGetToken ecalSampleMaskToken_; + edm::ESGetToken ecalSimPulseShapeToken_; + edm::ESGetToken ecalTimeBiasCorrectionsToken_; + edm::ESGetToken ecalSamplesCorrelationToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalGetLaserData.h b/CondTools/Ecal/interface/EcalGetLaserData.h index e85fa5277d93c..2b74f05bac8f3 100644 --- a/CondTools/Ecal/interface/EcalGetLaserData.h +++ b/CondTools/Ecal/interface/EcalGetLaserData.h @@ -2,27 +2,11 @@ #define ECALGETLASERDATA_H #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "CondCore/CondDB/interface/Exception.h" - -#include "FWCore/Framework/interface/IOVSyncValue.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" - -#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" -#include "OnlineDB/Oracle/interface/Oracle.h" -#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" - -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" #include #include -#include #include #include @@ -32,6 +16,11 @@ namespace edm { class EventSetup; } // namespace edm +class EcalLaserAPDPNRatios; +class EcalLaserAPDPNRatiosRcd; +class EcalLaserAPDPNRatiosRefRcd; +class EcalLaserAlphasRcd; + class EcalGetLaserData : public edm::EDAnalyzer { public: explicit EcalGetLaserData(const edm::ParameterSet& iConfig); @@ -48,6 +37,9 @@ class EcalGetLaserData : public edm::EDAnalyzer { void beginJob() override; void endJob() override; + edm::ESGetToken ecalLaserAPDPNRatiosToken_; + edm::ESGetToken ecalLaserAPDPNRatiosRefToken_; + edm::ESGetToken ecalLaserAlphasToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h index 5dd0f16cc2672..768165ebf9c91 100644 --- a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h +++ b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h @@ -5,9 +5,9 @@ #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" - +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include -#include namespace edm { class ParameterSet; @@ -15,6 +15,12 @@ namespace edm { class EventSetup; } // namespace edm +class EcalPedestalsRcd; +class EcalADCToGeVConstant; +class EcalADCToGeVConstantRcd; +class EcalIntercalibConstantsRcd; +class EcalLaserDbService; +class EcalLaserDbRecord; class EcalPFRecHitThresholdsMaker : public edm::EDAnalyzer { public: explicit EcalPFRecHitThresholdsMaker(const edm::ParameterSet& iConfig); @@ -25,6 +31,10 @@ class EcalPFRecHitThresholdsMaker : public edm::EDAnalyzer { private: std::string m_timetype; double m_nsigma; + edm::ESGetToken ecalPedestalsToken_; + edm::ESGetToken ecalADCToGeVConstantToken_; + edm::ESGetToken ecalIntercalibConstantsToken_; + edm::ESGetToken ecalLaserDbServiceToken_; }; #endif diff --git a/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc b/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc index a3a5ce72bf6c9..b53bf7d29c767 100644 --- a/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc +++ b/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc @@ -9,13 +9,12 @@ class ExTestEcalChannelStatusAnalyzer : public popcon::PopConAnalyzer(pset), m_populator(pset), - m_source(pset.getParameter("Source")) {} + m_source(pset.getParameter("Source")), + ecalElectronicsMappingToken_(esConsumes()) {} private: void analyze(const edm::Event& ev, const edm::EventSetup& iSetup) override { - edm::ESHandle eleMap; - iSetup.get().get(eleMap); - ecalElectronicsMap = eleMap.product(); + ecalElectronicsMap = &iSetup.getData(ecalElectronicsMappingToken_); } void endJob() override { @@ -29,6 +28,7 @@ class ExTestEcalChannelStatusAnalyzer : public popcon::PopConAnalyzer ecalElectronicsMappingToken_; }; //define this as a plug-in diff --git a/CondTools/Ecal/src/EcalDBCopy.cc b/CondTools/Ecal/src/EcalDBCopy.cc index 2ea779c8b19de..1f04ce036df8e 100644 --- a/CondTools/Ecal/src/EcalDBCopy.cc +++ b/CondTools/Ecal/src/EcalDBCopy.cc @@ -1,67 +1,38 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "CondTools/Ecal/interface/EcalDBCopy.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" #include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" #include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" #include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" #include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" #include "CondFormats/EcalObjects/interface/EcalTBWeights.h" #include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" #include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" #include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDCSTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDAQTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" #include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" #include "CondFormats/Alignment/interface/Alignments.h" @@ -86,36 +57,66 @@ #include EcalDBCopy::EcalDBCopy(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + : m_timetype(iConfig.getParameter("timetype")), + m_cacheIDs(), + m_records(), + ecalPedestalToken_(esConsumes()), + ecalADCtoGeVToken_(esConsumes()), + ecalTimeCalibToken_(esConsumes()), + ecalChannelStatusToken_(esConsumes()), + ecalDQMChannelStatusToken_(esConsumes()), + ecalDQMTowerStatusToken_(esConsumes()), + ecalDCSTowerStatusToken_(esConsumes()), + ecalDAQTowerStatusToken_(esConsumes()), + ecalTPGCrystalStatusToken_(esConsumes()), + ecalTPGTowerStatusToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalLinearCorrectionsToken_(esConsumes()), + ecalIntercalibConstantsMCToken_(esConsumes()), + ecalIntercalibErrorsToken_(esConsumes()), + ecalGainRatiosToken_(esConsumes()), + ecalWeightXtalGroupsToken_(esConsumes()), + ecalTBWeightsToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalLaserAPDPNRatiosRefToken_(esConsumes()), + ecalClusterCrackCorrParametersToken_(esConsumes()), + ecalPFRecHitThresholdsToken_(esConsumes()), + ecalClusterEnergyUncertaintyParametersToken_(esConsumes()), + ecalClusterEnergyCorrectionParametersToken_(esConsumes()), + ecalClusterEnergyCorrectionObjectSpecificParametersToken_(esConsumes()), + ecalClusterLocalContCorrParametersToken_(esConsumes()), + ebAlignmentToken_(esConsumes()), + eeAlignmentToken_(esConsumes()), + esAlignmentToken_(esConsumes()), + ecalTimeOffsetConstantToken_(esConsumes()), + ecalSampleMaskToken_(esConsumes()), + ecalSimPulseShapeToken_(esConsumes()), + ecalTimeBiasCorrectionsToken_(esConsumes()), + ecalSamplesCorrelationToken_(esConsumes()) { std::string container; - std::string tag; std::string record; typedef std::vector Parameters; Parameters toCopy = iConfig.getParameter("toCopy"); - for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (auto& iparam : toCopy) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } } EcalDBCopy::~EcalDBCopy() {} void EcalDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - if (shouldCopy(evtSetup, container)) { - copyToDB(evtSetup, container); + for (const auto& irec : m_records) { + if (shouldCopy(evtSetup, irec.first)) { + copyToDB(evtSetup, irec.first); } } } -bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "EcalPedestals") { cacheID = evtSetup.get().cacheIdentifier(); @@ -199,7 +200,7 @@ bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string contain } } -void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -208,209 +209,160 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container std::string recordName = m_records[container]; if (container == "EcalPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalPedestals* obj = handle.product(); - std::cout << "ped pointer is: " << obj << std::endl; + const EcalPedestals* obj = &evtSetup.getData(ecalPedestalToken_); + edm::LogInfo("EcalDBCopy") << "ped pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalADCToGeVConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalADCToGeVConstant* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; + const EcalADCToGeVConstant* obj = &evtSetup.getData(ecalADCtoGeVToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeCalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeCalibConstants* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; + const EcalTimeCalibConstants* obj = &evtSetup.getData(ecalTimeCalibToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTimeCalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalChannelStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; + const EcalChannelStatus* obj = &evtSetup.getData(ecalChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDQMChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDQMChannelStatus* obj = handle.product(); - std::cout << "DQM channel status pointer is: " << obj << std::endl; + const EcalDQMChannelStatus* obj = &evtSetup.getData(ecalDQMChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDQMChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDQMTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDQMTowerStatus* obj = handle.product(); - std::cout << "DQM Tower status pointer is: " << obj << std::endl; + const EcalDQMTowerStatus* obj = &evtSetup.getData(ecalDQMTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM Tower status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDQMTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDCSTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDCSTowerStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; + const EcalDCSTowerStatus* obj = &evtSetup.getData(ecalDCSTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDCSTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDAQTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDAQTowerStatus* obj = handle.product(); - std::cout << "DAQ channel status pointer is: " << obj << std::endl; + const EcalDAQTowerStatus* obj = &evtSetup.getData(ecalDAQTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DAQ channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDAQTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTPGCrystalStatus* obj = handle.product(); - std::cout << "TPG channel status pointer is: " << obj << std::endl; + const EcalTPGCrystalStatus* obj = &evtSetup.getData(ecalTPGCrystalStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTPGTowerStatus* obj = handle.product(); - std::cout << "TPG tower status pointer is: " << obj << std::endl; + const EcalTPGTowerStatus* obj = &evtSetup.getData(ecalTPGTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG tower status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibConstants* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalIntercalibConstants* obj = &evtSetup.getData(ecalIntercalibConstantsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLinearCorrections") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLinearCorrections* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalLinearCorrections* obj = &evtSetup.getData(ecalLinearCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLinearCorrections(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibConstantsMC") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibConstantsMC* obj = handle.product(); - std::cout << "intercalib MC pointer is: " << obj << std::endl; + const EcalIntercalibConstantsMC* obj = &evtSetup.getData(ecalIntercalibConstantsMCToken_); + edm::LogInfo("EcalDBCopy") << "intercalib MC pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibConstantsMC(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibErrors") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibErrors* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalIntercalibErrors* obj = &evtSetup.getData(ecalIntercalibErrorsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibErrors(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalGainRatios") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalGainRatios* obj = handle.product(); - std::cout << "gain pointer is: " << obj << std::endl; + const EcalGainRatios* obj = &evtSetup.getData(ecalGainRatiosToken_); + edm::LogInfo("EcalDBCopy") << "gain pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalGainRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalWeightXtalGroups") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalWeightXtalGroups* obj = handle.product(); - std::cout << "weight pointer is: " << obj << std::endl; + const EcalWeightXtalGroups* obj = &evtSetup.getData(ecalWeightXtalGroupsToken_); + edm::LogInfo("EcalDBCopy") << "weight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalWeightXtalGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTBWeights") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTBWeights* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalTBWeights* obj = &evtSetup.getData(ecalTBWeightsToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAlphas") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAlphas* obj = handle.product(); - std::cout << "ecalLaserAlpha pointer is: " << obj << std::endl; + const EcalLaserAlphas* obj = &evtSetup.getData(ecalLaserAlphasToken_); + edm::LogInfo("EcalDBCopy") << "ecalLaserAlpha pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAlphas(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatios") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAPDPNRatios* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalLaserAPDPNRatios* obj = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAPDPNRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatiosRef") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAPDPNRatiosRef* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalLaserAPDPNRatiosRef* obj = &evtSetup.getData(ecalLaserAPDPNRatiosRefToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAPDPNRatiosRef(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterCrackCorrParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterCrackCorrParameters* obj = handle.product(); - std::cout << "cluster crack pointer is: " << obj << std::endl; + const EcalClusterCrackCorrParameters* obj = &evtSetup.getData(ecalClusterCrackCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "cluster crack pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterCrackCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalPFRecHitThresholds") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalPFRecHitThresholds* obj = handle.product(); - std::cout << "Ecal PF rec hit thresholds pointer is: " << obj << std::endl; + const EcalPFRecHitThresholds* obj = &evtSetup.getData(ecalPFRecHitThresholdsToken_); + edm::LogInfo("EcalDBCopy") << "Ecal PF rec hit thresholds pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalPFRecHitThresholds(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyUncertaintyParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyUncertaintyParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyUncertaintyParameters* obj = &evtSetup.getData(ecalClusterEnergyUncertaintyParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyUncertaintyParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyCorrectionParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyCorrectionParameters* obj = &evtSetup.getData(ecalClusterEnergyCorrectionParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyCorrectionParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionObjectSpecificParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyCorrectionObjectSpecificParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyCorrectionObjectSpecificParameters* obj = + &evtSetup.getData(ecalClusterEnergyCorrectionObjectSpecificParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyCorrectionObjectSpecificParameters(*obj), dbOutput->beginOfTime(), @@ -418,65 +370,49 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container recordName); } else if (container == "EcalClusterLocalContCorrParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterLocalContCorrParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterLocalContCorrParameters* obj = &evtSetup.getData(ecalClusterLocalContCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterLocalContCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EBAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "EB alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(ebAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EB alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EEAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "EE alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(eeAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EE alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "ES alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(esAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "ES alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeOffsetConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeOffsetConstant* obj = handle.product(); - std::cout << "TimeOffset pointer is: " << obj << std::endl; + const EcalTimeOffsetConstant* obj = &evtSetup.getData(ecalTimeOffsetConstantToken_); + edm::LogInfo("EcalDBCopy") << "TimeOffset pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTimeOffsetConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalSampleMask") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSampleMask* obj = handle.product(); - std::cout << "sample mask pointer is: " << obj << std::endl; + const EcalSampleMask* obj = &evtSetup.getData(ecalSampleMaskToken_); + edm::LogInfo("EcalDBCopy") << "sample mask pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalSampleMask(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalSimPulseShape") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSimPulseShape* obj = handle.product(); + const EcalSimPulseShape* obj = &evtSetup.getData(ecalSimPulseShapeToken_); dbOutput->createNewIOV( new EcalSimPulseShape(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeBiasCorrections") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeBiasCorrections* obj = handle.product(); - std::cout << "TimeBiasCorrections pointer is: " << obj << std::endl; + const EcalTimeBiasCorrections* obj = &evtSetup.getData(ecalTimeBiasCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "TimeBiasCorrections pointer is: " << obj << std::endl; EcalTimeBiasCorrections* bias_; bias_ = new EcalTimeBiasCorrections(); std::vector vect = obj->EBTimeCorrAmplitudeBins; @@ -490,10 +426,8 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container dbOutput->writeOne(bias_, dbOutput->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); } else if (container == "EcalSamplesCorrelation") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSamplesCorrelation* obj = handle.product(); - std::cout << "SamplesCorrelation pointer is: " << obj << std::endl; + const EcalSamplesCorrelation* obj = &evtSetup.getData(ecalSamplesCorrelationToken_); + edm::LogInfo("EcalDBCopy") << "SamplesCorrelation pointer is: " << obj << std::endl; EcalSamplesCorrelation* correl_; correl_ = new EcalSamplesCorrelation(); std::vector vect = obj->EBG12SamplesCorrelation; @@ -514,5 +448,5 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container throw cms::Exception("Unknown container"); } - std::cout << "EcalDBCopy wrote " << recordName << std::endl; + edm::LogInfo("EcalDBCopy") << "EcalDBCopy wrote " << recordName << std::endl; } diff --git a/CondTools/Ecal/src/EcalGetLaserData.cc b/CondTools/Ecal/src/EcalGetLaserData.cc index 0040ce225e6a6..5d3a0f1d360ce 100644 --- a/CondTools/Ecal/src/EcalGetLaserData.cc +++ b/CondTools/Ecal/src/EcalGetLaserData.cc @@ -19,27 +19,38 @@ #include // user include files - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/EventSetupRecordKey.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/IOVSyncValue.h" -#include "DataFormats/Common/interface/Handle.h" +#include "CondCore/CondDB/interface/Exception.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondTools/Ecal/interface/EcalGetLaserData.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/EventSetupRecordKey.h" +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/Oracle/interface/Oracle.h" +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" + +#include "DataFormats/Common/interface/Handle.h" + +#include "CondTools/Ecal/interface/EcalGetLaserData.h" // // constants, enums and typedefs @@ -55,21 +66,21 @@ EcalGetLaserData::EcalGetLaserData(const edm::ParameterSet& iConfig) : // m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), - m_records() { - std::string container; - std::string tag; - std::string record; - + m_records(), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalLaserAPDPNRatiosRefToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()) { //m_firstRun=(unsigned long long)atoi( iConfig.getParameter("firstRun").c_str()); //m_lastRun=(unsigned long long)atoi( iConfig.getParameter("lastRun").c_str()); - + std::string container; + std::string record; typedef std::vector Parameters; Parameters toGet = iConfig.getParameter("toGet"); - for (Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (const auto& iparam : toGet) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } //now do what ever initialization is needed } @@ -88,26 +99,19 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt using namespace edm; // loop on offline DB conditions to be transferred as from config file - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - - std::string recordName = m_records[container]; + for (const auto& irec : m_records) { + const std::string& container = irec.first; + //record = irec.second; if (container == "EcalLaserAPDPNRatios") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - + const EcalLaserAPDPNRatios* laserapdpnrRatios = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); // this is the offline object EcalLaserAPDPNRatios::EcalLaserTimeStamp timestamp; EcalLaserAPDPNRatios::EcalLaserAPDPNpair apdpnpair; - const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = handle.product()->getLaserMap(); - const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = handle.product()->getTimeMap(); + const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = laserapdpnrRatios->getLaserMap(); + const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = laserapdpnrRatios->getTimeMap(); // loop through ecal barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -119,8 +123,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EB : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EB : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -138,8 +142,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EE+ : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE+ : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -151,8 +155,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EE- : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE- : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -161,19 +165,16 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt for (int i = 0; i < 92; i++) { timestamp = laserTimeMap[i]; - std::cout << "A value of timestamp pair : " << i << " " << timestamp.t1.value() << " , " << timestamp.t2.value() - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A value of timestamp pair : " << i << " " << timestamp.t1.value() << " , " + << timestamp.t2.value() << std::endl; } - std::cout << ".. just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << ".. just retrieved the last valid record from DB " << std::endl; } else if (container == "EcalLaserAPDPNRatiosRef") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - EcalLaserAPDPNref apdpnref; - const EcalLaserAPDPNRatiosRefMap& laserRefMap = handle.product()->getMap(); + const EcalLaserAPDPNRatiosRefMap& laserRefMap = (&evtSetup.getData(ecalLaserAPDPNRatiosRefToken_))->getMap(); // first barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -185,7 +186,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EB : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EB : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; } @@ -203,7 +205,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EE+ : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EE+ : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; @@ -216,23 +219,21 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EE- : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EE- : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; } } } - std::cout << "... just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl; } else if (container == "EcalLaserAlphas") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - // this is the offline object EcalLaserAlpha alpha; - const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns + const EcalLaserAlphaMap& laserAlphaMap = (&evtSetup.getData(ecalLaserAlphasToken_))->getMap(); // map of apdpns // first barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -244,7 +245,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } @@ -262,7 +264,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } @@ -274,14 +277,15 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } } } - std::cout << "... just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl; } else { edm::LogError("EcalGetLaserData") << "Cannot retrieve for container: " << container << std::endl; diff --git a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc index a9038062963a3..e897c83b43209 100644 --- a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc +++ b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc @@ -1,102 +1,27 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/Framework/interface/Event.h" - #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h" - #include "CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" +#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" -#include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" -#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" -#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDCSTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDAQTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" -#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" - -#include "CondFormats/Alignment/interface/Alignments.h" -#include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h" -#include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h" -#include "CondFormats/AlignmentRecord/interface/ESAlignmentRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" -#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" -#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" -#include "CondFormats/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSamplesCorrelation.h" -#include "CondFormats/DataRecord/interface/EcalSamplesCorrelationRcd.h" - -#include "DataFormats/Provenance/interface/Timestamp.h" - -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include EcalPFRecHitThresholdsMaker::EcalPFRecHitThresholdsMaker(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")) { - std::string container; - std::string tag; - std::string record; - + : m_timetype(iConfig.getParameter("timetype")), + ecalPedestalsToken_(esConsumes()), + ecalADCToGeVConstantToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalLaserDbServiceToken_(esConsumes()) { m_nsigma = iConfig.getParameter("NSigma"); } @@ -108,23 +33,16 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even throw cms::Exception("PoolDBOutputService is not available"); } - edm::ESHandle handle1; - evtSetup.get().get(handle1); - const EcalPedestals* ped_db = handle1.product(); - std::cout << "ped pointer is: " << ped_db << std::endl; + const EcalPedestals* ped_db = &evtSetup.getData(ecalPedestalsToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "ped pointer is: " << ped_db << std::endl; - edm::ESHandle handle2; - evtSetup.get().get(handle2); - const EcalADCToGeVConstant* adc_db = handle2.product(); - std::cout << "adc pointer is: " << adc_db << std::endl; + const EcalADCToGeVConstant* adc_db = &evtSetup.getData(ecalADCToGeVConstantToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "adc pointer is: " << adc_db << std::endl; - edm::ESHandle handle3; - evtSetup.get().get(handle3); - const EcalIntercalibConstants* ical_db = handle3.product(); - std::cout << "inter pointer is: " << ical_db << std::endl; + const EcalIntercalibConstants* ical_db = &evtSetup.getData(ecalIntercalibConstantsToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "inter pointer is: " << ical_db << std::endl; - edm::ESHandle laser; - evtSetup.get().get(laser); + const auto laser = evtSetup.getHandle(ecalLaserDbServiceToken_); EcalPFRecHitThresholds* pfthresh = new EcalPFRecHitThresholds(); @@ -155,7 +73,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma; if (iPhi == 100) - std::cout << "Thresh(GeV)=" << thresh << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; pfthresh->insert(std::make_pair(ebdetid.rawId(), thresh)); } @@ -198,7 +116,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even pfthresh->insert(std::make_pair(eedetid.rawId(), thresh)); if (iX == 50) - std::cout << "Thresh(GeV)=" << thresh << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; } } } @@ -206,5 +124,5 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even dbOutput->createNewIOV( pfthresh, dbOutput->beginOfTime(), dbOutput->endOfTime(), "EcalPFRecHitThresholdsRcd"); - std::cout << "EcalPFRecHitThresholdsMaker wrote it " << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "EcalPFRecHitThresholdsMaker wrote it " << std::endl; } From 58ad57ef908934bc2b53e63b869c5e44914e25dd Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 13 Sep 2021 06:54:41 +0200 Subject: [PATCH 543/923] thread safe analyzer --- CondTools/Ecal/interface/EcalDBCopy.h | 4 ++-- CondTools/Ecal/interface/EcalGetLaserData.h | 4 ++-- CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CondTools/Ecal/interface/EcalDBCopy.h b/CondTools/Ecal/interface/EcalDBCopy.h index c52267ba35f76..69a3d65bf7ff9 100644 --- a/CondTools/Ecal/interface/EcalDBCopy.h +++ b/CondTools/Ecal/interface/EcalDBCopy.h @@ -1,7 +1,7 @@ #ifndef ECALDBCOPY_H #define ECALDBCOPY_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" @@ -83,7 +83,7 @@ class EcalSimPulseShapeRcd; class EcalTimeBiasCorrectionsRcd; class EcalSamplesCorrelationRcd; -class EcalDBCopy : public edm::EDAnalyzer { +class EcalDBCopy : public edm::one::EDAnalyzer<> { public: explicit EcalDBCopy(const edm::ParameterSet& iConfig); ~EcalDBCopy() override; diff --git a/CondTools/Ecal/interface/EcalGetLaserData.h b/CondTools/Ecal/interface/EcalGetLaserData.h index 2b74f05bac8f3..c6a06f4b0f1a5 100644 --- a/CondTools/Ecal/interface/EcalGetLaserData.h +++ b/CondTools/Ecal/interface/EcalGetLaserData.h @@ -1,7 +1,7 @@ #ifndef ECALGETLASERDATA_H #define ECALGETLASERDATA_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" @@ -21,7 +21,7 @@ class EcalLaserAPDPNRatiosRcd; class EcalLaserAPDPNRatiosRefRcd; class EcalLaserAlphasRcd; -class EcalGetLaserData : public edm::EDAnalyzer { +class EcalGetLaserData : public edm::one::EDAnalyzer<> { public: explicit EcalGetLaserData(const edm::ParameterSet& iConfig); ~EcalGetLaserData() override; diff --git a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h index 768165ebf9c91..08103e946489d 100644 --- a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h +++ b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h @@ -1,7 +1,7 @@ #ifndef ECALPFRECHITTHRESHOLDSMAKER_H #define ECALPFRECHITTHRESHOLDSMAKER_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" @@ -21,7 +21,7 @@ class EcalADCToGeVConstantRcd; class EcalIntercalibConstantsRcd; class EcalLaserDbService; class EcalLaserDbRecord; -class EcalPFRecHitThresholdsMaker : public edm::EDAnalyzer { +class EcalPFRecHitThresholdsMaker : public edm::one::EDAnalyzer<> { public: explicit EcalPFRecHitThresholdsMaker(const edm::ParameterSet& iConfig); ~EcalPFRecHitThresholdsMaker() override; From 455c40a293935fb03fd68a55a8000a8bf57ec2f3 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 13 Sep 2021 11:56:25 +0200 Subject: [PATCH 544/923] cleanup Geant4 termination --- SimG4Core/Application/src/RunManagerMT.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SimG4Core/Application/src/RunManagerMT.cc b/SimG4Core/Application/src/RunManagerMT.cc index fe2230e220b3f..8e09106a61b88 100644 --- a/SimG4Core/Application/src/RunManagerMT.cc +++ b/SimG4Core/Application/src/RunManagerMT.cc @@ -266,7 +266,9 @@ void RunManagerMT::Connect(RunAction* runAction) { } void RunManagerMT::stopG4() { - m_geometryManager->OpenGeometry(); + if (nullptr != m_geometryManager) { + m_geometryManager->OpenGeometry(); + } m_stateManager->SetNewState(G4State_Quit); if (!m_runTerminated) { terminateRun(); @@ -274,12 +276,12 @@ void RunManagerMT::stopG4() { } void RunManagerMT::terminateRun() { - if (m_userRunAction) { + if (nullptr != m_userRunAction) { m_userRunAction->EndOfRunAction(m_currentRun); delete m_userRunAction; m_userRunAction = nullptr; } - if (m_kernel && !m_runTerminated) { + if (nullptr != m_kernel && !m_runTerminated) { m_kernel->RunTermination(); } m_runTerminated = true; From e2d53f40367865e2cdf05fed0b79a0fe790faeff Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 13 Sep 2021 12:47:54 +0200 Subject: [PATCH 545/923] add deltaR2 in FakeValidator --- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc | 5 +++-- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 27767c11932e1..3cc0d3c5269c8 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -76,6 +76,7 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); deltaR_ = conf.getParameter("DeltaR"); + deltaR2_ = deltaR_ * deltaR_; inputFile_ = conf.getParameter("InputFile"); outputFile_ = conf.getParameter("OutputFile"); inputInternalPath_ = conf.getParameter("InputFolderName"); @@ -2556,8 +2557,8 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; } - double deltaR = sqrt(pow((gsfIter3->eta() - moIter->eta()), 2) + pow(dphi, 2)); - if (deltaR < deltaR_) { + double deltaR2 = (gsfIter3->eta() - moIter->eta()) * (gsfIter3->eta() - moIter->eta()) + dphi * dphi; + if (deltaR2 < deltaR2_) { double tmpGsfRatio = gsfIter3->p() / moIter->energy(); if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { gsfOkRatio = tmpGsfRatio; diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h index b7cb107b0b083..bb46dac5ac933 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h @@ -67,7 +67,7 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_; + double deltaR_, deltaR2_; std::string inputFile_; std::string outputFile_; From 77e71b43664c5f22886ebc673525773a15fa05ae Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 13 Sep 2021 12:48:57 +0200 Subject: [PATCH 546/923] remove type specification into HGCal modifications part --- ...lectronMcFakeValidator_gedGsfElectrons_cfi.py | 15 +++++++-------- .../ElectronMcSignalValidatorMiniAOD_cfi.py | 4 ++-- ...cSignalValidatorPt1000_gedGsfElectrons_cfi.py | 14 ++++++-------- ...ctronMcSignalValidator_gedGsfElectrons_cfi.py | 16 ++++++++-------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py index b06c58fbfb5ea..6f6b626f8f9c5 100644 --- a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py @@ -1,4 +1,3 @@ - import FWCore.ParameterSet.Config as cms electronMcFakeHistosCfg = cms.PSet( @@ -67,17 +66,17 @@ electronMcFakeValidator, electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5, + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), -) +) \ No newline at end of file diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py index fc47bee9d7a08..7b3244bebb3b0 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py @@ -58,11 +58,11 @@ phase2_hgcal.toModify( electronMcSignalValidatorMiniAOD, electrons_endcaps=cms.InputTag("slimmedElectronsHGC"), - MaxAbsEta=cms.double(3.0), + MaxAbsEta=3.0, histosCfg=dict( Nbineta=60, Nbineta2D=60, Etamin=-3.0, Etamax=3.0, ), -) \ No newline at end of file +) diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py index b0f9897874206..f150f31312adb 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py @@ -71,19 +71,17 @@ electronMcSignalValidatorPt1000, electronCollectionEndcaps = cms.InputTag("ecalDrivenGsfElectronsHGC"), electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5, + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), ) - - diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py index d4b533cbf7d73..a7a509f9ea1dc 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py @@ -3,10 +3,10 @@ electronMcSignalHistosCfg = cms.PSet( Nbinxyz = cms.int32(50), Nbinp = cms.int32(50), Nbinp2D = cms.int32(50), Pmax = cms.double(300.0), - Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19),Ptmax = cms.double(100.0), + Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19), Ptmax = cms.double(100.0), Nbinfhits = cms.int32(30), Fhitsmax = cms.double(30.0), Nbinlhits = cms.int32(5), Lhitsmax = cms.double(10.0), - Nbineta = cms.int32(50), Nbineta2D = cms.int32(50),Etamin = cms.double(-2.5), Etamax = cms.double(2.5), + Nbineta = cms.int32(50), Nbineta2D = cms.int32(50), Etamin = cms.double(-2.5), Etamax = cms.double(2.5), Nbindeta = cms.int32(100), Detamin = cms.double(-0.005), Detamax = cms.double(0.005), Nbindetamatch = cms.int32(100), Nbindetamatch2D = cms.int32(50), Detamatchmin = cms.double(-0.05), Detamatchmax = cms.double(0.05), Nbinphi = cms.int32(64), Nbinphi2D = cms.int32(32), Phimin = cms.double(-3.2), Phimax = cms.double(3.2), @@ -67,17 +67,17 @@ electronMcSignalValidator, electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5 , + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), ) From d7af8e693771555dce7ebf188f5884f1ae88aa32 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 13 Sep 2021 13:09:17 +0200 Subject: [PATCH 547/923] fix undefined behavior in MultiTrackValidator --- Validation/RecoTrack/plugins/MultiTrackValidator.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Validation/RecoTrack/plugins/MultiTrackValidator.cc b/Validation/RecoTrack/plugins/MultiTrackValidator.cc index e91d2d62fee89..3a87f508c29af 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidator.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidator.cc @@ -483,6 +483,9 @@ size_t MultiTrackValidator::tpDR(const TrackingParticleRefVector& tPCeff, DynArray& dR_tPCeff, DynArray& dR_tPCeff_jet, const edm::View* cores) const { + if (tPCeff.empty()) { + return 0; + } float etaL[tPCeff.size()], phiL[tPCeff.size()]; size_t n_selTP_dr = 0; for (size_t iTP : selected_tPCeff) { @@ -532,6 +535,9 @@ void MultiTrackValidator::trackDR(const edm::View& trackCollection, DynArray& dR_trk, DynArray& dR_trk_jet, const edm::View* cores) const { + if (trackCollectionDr.empty()) { + return; + } int i = 0; float etaL[trackCollectionDr.size()]; float phiL[trackCollectionDr.size()]; From 8dc085a6d701dcb35820bb3a1e8c0a13f170d637 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Mon, 13 Sep 2021 13:51:26 +0200 Subject: [PATCH 548/923] fix typos --- .../SiPixelDetId/interface/PixelChannelIdentifier.h | 12 ++++++------ .../plugins/SiPixelRawToClusterGPUKernel.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h index 030988608bead..3f909412910ec 100644 --- a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h +++ b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h @@ -1,10 +1,10 @@ -#ifndef DATAFORMATS_PIXELCHANMNELIDENTIFIER_H -#define DATAFORMATS_PIXELCHANMNELIDENTIFIER_H +#ifndef DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h +#define DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h #include #include -namespace pixelchanelidentifierimpl { +namespace pixelchannelidentifierimpl { /** * Pack the pixel information to use less memory */ @@ -50,7 +50,7 @@ namespace pixelchanelidentifierimpl { const int max_column; const int max_adc; }; -} // namespace pixelchanelidentifierimpl +} // namespace pixelchannelidentifierimpl class PixelChannelIdentifier { public: @@ -65,7 +65,7 @@ class PixelChannelIdentifier { static int pixelToChannel(int row, int col) { return (row << thePacking.column_width) | col; } - using Packing = pixelchanelidentifierimpl::Packing; + using Packing = pixelchannelidentifierimpl::Packing; public: constexpr static Packing packing() { return Packing(8, 9, 4, 11); } @@ -73,4 +73,4 @@ class PixelChannelIdentifier { constexpr static Packing thePacking = {11, 10, 1, 10}; }; -#endif +#endif // DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h index a84662b397542..9a232569db30a 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelRawToClusterGPUKernel.h @@ -57,17 +57,17 @@ namespace pixelgpudetails { uint32_t col; }; - inline constexpr pixelchanelidentifierimpl::Packing packing() { return PixelChannelIdentifier::thePacking; } + inline constexpr pixelchannelidentifierimpl::Packing packing() { return PixelChannelIdentifier::thePacking; } inline constexpr uint32_t pack(uint32_t row, uint32_t col, uint32_t adc, uint32_t flag = 0) { - constexpr pixelchanelidentifierimpl::Packing thePacking = packing(); + constexpr pixelchannelidentifierimpl::Packing thePacking = packing(); adc = std::min(adc, uint32_t(thePacking.max_adc)); return (row << thePacking.row_shift) | (col << thePacking.column_shift) | (adc << thePacking.adc_shift); } constexpr uint32_t pixelToChannel(int row, int col) { - constexpr pixelchanelidentifierimpl::Packing thePacking = packing(); + constexpr pixelchannelidentifierimpl::Packing thePacking = packing(); return (row << thePacking.column_width) | col; } From be5e9e9fe6da400647c37c9bbc9eb0fbe9e47a77 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 13 Sep 2021 13:56:58 +0200 Subject: [PATCH 549/923] more safe solution --- SimG4Core/Application/interface/RunManagerMT.h | 2 -- SimG4Core/Application/src/RunManagerMT.cc | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/SimG4Core/Application/interface/RunManagerMT.h b/SimG4Core/Application/interface/RunManagerMT.h index a290b6c93ae49..f4951faaadc56 100644 --- a/SimG4Core/Application/interface/RunManagerMT.h +++ b/SimG4Core/Application/interface/RunManagerMT.h @@ -33,7 +33,6 @@ class G4MTRunManagerKernel; class G4Run; class G4Event; class G4StateManager; -class G4GeometryManager; class RunAction; class SimRunInterface; @@ -91,7 +90,6 @@ class RunManagerMT { RunAction* m_userRunAction; G4Run* m_currentRun; G4StateManager* m_stateManager; - G4GeometryManager* m_geometryManager; std::unique_ptr m_runInterface; diff --git a/SimG4Core/Application/src/RunManagerMT.cc b/SimG4Core/Application/src/RunManagerMT.cc index 8e09106a61b88..b8e95a45a5ac5 100644 --- a/SimG4Core/Application/src/RunManagerMT.cc +++ b/SimG4Core/Application/src/RunManagerMT.cc @@ -87,7 +87,6 @@ RunManagerMT::RunManagerMT(edm::ParameterSet const& p) m_kernel = new G4MTRunManagerKernel(); m_stateManager = G4StateManager::GetStateManager(); m_stateManager->SetExceptionHandler(new ExceptionHandler()); - m_geometryManager->G4GeometryManager::GetInstance(); m_check = p.getUntrackedParameter("CheckGeometry", false); } @@ -266,9 +265,7 @@ void RunManagerMT::Connect(RunAction* runAction) { } void RunManagerMT::stopG4() { - if (nullptr != m_geometryManager) { - m_geometryManager->OpenGeometry(); - } + G4GeometryManager::GetInstance()->OpenGeometry(); m_stateManager->SetNewState(G4State_Quit); if (!m_runTerminated) { terminateRun(); @@ -281,7 +278,7 @@ void RunManagerMT::terminateRun() { delete m_userRunAction; m_userRunAction = nullptr; } - if (nullptr != m_kernel && !m_runTerminated) { + if (!m_runTerminated) { m_kernel->RunTermination(); } m_runTerminated = true; From 77f75413cf0dc2be5e493706800072a7a719ec9d Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Mon, 13 Sep 2021 14:52:51 +0200 Subject: [PATCH 550/923] Use default destructor. --- RecoMET/METFilters/plugins/EcalDeadCellDeltaRFilter.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/RecoMET/METFilters/plugins/EcalDeadCellDeltaRFilter.cc b/RecoMET/METFilters/plugins/EcalDeadCellDeltaRFilter.cc index e00a1e71aa369..1c508cd009d8f 100644 --- a/RecoMET/METFilters/plugins/EcalDeadCellDeltaRFilter.cc +++ b/RecoMET/METFilters/plugins/EcalDeadCellDeltaRFilter.cc @@ -87,7 +87,7 @@ class EcalDeadCellDeltaRFilter : public edm::stream::EDFilter<> { public: explicit EcalDeadCellDeltaRFilter(const edm::ParameterSet &); - ~EcalDeadCellDeltaRFilter() override; + ~EcalDeadCellDeltaRFilter() override = default; private: bool filter(edm::Event &, const edm::EventSetup &) override; @@ -226,8 +226,6 @@ EcalDeadCellDeltaRFilter::EcalDeadCellDeltaRFilter(const edm::ParameterSet &iCon produces(); } -EcalDeadCellDeltaRFilter::~EcalDeadCellDeltaRFilter() {} - void EcalDeadCellDeltaRFilter::envSet(const edm::EventSetup &iSetup) { if (debug_) std::cout << "***envSet***" << std::endl; From bee833766394943c53321ca93b9698ddfa7ab591 Mon Sep 17 00:00:00 2001 From: yuanchao Date: Mon, 13 Sep 2021 20:53:28 +0800 Subject: [PATCH 551/923] Remove unused headers for phys/event filter packages --- .../DTRawToDigi/interface/DTROS25Data.h | 61 - .../ESRawToDigi/interface/ESCrcKchipFast.h | 50 - .../interface/ECALUnpackerException.h | 32 - .../EcalRawToDigi/interface/MyWatcher.h | 43 - .../RPCRawToDigi/interface/RPCRawSynchro.h | 1 - EventFilter/Utilities/interface/ModuleWeb.h | 51 - EventFilter/Utilities/interface/config_json.h | 43 - .../interface/BPHMuonChargeSelect.h | 54 - .../interface/BPHParticleChargeSelect.h | 73 - IOPool/Common/interface/CustomStreamer.h | 58 - .../interface/BoxNDScanner.h | 172 -- .../interface/MultivariateFunctorScanner.h | 77 - .../interface/rescanArray.h | 122 -- .../interface/CorrectedMETProducerT.h | 110 -- PhysicsTools/FWLite/interface/WSelectorFast.h | 87 - .../MVAComputer/interface/MVAModuleHelper.h | 160 -- .../interface/WPlusJetsEventSelector.h | 2 - PhysicsTools/PatUtils/interface/JetSelector.h | 67 - .../PatUtils/interface/JetSelector.icc | 63 - .../PatUtils/interface/PatSelectorByFlags.h | 19 - PhysicsTools/PatUtils/interface/RefHelper.h | 130 -- .../SelectorUtils/interface/Variables.h | 16 - .../UtilAlgos/interface/DummyMatchSelector.h | 26 - .../UtilAlgos/interface/EventSelector.h | 1 - .../UtilAlgos/interface/MCMatchSelector.h | 43 - .../UtilAlgos/interface/NtpProducer.h | 74 - .../interface/SelectedOutputCollectionTrait.h | 49 - .../UtilAlgos/interface/SelectionAdderTrait.h | 147 -- .../UtilAlgos/interface/StoreContainerTrait.h | 39 - .../UtilAlgos/interface/TwoObjectCalculator.h | 16 - .../Utilities/interface/GammaPropagator.h | 16 - .../Utilities/interface/GammaZInterference.h | 30 - PhysicsTools/Utilities/interface/Number.h | 15 - PhysicsTools/Utilities/interface/ZLineShape.h | 29 - .../TopTools/interface/TopologyWorker.h | 1718 ----------------- .../interface/CurvilinearJacobian.h | 25 - .../GsfTools/interface/GaussianSumUtilities.h | 154 -- .../interface/GaussianSumUtilities.icc | 573 ------ .../PatternTools/interface/MediumProperties.h | 7 - TrackingTools/Records/interface/Records.h | 5 - 40 files changed, 4458 deletions(-) delete mode 100644 EventFilter/DTRawToDigi/interface/DTROS25Data.h delete mode 100644 EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h delete mode 100644 EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h delete mode 100644 EventFilter/EcalRawToDigi/interface/MyWatcher.h delete mode 100644 EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h delete mode 100644 EventFilter/Utilities/interface/ModuleWeb.h delete mode 100644 EventFilter/Utilities/interface/config_json.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h delete mode 100644 IOPool/Common/interface/CustomStreamer.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/rescanArray.h delete mode 100644 JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h delete mode 100644 PhysicsTools/FWLite/interface/WSelectorFast.h delete mode 100644 PhysicsTools/MVAComputer/interface/MVAModuleHelper.h delete mode 100644 PhysicsTools/PatExamples/interface/WPlusJetsEventSelector.h delete mode 100644 PhysicsTools/PatUtils/interface/JetSelector.h delete mode 100644 PhysicsTools/PatUtils/interface/JetSelector.icc delete mode 100644 PhysicsTools/PatUtils/interface/PatSelectorByFlags.h delete mode 100644 PhysicsTools/PatUtils/interface/RefHelper.h delete mode 100644 PhysicsTools/SelectorUtils/interface/Variables.h delete mode 100644 PhysicsTools/UtilAlgos/interface/DummyMatchSelector.h delete mode 100644 PhysicsTools/UtilAlgos/interface/EventSelector.h delete mode 100644 PhysicsTools/UtilAlgos/interface/MCMatchSelector.h delete mode 100755 PhysicsTools/UtilAlgos/interface/NtpProducer.h delete mode 100755 PhysicsTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h delete mode 100755 PhysicsTools/UtilAlgos/interface/SelectionAdderTrait.h delete mode 100755 PhysicsTools/UtilAlgos/interface/StoreContainerTrait.h delete mode 100644 PhysicsTools/UtilAlgos/interface/TwoObjectCalculator.h delete mode 100644 PhysicsTools/Utilities/interface/GammaPropagator.h delete mode 100644 PhysicsTools/Utilities/interface/GammaZInterference.h delete mode 100644 PhysicsTools/Utilities/interface/Number.h delete mode 100644 PhysicsTools/Utilities/interface/ZLineShape.h delete mode 100644 TopQuarkAnalysis/TopTools/interface/TopologyWorker.h delete mode 100644 TrackingTools/AnalyticalJacobians/interface/CurvilinearJacobian.h delete mode 100644 TrackingTools/GsfTools/interface/GaussianSumUtilities.h delete mode 100644 TrackingTools/GsfTools/interface/GaussianSumUtilities.icc delete mode 100644 TrackingTools/PatternTools/interface/MediumProperties.h delete mode 100644 TrackingTools/Records/interface/Records.h diff --git a/EventFilter/DTRawToDigi/interface/DTROS25Data.h b/EventFilter/DTRawToDigi/interface/DTROS25Data.h deleted file mode 100644 index 57ea5ecaa1df0..0000000000000 --- a/EventFilter/DTRawToDigi/interface/DTROS25Data.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef DTRawToDigi_DTROS25Data_h -#define DTRawToDigi_DTROS25Data_h - -/** \class DTROS25Data - * The collection containing DT ROS25 status data. - * - * \author M. Zanetti - INFN Padova - */ - -#include - -#include - - -typedef std::pair DTTDCData; - -class DTROS25Data { - -public: - - /// Constructors - DTROS25Data(int ROSId = 0): theROSId(ROSId) {} - - - /// Destructor - virtual ~DTROS25Data() {} - - /// Setters - inline void setROSId(const int & ID) { theROSId = ID; } - - inline void addROSTrailer( const DTROSTrailerWord & word) { theROSTrailers.push_back(word); } - inline void addROSError( const DTROSErrorWord & word) { theROSErrors.push_back(word); } - inline void addROSDebug( const DTROSDebugWord & word) { theROSDebugs.push_back(word); } - inline void addROBTrailer( const DTROBTrailerWord & word) { theROBTrailers.push_back(word); } - inline void addTDCMeasurement( const DTTDCMeasurementWord & word) { theTDCMeasurements.push_back(word); } - inline void addTDCData( const DTTDCData & tdcData) { theTDCData.push_back(tdcData); } - - /// Getters - inline int getROSID() const { return theROSId; } - - inline const std::vector& getROSTrailers() const {return theROSTrailers;} - inline const std::vector& getROSErrors() const {return theROSErrors;} - inline const std::vector& getROSDebugs() const {return theROSDebugs;} - inline const std::vector& getROBTrailers() const {return theROBTrailers;} - inline const std::vector& getTDCMeasurements() const {return theTDCMeasurements;} - inline const std::vector& getTDCData() const {return theTDCData;} - -private: - - int theROSId; - - std::vector theROSTrailers; - std::vector theROSErrors; - std::vector theROSDebugs; - std::vector theROBTrailers; - std::vector theTDCMeasurements; - std::vector theTDCData; - -}; - -#endif diff --git a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h b/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h deleted file mode 100644 index 206cbc5c734dc..0000000000000 --- a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef ESCrcKchipFast_H -#define ESCrcKchipFast_H - -#include - -class ESCrcKchipFast { - - private : - - uint32_t crc; - - public: - - ESCrcKchipFast() { - init(); - reset() ; - }; - - void init() { - crc = 0x0ffff ; - } - - void reset() { - crc = 0x0ffff ; - } ; - - void add(unsigned int data) { - for (int i=0;i<16;i++) - { - if ((crc&0x0001) == (data&0x0001)) - crc=crc>>1; - else - crc=(crc>>1)^0x8408; // flipped 0x1021; - data=(data>>1); - } - }; - - uint32_t get_crc() { - return crc ; - }; - - bool isCrcOk(unsigned int crcin=0x0000) { - return ((get_crc()==crcin) ? true : false ); - }; - - ~ESCrcKchipFast() { } ; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h b/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h deleted file mode 100644 index a9f1e57d0cdb2..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h +++ /dev/null @@ -1,32 +0,0 @@ -// Date : 30/05/2005 -// Author : N.Almeida (LIP) - -#ifndef ECALUNPACKEREXCEPTION_H -#define ECALUNPACKEREXCEPTION_H - -#include -#include -#include - - -class ECALUnpackerException { - public : - - /** - * Constructor - */ - ECALUnpackerException(std::ostringstream a){ info_=a.str(); } - - ECALUnpackerException(std::string a){info_=a;} - /** - * Exception's discription - */ - std::string what() const throw() { return info_;} - - protected : - - std::string info_; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/MyWatcher.h b/EventFilter/EcalRawToDigi/interface/MyWatcher.h deleted file mode 100644 index 5d26a0df24808..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/MyWatcher.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MyWATCHER_H -#define MyWATCHER_H - -#include "TStopwatch.h" -#include -#include - -#ifdef EDM_ML_DEBUG -class MyWatcher : public TStopwatch { - public: - MyWatcher(const std::string n=""):name(n),total(0) {} - ~MyWatcher(){} - - std::string start(bool r=true){Start(r); return " [Start]";} - std::string continu(){Continue(); return " [Continue]";} - std::string reset(){Reset(); return " [Reset]";} - std::string stop() {Stop(); return " [Stop]";} - std::string lap() { - std::stringstream o; - double r=RealTime(); - total+=r; - o<<"\n "< -#include -#include - - - - namespace evf - { - - - namespace moduleweb { - class ForkParams { - public: - ForkParams():slotId(-1),restart(0),isMaster(-1){} - int slotId; - bool restart; - int isMaster; - }; - class ForkInfoObj { - public: - ForkInfoObj() - { - control_sem_ = new sem_t; - sem_init(control_sem_,0,0); - stopCondition=0; - receivedStop_=false; - } - ~ForkInfoObj() - { - sem_destroy(control_sem_); - delete control_sem_; - } - void lock() {if (mst_lock_) pthread_mutex_lock(mst_lock_);} - void unlock() {if (mst_lock_) pthread_mutex_unlock(mst_lock_);} - void (*forkHandler) (void *); - ForkParams forkParams; - unsigned int stopCondition; - bool receivedStop_; - sem_t *control_sem_; - pthread_mutex_t * mst_lock_; - void * fuAddr; - }; - } - -} -#endif diff --git a/EventFilter/Utilities/interface/config_json.h b/EventFilter/Utilities/interface/config_json.h deleted file mode 100644 index 5d334cbc5e6b9..0000000000000 --- a/EventFilter/Utilities/interface/config_json.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef JSON_CONFIG_H_INCLUDED -# define JSON_CONFIG_H_INCLUDED - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 -/// If defined, indicates that Json specific container should be used -/// (hash table & simple deque container with customizable allocator). -/// THIS FEATURE IS STILL EXPERIMENTAL! -//# define JSON_VALUE_USE_INTERNAL_MAP 1 -/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. -/// The memory pools allocator used optimization (initializing Value and ValueInternalLink -/// as if it was a POD) that may cause some validation tool to report errors. -/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. -//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 - -/// If defined, indicates that Json use exception to report invalid type manipulation -/// instead of C assert macro. -# define JSON_USE_EXCEPTION 1 - -# ifdef JSON_IN_CPPTL -# include -# ifndef JSON_USE_CPPTL -# define JSON_USE_CPPTL 1 -# endif -# endif - -# ifdef JSON_IN_CPPTL -# define JSON_API CPPTL_API -# elif defined(JSON_DLL_BUILD) -# define JSON_API __declspec(dllexport) -# elif defined(JSON_DLL) -# define JSON_API __declspec(dllimport) -# else -# define JSON_API -# endif - -#endif // JSON_CONFIG_H_INCLUDED diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h deleted file mode 100644 index 3f7d574ed79fc..0000000000000 --- a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h -#define HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h -/** \class BPHMuonChargeSelect - * - * Description: - * Class for muon selection by charge - * - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "DataFormats/PatCandidates/interface/Muon.h" - -//--------------- -// C++ Headers -- -//--------------- - -// --------------------- -// -- Class Interface -- -// --------------------- - -class BPHMuonChargeSelect : public BPHParticleChargeSelect { -public: - /** Constructor - */ - BPHMuonChargeSelect(int c) : BPHParticleChargeSelect(c) {} - - // deleted copy constructor and assignment operator - BPHMuonChargeSelect(const BPHMuonChargeSelect& x) = delete; - BPHMuonChargeSelect& operator=(const BPHMuonChargeSelect& x) = delete; - - /** Destructor - */ - ~BPHMuonChargeSelect() override {} - - /** Operations - */ - /// select muon - bool accept(const reco::Candidate& cand) const override { - if (dynamic_cast(&cand) == nullptr) - return false; - return BPHParticleChargeSelect::accept(cand); - }; -}; - -#endif diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h deleted file mode 100644 index e85f05677bad2..0000000000000 --- a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h -#define HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h -/** \class BPHParticleChargeSelect - * - * Description: - * Class for particle selection by charge - * - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoSelect.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" - -//--------------- -// C++ Headers -- -//--------------- - -// --------------------- -// -- Class Interface -- -// --------------------- - -class BPHParticleChargeSelect : public BPHRecoSelect { -public: - /** Constructor - */ - BPHParticleChargeSelect(int c) : charge(c ? (c > 0 ? 1 : -1) : 0) {} - - // deleted copy constructor and assignment operator - BPHParticleChargeSelect(const BPHParticleChargeSelect& x) = delete; - BPHParticleChargeSelect& operator=(const BPHParticleChargeSelect& x) = delete; - - /** Destructor - */ - ~BPHParticleChargeSelect() override {} - - /** Operations - */ - /// select particle - bool accept(const reco::Candidate& cand) const override { - switch (charge) { - default: - case 0: - return (cand.charge() != 0); - case 1: - return (cand.charge() > 0); - case -1: - return (cand.charge() < 0); - } - return true; - }; - - /// set selection charge - void setCharge(int c) { - charge = (c ? (c > 0 ? 1 : -1) : 0); - return; - } - - /// get selection charge - double getCharge() const { return charge; } - -private: - int charge; -}; - -#endif diff --git a/IOPool/Common/interface/CustomStreamer.h b/IOPool/Common/interface/CustomStreamer.h deleted file mode 100644 index 5f07f3e7fd904..0000000000000 --- a/IOPool/Common/interface/CustomStreamer.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef IOPool_Common_CustomStreamer_h -#define IOPool_Common_CustomStreamer_h - -#include -#include "TClass.h" -#include "TClassStreamer.h" -#include "TClassRef.h" -#include "FWCore/Utilities/interface/TypeID.h" -#include "TBuffer.h" - -namespace edm { - template - class CustomStreamer : public TClassStreamer { - public: - typedef T element_type; - CustomStreamer(); - void operator() (TBuffer &R__b, void *objp); - private: - std::string className_; - TClassRef cl_; - }; - - template - CustomStreamer::CustomStreamer() : - className_(TypeID(typeid(T)).className()), - cl_(className_.c_str()) - {} - - template - void - CustomStreamer::operator()(TBuffer &R__b, void *objp) { - if (R__b.IsReading()) { - cl_->ReadBuffer(R__b, objp); - } else { - cl_->WriteBuffer(R__b, objp); - } - } - - template - void - SetCustomStreamer() { - TClass *cl = TClass::GetClass(typeid(T)); - if (cl->GetStreamer() == 0) { - cl->AdoptStreamer(new CustomStreamer()); - } - } - - template - void - SetCustomStreamer(T const&) { - TClass *cl = TClass::GetClass(typeid(T)); - if (cl->GetStreamer() == 0) { - cl->AdoptStreamer(new CustomStreamer()); - } - } -} - -#endif diff --git a/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h b/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h deleted file mode 100644 index 44d32c6b037da..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef NPSTAT_BOXNDSCANNER_HH_ -#define NPSTAT_BOXNDSCANNER_HH_ - -/*! -// \file BoxNDScanner.h -// -// \brief Iteration over uniformly spaced coordinates inside -// a multidimensional box -// -// Author: I. Volobouev -// -// March 2010 -*/ - -#include "JetMETCorrections/InterpolationTables/interface/BoxND.h" - -namespace npstat { - /** - * A class for iterating over all coordinates in a multidimensional box - * (but not a full-fledeged iterator). The expected usage pattern is as - * follows: - * - * @code - * double* coords = ... (the buffer size should be at least box.dim()) - * for (BoxNDScanner scan(box,shape); scan.isValid(); ++scan) - * { - * scan.getCoords(coords, coordsBufferSize); - * .... Do what is necessary with coordinates .... - * .... Extract linear bin number: .............. - * scan.state(); - * } - * @endcode - * - * The coordinates will be in the middle of the bins (imagine - * a multivariate histogram with boundaries defined by the given box). - */ - template - class BoxNDScanner - { - public: - //@{ - /** - // Constructor from a bounding box and a multidimensional - // array shape - */ - inline BoxNDScanner(const BoxND& box, - const std::vector& shape) - : box_(box), state_(0UL) - {initialize(shape.empty() ? static_cast(0) : - &shape[0], shape.size());} - - inline BoxNDScanner(const BoxND& box, - const unsigned* shape, const unsigned lenShape) - : box_(box), state_(0UL) {initialize(shape, lenShape);} - //@} - - /** Dimensionality of the scan */ - inline unsigned dim() const {return box_.dim();} - - /** Retrieve current state (i.e., linear index of the scan) */ - inline unsigned long state() const {return state_;} - - /** Maximum possible state (i.e., linear index of the scan) */ - inline unsigned long maxState() const {return maxState_;} - - /** Returns false when iteration is complete */ - inline bool isValid() const {return state_ < maxState_;} - - /** Retrieve current coordinates inside the box */ - void getCoords(Numeric* x, unsigned nx) const; - - /** Retrieve current multidimensional index */ - void getIndex(unsigned* index, unsigned indexBufferLen) const; - - /** Reset the state (as if the object has just been constructed) */ - inline void reset() {state_ = 0UL;} - - /** Prefix increment */ - inline BoxNDScanner& operator++() - {if (state_ < maxState_) ++state_; return *this;} - - /** Postfix increment (distinguished by the dummy "int" parameter) */ - inline void operator++(int) {if (state_ < maxState_) ++state_;} - - /** Set the state directly */ - inline void setState(const unsigned long state) - {state_ = state <= maxState_ ? state : maxState_;} - - private: - BoxNDScanner(); - - void initialize(const unsigned* shape, unsigned lenShape); - - BoxND box_; - std::vector strides_; - std::vector bw_; - unsigned long state_; - unsigned long maxState_; - }; -} - -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -namespace npstat { - template - void BoxNDScanner::initialize(const unsigned* shape, - const unsigned dim) - { - if (!(dim && box_.dim() == dim)) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::initialize: incompatible scan shape"); - assert(shape); - for (unsigned j=0; j0; --j) - strides_[j - 1] = strides_[j]*shape[j]; - maxState_ = strides_[0]*shape[0]; - - bw_.reserve(dim); - for (unsigned j=0; j - void BoxNDScanner::getCoords(Numeric* x, const unsigned nx) const - { - const unsigned dim = strides_.size(); - if (nx < dim) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::getCoords: " - "insufficient length of the output buffer"); - if (state_ >= maxState_) throw npstat::NpstatRuntimeError( - "In npstat::BoxNDScanner::getCoords: invalid scanner state"); - assert(x); - - unsigned long l = state_; - for (unsigned i=0; i - void BoxNDScanner::getIndex(unsigned* ix, const unsigned nx) const - { - const unsigned dim = strides_.size(); - if (nx < dim) throw npstat::NpstatInvalidArgument( - "In npstat::BoxNDScanner::getIndex: " - "insufficient length of the output buffer"); - if (state_ >= maxState_) throw npstat::NpstatRuntimeError( - "In npstat::BoxNDScanner::getIndex: invalid scanner state"); - assert(ix); - - unsigned long l = state_; - for (unsigned i=0; i(idx); - l -= (idx * strides_[i]); - } - } -} - - -#endif // NPSTAT_BOXNDSCANNER_HH_ - diff --git a/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h b/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h deleted file mode 100644 index c34494d45b63e..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ -#define NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ - -/*! -// \file MultivariateFunctorScanner.h -// -// \brief Adapts any AbsMultivariateFunctor for use with ArrayND method -// "functorFill" -// -// Author: I. Volobouev -// -// July 2012 -*/ - -#include -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -#include "JetMETCorrections/InterpolationTables/interface/AbsMultivariateFunctor.h" - -namespace npstat { - /** - // This class adapts an object derived from AbsMultivariateFunctor - // so that it can be used with ArrayND method "functorFill" and such - */ - template - class MultivariateFunctorScanner - { - public: - /** - // A mapper for each coordinate in the "maps" argument will - // convert the array index into a proper argument for the scanned - // density. - // - // This functor will NOT make copies of either "fcn" or "maps" - // parameters. These parameters will be used by reference only - // (aliased). It is up to the user of this class to ensure proper - // lifetime of these objects. - */ - inline MultivariateFunctorScanner(const AbsMultivariateFunctor& fcn, - const std::vector& maps) - : fcn_(fcn), mapping_(maps), buf_(fcn.minDim()), dim_(fcn.minDim()) - { - if (!(dim_ && dim_ == maps.size())) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner constructor: " - "incompatible arguments"); - if (dim_ != fcn.maxDim()) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner constructor: " - "functors of variable dimensionality are not supported"); - } - - /** Calculate the functor value for the given array indices */ - inline double operator()(const unsigned* index, - const unsigned indexLen) const - { - if (dim_ != indexLen) throw npstat::NpstatInvalidArgument( - "In npstat::MultivariateFunctorScanner::operator(): " - "incompatible input point dimensionality"); - assert(index); - double* x = &buf_[0]; - for (unsigned i=0; i& mapping_; - mutable std::vector buf_; - unsigned dim_; - }; -} - -#endif // NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ - diff --git a/JetMETCorrections/InterpolationTables/interface/rescanArray.h b/JetMETCorrections/InterpolationTables/interface/rescanArray.h deleted file mode 100644 index 08742b7113908..0000000000000 --- a/JetMETCorrections/InterpolationTables/interface/rescanArray.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef NPSTAT_RESCANARRAY_HH_ -#define NPSTAT_RESCANARRAY_HH_ - -/*! -// \file rescanArray.h -// -// \brief Fill a multidimensional array using values from another array -// with a different shape -// -// Author: I. Volobouev -// -// October 2010 -*/ - -#include "JetMETCorrections/InterpolationTables/interface/ArrayND.h" - -namespace npstat { - /** - // A utility for filling one array using values of another. The - // array shapes do not have to be the same but the ranks have to be. - // Roughly, the arrays are treated as values of histogram bins inside - // the unit box. The array "to" is filled either with the closest bin - // value of the array "from" or with an interpolated value (if - // "interpolationDegree" parameter is not 0). - // - // interpolationDegree parameter must be one of 0, 1, or 3. - */ - template - void rescanArray(const ArrayND& from, - ArrayND* to, - unsigned interpolationDegree=0); -} - -#include -#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" - -#include "JetMETCorrections/InterpolationTables/interface/LinearMapper1d.h" - -namespace npstat { - namespace Private { - template - class ArrayMapper - { - public: - ArrayMapper(const ArrayND& from, - const ArrayND& to, - const unsigned interpolationDegree) - : mapped_(from.rank()), - from_(from), - dim_(from.rank()), - ideg_(interpolationDegree) - { - assert(dim_ == to.rank()); - if (dim_) - { - mappers_.reserve(dim_); - for (unsigned i=0; i mappers_; - mutable std::vector mapped_; - const ArrayND& from_; - unsigned dim_; - unsigned ideg_; - }; - } - - template - void rescanArray(const ArrayND& from, - ArrayND* to, - const unsigned interpolationDegree) - { - assert(to); - if (from.rank() != to->rank()) throw npstat::NpstatInvalidArgument( - "In npstat::rescanArray: incompatible dimensionalities " - "of input and output arrays"); - if (!(interpolationDegree == 0U || - interpolationDegree == 1U || - interpolationDegree == 3U)) throw npstat::NpstatInvalidArgument( - "In npstat::rescanArray: unsupported interpolation degree"); - to->functorFill(Private::ArrayMapper( - from, *to, interpolationDegree)); - } -} - - -#endif // NPSTAT_RESCANARRAY_HH_ - diff --git a/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h b/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h deleted file mode 100644 index 298d28b228224..0000000000000 --- a/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef JetMETCorrections_Type1MET_CorrectedMETProducer_h -#define JetMETCorrections_Type1MET_CorrectedMETProducer_h - -/** \class CorrectedMETProducerT - * - * Produce MET collections with Type 1 / Type 1 + 2 corrections applied - * - * NOTE: This file defines the generic template. - * Concrete instances for CaloMET and PFMET are defined in - * JetMETCorrections/Type1MET/plugins/CorrectedCaloMETProducer.cc - * JetMETCorrections/Type1MET/plugins/CorrectedPFMETProducer.cc - * - * \authors Michael Schmitt, Richard Cavanaugh, The University of Florida - * Florent Lacroix, University of Illinois at Chicago - * Christian Veelken, LLR - * - * - * - */ - -#include "FWCore/Framework/interface/stream/EDProducer.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 "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "JetMETCorrections/Type1MET/interface/METCorrectionAlgorithm.h" -#include "DataFormats/METReco/interface/CorrMETData.h" -#include "DataFormats/Candidate/interface/Candidate.h" - -#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" - -#include - -namespace CorrectedMETProducer_namespace { - template - reco::Candidate::LorentzVector correctedP4(const T& rawMEt, const CorrMETData& correction) { - double correctedMEtPx = rawMEt.px() + correction.mex; - double correctedMEtPy = rawMEt.py() + correction.mey; - double correctedMEtPt = sqrt(correctedMEtPx * correctedMEtPx + correctedMEtPy * correctedMEtPy); - return reco::Candidate::LorentzVector(correctedMEtPx, correctedMEtPy, 0., correctedMEtPt); - } - - template - double correctedSumEt(const T& rawMEt, const CorrMETData& correction) { - return rawMEt.sumEt() + correction.sumet; - } - - template - class CorrectedMETFactoryT { - public: - T operator()(const T&, const CorrMETData&) const { - assert(0); // "place-holder" for template instantiations for concrete T types only, **not** to be called - } - }; -} // namespace CorrectedMETProducer_namespace - -template -class CorrectedMETProducerT : public edm::stream::EDProducer<> { - typedef std::vector METCollection; - -public: - explicit CorrectedMETProducerT(const edm::ParameterSet& cfg) - : moduleLabel_(cfg.getParameter("@module_label")), algorithm_(0) { - token_ = consumes(cfg.getParameter("src")); - - algorithm_ = new METCorrectionAlgorithm(cfg, consumesCollector()); - - produces(""); - } - ~CorrectedMETProducerT() { delete algorithm_; } - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("corrPfMetType1", "type1")); - descriptions.add(defaultModuleLabel >(), desc); - } - -private: - void produce(edm::Event& evt, const edm::EventSetup& es) { - std::unique_ptr correctedMEtCollection(new METCollection); - - edm::Handle rawMEtCollection; - evt.getByToken(token_, rawMEtCollection); - - for (typename METCollection::const_iterator rawMEt = rawMEtCollection->begin(); rawMEt != rawMEtCollection->end(); - ++rawMEt) { - CorrMETData correction = algorithm_->compMETCorrection(evt); - - static const CorrectedMETProducer_namespace::CorrectedMETFactoryT correctedMET_factory{}; - T correctedMEt = correctedMET_factory(*rawMEt, correction); - - correctedMEtCollection->push_back(correctedMEt); - } - - //--- add collection of MET objects with Type 1 / Type 1 + 2 corrections applied to the event - evt.put(std::move(correctedMEtCollection)); - } - - std::string moduleLabel_; - - edm::EDGetTokenT token_; - - METCorrectionAlgorithm* algorithm_; // algorithm for computing Type 1 / Type 1 + 2 MET corrections -}; - -#endif diff --git a/PhysicsTools/FWLite/interface/WSelectorFast.h b/PhysicsTools/FWLite/interface/WSelectorFast.h deleted file mode 100644 index 9b9f923e7914f..0000000000000 --- a/PhysicsTools/FWLite/interface/WSelectorFast.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef PhysicsTools_FWLite_WSelectorFast_h -#define PhysicsTools_FWLite_WSelectorFast_h -#include "DataFormats/PatCandidates/interface/MET.h" -#include "DataFormats/PatCandidates/interface/Muon.h" -#include "PhysicsTools/SelectorUtils/interface/EventSelector.h" - -/** - \class WSelector WSelector.h "PhysicsTools/FWLite/interface/WSelector.h" - \brief Example class of an EventSelector to apply a simple W Boson selection - - Example class for of an EventSelector as defined in the SelectorUtils package. - EventSelectors may be used to facilitate cutflows and to implement selections - independent from the event loop in FWLite or full framework. -*/ - -class WSelectorFast : public EventSelector { -public: - /// constructor - WSelectorFast(edm::ParameterSet const& params) - : muonSrc_(params.getParameter("muonSrc")), metSrc_(params.getParameter("metSrc")) { - double muonPtMin = params.getParameter("muonPtMin"); - double metMin = params.getParameter("metMin"); - push_back("Muon Pt", muonPtMin); - push_back("MET", metMin); - set("Muon Pt"); - set("MET"); - wMuon_ = 0; - met_ = 0; - if (params.exists("cutsToIgnore")) { - setIgnoredCuts(params.getParameter >("cutsToIgnore")); - } - retInternal_ = getBitTemplate(); - } - /// destructor - virtual ~WSelectorFast() {} - /// return muon candidate of W boson - pat::Muon const& wMuon() const { return *wMuon_; } - /// return MET of W boson - pat::MET const& met() const { return *met_; } - - /// here is where the selection occurs - virtual bool operator()(edm::EventBase const& event, pat::strbitset& ret) { - ret.set(false); - // Handle to the muon collection - edm::Handle > muons; - // Handle to the MET collection - edm::Handle > met; - // get the objects from the event - bool gotMuons = event.getByLabel(muonSrc_, muons); - bool gotMET = event.getByLabel(metSrc_, met); - // get the MET, require to be > minimum - if (gotMET) { - met_ = &met->at(0); - if (met_->pt() > cut(metIndex_, double()) || ignoreCut(metIndex_)) - passCut(ret, metIndex_); - } - // get the highest pt muon, require to have pt > minimum - if (gotMuons) { - if (!ignoreCut(muonPtIndex_)) { - if (muons->size() > 0) { - wMuon_ = &muons->at(0); - if (wMuon_->pt() > cut(muonPtIndex_, double()) || ignoreCut(muonPtIndex_)) - passCut(ret, muonPtIndex_); - } - } else { - passCut(ret, muonPtIndex_); - } - } - setIgnored(ret); - return (bool)ret; - } - -protected: - /// muon input - edm::InputTag muonSrc_; - /// met input - edm::InputTag metSrc_; - /// muon candidate from W boson - pat::Muon const* wMuon_; - /// MET from W boson - pat::MET const* met_; - /// index for muon Pt cut - index_type muonPtIndex_; - /// index for MET cut - index_type metIndex_; -}; -#endif // PhysicsTools_FWLite_WSelectorFast_h diff --git a/PhysicsTools/MVAComputer/interface/MVAModuleHelper.h b/PhysicsTools/MVAComputer/interface/MVAModuleHelper.h deleted file mode 100644 index d0cc993c87ac9..0000000000000 --- a/PhysicsTools/MVAComputer/interface/MVAModuleHelper.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef PhysicsTools_MVAComputer_MVAModuleHelper_h -#define PhysicsTools_MVAComputer_MVAModuleHelper_h -// -*- C++ -*- -// -// Package: MVAComputer -// Class : MVAModuleHelper -// - -// -// Author: Christophe Saout -// Created: Sat Apr 24 15:18 CEST 2007 -// - -#include -#include -#include -#include -#include -#include -#include - -#include "FWCore/Framework/interface/EventSetup.h" - -#include "PhysicsTools/MVAComputer/interface/AtomicId.h" -#include "PhysicsTools/MVAComputer/interface/Calibration.h" -#include "PhysicsTools/MVAComputer/interface/MVAComputerCache.h" -#include "CondFormats/PhysicsToolsObjects/interface/MVAComputer.h" - -namespace PhysicsTools { - - /** \class MVAModuleHelperDefaultFiller - * - * \short Default template for MVAModuleHelper "Filler" template argument - * - * Simply calls a "double compute(const AtomicID &name) const" method - * on the object for each variable requested. - * - ************************************************************/ - template - struct MVAModuleHelperDefaultFiller { - MVAModuleHelperDefaultFiller(const PhysicsTools::AtomicId &name) {} - - double operator()(const Object &object, const PhysicsTools::AtomicId &name) { return object.compute(name); } - }; - - /** \class MVAModuleHelper - * - * \short Template for automated variable collection and MVA computation in EDM modules - * - * The class MVAModuleHelper can be embedded in EDM modules. It automatically - * collects the variables listed in the MVA training description using type - * traits and passes them on to the computer. The calibration and or trainer - * is automatically collected from the EventSetup. - * - ************************************************************/ - template > - class MVAModuleHelper { - public: - MVAModuleHelper(const std::string &label) : label(label) {} - MVAModuleHelper(const MVAModuleHelper &orig) : label(orig.label) {} - ~MVAModuleHelper() {} - - void setEventSetup(const edm::EventSetup &setup); - void setEventSetup(const edm::EventSetup &setup, const char *esLabel); - - double operator()(const Object &object) const; - - void train(const Object &object, bool target, double weight = 1.0) const; - - private: - void init(const PhysicsTools::Calibration::MVAComputerContainer *container); - - const std::string label; - PhysicsTools::MVAComputerCache cache; - - class Value { - public: - Value(const std::string &name) : name(name), filler(name) {} - Value(const std::string &name, double value) : name(name), filler(name), value(value) {} - - inline bool update(const Object &object) const { - value = filler(object, name); - return !std::isfinite(value); - } - - PhysicsTools::AtomicId getName() const { return name; } - double getValue() const { return value; } - - private: - PhysicsTools::AtomicId name; - Filler filler; - - mutable double value; - }; - - std::vector values; - }; - - template - void MVAModuleHelper::setEventSetup(const edm::EventSetup &setup) { - edm::ESHandle handle; - setup.get().get(handle); - const PhysicsTools::Calibration::MVAComputerContainer *container = handle.product(); - if (cache.update(container, label.c_str()) && cache) - init(container); - } - - template - void MVAModuleHelper::setEventSetup(const edm::EventSetup &setup, const char *esLabel) { - edm::ESHandle handle; - setup.get().get(esLabel, handle); - const PhysicsTools::Calibration::MVAComputerContainer *container = handle.product(); - if (cache.update(container, label.c_str()) && cache) - init(container); - } - - template - void MVAModuleHelper::init(const PhysicsTools::Calibration::MVAComputerContainer *container) { - const std::vector &vars = container->find(label).inputSet; - values.clear(); - for (std::vector::const_iterator iter = vars.begin(); iter != vars.end(); - ++iter) - if (std::strncmp(iter->name.c_str(), "__", 2) != 0) - values.push_back(Value(iter->name)); - } - - template - double MVAModuleHelper::operator()(const Object &object) const { - std::for_each(values.begin(), values.end(), std::bind(&Value::update, std::placeholders::_1, object)); - return cache->eval(values); - } - - template - void MVAModuleHelper::train(const Object &object, bool target, double weight) const { - static const PhysicsTools::AtomicId kTargetId("__TARGET__"); - static const PhysicsTools::AtomicId kWeightId("__WEIGHT__"); - - if (!cache) - return; - - if (std::accumulate( - values.begin(), - values.end(), - 0, - std::bind( - std::plus(), std::placeholders::_1, std::bind(&Value::update, std::placeholders::_2, object)))) - return; - - PhysicsTools::Variable::ValueList list; - list.add(kTargetId, target); - list.add(kWeightId, weight); - for (typename std::vector::const_iterator iter = values.begin(); iter != values.end(); ++iter) - list.add(iter->getName(), iter->getValue()); - - cache->eval(list); - } - -} // namespace PhysicsTools - -#endif // PhysicsTools_MVAComputer_MVAModuleHelper_h diff --git a/PhysicsTools/PatExamples/interface/WPlusJetsEventSelector.h b/PhysicsTools/PatExamples/interface/WPlusJetsEventSelector.h deleted file mode 100644 index 0de02de5f5412..0000000000000 --- a/PhysicsTools/PatExamples/interface/WPlusJetsEventSelector.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning "This has moved to PhysicsTools/SelectorUtils" -#include "PhysicsTools/SelectorUtils/interface/WPlusJetsEventSelector.h" diff --git a/PhysicsTools/PatUtils/interface/JetSelector.h b/PhysicsTools/PatUtils/interface/JetSelector.h deleted file mode 100644 index a3c17dd98a88a..0000000000000 --- a/PhysicsTools/PatUtils/interface/JetSelector.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef PhysicsTools_PatUtils_JetSelector_h -#define PhysicsTools_PatUtils_JetSelector_h - -/** - \class pat::JetSelector JetSelector.h "PhysicsTools/PatUtils/JetSelector.h" - \brief Selects good Jets - - The Jet selector returns a flag (see pat::ParticleStatus) based on one of the possible - selections: either cut-based or custom (user-defined set of cuts). - This is driven by the configuration parameters (see the PATJetCleaner - documentation for configuration details). - - The parameters are passed to the selector through a JetSelection struct. - (An adapter exists for use in CMSSW: - reco::modules::ParameterAdapter>.) - - \author C. Autermann (Uni Hamburg) - \version $Id: JetSelector.h,v 1.4 2008/03/05 14:51:02 fronga Exp $ -**/ - -#include -#include "DataFormats/JetReco/interface/Jet.h" -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/JetReco/interface/PFJet.h" -#include "PhysicsTools/PatUtils/interface/JetSelection.h" -#include "PhysicsTools/PatUtils/interface/CaloJetSelector.h" -#include "DataFormats/Common/interface/ValueMap.h" - -#include "PhysicsTools/PatUtils/interface/ParticleCode.h" - - -namespace pat { - - typedef edm::ValueMap JetValueMap; - - template - class JetSelector { - - - public: - JetSelector( const JetSelection& config ); - ~JetSelector() {} - - /// Returns 0 if Jet matches criteria, a flag otherwise. - /// Criteria depend on the selector's configuration. - /// Jet IDs only need to be provided if selection is based - /// on it (cut, neural net or likelihood). Cluster shapes are for - /// custom selection only. - const ParticleStatus - filter( const unsigned int& index, - const edm::View& Jets, - const JetValueMap* JetMap - ) const; - - - private: - - JetSelection config_; - - std::unique_ptr CaloJetSelector_;///Selects CaloJets - //std::unique_ptr PFSelector_;///Selects PFJets - - }; // class - -} // namespace - -#endif diff --git a/PhysicsTools/PatUtils/interface/JetSelector.icc b/PhysicsTools/PatUtils/interface/JetSelector.icc deleted file mode 100644 index a462b047b54b4..0000000000000 --- a/PhysicsTools/PatUtils/interface/JetSelector.icc +++ /dev/null @@ -1,63 +0,0 @@ - -#include "PhysicsTools/PatUtils/interface/JetSelector.h" -#include "DataFormats/Common/interface/RefToBase.h" - - -//______________________________________________________________________________ -template -pat::JetSelector::JetSelector( const pat::JetSelection& config ) : - config_( config ) -{ - - if (config_.selectionType=="custom") { - CaloJetSelector_ = std::make_unique(config); - //PFJetSelector_ = std::make_unique(config); - } - -} - - -//______________________________________________________________________________ -template -const pat::ParticleStatus -pat::JetSelector::filter( const unsigned int& index, - const edm::View& Jets, - const JetValueMap * JetMap - ) const -{ - - ParticleStatus result = BAD; - - if (config_.selectionType=="none") { - - result = GOOD; - } - else if (config_.selectionType=="JetID" && JetMap!=0) { - const double jetIDresult = (*JetMap)[ Jets.refAt(index) ]; - if ( jetIDresult > config_.value ) result = GOOD; - else result = BAD; - } - else if ( config_.selectionType == "custom" ) { - - const JetType& Jet = Jets[index]; - const reco::CaloJet * caloJet = 0; - const reco::PFJet * pfJet = 0; - caloJet = dynamic_cast(&Jet); - ///specific selection for CaloJets - if (caloJet) result = CaloJetSelector_->filter( *caloJet ); - else { - ///specific selection for PFJets - pfJet = dynamic_cast( &Jet); - //FIXME: not implemented yet! - //if (pfJet) result = PFJetSelector_->filter( *pfJet); - } - - } else - // Throw! unknown configuration - throw edm::Exception(edm::errors::Configuration) - << "Unknown Jet ID selection " << config_.selectionType; - - - return result; -} - diff --git a/PhysicsTools/PatUtils/interface/PatSelectorByFlags.h b/PhysicsTools/PatUtils/interface/PatSelectorByFlags.h deleted file mode 100644 index fcd5d01e519f7..0000000000000 --- a/PhysicsTools/PatUtils/interface/PatSelectorByFlags.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef PhysicsTools_PatUtils_interface_PatSelectorByFlags_h -#define PhysicsTools_PatUtils_interface_PatSelectorByFlags_h - -#include "DataFormats/PatCandidates/interface/Flags.h" - -namespace pat { - class SelectorByFlags { - public: - SelectorByFlags() : mask_(0) { } - SelectorByFlags(uint32_t maskToTest) : mask_(~maskToTest) {} - SelectorByFlags(const std::string &bitToTest) ; - SelectorByFlags(const std::vector bitsToTest) ; - bool operator()(const reco::Candidate &c) const { return pat::Flags::test(c, mask_); } - bool operator()(const reco::Candidate *c) const { return (c == 0 ? false : pat::Flags::test(*c, mask_)); } - private: - uint32_t mask_; - }; -} -#endif diff --git a/PhysicsTools/PatUtils/interface/RefHelper.h b/PhysicsTools/PatUtils/interface/RefHelper.h deleted file mode 100644 index 4756266e9ba40..0000000000000 --- a/PhysicsTools/PatUtils/interface/RefHelper.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef PhysicsTools_PatUtils_RefHelper_h -#define PhysicsTools_PatUtils_RefHelper_h - -#include "DataFormats/Common/interface/Ptr.h" -#include "DataFormats/Common/interface/ValueMap.h" -namespace pat { namespace helper { -/*** \brief A class to help manage references and associative containers in some tricky cases (e.g. selection by copy) -*/ -template -class RefHelper { - public: - typedef typename edm::Ptr Ref; - - /// Constructor taking a ValueMap of back-references daughter => mother. - RefHelper(const edm::ValueMap< Ref > &backRefMap) : backRefMap_(backRefMap) { } - - /// Returns a Ref to the direct parent of "ref", or a null Ref if "ref" is already root - Ref parentOrNull(const Ref &ref) const ; - - /// Returns a Ref to the direct parent of "ref", or "ref" itself if it's already root - Ref parentOrSelf(const Ref &ref) const ; - - /// Climbs back the Ref chain and returns the root of the branch starting from "ref" - Ref ancestorOrSelf(const Ref &ref) const ; - - bool isRoot(const Ref &ref) const ; - - /// true if old is some ancestor of young (it does not have to be the root) - bool isAncestorOf(const Ref &old, const Ref &young) const ; - - /// true if the two share the same root - bool sharedAncestor(const Ref &ref1, const Ref &ref2) const ; - - /// Recursively looks up map to find something associated to ref, or one of its parents. - /// Throws edm::Exception(edm::errors::InvalidReference) if there's no match - template - V recursiveLookup(const SomeRef &ref, const edm::ValueMap &map) const ; - - /// Looks up map to find something associated to the root ancestor of "ref" - /// Throws edm::Exception(edm::errors::InvalidReference) if there's no match - template - V ancestorLookup(const SomeRef &ref, const edm::ValueMap &map) const ; - - private: - const edm::ValueMap< Ref > & backRefMap_; -}; - -template -typename RefHelper::Ref RefHelper::parentOrNull(const RefHelper::Ref &ref) const { - if (backRefMap_.contains(ref.id())) { - try { - return backRefMap_[ref]; - } catch (edm::Exception &e) { - if (e.categoryCode() == edm::errors::InvalidReference) { - return Ref(); - } else { - throw; - } - } - } else { - return Ref(); - } -} - -template -typename RefHelper::Ref RefHelper::parentOrSelf(const RefHelper::Ref &ref) const { - Ref ret = parentOrNull(ref); - return ret.isNonnull() ? ret : ref; -} - -template -typename RefHelper::Ref RefHelper::ancestorOrSelf(const RefHelper::Ref &ref) const { - Ref ret = ref; - do { - Ref test = parentOrNull(ret); - if (test.isNull()) return ret; - ret = test; - } while (true); -} - - -template -bool RefHelper::isRoot(const RefHelper::Ref &ref) const { - return parentOrNull(ref).isNull(); -} - -template -bool RefHelper::isAncestorOf(const RefHelper::Ref &old, const RefHelper::Ref &young) const { - Ref test = young; - do { - if (test == old) return true; - test = parentOrNull(test); - } while (test.isNonnull()); - return false; -} - -template -bool RefHelper::sharedAncestor(const RefHelper::Ref &ref1, const RefHelper::Ref &ref2) const { - return ( ancestorOrSelf(ref1) == ancestorOrSelf(ref2) ); -} - -template -template -V RefHelper::recursiveLookup(const SomeRef &ref, const edm::ValueMap &map) const { - Ref test(ref); - do { - if (map.contains(test.id())) { - try { - return map[test]; - } catch (edm::Exception &e) { - if (e.categoryCode() != edm::errors::InvalidReference) { - throw; - } - } - } - test = parentOrNull(test); - } while (test.isNonnull()); - throw edm::Exception(edm::errors::InvalidReference) << - "RefHelper: recursive Lookup failed: neither the specified ref nor any of its parents are in the map.\n"; -} - -template -template -V RefHelper::ancestorLookup(const SomeRef &ref, const edm::ValueMap &map) const { - Ref tref(ref); - return map[ancestorOrSelf(tref)]; -} - -} } // namespace -#endif diff --git a/PhysicsTools/SelectorUtils/interface/Variables.h b/PhysicsTools/SelectorUtils/interface/Variables.h deleted file mode 100644 index b911a79e316b0..0000000000000 --- a/PhysicsTools/SelectorUtils/interface/Variables.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SelectorUtils_Variables_h -#define SelectorUtils_Variables_h - -// short cut classes for reco::Candidate methods -// Benedikt Hegner, DESY - -#include "DataFormats/Candidate/interface/Candidate.h" - -class vEnergy { -public: - typedef reco::Candidate ValType; - vEnergy() {} - double operator()( const ValType& x ) const { return x.energy(); } -}; - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/DummyMatchSelector.h b/PhysicsTools/UtilAlgos/interface/DummyMatchSelector.h deleted file mode 100644 index 8d0d99aab14d8..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/DummyMatchSelector.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef DummyMatchSelector_h -#define DummyMatchSelector_h - -/** - Dummy class for preselection of object matches. -*/ - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -namespace reco { - - template - class DummyMatchSelector { - - public: - - DummyMatchSelector(const edm::ParameterSet& cfg) { } - - bool operator()( const T1 & c, const T2 & hlt ) const { return true; } - - }; - -} - - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/EventSelector.h b/PhysicsTools/UtilAlgos/interface/EventSelector.h deleted file mode 100644 index 60176c8025f34..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/EventSelector.h +++ /dev/null @@ -1 +0,0 @@ -#include "CommonTools/UtilAlgos/interface/EventSelector.h" diff --git a/PhysicsTools/UtilAlgos/interface/MCMatchSelector.h b/PhysicsTools/UtilAlgos/interface/MCMatchSelector.h deleted file mode 100644 index a54aecc246ba8..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/MCMatchSelector.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MCMatchSelector_h -#define MCMatchSelector_h -/* \class MCMatchSelector - * - * Extended version of MCTruthPairSelector. Preselects matches - * based on charge, pdgId and status. - */ - -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -namespace reco { - template - class MCMatchSelector { - public: - MCMatchSelector(const edm::ParameterSet& cfg) : - checkCharge_(cfg.getParameter("checkCharge")) { - std::vector ids = - cfg.getParameter< std::vector >("mcPdgId"); - for ( std::vector::const_iterator i=ids.begin(); - i!=ids.end(); ++i ) ids_.insert(*i); - std::vector status = - cfg.getParameter< std::vector >("mcStatus"); - for ( std::vector::const_iterator i=status.begin(); - i!=status.end(); ++i ) status_.insert(*i); - } - /// true if match is possible - bool operator()( const T1 & c, const T2 & mc ) const { - if ( checkCharge_ && c.charge() != mc.charge() ) return false; - if ( !ids_.empty() ) { - if ( ids_.find(abs(mc.pdgId()))==ids_.end() ) return false; - } - if ( status_.empty() ) return true; - return status_.find(mc.status())!=status_.end(); - } - private: - bool checkCharge_; - std::set ids_; - std::set status_; - }; -} - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/NtpProducer.h b/PhysicsTools/UtilAlgos/interface/NtpProducer.h deleted file mode 100755 index 5f0fab84a092f..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/NtpProducer.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef UtilAlgos_NtpProducer_h -#define UtilAlgos_NtpProducer_h -/** \class NtpProducer - * - * Creates histograms defined in config file - * - * \author: Luca Lista, INFN - * - * Template parameters: - * - C : Concrete candidate collection type - * - */ -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "CommonTools/Utils/interface/StringObjectFunction.h" - -template -class NtpProducer : public edm::EDProducer { -public: - /// constructor from parameter set - NtpProducer( const edm::ParameterSet& ); - /// destructor - ~NtpProducer(); - -protected: - /// process an event - virtual void produce( edm::Event&, const edm::EventSetup& ); - -private: - /// label of the collection to be read in - edm::EDGetTokenT srcToken_; - /// variable tags - std::vector > > tags_; -}; - -template -NtpProducer::NtpProducer( const edm::ParameterSet& par ) : - srcToken_( consumes(par.template getParameter( "src" ) ) ) { - std::vector variables = - par.template getParameter >("variables"); - std::vector::const_iterator - q = variables.begin(), end = variables.end(); - for (; q!=end; ++q) { - std::string tag = q->getUntrackedParameter("tag"); - StringObjectFunction quantity(q->getUntrackedParameter("quantity")); - tags_.push_back(std::make_pair(tag, quantity)); - produces >(tag).setBranchAlias(tag); - } -} - -template -NtpProducer::~NtpProducer() { -} - -template -void NtpProducer::produce( edm::Event& iEvent, const edm::EventSetup& ) { - edm::Handle coll; - iEvent.getByToken(srcToken_, coll); - - typename std::vector > >::const_iterator - q = tags_.begin(), end = tags_.end(); - for(;q!=end; ++q) { - auto x = std::make_unique>(); - x->reserve(coll->size()); - for (typename C::const_iterator elem=coll->begin(); elem!=coll->end(); ++elem ) { - x->push_back(q->second(*elem)); - } - iEvent.put(std::move(x), q->first); - } -} - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h b/PhysicsTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h deleted file mode 100755 index 229e4b88144d1..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef UtilAlgos_SelectedOutputCollectionTrait_h -#define UtilAlgos_SelectedOutputCollectionTrait_h -/* \class helper SelectedOutputCollection - * - * \author Luca Lista, INFN - * - */ -#include "DataFormats/Common/interface/AssociationVector.h" -#include "DataFormats/Common/interface/RefToBase.h" -#include "DataFormats/Common/interface/RefToBaseVector.h" -#include "DataFormats/Common/interface/RefToBaseProd.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/View.h" - -namespace helper { - - template - struct SelectedOutputCollectionTrait { - typedef InputCollection type; - }; - - template - struct SelectedOutputCollectionTrait, C> > { - typedef typename edm::RefProd::product_type type; - }; - - template - struct SelectedOutputCollectionTrait, C> > { - typedef typename edm::RefToBaseVector type; - }; - - template - struct SelectedOutputCollectionTrait > { - typedef typename edm::RefToBaseVector type; - }; - - template - struct SelectedOutputCollectionTrait > { - typedef typename edm::RefToBaseVector type; - }; - - template - struct SelectedOutputCollectionTrait > { - typedef typename edm::RefVector type; - }; - -} - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/SelectionAdderTrait.h b/PhysicsTools/UtilAlgos/interface/SelectionAdderTrait.h deleted file mode 100755 index d830b07f6bc8c..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/SelectionAdderTrait.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef UtilAlgos_SelectionAdderTrait_h -#define UtilAlgos_SelectionAdderTrait_h -/* \class SelectionAdderTrait - * - * \author Luca Lista, INFN - */ -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/PtrVector.h" -#include "DataFormats/Common/interface/RefToBaseVector.h" -#include "DataFormats/Common/interface/RefToBaseProd.h" -#include "DataFormats/Common/interface/RefProd.h" -#include "DataFormats/Common/interface/AssociationVector.h" - -namespace helper { - - template - struct SelectionCopyAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( ( * c )[ idx ] ); - } - }; - - template - struct SelectionPointerAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( & ( * c )[ idx ] ); - } - }; - - template - struct SelectionPointerDerefAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( & * ( * c )[ idx ] ); - } - }; - - template - struct SelectionFirstPointerAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( & * ( ( * c )[ idx ].first ) ); - } - }; - - template - struct SelectionFirstRefAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( ( * c )[ idx ].first ); - } - }; - - template - struct SelectionRefAdder { - template - void operator()( StoreContainer & selected, const edm::Handle & c, size_t idx ) { - selected.push_back( edm::Ref( c, idx ) ); - } - }; - - template - struct SelectionRefViewAdder { - void operator()( edm::RefToBaseVector & selected, const edm::Handle > & c, size_t idx ) { - selected.push_back( c->refAt( idx ) ); - } - }; - - template - struct SelectionPtrViewAdder { - void operator()( edm::PtrVector & selected, const edm::Handle > & c, size_t idx ) { - selected.push_back( c->ptrAt( idx ) ); - } - }; - - template - struct SelectionAdderTrait { - static_assert(sizeof(InputCollection) == 0); - }; - - template - struct SelectionAdderTrait > { - typedef SelectionPointerAdder > type; - }; - - template - struct SelectionAdderTrait > { - typedef SelectionRefAdder > type; - }; - - template - struct SelectionAdderTrait, edm::RefVector > { - typedef SelectionCopyAdder > type; - }; - - template - struct SelectionAdderTrait, std::vector > { - typedef SelectionPointerDerefAdder > type; - }; - - template - struct SelectionAdderTrait, edm::RefToBaseVector > { - typedef SelectionCopyAdder > type; - }; - - template - struct SelectionAdderTrait, std::vector > { - typedef SelectionPointerDerefAdder > type; - }; - - template - struct SelectionAdderTrait, C>, std::vector > { - typedef SelectionFirstPointerAdder > type; - }; - - template - struct SelectionAdderTrait, C>, std::vector > { - typedef SelectionFirstPointerAdder > type; - }; - - template - struct SelectionAdderTrait, C>, edm::RefVector > { - typedef SelectionFirstRefAdder > type; - }; - - template - struct SelectionAdderTrait, C>, - edm::RefToBaseVector > { - typedef SelectionFirstRefAdder > type; - }; - - template - struct SelectionAdderTrait, edm::RefToBaseVector > { - typedef SelectionRefViewAdder type; - }; - - template - struct SelectionAdderTrait, edm::PtrVector > { - typedef SelectionPtrViewAdder type; - }; - -} - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/StoreContainerTrait.h b/PhysicsTools/UtilAlgos/interface/StoreContainerTrait.h deleted file mode 100755 index f563c548df5e4..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/StoreContainerTrait.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef UtilAlgos_StoreContainerTrait_h -#define UtilAlgos_StoreContainerTrait_h -/* \class helper::StoreContainerTrait - * - * \author Luca Lista, INFN - */ -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefToBaseVector.h" -#include "DataFormats/Common/interface/PtrVector.h" -#include "DataFormats/Common/interface/AssociationVector.h" - -namespace helper { - template - struct StoreContainerTrait { - typedef std::vector type; - }; - - template - struct StoreContainerTrait > { - typedef edm::RefVector type; - }; - - template - struct StoreContainerTrait > { - typedef edm::RefToBaseVector type; - }; - - template - struct StoreContainerTrait > { - typedef edm::PtrVector type; - }; - - template - struct StoreContainerTrait > { - typedef typename StoreContainerTrait::type type; - }; -} - -#endif diff --git a/PhysicsTools/UtilAlgos/interface/TwoObjectCalculator.h b/PhysicsTools/UtilAlgos/interface/TwoObjectCalculator.h deleted file mode 100644 index cc3bc3b8b048e..0000000000000 --- a/PhysicsTools/UtilAlgos/interface/TwoObjectCalculator.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CommonTools_UtilAlgos_TwoObjectCalculator_H -#define CommonTools_UtilAlgos_TwoObjectCalculator_H - -#include -#include - -struct CosDphiCalculator { - template double operator()( const LHS & lhs, const RHS & rhs){ - double cdphi = cos(lhs.phi()-rhs.phi()); - return cdphi; - } - static std::string calculationType(){ return "CosDphiCalculator";} - static std::string description() { return " calculate cos(Delta Phi(Obj1, Obj2))";} -}; - -#endif diff --git a/PhysicsTools/Utilities/interface/GammaPropagator.h b/PhysicsTools/Utilities/interface/GammaPropagator.h deleted file mode 100644 index d9c31e730722c..0000000000000 --- a/PhysicsTools/Utilities/interface/GammaPropagator.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef PhysicsTools_Utilities_GammaPropagator_h -#define PhysicsTools_Utilities_GammaPropagator_h - -namespace funct { - - struct GammaPropagator { - GammaPropagator() {} - double operator()(double mass) const { - if(mass <= 0) return 0; - return 1./(mass*mass); - } - }; - -} - -#endif diff --git a/PhysicsTools/Utilities/interface/GammaZInterference.h b/PhysicsTools/Utilities/interface/GammaZInterference.h deleted file mode 100644 index e6a09214baac3..0000000000000 --- a/PhysicsTools/Utilities/interface/GammaZInterference.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef PhysicsTools_Utilities_GammaZInterference_h -#define PhysicsTools_Utilities_GammaZInterference_h -#include "PhysicsTools/Utilities/interface/Parameter.h" - -#include - -namespace funct { - - struct GammaZInterference { - GammaZInterference(const Parameter& m, const Parameter& g) : mass(m.ptr()), width(g.ptr()) {} - GammaZInterference(std::shared_ptr m, std::shared_ptr g) : mass(m), width(g) {} - double operator()(double x) const { - double m2 = *mass * (*mass); - double g2 = *width * (*width); - double g2OverM2 = g2 / m2; - double s = x * x; - double deltaS = s - m2; - double interference = 0; - if (fabs(deltaS / m2) < 16) { - double prop = deltaS * deltaS + s * s * g2OverM2; - interference = 5 * (*mass) * deltaS / prop; - } - return interference; - } - std::shared_ptr mass, width; - }; - -} // namespace funct - -#endif diff --git a/PhysicsTools/Utilities/interface/Number.h b/PhysicsTools/Utilities/interface/Number.h deleted file mode 100644 index 017216302d631..0000000000000 --- a/PhysicsTools/Utilities/interface/Number.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef PhysicsTools_Utilities_Number_h -#define PhysicsTools_Utilities_Number_h - -namespace funct { - - struct Number { - Number(double value) : value_(value) { } - double operator()(double x) const { return value_; } - private: - double value_; - }; - -} - -#endif diff --git a/PhysicsTools/Utilities/interface/ZLineShape.h b/PhysicsTools/Utilities/interface/ZLineShape.h deleted file mode 100644 index faa936648c335..0000000000000 --- a/PhysicsTools/Utilities/interface/ZLineShape.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef PhysicsTools_Utilities_ZLineShape_h -#define PhysicsTools_Utilities_ZLineShape_h -#include "PhysicsTools/Utilities/interface/BreitWigner.h" -#include "PhysicsTools/Utilities/interface/GammaPropagator.h" -#include "PhysicsTools/Utilities/interface/GammaZInterference.h" -#include "PhysicsTools/Utilities/interface/Parameter.h" - -namespace funct { - class ZLineShape { - public: - ZLineShape(const Parameter& m, const Parameter& g, const Parameter& Ng, const Parameter& Ni) - : Ngamma(Ng.ptr()), Nint(Ni.ptr()), bw_(m, g), gp_(), gzi_(m, g) {} - ZLineShape(std::shared_ptr m, - std::shared_ptr g, - std::shared_ptr Ng, - std::shared_ptr Ni) - : Ngamma(Ng), Nint(Ni), bw_(m, g), gp_(), gzi_(m, g) {} - double operator()(double x) const { return (1.0 - *Nint - *Ngamma) * bw_(x) + *Ngamma * gp_(x) + *Nint * gzi_(x); } - std::shared_ptr Ngamma, Nint; - - private: - BreitWigner bw_; - GammaPropagator gp_; - GammaZInterference gzi_; - }; - -} // namespace funct - -#endif diff --git a/TopQuarkAnalysis/TopTools/interface/TopologyWorker.h b/TopQuarkAnalysis/TopTools/interface/TopologyWorker.h deleted file mode 100644 index 101c5bbd43b46..0000000000000 --- a/TopQuarkAnalysis/TopTools/interface/TopologyWorker.h +++ /dev/null @@ -1,1718 +0,0 @@ -// -*- C++ -*- -// -// Package: TopTools -// Class: TopologyWorker -// -/**\class TopologyWorker TopologyWorker.cc TopQuarkAnalysis/TopTools/interface/TopologyWorker.h - - Description: - - Implementation: - - This class contains the topological methods as used in D0 (all hadronic) analyses. -*/ -#ifndef __TOPTOOLSTOPOLOGYWORKER__ -#define __TOPTOOLSTOPOLOGYWORKER__ - -#warning The TopologyWorker class is currently not supported anymore! There might be issues in its implementation. -#warning If you are still using it or planned to do so, please contact the admins of the corresponding CMSSW package. -#warning You can find their e-mail adresses in: cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/TopQuarkAnalysis/TopTools/.admin/ - -#include "TF1.h" -#include "TMath.h" -#include "TClass.h" -#include "TString.h" -#include "TRandom.h" -#include "TMatrixD.h" -#include "TLorentzVector.h" - -#include -#include - -class TopologyWorker -{ -public: - TopologyWorker(){;} - TopologyWorker(bool boost); - virtual ~TopologyWorker(){;} - - void clear(void){m_np=0;m_np2=0;return;} - - void setPartList(TObjArray* e1, TObjArray* e2); - void setVerbose(bool loud){m_verbose=loud; return;} - - void setThMomPower(double tp); - double getThMomPower(); - void setFast(int nf); - int getFast(); - - TVector3 thrustAxis(); - TVector3 majorAxis(); - TVector3 minorAxis(); - - TVector3 thrust(); - // thrust :: Corresponding thrust, major, and minor value. - - double oblateness(); - double get_sphericity(); - double get_aplanarity(); - double get_h10(); - double get_h20(); - double get_h30(); - double get_h40(); - double get_h50(); - double get_h60(); - - - void planes_sphe(double& pnorm,double& p2, double& p3); - void planes_sphe_wei(double& pnorm,double& p2, double& p3); - void planes_thrust(double& pnorm,double& p2, double& p3); - void sumangles(float& sdeta, float& sdr); - - double get_ht() {return m_ht;} - double get_ht3() {return m_ht3;} - double get_et0() {return m_et0;} - double get_sqrts() {return m_sqrts;} - double get_njetW() {return m_njetsweighed;} - double get_et56() {return m_et56;} - double get_centrality() { return m_centrality;} - -private: - bool m_verbose; - void getetaphi(double px, double py, double pz, double& eta, double& phi); - double ulAngle(double x, double y); - double sign(double a, double b); - void ludbrb(TMatrix *mom, - double the, - double phi, - double bx, - double by, - double bz); - - int iPow(int man, int exp); - - double m_dSphMomPower; - // PARU(41): Power of momentum dependence in sphericity finder. - - double m_dDeltaThPower; - // PARU(42): Power of momentum dependence in thrust finder. - - int m_iFast; - // MSTU(44): # of initial fastest particles choosen to start search. - - double m_dConv; - // PARU(48): Convergence criteria for axis maximization. - - int m_iGood; - // MSTU(45): # different starting configurations that must - // converge before axis is accepted as correct. - - TMatrix m_dAxes; - // data: results - // m_dAxes[1] is the Thrust axis. - // m_dAxes[2] is the Major axis. - // m_dAxes[3] is the Minor axis. - - TVector3 m_ThrustAxis; - TVector3 m_MajorAxis; - TVector3 m_MinorAxis; - TVector3 m_Thrust; - - TRandom m_random; - - TMatrix m_mom; - TMatrix m_mom2; - - double m_dThrust[4]; - double m_dOblateness; - int m_np; - int m_np2; - bool m_sanda_called; - bool m_fowo_called; - bool m_boost; - bool m_sumangles_called; - double m_sph; - double m_apl; - double m_h10; - double m_h20; - double m_h30; - double m_h40; - double m_h50; - double m_h60; - double m_ht; - double m_ht3; - double m_et0; - double m_sqrts; - double m_njetsweighed; - double m_et56; - double m_centrality; - - void sanda(); - void fowo(); - static int m_maxpart; - - void CalcWmul(); - void CalcSqrts(); - void CalcHTstuff(); - double CalcPt(int i) { return sqrt(pow(m_mom(i,1),2)+pow(m_mom(i,2),2));} - double CalcPt2(int i) { return sqrt(pow(m_mom2(i,1),2)+pow(m_mom2(i,2),2));} - double CalcEta(int i) {double eta, phi;getetaphi(m_mom(i,1),m_mom(i,2),m_mom(i,3),eta,phi); return eta;} - double CalcEta2(int i) {double eta, phi; getetaphi(m_mom2(i,1),m_mom2(i,2),m_mom2(i,3),eta,phi); return eta;} - -}; - -class LessThan { - public : - // retrieve tru info MC stuff - bool operator () (const TLorentzVector & tl1, const TLorentzVector & - tl2) - const { - return tl2.Pt() < tl1.Pt(); - } -}; - -Int_t TopologyWorker::m_maxpart = 1000; - -TopologyWorker::TopologyWorker(bool boost): - m_dSphMomPower(2.0),m_dDeltaThPower(0), - m_iFast(4),m_dConv(0.0001),m_iGood(2) -{ - m_dAxes.ResizeTo(4,4); - m_mom.ResizeTo(m_maxpart,6); - m_mom2.ResizeTo(m_maxpart,6); - m_np=-1; - m_np2=-1; - m_sanda_called=false; - m_fowo_called=false; - m_sumangles_called=false; - m_verbose=false; - m_boost=boost; - m_sph=-1; - m_apl=-1; - m_h10=-1; - m_h20=-1; - m_h30=-1; - m_h40=-1; - m_sqrts=0; - m_ht=0; - m_ht3=0; - m_et56=0; - m_njetsweighed=0; - m_et0=0; -} -//______________________________________________________________ - - -// Input the particle 3(4)-vector list -// e: 3-vector TVector3 ..(px,py,pz) or -// 4-vector TLorentzVector ..(px,py,pz,E) -// Even input the TLorentzVector, we don't use Energy -// -void TopologyWorker::setPartList(TObjArray* e1, TObjArray* e2) -{ - //To make this look like normal physics notation the - //zeroth element of each array, mom[i][0], will be ignored - //and operations will be on elements 1,2,3... - TMatrix mom(m_maxpart,6); - TMatrix mom2(m_maxpart,6); - double tmax = 0; - double phi = 0.; - double the = 0.; - double sgn; - TMatrix fast(m_iFast + 1,6); - TMatrix work(11,6); - double tdi[4] = {0.,0.,0.,0.}; - double tds; - double tpr[4] = {0.,0.,0.,0.}; - double thp; - double thps; - double pxtot=0; - double pytot=0; - double pztot=0; - double etot=0; - - TMatrix temp(3,5); - Int_t np = 0; - Int_t numElements = e1->GetEntries(); - Int_t numElements2 = e2->GetEntries(); - - // trying to sort... - - - - m_np=0; - for(Int_t elem=0;elemAt(elem); - if(m_verbose){ - std::cerr << "TopologyWorker:SetPartList(): adding jet " << elem << "." << std::endl; - } - if (np >= m_maxpart) { - printf("Too many particles input to TopologyWorker"); - return; - } - if(m_verbose){ - std::cout << "getting name of object..." << std::endl; - } - TString nam(o->IsA()->GetName()); - if(m_verbose){ - std::cout << "TopologyWorker::setPartList(): object is of type " << nam << std::endl; - } - if (nam.Contains("TVector3")) { - TVector3 v(((TVector3 *) o)->X(), - ((TVector3 *) o)->Y(), - ((TVector3 *) o)->Z()); - mom(np,1) = v.X(); - mom(np,2) = v.Y(); - mom(np,3) = v.Z(); - mom(np,4) = v.Mag(); - } - else if (nam.Contains("TLorentzVector")) { - TVector3 v(((TLorentzVector *) o)->X(), - ((TLorentzVector *) o)->Y(), - ((TLorentzVector *) o)->Z()); - mom(np,1) = v.X(); - mom(np,2) = v.Y(); - mom(np,3) = v.Z(); - mom(np,4) = ((TLorentzVector *) o)->T(); - } - else { - printf("TopologyWorker::setEvent input is not a TVector3 or a TLorentzVector\n"); - continue; - } - - - if ( TMath::Abs( m_dDeltaThPower ) <= 0.001 ) { - mom(np,5) = 1.0; - } - else { - mom(np,5) = TMath::Power(mom(np,4),m_dDeltaThPower); - } - tmax = tmax + mom(np,4)*mom(np,5); - pxtot+=mom(np,1); - pytot+=mom(np,2); - pztot+=mom(np,3); - etot+=mom(np,4); - np++; - m_np=np; - } - Int_t np2=0; - // second jet array.... only use some values here. - for(Int_t elem=0;elemAt(elem); - if (np2 >= m_maxpart) { - printf("Too many particles input to TopologyWorker"); - return; - } - - TString nam(o->IsA()->GetName()); - if (nam.Contains("TVector3")) { - TVector3 v(((TVector3 *) o)->X(), - ((TVector3 *) o)->Y(), - ((TVector3 *) o)->Z()); - mom2(np2,1) = v.X(); - mom2(np2,2) = v.Y(); - mom2(np2,3) = v.Z(); - mom2(np2,4) = v.Mag(); - } - else if (nam.Contains("TLorentzVector")) { - TVector3 v(((TLorentzVector *) o)->X(), - ((TLorentzVector *) o)->Y(), - ((TLorentzVector *) o)->Z()); - mom2(np2,1) = v.X(); - mom2(np2,2) = v.Y(); - mom2(np2,3) = v.Z(); - mom2(np2,4) = ((TLorentzVector *) o)->T(); - // cout << "mom2: " << mom2(np2,1) << ", " << mom2(np2,2)<<", " << mom2(np2,3)<<", " << mom2(np2,4)<< endl; - } - else { - printf("TopologyWorker::setEvent Second vector input is not a TVector3 or a TLorentzVector\n"); - continue; - } - np2++; - m_np2=np2; - } - m_mom2=mom2; - - if (m_boost && m_np>1) { - printf("TopologyWorker::setEvent Only boosting first vector so watch out when you do this!!!"); - TVector3 booze(-pxtot/etot,-pytot/etot,-pztot/etot); - TLorentzVector l1; - for (int k=0; k -1; ifas-- ) { - if ( mom(i,4) > fast(ifas,4) ) { - for ( Int_t j = 1; j < 6; j++ ) { - fast(ifas+1,j) = fast(ifas,j); - if ( ifas == 0 ) fast(ifas,j) = mom(i,j); - } - } - else { - for ( Int_t j = 1; j < 6; j++ ) { - fast(ifas+1,j) = mom(i,j); - } - break; - } - } - } - // Find axis with highest thrust (case 1)/ highest major (case 2). - for ( Int_t ie = 0; ie < work.GetNrows(); ie++ ) { - work(ie,4) = 0.; - } - Int_t p = TMath::Min( m_iFast, np ) - 1; - // Don't trust Math.pow to give right answer always. - // Want nc = 2**p. - Int_t nc = iPow(2,p); - for ( Int_t n = 0; n < nc; n++ ) { - for ( Int_t j = 1; j < 4; j++ ) { - tdi[j] = 0.; - } - for ( Int_t i = 0; i < TMath::Min(m_iFast,n); i++ ) { - sgn = fast(i,5); - if (iPow(2,(i+1))*((n+iPow(2,i))/iPow(2,(i+1))) >= i+1){ - sgn = -sgn; - } - for ( Int_t j = 1; j < 5-pass; j++ ) { - tdi[j] = tdi[j] + sgn*fast(i,j); - } - } - tds = tdi[1]*tdi[1] + tdi[2]*tdi[2] + tdi[3]*tdi[3]; - for ( Int_t iw = TMath::Min(n,9); iw > -1; iw--) { - if( tds > work(iw,4) ) { - for ( Int_t j = 1; j < 5; j++ ) { - work(iw+1,j) = work(iw,j); - if ( iw == 0 ) { - if ( j < 4 ) { - work(iw,j) = tdi[j]; - } - else { - work(iw,j) = tds; - } - } - } - } - else { - for ( Int_t j = 1; j < 4; j++ ) { - work(iw+1,j) = tdi[j]; - } - work(iw+1,4) = tds; - } - } - } - // Iterate direction of axis until stable maximum. - m_dThrust[pass] = 0; - thp = -99999.; - Int_t nagree = 0; - for ( Int_t iw = 0; - iw < TMath::Min(nc,10) && nagree < m_iGood; iw++ ){ - thp = 0.; - thps = -99999.; - while ( thp > thps + m_dConv ) { - thps = thp; - for ( Int_t j = 1; j < 4; j++ ) { - if ( thp <= 1E-10 ) { - tdi[j] = work(iw,j); - } - else { - tdi[j] = tpr[j]; - tpr[j] = 0; - } - } - for ( Int_t i = 0; i < np; i++ ) { - sgn = sign(mom(i,5), - tdi[1]*mom(i,1) + - tdi[2]*mom(i,2) + - tdi[3]*mom(i,3)); - for ( Int_t j = 1; j < 5 - pass; j++ ){ - tpr[j] = tpr[j] + sgn*mom(i,j); - } - } - thp = TMath::Sqrt(tpr[1]*tpr[1] - + tpr[2]*tpr[2] - + tpr[3]*tpr[3])/tmax; - } - // Save good axis. Try new initial axis until enough - // tries agree. - if ( thp < m_dThrust[pass] - m_dConv ) { - break; - } - if ( thp > m_dThrust[pass] + m_dConv ) { - nagree = 0; - sgn = iPow( -1, (Int_t)TMath::Nint(m_random.Rndm()) ); - for ( Int_t j = 1; j < 4; j++ ) { - m_dAxes(pass,j) = sgn*tpr[j]/(tmax*thp); - } - m_dThrust[pass] = thp; - } - nagree = nagree + 1; - } - } - // Find minor axis and value by orthogonality. - sgn = iPow( -1, (Int_t)TMath::Nint(m_random.Rndm())); - m_dAxes(3,1) = -sgn*m_dAxes(2,2); - m_dAxes(3,2) = sgn*m_dAxes(2,1); - m_dAxes(3,3) = 0.; - thp = 0.; - for ( Int_t i = 0; i < np; i++ ) { - thp += mom(i,5)*TMath::Abs(m_dAxes(3,1)*mom(i,1) + - m_dAxes(3,2)*mom(i,2)); - } - m_dThrust[3] = thp/tmax; - // Rotate back to original coordinate system. - for ( Int_t i6 = 0; i6 < 3; i6++ ) { - for ( Int_t j = 1; j < 4; j++ ) { - temp(i6,j) = m_dAxes(i6+1,j); - } - temp(i6,4) = 0; - } - ludbrb(&temp,the,phi,0.,0.,0.); - for ( Int_t i7 = 0; i7 < 3; i7++ ) { - for ( Int_t j = 1; j < 4; j++ ) { - m_dAxes(i7+1,j) = temp(i7,j); - } - } - m_dOblateness = m_dThrust[2] - m_dThrust[3]; - - // more stuff: - - // calculate weighed jet multiplicity(); - CalcWmul(); - CalcHTstuff(); - CalcSqrts(); - -} -//______________________________________________________________ - -// Setting and getting parameters. - -void TopologyWorker::setThMomPower(double tp) -{ - // Error if sp not positive. - if ( tp > 0. ) m_dDeltaThPower = tp - 1.0; - return; -} -//______________________________________________________________ - -double TopologyWorker::getThMomPower() -{ - return 1.0 + m_dDeltaThPower; -} -//______________________________________________________________ - -void TopologyWorker::setFast(Int_t nf) -{ - // Error if sp not positive. - if ( nf > 3 ) m_iFast = nf; - return; -} -//______________________________________________________________ - -Int_t TopologyWorker::getFast() -{ - return m_iFast; -} -//______________________________________________________________ - -// Returning results - -TVector3 TopologyWorker::thrustAxis() { - TVector3 m_ThrustAxis(m_dAxes(1,1),m_dAxes(1,2),m_dAxes(1,3)); - return m_ThrustAxis; -} -//______________________________________________________________ - -TVector3 TopologyWorker::majorAxis() { - TVector3 m_MajorAxis(m_dAxes(2,1),m_dAxes(2,2),m_dAxes(2,3)); - return m_MajorAxis; -} -//______________________________________________________________ - -TVector3 TopologyWorker::minorAxis() { - TVector3 m_MinorAxis(m_dAxes(3,1),m_dAxes(3,2),m_dAxes(3,3)); - return m_MinorAxis; -} -//______________________________________________________________ - -TVector3 TopologyWorker::thrust() { - TVector3 m_Thrust(m_dThrust[1],m_dThrust[2],m_dThrust[3]); - return m_Thrust; -} -//______________________________________________________________ - -double TopologyWorker::oblateness() { - return m_dOblateness; -} -//______________________________________________________________ - -// utilities(from Jetset): -double TopologyWorker::ulAngle(double x, double y) -{ - double ulangl = 0; - double r = TMath::Sqrt(x*x + y*y); - if ( r < 1.0E-20 ) { - return ulangl; - } - if ( TMath::Abs(x)/r < 0.8 ) { - ulangl = sign(TMath::ACos(x/r),y); - } - else { - ulangl = TMath::ASin(y/r); - if ( x < 0. && ulangl >= 0. ) { - ulangl = TMath::Pi() - ulangl; - } - else if ( x < 0. ) { - ulangl = -TMath::Pi() - ulangl; - } - } - return ulangl; -} -//______________________________________________________________ - -double TopologyWorker::sign(double a, double b) { - if ( b < 0 ) { - return -TMath::Abs(a); - } - else { - return TMath::Abs(a); - } -} -//______________________________________________________________ - -void TopologyWorker::ludbrb(TMatrix* mom, - double the, - double phi, - double bx, - double by, - double bz) -{ - // Ignore "zeroth" elements in rot,pr,dp. - // Trying to use physics-like notation. - TMatrix rot(4,4); - double pr[4]; - double dp[5]; - Int_t np = mom->GetNrows(); - if ( the*the + phi*phi > 1.0E-20 ) - { - rot(1,1) = TMath::Cos(the)*TMath::Cos(phi); - rot(1,2) = -TMath::Sin(phi); - rot(1,3) = TMath::Sin(the)*TMath::Cos(phi); - rot(2,1) = TMath::Cos(the)*TMath::Sin(phi); - rot(2,2) = TMath::Cos(phi); - rot(2,3) = TMath::Sin(the)*TMath::Sin(phi); - rot(3,1) = -TMath::Sin(the); - rot(3,2) = 0.0; - rot(3,3) = TMath::Cos(the); - for ( Int_t i = 0; i < np; i++ ) - { - for ( Int_t j = 1; j < 4; j++ ) - { - pr[j] = (*mom)(i,j); - (*mom)(i,j) = 0; - } - for ( Int_t jb = 1; jb < 4; jb++) - { - for ( Int_t k = 1; k < 4; k++) - { - (*mom)(i,jb) = (*mom)(i,jb) + rot(jb,k)*pr[k]; - } - } - } - double beta = TMath::Sqrt( bx*bx + by*by + bz*bz ); - if ( beta*beta > 1.0E-20 ) - { - if ( beta > 0.99999999 ) - { - //send message: boost too large, resetting to <~1.0. - bx = bx*(0.99999999/beta); - by = by*(0.99999999/beta); - bz = bz*(0.99999999/beta); - beta = 0.99999999; - } - double gamma = 1.0/TMath::Sqrt(1.0 - beta*beta); - for ( Int_t i = 0; i < np; i++ ) - { - for ( Int_t j = 1; j < 5; j++ ) - { - dp[j] = (*mom)(i,j); - } - double bp = bx*dp[1] + by*dp[2] + bz*dp[3]; - double gbp = gamma*(gamma*bp/(1.0 + gamma) + dp[4]); - (*mom)(i,1) = dp[1] + gbp*bx; - (*mom)(i,2) = dp[2] + gbp*by; - (*mom)(i,3) = dp[3] + gbp*bz; - (*mom)(i,4) = gamma*(dp[4] + bp); - } - } - } - return; -} - - - -// APLANARITY and SPHERICITY - -void TopologyWorker::sanda() { - float SPH=-1; - float APL=-1; - m_sanda_called=true; - //======================================================================= - // By M.Vreeswijk, (core was fortran, stolen from somewhere) - // Purpose: to perform sphericity tensor analysis to give sphericity - // and aplanarity. - // - // Needs: Array (standard from root-tuples): GTRACK_px, py, pz - // The number of tracks in these arrays: GTRACK_ijet - // In addition: Array GTRACK_ijet contains a jet number 'ijet' - // (if you wish to change this, simply change code) - // - // Uses: TVector3 and TLorentzVector classes - // - // Output: Sphericity SPH and Aplanarity APL - //======================================================================= -// C...Calculate matrix to be diagonalized. - float P[1000][6]; - double SM[4][4],SV[4][4]; - double PA,PWT,PS,SQ,SR,SP,SMAX,SGN; - int NP; - int J, J1, J2, I, N, JA, JB, J3, JC, JB1, JB2; - JA=JB=JC=0; - double RL; - float rlu,rlu1; - // - // --- get the input form GTRACK arrays - // - N=m_np; - NP=0; - for (I=1;I 1E-5) { - -// C...Find first and last eigenvector by solving equation system. - for (I=1;I<4;I=I+2) { // 240 - for (J1=1;J1<4;J1++) { // 180 - SV[J1][J1]=SM[J1][J1]-P[N+I][4]; - for (J2=J1+1;J2<4;J2++) { // 170 - SV[J1][J2]=SM[J1][J2]; - SV[J2][J1]=SM[J1][J2]; - } - } // 180 - SMAX=0.; - for (J1=1;J1<4;J1++) { // 200 - for (J2=1;J2<4;J2++) { // 190 - if(std::fabs(SV[J1][J2])>SMAX) { // 190 - JA=J1; - JB=J2; - SMAX=std::fabs(SV[J1][J2]); - } - } // 190 - } // 200 - SMAX=0.; - for (J3=JA+1;J3SMAX) { // GOTO 210 - JC=J1; - SMAX=std::fabs(SV[J1][J2]); - } - } // 210 - } // 220 - JB1=JB+1-3*(JB/3); - JB2=JB+2-3*((JB+1)/3); - P[N+I][JB1]=-SV[JC][JB2]; - P[N+I][JB2]=SV[JC][JB1]; - P[N+I][JB]=-(SV[JA][JB1]*P[N+I][JB1]+SV[JA][JB2]*P[N+I][JB2])/ - SV[JA][JB]; - PA=TMath::Sqrt(pow(P[N+I][1],2)+pow(P[N+I][2],2)+pow(P[N+I][3],2)); -// make a random number - float pa=P[N-1][I]; - rlu=std::fabs(pa)-std::fabs(int(pa)*1.); - rlu1=std::fabs(pa*pa)-std::fabs(int(pa*pa)*1.); - SGN=pow((-1.),1.*int(rlu+0.5)); - for (J=1;J<4;J++) { // 230 - P[N+I][J]=SGN*P[N+I][J]/PA; - } // 230 - } // 240 - -// C...Middle axis orthogonal to other two. Fill other codes. - SGN=pow((-1.),1.*int(rlu1+0.5)); - P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]); - P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]); - P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]); - -// C...Calculate sphericity and aplanarity. Select storing option. - SPH=1.5*(P[N+2][4]+P[N+3][4]); - APL=1.5*P[N+3][4]; - - } // check 1 - - m_sph=SPH; - m_apl=APL; - return; -} // end sanda - - - - -void TopologyWorker::planes_sphe(double& pnorm, double& p2, double& p3) { - //float SPH=-1; //FIXME: commented out since gcc461 complained that this variable is set but unused - //float APL=-1; //FIXME: commented out since gcc461 complained that this variable is set but unused -// C...Calculate matrix to be diagonalized. - float P[1000][6]; - double SM[4][4],SV[4][4]; - double PA,PWT,PS,SQ,SR,SP,SMAX,SGN; - int NP; - int J, J1, J2, I, N, JA, JB, J3, JC, JB1, JB2; - JA=JB=JC=0; - double RL; - float rlu,rlu1; - // - // --- get the input form GTRACK arrays - // - N=m_np; - NP=0; - for (I=1;I 1E-5) { - -// C...Find first and last eigenvector by solving equation system. - for (I=1;I<4;I=I+2) { // 240 - for (J1=1;J1<4;J1++) { // 180 - SV[J1][J1]=SM[J1][J1]-P[N+I][4]; - for (J2=J1+1;J2<4;J2++) { // 170 - SV[J1][J2]=SM[J1][J2]; - SV[J2][J1]=SM[J1][J2]; - } - } // 180 - SMAX=0.; - for (J1=1;J1<4;J1++) { // 200 - for (J2=1;J2<4;J2++) { // 190 - if(std::fabs(SV[J1][J2])>SMAX) { // 190 - JA=J1; - JB=J2; - SMAX=std::fabs(SV[J1][J2]); - } - } // 190 - } // 200 - SMAX=0.; - for (J3=JA+1;J3SMAX) { // GOTO 210 - JC=J1; - SMAX=std::fabs(SV[J1][J2]); - } - } // 210 - } // 220 - JB1=JB+1-3*(JB/3); - JB2=JB+2-3*((JB+1)/3); - P[N+I][JB1]=-SV[JC][JB2]; - P[N+I][JB2]=SV[JC][JB1]; - P[N+I][JB]=-(SV[JA][JB1]*P[N+I][JB1]+SV[JA][JB2]*P[N+I][JB2])/ - SV[JA][JB]; - PA=TMath::Sqrt(pow(P[N+I][1],2)+pow(P[N+I][2],2)+pow(P[N+I][3],2)); -// make a random number - float pa=P[N-1][I]; - rlu=std::fabs(pa)-std::fabs(int(pa)*1.); - rlu1=std::fabs(pa*pa)-std::fabs(int(pa*pa)*1.); - SGN=pow((-1.),1.*int(rlu+0.5)); - for (J=1;J<4;J++) { // 230 - P[N+I][J]=SGN*P[N+I][J]/PA; - } // 230 - } // 240 - -// C...Middle axis orthogonal to other two. Fill other codes. - SGN=pow((-1.),1.*int(rlu1+0.5)); - P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]); - P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]); - P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]); - -// C...Calculate sphericity and aplanarity. Select storing option. - //SPH=1.5*(P[N+2][4]+P[N+3][4]); //FIXME: commented out since gcc461 complained that this variable is set but unused - //APL=1.5*P[N+3][4]; //FIXME: commented out since gcc461 complained that this variable is set but unused - - } // check 1 - - // so assume now we have Sphericity axis, which one give the minimal Pts - double etstot[4]; - double eltot[4]; - double sum23=0; - double sum22=0; - double sum33=0; - double pina[4]; - double ax[4], ay[4], az[4]; - for (int ia=1;ia<4;ia++) { - etstot[ia]=0; - eltot[ia]=0; - pina[ia]=0; - ax[ia]=P[N+ia][1]; - ay[ia]=P[N+ia][2]; - az[ia]=P[N+ia][3]; - ax[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - ay[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - az[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - } - - - for (int k =0 ; k=0) { - double x1=(sqrt(disc)-b)/2/a; - double x2=(-sqrt(disc)-b)/2/a; - phi=atan(x1); - phip=atan(x2); - if (phi<0) phi=2.*pi+phi; - if (phip<0) phip=2.*pi+phip; - } - double p21=sum22*cos(phi)*cos(phi)+sum33*sin(phi)*sin(phi)+2*sum23*cos(phi)*sin(phi); - double p31=sum22*sin(phi)*sin(phi)+sum33*cos(phi)*cos(phi)-2*sum23*cos(phi)*sin(phi); - - double p22=sum22*cos(phip)*cos(phip)+sum33*sin(phip)*sin(phip)+2*sum23*cos(phip)*sin(phip); - double p32=sum22*sin(phip)*sin(phip)+sum33*cos(phip)*cos(phip)-2*sum23*cos(phip)*sin(phip); - - - double d1=std::fabs(p31*p31 - p21*p21); - double d2=std::fabs(p32*p32 - p22*p22); - //cout << " eltot " << eltot[2] << " " << eltot[3] << endl; - //cout << " phi " << phi << " " << phip << endl; - //cout << " d " << d1 << " " << d2 << endl; - p2=p21; - p3=p31; - if (d2>d1) { - p2=p22; - p3=p32; - } - pnorm=sqrt(eltot[1]); - if (p2>p3) { - p3=sqrt(p3); - p2=sqrt(p2); - }else { - double p4=p3; - p3=sqrt(p2); - p2=sqrt(p4); - } - //cout << " sum2 sum3 " << sqrt(sum22) << " " << sqrt(sum33) << endl; - //cout << " p2 p3 " << p2 << " " << p3 << endl; - //double els=sqrt(eltot[2]*eltot[2]+eltot[3]*eltot[3]); - // cout << " ets els " << (ettot[1]) << " " << els << endl; - - //m_sph=SPH; //FIXME: shouldn't the local variables be used to reset the class member variables accordingly? - //m_apl=APL; //FIXME: shouldn't the local variables be used to reset the class member variables accordingly? - return; -} // end planes_sphe - - -void TopologyWorker::planes_sphe_wei(double& pnorm, double& p2, double& p3) { - //float SPH=-1; //FIXME: commented out since gcc461 complained that this variable is set but unused - //float APL=-1; //FIXME: commented out since gcc461 complained that this variable is set but unused -// C...Calculate matrix to be diagonalized. - float P[1000][6]; - double SM[4][4],SV[4][4]; - double PA,PWT,PS,SQ,SR,SP,SMAX,SGN; - int NP; - int J, J1, J2, I, N, JA, JB, J3, JC, JB1, JB2; - JA=JB=JC=0; - double RL; - float rlu,rlu1; - // - // --- get the input form GTRACK arrays - // - N=m_np; - NP=0; - for (I=1;I 1E-5) { - -// C...Find first and last eigenvector by solving equation system. - for (I=1;I<4;I=I+2) { // 240 - for (J1=1;J1<4;J1++) { // 180 - SV[J1][J1]=SM[J1][J1]-P[N+I][4]; - for (J2=J1+1;J2<4;J2++) { // 170 - SV[J1][J2]=SM[J1][J2]; - SV[J2][J1]=SM[J1][J2]; - } - } // 180 - SMAX=0.; - for (J1=1;J1<4;J1++) { // 200 - for (J2=1;J2<4;J2++) { // 190 - if(std::fabs(SV[J1][J2])>SMAX) { // 190 - JA=J1; - JB=J2; - SMAX=std::fabs(SV[J1][J2]); - } - } // 190 - } // 200 - SMAX=0.; - for (J3=JA+1;J3SMAX) { // GOTO 210 - JC=J1; - SMAX=std::fabs(SV[J1][J2]); - } - } // 210 - } // 220 - JB1=JB+1-3*(JB/3); - JB2=JB+2-3*((JB+1)/3); - P[N+I][JB1]=-SV[JC][JB2]; - P[N+I][JB2]=SV[JC][JB1]; - P[N+I][JB]=-(SV[JA][JB1]*P[N+I][JB1]+SV[JA][JB2]*P[N+I][JB2])/ - SV[JA][JB]; - PA=TMath::Sqrt(pow(P[N+I][1],2)+pow(P[N+I][2],2)+pow(P[N+I][3],2)); -// make a random number - float pa=P[N-1][I]; - rlu=std::fabs(pa)-std::fabs(int(pa)*1.); - rlu1=std::fabs(pa*pa)-std::fabs(int(pa*pa)*1.); - SGN=pow((-1.),1.*int(rlu+0.5)); - for (J=1;J<4;J++) { // 230 - P[N+I][J]=SGN*P[N+I][J]/PA; - } // 230 - } // 240 - -// C...Middle axis orthogonal to other two. Fill other codes. - SGN=pow((-1.),1.*int(rlu1+0.5)); - P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]); - P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]); - P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]); - -// C...Calculate sphericity and aplanarity. Select storing option. - //SPH=1.5*(P[N+2][4]+P[N+3][4]); //FIXME: commented out since gcc461 complained that this variable is set but unused - //APL=1.5*P[N+3][4]; //FIXME: commented out since gcc461 complained that this variable is set but unused - - } // check 1 - - // so assume now we have Sphericity axis, which one give the minimal Pts - double etstot[4]; - double eltot[4]; - double sum23=0; - double sum22=0; - double sum33=0; - double pina[4]; - double ax[4], ay[4], az[4]; - for (int ia=1;ia<4;ia++) { - etstot[ia]=0; - eltot[ia]=0; - pina[ia]=0; - ax[ia]=P[N+ia][1]; - ay[ia]=P[N+ia][2]; - az[ia]=P[N+ia][3]; - ax[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - ay[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - az[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - } - - for (int k =0 ; k=0) { - double x1=(sqrt(disc)-b)/2/a; - double x2=(-sqrt(disc)-b)/2/a; - phi=atan(x1); - phip=atan(x2); - if (phi<0) phi=2.*pi+phi; - if (phip<0) phip=2.*pi+phip; - } - double p21=sum22*cos(phi)*cos(phi)+sum33*sin(phi)*sin(phi)+2*sum23*cos(phi)*sin(phi); - double p31=sum22*sin(phi)*sin(phi)+sum33*cos(phi)*cos(phi)-2*sum23*cos(phi)*sin(phi); - - double p22=sum22*cos(phip)*cos(phip)+sum33*sin(phip)*sin(phip)+2*sum23*cos(phip)*sin(phip); - double p32=sum22*sin(phip)*sin(phip)+sum33*cos(phip)*cos(phip)-2*sum23*cos(phip)*sin(phip); - - - double d1=std::fabs(p31*p31 - p21*p21); - double d2=std::fabs(p32*p32 - p22*p22); - //cout << " eltot " << eltot[2] << " " << eltot[3] << endl; - //cout << " phi " << phi << " " << phip << endl; - //cout << " d " << d1 << " " << d2 << endl; - p2=p21; - p3=p31; - if (d2>d1) { - p2=p22; - p3=p32; - } - pnorm=sqrt(eltot[1]); - if (p2>p3) { - p3=sqrt(p3); - p2=sqrt(p2); - }else { - double p4=p3; - p3=sqrt(p2); - p2=sqrt(p4); - } - //cout << " sum2 sum3 " << sqrt(sum22) << " " << sqrt(sum33) << endl; - //cout << " p2 p3 " << p2 << " " << p3 << endl; - //double els=sqrt(eltot[2]*eltot[2]+eltot[3]*eltot[3]); - // cout << " ets els " << (ettot[1]) << " " << els << endl; - - //m_sph=SPH; //FIXME: shouldn't the local variables be used to reset the class member variables accordingly? - //m_apl=APL; //FIXME: shouldn't the local variables be used to reset the class member variables accordingly? - return; -} // end planes_sphe - - - -void TopologyWorker::planes_thrust(double& pnorm, double& p2, double& p3) { - TVector3 thrustaxis=thrustAxis(); - TVector3 majoraxis=majorAxis(); - TVector3 minoraxis=minorAxis(); - // so assume now we have Sphericity axis, which one give the minimal Pts - double etstot[4]; - double eltot[4]; - double sum23=0; - double sum22=0; - double sum33=0; - double pina[4]; - double ax[4], ay[4], az[4]; - ax[1]=thrustaxis(0); ay[1]=thrustaxis(1); az[1]=thrustaxis(2); - ax[2]=minoraxis(0); ay[2]=minoraxis(1); az[2]=minoraxis(2); - ax[3]=majoraxis(0); ay[3]=majoraxis(1); az[3]=majoraxis(2); - for (int ia=1;ia<4;ia++) { - etstot[ia]=0; - eltot[ia]=0; - pina[ia]=0; - ax[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - ay[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - az[ia]/=sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]); - } - - for (int k =0 ; k=0) { - double x1=(sqrt(disc)-b)/2/a; - double x2=(-sqrt(disc)-b)/2/a; - phi=atan(x1); - phip=atan(x2); - if (phi<0) phi=2.*pi+phi; - if (phip<0) phip=2.*pi+phip; - } - double p21=sum22*cos(phi)*cos(phi)+sum33*sin(phi)*sin(phi)+2*sum23*cos(phi)*sin(phi); - double p31=sum22*sin(phi)*sin(phi)+sum33*cos(phi)*cos(phi)-2*sum23*cos(phi)*sin(phi); - - double p22=sum22*cos(phip)*cos(phip)+sum33*sin(phip)*sin(phip)+2*sum23*cos(phip)*sin(phip); - double p32=sum22*sin(phip)*sin(phip)+sum33*cos(phip)*cos(phip)-2*sum23*cos(phip)*sin(phip); - - - double d1=std::fabs(p31*p31 - p21*p21); - double d2=std::fabs(p32*p32 - p22*p22); - //cout << " eltot " << eltot[2] << " " << eltot[3] << endl; - //cout << " phi " << phi << " " << phip << endl; - //cout << " d " << d1 << " " << d2 << endl; - p2=p21; - p3=p31; - if (d2>d1) { - p2=p22; - p3=p32; - } - pnorm=sqrt(etstot[1]); - if (p2>p3) { - p3=sqrt(p3); - p2=sqrt(p2); - }else { - double p4=p3; - p3=sqrt(p2); - p2=sqrt(p4); - } - //cout << " sum2 sum3 " << sqrt(sum22) << " " << sqrt(sum33) << endl; - //cout << " p2 p3 " << p2 << " " << p3 << endl; - //double els=sqrt(eltot[2]*eltot[2]+eltot[3]*eltot[3]); - // cout << " ets els " << (ettot[1]) << " " << els << endl; - return; -} // end planes_thru - - -void TopologyWorker::fowo() { -// 20020830 changed: from p/E to Et/Ettot and include H50 and H60 - m_fowo_called=true; - // include fox wolframs - float H10=-1; - float H20=-1; - float H30=-1; - float H40=-1; - float H50=-1; - float H60=-1; - if (1==1) { - float P[1000][6],H0,HD,CTHE; - int N,NP,I,J,I1,I2; - H0=HD=0.; - N=m_np; - NP=0; - for (I=1;I0.000001) { - eta = -log( tan( thg/2.0 ) ); - } - phi = atan2(py,px); - if(phi<=0) phi += 2.0*pi; - return; -} - - - -void TopologyWorker::sumangles(float& sdeta, float& sdr) { - double eta1,eta2,phi1,phi2,deta,dphi,dr; - m_sumangles_called=true; - sdeta=0; - sdr=0; - for (int k=0;k3.1415) dphi=2*3.1415-dphi; - deta=std::fabs(eta1-eta2); - dr=sqrt(dphi*dphi+deta*deta); - sdeta+=deta; - sdr+=dr; - } - } - return; -} - -//______________________________________________________________ - -Int_t TopologyWorker::iPow(Int_t man, Int_t exp) -{ - Int_t ans = 1; - for( Int_t k = 0; k < exp; k++) - { - ans = ans*man; - } - return ans; -} - -// added by Freya: - -void TopologyWorker::CalcWmul(){ - - Int_t njets = m_np; - double result=0; - for(Int_t ijet=0; ijetelo){ - elo=CalcPt(njets-1); - } - - result+=0.5 * (elo*elo-(15*15))*(njets); - result/=((55*55)-100)/2.0; - m_njetsweighed=result; -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -void TopologyWorker::CalcSqrts(){ - TLorentzVector event(0,0,0,0); - TLorentzVector worker(0,0,0,0); - - for(int i=0; i< m_np; i++){ - double energy=m_mom(i,4); - if(m_mom(i,4)<0.00001) - energy=sqrt(pow(m_mom(i,1),2)+pow(m_mom(i,2),2)+pow(m_mom(i,3),2)); - // assume massless particle if only TVector3s are provided... - worker.SetXYZT(m_mom(i,1),m_mom(i,2),m_mom(i,3),energy); - event+=worker; - } - m_sqrts=event.M(); -} - -//++++++++++++++++++++++++++++++++++++++ -void TopologyWorker::CalcHTstuff(){ - m_ht=0; - m_ht3=0; - m_et56=0; - m_et0=0; - double ptlead=0; - double h=0; - for(int i=0; i< m_np; i++){ - //cout << i << "/" << m_np << ":" << CalcPt(i) << endl; - m_ht+=CalcPt(i); - h+=m_mom(i,4); - if(i>1) - m_ht3+=CalcPt(i); - if(i==5) - m_et56=sqrt(CalcPt(i)*CalcPt(i-1)); - } - - for(int j=0; j< m_np2; j++){ - //cout << j << "/" << m_np2 << ":" << CalcPt2(j) << endl; - if(ptlead0.0001){ - m_et0=ptlead/m_ht; - //cout << "calculating ETO" << m_et0 << "=" << ptlead << endl; - } - if(h>0.00001) - m_centrality=m_ht/h; -} - -#endif - - - - diff --git a/TrackingTools/AnalyticalJacobians/interface/CurvilinearJacobian.h b/TrackingTools/AnalyticalJacobians/interface/CurvilinearJacobian.h deleted file mode 100644 index 85ae38f062ac1..0000000000000 --- a/TrackingTools/AnalyticalJacobians/interface/CurvilinearJacobian.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CurvilinearJacobian_H -#define CurvilinearJacobian_H - -#include "DataFormats/Math/interface/AlgebraicROOTObjects.h" - -/** Base class for calculations of Jacobians of transformations within the curvilinear frame. - */ - -class CurvilinearJacobian { -public: - - CurvilinearJacobian() : theJacobian(AlgebraicMatrixID()){} - - virtual ~CurvilinearJacobian() {} - - const AlgebraicMatrix55& jacobian() const {return theJacobian;} - -protected: - - AlgebraicMatrix55 theJacobian; - - -}; - -#endif diff --git a/TrackingTools/GsfTools/interface/GaussianSumUtilities.h b/TrackingTools/GsfTools/interface/GaussianSumUtilities.h deleted file mode 100644 index 77ca08116638f..0000000000000 --- a/TrackingTools/GsfTools/interface/GaussianSumUtilities.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef GaussianSumUtilities_h_ -#define GaussianSumUtilities_h_ - -#include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h" -#include "TrackingTools/GsfTools/interface/SingleGaussianState.h" -#include "TrackingTools/GsfTools/interface/MultiGaussianState.h" -#include - -/** Utility class for the analysis of multi-dimensional Gaussian - * mixtures. The input state is assumed to exist for - * the lifetime of this object. - */ - -template -class GaussianSumUtilities { -public: - typedef SingleGaussianState SingleState; - typedef MultiGaussianState MultiState; -// typedef ROOT::Math::SVector Vector; - typedef ROOT::Math::SMatrix > GenMatrix; - - typedef typename SingleState::Vector Vector; - typedef typename SingleState::Matrix Matrix; - typedef typename MultiState::SingleStatePtr SingleStatePtr; - typedef typename MultiState::SingleStateContainer SingleStateContainer; - -private: - enum ModeStatus { Valid, NotValid, NotComputed }; - -public: - GaussianSumUtilities (const MultiState& state) : - theState(state), - theModeStatus(NotComputed) { - } - ~GaussianSumUtilities () { - } - - /// number of components - inline unsigned int size () const { - return components().size(); - } - /// components - const SingleStateContainer& components () const { - return theState.components(); - } - /// multi-state - const MultiState& state () const { - return theState; - } - /// weight of a component - inline double weight (unsigned int i) const { - return components()[i]->weight(); - } - /// mean value of a component - inline const Vector& mean (unsigned int i) const { - return components()[i]->mean(); - } - /// covariance matrix of a component - inline const Matrix& covariance (unsigned int i) const { - return components()[i]->covariance(); - } - /// mode status - bool modeIsValid () const; - /** Mode "state": mean = mode, covariance = local covariance at mode, - * weight chosen to have pdf(mode) equal to the one of the mixture */ - const SingleGaussianState& mode () const; - /// value of the p.d.f. - double pdf (const Vector&) const; - /// gradient - Vector d1Pdf (const Vector&) const; - /// Hessian - Matrix d2Pdf (const Vector&) const; - /// value of ln(pdf) - double lnPdf (const Vector&) const; - /// gradient of ln(pdf) - Vector d1LnPdf (const Vector&) const; - /// Hessian of ln(pdf) - Matrix d2LnPdf (const Vector&) const; - - /// combined weight - double weight () const { - return theState.weight(); - } - /// combined mean - const Vector& mean () const { - return theState.mean(); - } - /// combined covariance - const Matrix& covariance () const { - return theState.covariance(); - } - - -protected: - /// calculation of mode - Vector computeModeWithoutTransform () const; - -private: - /// Symmetric Tensor Product (not recognized by standard ROOT Math) - Matrix tensorProduct (const Vector&) const; - /// value of gaussian distribution - double gauss (const double&, const double&, const double&) const; - /// value of multidimensional gaussian distribution - double gauss (const Vector&, - const Vector&, - const Matrix&) const; - /// mode from starting value in ln(pdf); returns true on success - bool findMode (Vector& mode, double& pdfAtMode, - const Vector& xStart) const; - /// calculation of mode with transformation of pdf - void computeMode () const; - /// state constrained to a line x = s*d+x0 - MultiGaussianState1D constrainedState (const Vector& d, - const Vector& x0) const; -// /// replacement of CLHEP determinant (which rounds off small values) -// double determinant (const Matrix& matrix) const; - /** Local variance from Hessian matrix. - * Only valid if x corresponds to a (local) maximum! */ - Matrix localCovariance (const Vector& x) const; - /// set mode "state" from solution of mode finding - void setMode (const Vector& mode) const; - /// set mode "state" in case of failure - void setInvalidMode () const; - - /// pdf components - std::vector pdfComponents (const Vector&) const; - /// value of the p.d.f. using the pdf components at the evaluation point - double pdf (const Vector&, const std::vector&) const; - /// gradient using the pdf components at the evaluation point - Vector d1Pdf (const Vector&, const std::vector&) const; - /// Hessian using the pdf components at the evaluation point - Matrix d2Pdf (const Vector&, const std::vector&) const; - /// value of ln(pdf) using the pdf components at the evaluation point - double lnPdf (const Vector&, const std::vector&) const; - /// gradient of ln(pdf) using the pdf components at the evaluation point - Vector d1LnPdf (const Vector&, const std::vector&) const; - /// Hessian of ln(pdf) using the pdf components at the evaluation point - Matrix d2LnPdf (const Vector&, const std::vector&) const; - - - -private: - const MultiState& theState; -// int theDimension; - - mutable ModeStatus theModeStatus; -// mutable Vector theMode; - mutable SingleGaussianState theMode; - -}; - -#include "TrackingTools/GsfTools/interface/GaussianSumUtilities.icc" - -#endif diff --git a/TrackingTools/GsfTools/interface/GaussianSumUtilities.icc b/TrackingTools/GsfTools/interface/GaussianSumUtilities.icc deleted file mode 100644 index 926f60dd7f6af..0000000000000 --- a/TrackingTools/GsfTools/interface/GaussianSumUtilities.icc +++ /dev/null @@ -1,573 +0,0 @@ -#include "TrackingTools/GsfTools/interface/GaussianSumUtilities.h" - -#include "TrackingTools/GsfTools/interface/SingleGaussianState1D.h" -#include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h" -#include "TrackingTools/GsfTools/interface/GaussianSumUtilities1D.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -// #include "Utilities/Timing/interface/TimingReport.h" -// #include "Utilities/Timing/interface/TimerStack.h" - -#include "TROOT.h" -#include "TMath.h" -#include "TVectorD.h" -#include "TMatrixDSym.h" -#include "TMatrixDSymEigen.h" - -#include -#include - -#include -#include - - -template -bool -GaussianSumUtilities::modeIsValid () const -{ - if ( theModeStatus==NotComputed ) computeMode(); - return theModeStatus==Valid; -} - -template -const SingleGaussianState& -GaussianSumUtilities::mode () const -{ - if ( theModeStatus==NotComputed ) computeMode(); - return theMode; -} - -template -void -GaussianSumUtilities::computeMode () const -{ -// TimerStack tstack; -// tstack.benchmark("GSUND::benchmark",1000000); -// FastTimerStackPush(tstack,"GaussianSumUtilities::computeMode"); - // - // initialize status - // - theModeStatus = NotValid; - // - // diagonalize / normalize (better convergence) - // based on component with highest pdf at mean - // - unsigned int icMax(0); - double yMax(-1.); - for ( unsigned int ic=0; icyMax ) { - icMax = ic; - yMax = y; - } - } - // need to copy the matrix since diagonalization is not - // available for SMatrix but there must be a better way - // to copy the matrix ... - TMatrixDSym diag(N); - for ( unsigned int i=0; i(newMean,newCov,(**i).weight()); - newStates.push_back(sgs); - } - MultiState newState(newStates); - GaussianSumUtilities newGSU(newState); - // - // get mode in transformed system - // - Vector newMode = newGSU.computeModeWithoutTransform(); - // - // transform back - // - if ( newGSU.modeIsValid() ) { -// Vector mode((ROOT::Math::Transpose(rotT)*newMode)+trans); - Vector mode(rot*newMode+trans); - setMode(mode); - } - else { - edm::LogWarning("GaussianSumUtilities") << "multi-dimensional mode calculation failed"; - setInvalidMode(); - } - -} - -template -typename GaussianSumUtilities::Vector -GaussianSumUtilities::computeModeWithoutTransform () const -{ - // - // initialize status - // - theModeStatus = NotValid; - // - // Use means of individual components as start values. - // Sort by value of pdf. - // - typedef std::multimap > StartMap; - StartMap xStart; - for ( UInt_t i=0; i result(-1.,mean((*xStart.begin()).second)); - Vector xRes; - double yRes(0.); - for ( StartMap::const_iterator i=xStart.begin(); - i!=xStart.end(); i++ ) { - // - // If a solution exists: drop as soon as the pdf at - // start value drops to < 75% of maximum (try to avoid - // unnecessary searches for the mode) - // - if ( theModeStatus==Valid && - (*i).first/(*xStart.begin()).first<0.75 ) break; - // - // try to find mode from this start value - // - bool valid = findMode(xRes,yRes,mean((*i).second)); - - // - // store result if findMode was successful and if - // the new value is significantly higher - // - if ( valid && (result.first<0. || - (yRes-result.first)/(yRes+result.first)>1.e-5) ) { - theModeStatus = Valid; - result = std::make_pair(yRes,xRes); - } - } - // - // check (existance of) solution - // - if ( theModeStatus==Valid ) { - setMode(result.second); - } - else - setInvalidMode(); - - - return theMode.mean(); -} - -template -bool -GaussianSumUtilities::findMode (Vector& xMode, double& yMode, - const Vector& xStart) const -{ - static const int signHesse = (N%2) ? -1 : 1; - // - // use Newton or follow gradient - // - bool result(false); - Vector x1; - double y1(0.); - Vector x2(xStart); - std::vector pdfs; - pdfs.reserve(size()); - double y2(0.); - Vector yd2; - Vector ydh2; - double detHesse2(0.); - bool usedHesse(false); - // - // iterate until convergence - // - int nLoop(0); - while ( nLoop++<50 ) { - pdfs = pdfComponents(x2); - y2 = pdf(x2,pdfs); - ydh2 = yd2 = d1LnPdf(x2,pdfs); - // cuts tuned on N=5, might need revision for other dimension - // even if distribution is approx. normalized - if ( nLoop>1 && usedHesse && detHesse2>0. && - fabs(y2-y1)/(y2+y1)<1.e-10 || ROOT::Math::Mag2(yd2)<1.e-20 ) { - result = true; - break; - } - // - // Hessian (Sign(Det(hesse)) should be (-1)**N around maximum) - // -// Matrix hesse2 = d2LnPdf(x2,pdfs); -// usedHesse = false; -// hesse2.Det2(detHesse2); -// detHesse2 *= signHesse; -// int ifail; -// // GenMatrix invHesse2(hesse2.inverse(ifail)); -// Matrix invHesse2 = hesse2.Inverse(ifail); - Matrix hesse2(d2LnPdf(x2,pdfs)); - usedHesse = false; - hesse2.Det2(detHesse2); - detHesse2 *= signHesse; - bool success = hesse2.Invert(); - if ( success ) { - ydh2 = -hesse2*yd2; - usedHesse = true; - } - double s = ROOT::Math::Mag(ydh2); - if ( fabs(s)>FLT_MIN ) ydh2 *= 1./s; - // - // restrict to direction of gradient - // - if ( !usedHesse || detHesse2<0. ) { - MultiGaussianState1D oneDimState(constrainedState(ydh2,x2)); - GaussianSumUtilities1D gsUtils(oneDimState); - if ( !usedHesse || gsUtils.d2Pdf(0.)>=0. ) { - s = gsUtils.mode().mean(); - if ( !gsUtils.modeIsValid() ) s = 0.1; - } - } - // - // protect against too large steps (to be revised??) - // - if ( s<-3. ) s = -3.; - else if ( s>3. ) s = 3.; - // - // save old values - // - x1 = x2; - y1 = y2; - // - // set new values - // - x2 += s*ydh2; - } - xMode = x2; - yMode = y2; - return result; -} - -template -MultiGaussianState1D -GaussianSumUtilities::constrainedState (const Vector& d, - const Vector& x0) const -{ - static const double fNorm(1./pow(2*TMath::Pi(),N-1)); - std::vector states; - states.reserve(size()); - for ( typename SingleStateContainer::const_iterator i=components().begin(); - i!=components().end(); i++ ) { - double det; - (**i).weightMatrix().Det2(det); - if ( det<0 ) continue; - - Vector dx((**i).mean()-x0); -// double dGd = (**i).weightMatrix().similarity(d); - double dGd = ROOT::Math::Similarity(d,(**i).weightMatrix()); - if ( dGd<-FLT_MIN ) continue; - Vector gDx = (**i).weightMatrix()*dx; -// double dxGdx = dot(dx,gDx); -// double dGdx = dot(d,gDx); - double dxGdx = ROOT::Math::Dot(dx,gDx); - double dGdx = ROOT::Math::Dot(d,gDx); - double weight((**i).weight()); -// weight *= sqrt(determinant((**i).weightMatrix())* -// pow(fNorm,N-1)/dGd); -// weight *= sqrt(det*pow(fNorm,N-1)/dGd); - weight *= sqrt(det*fNorm/dGd); - double exponent = dxGdx - dGdx*dGdx/dGd; - if ( exponent>-400. ) weight *= exp(-0.5*exponent); - else weight = 0.; - states.push_back(SingleGaussianState1D(dGdx/dGd,1./dGd,weight)); - } - return MultiGaussianState1D(states); -} - -template -double -GaussianSumUtilities::pdf(const Vector& x) const -{ -return pdf(x,pdfComponents(x)); -} - -template -typename GaussianSumUtilities::Vector -GaussianSumUtilities::d1Pdf(const Vector& x) const -{ -return d1Pdf(x,pdfComponents(x)); -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::d2Pdf(const Vector& x) const -{ -return d2Pdf(x,pdfComponents(x)); -} - -template -double -GaussianSumUtilities::lnPdf(const Vector& x) const -{ -return lnPdf(x,pdfComponents(x)); -} - -template -typename GaussianSumUtilities::Vector -GaussianSumUtilities::d1LnPdf(const Vector& x) const -{ -return d1LnPdf(x,pdfComponents(x)); -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::d2LnPdf (const Vector& x) const -{ -return d2LnPdf(x,pdfComponents(x)); -} - -template -std::vector -GaussianSumUtilities::pdfComponents (const Vector& x) const -{ - std::vector result; - result.reserve(size()); - for ( typename SingleStateContainer::const_iterator i=components().begin(); - i!=components().end(); i++ ) { - result.push_back((**i).weight()*gauss(x,(**i).mean(),(**i).weightMatrix())); - } - return result; -} - -template -double -GaussianSumUtilities::pdf (const Vector& x, const std::vector& pdfs) const -{ - double result(0.); - for ( std::vector::const_iterator i=pdfs.begin(); - i!=pdfs.end(); ++i ) result += *i; - return result; -} - -template -typename GaussianSumUtilities::Vector -GaussianSumUtilities::d1Pdf (const Vector& x, const std::vector& pdfs) const -{ - Vector result; // rely on root doc that vector is initialised to 0 - typename SingleStateContainer::const_iterator ic = components().begin(); - std::vector::const_iterator ip = pdfs.begin(); - for ( ; ic!=components().end(); ++ic,++ip ) { - Vector gx((**ic).weightMatrix()*(x-(**ic).mean())); - gx *= -(*ip); - result += gx; - } - return result; -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::d2Pdf (const Vector& x, const std::vector& pdfs) const -{ - Matrix result; // (N,0); - typename SingleStateContainer::const_iterator ic = components().begin(); - std::vector::const_iterator ip = pdfs.begin(); - for ( ; ic!=components().end(); ++ic,++ip ) { - Vector gx((**ic).weightMatrix()*(x-(**ic).mean())); -// Matrix c(vT_times_v(gx)); - Matrix c(tensorProduct(gx)); - c -= (**ic).weightMatrix(); - c *= (*ip); - result += c; - } - return result; -} - -template -double -GaussianSumUtilities::lnPdf (const Vector& x, const std::vector& pdfs) const -{ - double result = pdf(x,pdfs); - if ( result>DBL_MIN ) result = log(result); - else result = -FLT_MAX; - return result; -} - -template -typename GaussianSumUtilities::Vector -GaussianSumUtilities::d1LnPdf (const Vector& x, const std::vector& pdfs) const -{ - double f = pdf(x,pdfs); - Vector result(d1Pdf(x,pdfs)); - if ( f>DBL_MIN ) result /= f; - else result *= 0.; - return result; -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::d2LnPdf (const Vector& x, const std::vector& pdfs) const -{ - double f(pdf(x,pdfs)); - Vector df(d1LnPdf(x,pdfs)); -// Matrix result(-vT_times_v(df)); - Matrix result(-tensorProduct(df)); - if ( f>DBL_MIN ) result += d2Pdf(x,pdfs)/f; - return result; -} - -template -double -GaussianSumUtilities::gauss (const double& x, const double& mean, - const double& sigma) const -{ - const double fNorm(1./sqrt(2*TMath::Pi())); - double result(0.); - - double d((x-mean)/sigma); - if ( fabs(d)<20. ) result = exp(-d*d/2.); - result *= fNorm/sigma; - return result; -} - -template -double -GaussianSumUtilities::gauss (const Vector& x, - const Vector& means, - const Matrix& weightMatrix) const -{ - static const double fNorm(1./pow(2*TMath::Pi(),N)); - double result(0.); - - double det; - weightMatrix.Det2(det); - if ( det<0. ) return 0.; - - Vector dx(x-means); -// double d = weightMatrix.similarity(dx); - double d = ROOT::Math::Similarity(dx,weightMatrix); - // protection against numerical problems - if ( d<-FLT_MIN ) return 0.; - if ( d<400. ) result = exp(-d/2.); -// result *= sqrt(pow(fNorm,N)*determinant(weightMatrix)); -// result *= sqrt(pow(fNorm,N)*det); - result *= sqrt(fNorm*det); - return result; -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::localCovariance (const Vector& x) const -{ - Matrix result(d2Pdf(x)); - result *= -1./pdf(x); - - double det; - result.Det2(det); -// int ifail; -// // Matrix covariance(weightMatrix.inverse(ifail)); -// Matrix covariance = weightMatrix.Inverse(ifail); -// if ( ifail!=0 || det<=DBL_MIN ) { - bool success = result.Invert(); - if ( !success || det<=DBL_MIN ) { - edm::LogWarning("GaussianSumUtilities") - << "localCovariance: weight matrix is not pos. def."; - } -// return covariance; - return result; -} - -template -void -GaussianSumUtilities::setMode (const Vector& mode) const -{ - // - // Valid mode: construct single Gaussian state with - // mean = mode - // covariance = local covariance at mode - // weight such that the pdf's of the mixture and the - // single state are equal at the mode - // - theModeStatus = Valid; - Matrix covMode(localCovariance(mode)); - static const double fNorm(pow(2*TMath::Pi(),N)); - double det; - covMode.Det2(det); - double wgtMode = pdf(mode)*sqrt(fNorm*det); - theMode = SingleGaussianState(mode,covMode,wgtMode); -} - -template -void -GaussianSumUtilities::setInvalidMode () const -{ - // - // Mode finding failed: set solution to highest component - // (alternative would be global mean / covariance ..?) - // -// theMode = SingleGaussianState(mean(),covariance(),weight()); - // - // look for component with highest value at mean - // - unsigned int icMax(0); - double ySqMax(0.); - for ( unsigned int ic=0; ic(*components()[icMax]); -} - -template -typename GaussianSumUtilities::Matrix -GaussianSumUtilities::tensorProduct (const Vector& v) const -{ - Matrix result; - for ( unsigned int i=0; i Date: Mon, 13 Sep 2021 15:19:34 +0200 Subject: [PATCH 552/923] remove deltaR_ --- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc | 3 +-- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h | 2 +- Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc | 3 +-- Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 3cc0d3c5269c8..2b286619100f9 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -75,8 +75,7 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); - deltaR_ = conf.getParameter("DeltaR"); - deltaR2_ = deltaR_ * deltaR_; + deltaR2_ = conf.getParameter("DeltaR") * conf.getParameter("DeltaR"); inputFile_ = conf.getParameter("InputFile"); outputFile_ = conf.getParameter("OutputFile"); inputInternalPath_ = conf.getParameter("InputFolderName"); diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h index bb46dac5ac933..1d946e107e96e 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h @@ -67,7 +67,7 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_, deltaR2_; + double deltaR2_; std::string inputFile_; std::string outputFile_; diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc index d4d04c744bcd2..2ad72414b2d13 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc @@ -82,8 +82,7 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); - deltaR_ = conf.getParameter("DeltaR"); - deltaR2_ = deltaR_ * deltaR_; + deltaR2_ = conf.getParameter("DeltaR") * conf.getParameter("DeltaR"); matchingIDs_ = conf.getParameter >("MatchingID"); matchingMotherIDs_ = conf.getParameter >("MatchingMotherID"); inputFile_ = conf.getParameter("InputFile"); diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h index 5a42cbc8f779d..7b7433b1992d4 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h @@ -58,7 +58,7 @@ class ElectronMcSignalValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_, deltaR2_; + double deltaR2_; std::vector matchingIDs_; std::vector matchingMotherIDs_; std::string inputFile_; From ab8c5222f52f987897696464fd0292dcc5064757 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Tue, 7 Sep 2021 22:02:49 +0200 Subject: [PATCH 553/923] Set numberOfConcurrentLuminosityBlocks to 1 for GEN steps that have EDModules that are not going to support concurrent lumis --- .../Applications/python/ConfigBuilder.py | 6 ++++++ .../Generator/python/concurrentLumisDisable.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Configuration/Generator/python/concurrentLumisDisable.py diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index f87fe67ec4ce7..1a23bfbbff0c3 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -1368,6 +1368,8 @@ def prepare_GEN(self, sequence = None): raise Exception("Neither gen fragment of input files provided: this is an inconsistent GEN step configuration") if not loadFailure: + from Configuration.Generator.concurrentLumisDisable import noConcurrentLumiGenerators + generatorModule=sys.modules[loadFragment] genModules=generatorModule.__dict__ #remove lhe producer module since this should have been @@ -1385,6 +1387,10 @@ def prepare_GEN(self, sequence = None): theObject = getattr(generatorModule,name) if isinstance(theObject, cmstypes._Module): self._options.inlineObjets=name+','+self._options.inlineObjets + if theObject.type_() in noConcurrentLumiGenerators: + print("Setting numberOfConcurrentLuminosityBlocks=1 because of generator {}".format(theObject.type_())) + self._options.nConcurrentLumis = "1" + self._options.nConcurrentIOVs = "1" elif isinstance(theObject, cms.Sequence) or isinstance(theObject, cmstypes.ESProducer): self._options.inlineObjets+=','+name diff --git a/Configuration/Generator/python/concurrentLumisDisable.py b/Configuration/Generator/python/concurrentLumisDisable.py new file mode 100644 index 0000000000000..5c0f3b851d9b5 --- /dev/null +++ b/Configuration/Generator/python/concurrentLumisDisable.py @@ -0,0 +1,17 @@ +# list of generator EDModules (C++ type) that do not support concurrentLuminosityBlocks +noConcurrentLumiGenerators = [ + "AMPTGeneratorFilter", + "BeamHaloProducer", + "CosMuoGenProducer", + "Herwig7GeneratorFilter", + "HydjetGeneratorFilter", + "PyquenGeneratorFilter", + "Pythia6GeneratorFilter", + "Pythia8EGun", + "Pythia8GeneratorFilter", + "Pythia8HadronizerFilter", + "Pythia8PtAndDxyGun", + "Pythia8PtGun", + "ReggeGribovPartonMCGeneratorFilter", + "SherpaGeneratorFilter", +] From 78474b29356450e3abfcbaa2935976a09cd996e9 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 09:50:19 -0500 Subject: [PATCH 554/923] Change current path in cmsExternalGenerator not cmsRun When doing concurrent beginStreams, changing of the current path was causing interference between threads. --- GeneratorInterface/Core/bin/externalGenerator.cc | 8 ++++++++ .../Core/plugins/ExternalGeneratorFilter.cc | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/GeneratorInterface/Core/bin/externalGenerator.cc b/GeneratorInterface/Core/bin/externalGenerator.cc index fb8722415842d..08ed2d0eb8374 100644 --- a/GeneratorInterface/Core/bin/externalGenerator.cc +++ b/GeneratorInterface/Core/bin/externalGenerator.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include "FWCore/TestProcessor/interface/TestProcessor.h" @@ -137,6 +138,13 @@ int main(int argc, char* argv[]) { return 1; } + using namespace std::string_literals; + using namespace std::filesystem; + + auto newDir = path("thread"s + vm[kUniqueIDOpt].as()); + create_directory(newDir); + current_path(newDir); + WorkerMonitorThread monitorThread; monitorThread.startThread(); diff --git a/GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc b/GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc index 2436ef977b565..9a8960f10fdb7 100644 --- a/GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc +++ b/GeneratorInterface/Core/plugins/ExternalGeneratorFilter.cc @@ -46,22 +46,15 @@ namespace externalgen { channel_.setupWorker([&]() { using namespace std::string_literals; - using namespace std::filesystem; edm::LogSystem("ExternalProcess") << id_ << " starting external process \n"; std::string verboseCommand; if (verbose) { verboseCommand = "--verbose "; } - auto curDir = current_path(); - auto newDir = path("thread"s + std::to_string(id_)); - create_directory(newDir); - current_path(newDir); pipe_ = popen(("cmsExternalGenerator "s + verboseCommand + channel_.sharedMemoryName() + " " + channel_.uniqueID()) .c_str(), "w"); - current_path(curDir); - if (nullptr == pipe_) { abort(); } From 68e0b7946099b091bc7419cdab613525767a415c Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 13 Sep 2021 13:07:49 +0200 Subject: [PATCH 555/923] modernize Alignment/TrackerAlignment --- .../plugins/AlignmentPrescaler.cc | 146 +++++++++++------- .../plugins/AlignmentPrescaler.h | 48 ------ .../TrackerAlignment/plugins/BuildFile.xml | 1 + .../plugins/TkAlCaOverlapTagger.cc | 79 ++++++---- .../plugins/TkAlCaSkimTreeMerger.cc | 75 +++++---- 5 files changed, 189 insertions(+), 160 deletions(-) delete mode 100644 Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h diff --git a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc index a62eec5546a0e..029a0b5146727 100644 --- a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc +++ b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc @@ -1,33 +1,73 @@ -#include "Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Alignment/CommonAlignment/interface/Alignable.h" +#include "Alignment/CommonAlignment/interface/Utilities.h" +#include "Alignment/TrackerAlignment/interface/AlignableTracker.h" +#include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" +#include "DataFormats/Alignment/interface/AliClusterValueMap.h" +#include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Common/interface/View.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/Utilities/interface/InputTag.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Alignment/TrackerAlignment/interface/AlignableTracker.h" -#include "Alignment/CommonAlignment/interface/Alignable.h" -#include "Alignment/CommonAlignment/interface/Utilities.h" +#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h" +#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h" #include "Utilities/General/interface/ClassName.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" +#include "TFile.h" +#include "TTree.h" +#include "TRandom3.h" +#include "TH1F.h" +#include -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h" -#include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" -#include "DataFormats/Alignment/interface/AliClusterValueMap.h" +class TrackerTopology; + +class AlignmentPrescaler : public edm::one::EDProducer<> { +public: + AlignmentPrescaler(const edm::ParameterSet& iConfig); + ~AlignmentPrescaler() override; + void beginJob() override; + void endJob() override; + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + // tokens + edm::EDGetTokenT tracksToken_; //tracks in input + edm::EDGetTokenT aliClusterToken_; //Hit-quality association map -// #include "Riostream.h" + std::string prescfilename_; //name of the file containing the TTree with the prescaling factors + std::string presctreename_; //name of the TTree with the prescaling factors + + TFile* fpresc_; + TTree* tpresc_; + TRandom3* myrand_; + + int layerFromId(const DetId& id, const TrackerTopology* tTopo) const; + + unsigned int detid_; + float hitPrescFactor_, overlapPrescFactor_; + int totnhitspxl_; +}; using namespace std; AlignmentPrescaler::AlignmentPrescaler(const edm::ParameterSet& iConfig) - : src_(iConfig.getParameter("src")), - srcQualityMap_(iConfig.getParameter("assomap")), + : tracksToken_(consumes(iConfig.getParameter("src"))), + aliClusterToken_(consumes(iConfig.getParameter("assomap"))), prescfilename_(iConfig.getParameter("PrescFileName")), presctreename_(iConfig.getParameter("PrescTreeName")) { // issue the produce<> @@ -35,13 +75,11 @@ AlignmentPrescaler::AlignmentPrescaler(const edm::ParameterSet& iConfig) produces(); } -AlignmentPrescaler::~AlignmentPrescaler() { - // -} +AlignmentPrescaler::~AlignmentPrescaler() = default; void AlignmentPrescaler::beginJob() { // - std::cout << "in AlignmentPrescaler::beginJob" << std::flush; + edm::LogPrint("AlignmentPrescaler") << "in AlignmentPrescaler::beginJob" << std::flush; fpresc_ = new TFile(prescfilename_.c_str(), "READ"); tpresc_ = (TTree*)fpresc_->Get(presctreename_.c_str()); tpresc_->BuildIndex("DetId"); @@ -49,7 +87,7 @@ void AlignmentPrescaler::beginJob() { tpresc_->SetBranchStatus("DetId", true); tpresc_->SetBranchStatus("PrescaleFactor", true); tpresc_->SetBranchStatus("PrescaleFactorOverlap", true); - cout << " Branches activated " << std::flush; + edm::LogPrint("AlignmentPrescaler") << " Branches activated " << std::flush; detid_ = 0; hitPrescFactor_ = 99.0; overlapPrescFactor_ = 88.0; @@ -57,10 +95,10 @@ void AlignmentPrescaler::beginJob() { tpresc_->SetBranchAddress("DetId", &detid_); tpresc_->SetBranchAddress("PrescaleFactor", &hitPrescFactor_); tpresc_->SetBranchAddress("PrescaleFactorOverlap", &overlapPrescFactor_); - cout << " addressed " << std::flush; + edm::LogPrint("AlignmentPrescaler") << " addressed " << std::flush; myrand_ = new TRandom3(); // myrand_->SetSeed(); - cout << " ok " << std::endl; + edm::LogPrint("AlignmentPrescaler") << " ok "; } void AlignmentPrescaler::endJob() { @@ -71,25 +109,25 @@ void AlignmentPrescaler::endJob() { } void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // std::cout<<"\n\n#################\n### Starting the AlignmentPrescaler::produce ; Event: "< Tracks; - iEvent.getByLabel(src_, Tracks); + iEvent.getByToken(tracksToken_, Tracks); //take HitAssomap - edm::Handle hMap; - iEvent.getByLabel(srcQualityMap_, hMap); - AliClusterValueMap InValMap = *hMap; + AliClusterValueMap InValMap = iEvent.get(aliClusterToken_); //prepare the output of the ValueMap flagging tracks std::vector trackflags(Tracks->size(), 0); - //int npxlhits=0; + int npxlhits = 0; //loop on tracks for (std::vector::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk; ++ittrk) { //loop on tracking rechits - // std::cout << "Loop on hits of track #" << (ittrk - Tracks->begin()) << std::endl; + LogDebug("AlignmentPrescaler") << "Loop on hits of track #" << (ittrk - Tracks->begin()) << std::endl; int nhit = 0; int ntakenhits = 0; bool firstTakenHit = false; @@ -135,10 +173,11 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet tmpflag.SetDetId(hit->geographicalId()); if (tmpflag.isOverlap()) isOverlapHit = true; - // std::cout<<"~*~*~* Prescale (1D) for module "<(hit); @@ -148,17 +187,18 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet tmpflag.SetDetId(hit->geographicalId()); if (tmpflag.isOverlap()) isOverlapHit = true; - // std::cout<<"~*~*~* Prescale (2D) for module "<(hit); if (pixelhit != nullptr) { - //npxlhits++; + npxlhits++; SiPixelClusterRefNew pixclust(pixelhit->cluster()); tmpflag = InValMap[pixclust]; tmpflag.SetDetId(hit->geographicalId()); @@ -169,7 +209,7 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet // tmpflag.SetDetId(hit->geographicalId()); if (isOverlapHit) { - //cout<<" DetId="<Rndm()) <= overlapPrescFactor_); } if (!takeit) { @@ -177,7 +217,7 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet takeit = (rr <= hitPrescFactor_); } if (takeit) { //HIT TAKEN ! - //cout<<" DetId="< 2) { @@ -196,22 +236,15 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet if (!firstTakenHit) { firstTakenHit = true; - //std::cout<<"Index of the track iterator is "<< ittrk-Tracks->begin() <begin(); } ntakenhits++; } //end if take this hit - //cout<begin()] = ntakenhits; - } //end loop on tracks - // totnhitspxl_+=ntakenhits; - //cout<<"AlignmentPrescaler::produce says that in this event "<(); @@ -242,9 +275,18 @@ int AlignmentPrescaler::layerFromId(const DetId& id, const TrackerTopology* tTop return tTopo->tidWheel(id) + (3 * (tTopo->tidSide(id) - 1)); } return -1; - } //end layerfromId +void AlignmentPrescaler::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Prescale Tracker Alignment hits for alignment procedures"); + desc.add("src", edm::InputTag("generalTracks")); + desc.add("assomap", edm::InputTag("OverlapAssoMap")); + desc.add("PrescFileName", "PrescaleFactors.root"); + desc.add("PrescTreeName", "AlignmentHitMap"); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h deleted file mode 100644 index dc143c2220dab..0000000000000 --- a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef TrackerAlignment_AlignmentPrescaler_H -#define TrackerAlignment_AlignmentPrescaler_H - -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/EventPrincipal.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" - -#include "DataFormats/DetId/interface/DetId.h" - -#include -#include "TFile.h" -#include "TTree.h" -#include "TRandom3.h" -#include "TH1F.h" - -class TrackerTopology; - -class AlignmentPrescaler : public edm::EDProducer { -public: - AlignmentPrescaler(const edm::ParameterSet &iConfig); - ~AlignmentPrescaler() override; - void beginJob() override; - void endJob() override; - void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; - -private: - edm::InputTag src_; //tracks in input - edm::InputTag srcQualityMap_; //Hit-quality association map - - std::string prescfilename_; //name of the file containing the TTree with the prescaling factors - std::string presctreename_; //name of the TTree with the prescaling factors - - TFile *fpresc_; - TTree *tpresc_; - TRandom3 *myrand_; - - int layerFromId(const DetId &id, const TrackerTopology *tTopo) const; - - unsigned int detid_; - float hitPrescFactor_, overlapPrescFactor_; - int totnhitspxl_; -}; -#endif diff --git a/Alignment/TrackerAlignment/plugins/BuildFile.xml b/Alignment/TrackerAlignment/plugins/BuildFile.xml index 1ba9005254f6d..80f283bd6dd47 100644 --- a/Alignment/TrackerAlignment/plugins/BuildFile.xml +++ b/Alignment/TrackerAlignment/plugins/BuildFile.xml @@ -18,6 +18,7 @@ + diff --git a/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc b/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc index 28cd34eebd324..1aa11fff757fd 100644 --- a/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc +++ b/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc @@ -1,10 +1,12 @@ -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventPrincipal.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/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/View.h" @@ -25,16 +27,19 @@ #include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Alignment/interface/AliClusterValueMap.h" -//#include -class TkAlCaOverlapTagger : public edm::EDProducer { +class TkAlCaOverlapTagger : public edm::stream::EDProducer<> { public: TkAlCaOverlapTagger(const edm::ParameterSet& iConfig); ~TkAlCaOverlapTagger() override; void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions&); private: const edm::ESGetToken topoToken_; + edm::EDGetTokenT trajTrackToken_; + edm::EDGetTokenT siPixelClustersToken_; + edm::EDGetTokenT siStripClustersToken_; edm::InputTag src_; edm::InputTag srcClust_; bool rejectBadMods_; @@ -45,31 +50,33 @@ class TkAlCaOverlapTagger : public edm::EDProducer { TkAlCaOverlapTagger::TkAlCaOverlapTagger(const edm::ParameterSet& iConfig) : topoToken_(esConsumes()), - src_(iConfig.getParameter("src")), - srcClust_(iConfig.getParameter("Clustersrc")), + trajTrackToken_(consumes((iConfig.getParameter("src")))), + siPixelClustersToken_(consumes((iConfig.getParameter("Clustersrc")))), + siStripClustersToken_(consumes((iConfig.getParameter("Clustersrc")))), rejectBadMods_(iConfig.getParameter("rejectBadMods")), - BadModsList_(iConfig.getParameter >("BadMods")) { + BadModsList_(iConfig.getParameter>("BadMods")) { produces(); //produces the ValueMap (VM) to be stored in the Event at the end } -TkAlCaOverlapTagger::~TkAlCaOverlapTagger() {} +TkAlCaOverlapTagger::~TkAlCaOverlapTagger() = default; void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry const TrackerTopology* tTopo = &iSetup.getData(topoToken_); edm::Handle assoMap; - iEvent.getByLabel(src_, assoMap); - // cout<<"\n\n############################\n### Starting a new TkAlCaOverlapTagger - Ev "< > pixelclusters; - iEvent.getByLabel(srcClust_, pixelclusters); //same label as tracks + edm::Handle> pixelclusters; + iEvent.getByToken(siPixelClustersToken_, pixelclusters); //same label as tracks std::vector pixelvalues(pixelclusters->dataSize(), iniflag); //vector where to store value to be fileld in the VM - edm::Handle > stripclusters; - iEvent.getByLabel(srcClust_, stripclusters); //same label as tracks + edm::Handle> stripclusters; + iEvent.getByToken(siStripClustersToken_, stripclusters); //same label as tracks std::vector stripvalues(stripclusters->dataSize(), iniflag); //vector where to store value to be fileld in the VM @@ -78,7 +85,7 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe //loop over trajectories for (TrajTrackAssociationCollection::const_iterator itass = assoMap->begin(); itass != assoMap->end(); ++itass) { int nOverlaps = 0; - const edm::Ref > traj = itass->key; //trajectory in the collection + const edm::Ref> traj = itass->key; //trajectory in the collection const Trajectory* myTrajectory = &(*traj); std::vector tmColl = myTrajectory->measurements(); @@ -95,14 +102,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe hitcnt++; if (previousTM != nullptr) { - // std::cout<<"Checking TrajMeas ("<recHit()->isValid()) { - //std::cout<<"Previous RecHit invalid !"<recHit()->geographicalId().rawId() + << "\t Local x of hit: " << previousTM->recHit()->localPosition().x(); } - //else std::cout<<"\nDetId: "<recHit()->geographicalId().rawId()<<"\t Local x of hit: "<recHit()->localPosition().x()<recHit(); @@ -110,7 +120,6 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe if (!hit->isValid()) continue; - //std::cout << " hit number " << (ith - itt->recHits().begin()) << std::endl; DetId detid = hit->geographicalId(); int layer(layerFromId(detid, tTopo)); //layer 1-4=TIB, layer 5-10=TOB int subDet = detid.subdetId(); @@ -133,12 +142,12 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe // AlignmentClusterFlag hitflag(hit->geographicalId()); hitflag.SetOverlapFlag(); - // cout<<"Overlap found in SubDet "<(hit); const SiStripRecHit1D* transstriphit1D = dynamic_cast(hit); @@ -177,14 +186,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe .id()) { //ensure that the stripclust is really present in the original cluster collection!!! stripvalues[stripclust.key()] = hitflag; - //cout<<">>> Storing in the ValueMap a StripClusterRef with Cluster.Key: "<cluster().key() <<"), Cluster.Id: "<geographicalId().rawId()<<")"<>> Storing in the ValueMap a StripClusterRef with Cluster.Key: " << stripclust.key() + << " (" << striphit->cluster().key() << "), Cluster.Id: " << stripclust.id() << " (DetId is " + << hit->geographicalId().rawId() << ")"; } else { edm::LogError("TkAlCaOverlapTagger") << "ERROR in : ProdId of Strip clusters mismatched: " << stripclust.id() << " vs " << stripclusters.id(); } - // cout<<"Cluster baricentre: "<barycenter()<barycenter(); } else { edm::LogError("TkAlCaOverlapTagger") << "ERROR in : Dynamic cast of " "Strip RecHit failed! TypeId of the RecHit: " @@ -206,7 +218,9 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe if (pixclust.id() == pixelclusters.id()) { pixelvalues[pixclust.key()] = hitflag; - //cout<<">>> Storing in the ValueMap a PixelClusterRef with ProdID: "<geographicalId().rawId()<<")" <>> Storing in the ValueMap a PixelClusterRef with ProdID: " << pixclust.id() + << " (DetId is " << hit->geographicalId().rawId() << ")"; //" and a Val with ID: "<: ProdId of Pixel clusters mismatched: " @@ -228,18 +242,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe previousTM = &(*itTrajMeas); previousId = detid; } //end loop over traj meas - //std::cout<<"Found "<(); AliClusterValueMap::Filler mapfiller(*hitvalmap); - edm::TestHandle > fakePixelHandle(&pixelvalues, pixelclusters.id()); + edm::TestHandle> fakePixelHandle(&pixelvalues, pixelclusters.id()); mapfiller.insert(fakePixelHandle, pixelvalues.begin(), pixelvalues.end()); - edm::TestHandle > fakeStripHandle(&stripvalues, stripclusters.id()); + edm::TestHandle> fakeStripHandle(&stripvalues, stripclusters.id()); mapfiller.insert(fakeStripHandle, stripvalues.begin(), stripvalues.end()); mapfiller.fill(); @@ -264,6 +277,16 @@ int TkAlCaOverlapTagger::layerFromId(const DetId& id, const TrackerTopology* tTo } //end layerfromId +void TkAlCaOverlapTagger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Tagger of overlaps for tracker alignment"); + desc.add("src", edm::InputTag("generalTracks")); + desc.add("Clustersrc", edm::InputTag("ALCARECOTkAlCosmicsCTF0T")); + desc.add("rejectBadMods", false); + desc.add>("BadMods", {}); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc b/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc index 458babf469b2f..4c11866e91217 100644 --- a/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc +++ b/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc @@ -1,19 +1,17 @@ - -#ifndef TrackerAlignment_TkAlCaSkimTreeMerger_H -#define TrackerAlignment_TkAlCaSkimTreeMerger_H - -#include #include #include #include +#include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventPrincipal.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/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "TFile.h" @@ -21,13 +19,14 @@ #include "TChain.h" #include "TStopwatch.h" -class TkAlCaSkimTreeMerger : public edm::EDAnalyzer { +class TkAlCaSkimTreeMerger : public edm::one::EDAnalyzer<> { public: TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig); ~TkAlCaSkimTreeMerger() override; void beginJob() override; void endJob() override; void analyze(const edm::Event &, const edm::EventSetup &) override; + static void fillDescriptions(edm::ConfigurationDescriptions &); private: TTree *out_; //TTree containing the merged result @@ -49,13 +48,10 @@ class TkAlCaSkimTreeMerger : public edm::EDAnalyzer { TStopwatch myclock; }; -#endif - TkAlCaSkimTreeMerger::TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig) : filelist_(iConfig.getParameter("FileList")), treename_(iConfig.getParameter("TreeName")), outfilename_(iConfig.getParameter("OutputFile")), - // maxhits_(iConfig.getParameter("NhitsMaxLimit")) maxhits_(iConfig.getParameter("NhitsMaxLimit")), maxhitsSet_(iConfig.getParameter("NhitsMaxSet")) { maxPXBhits_ = maxhitsSet_.getParameter("PXBmaxhits"); @@ -65,19 +61,15 @@ TkAlCaSkimTreeMerger::TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig) maxTOBhits_ = maxhitsSet_.getParameter("TOBmaxhits"); maxTEChits_ = maxhitsSet_.getParameter("TECmaxhits"); //anything you want to do for initializing - std::cout << "\n\n*** MAX N HITS = " << maxhits_ << std::endl << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "\n\n*** MAX N HITS = " << maxhits_ << std::endl << std::endl; out_ = nullptr; firsttree_ = nullptr; ch_ = nullptr; } TkAlCaSkimTreeMerger::~TkAlCaSkimTreeMerger() { - //default destructor - // delete out_; - // delete firsttree_; - delete ch_; - std::cout << "finished." << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "finished." << std::endl; } // ------------ method called before analyzing the first event ------------ @@ -86,7 +78,7 @@ void TkAlCaSkimTreeMerger::beginJob() { //prepare the chain ch_ = new TChain(treename_.c_str()); - std::cout << "The chain contains " << ch_->GetNtrees() << " trees" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "The chain contains " << ch_->GetNtrees() << " trees" << std::endl; //load the trees into the chain std::ifstream flist(filelist_.c_str(), std::ios::in); @@ -98,15 +90,15 @@ void TkAlCaSkimTreeMerger::beginJob() { flist >> filename; if (filename.empty()) continue; - //std::cout<<"Adding "<Add(filename.c_str()); if (first) { firstfilename_ = filename; first = false; } } - std::cout << "Now the chain contains " << ch_->GetNtrees() << " trees (" << ch_->GetEntries() << " entries)" - << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Now the chain contains " << ch_->GetNtrees() << " trees (" << ch_->GetEntries() + << " entries)" << std::endl; unsigned int id_ch = 0; uint32_t nhits_ch = 0, noverlaps_ch = 0; @@ -153,18 +145,18 @@ void TkAlCaSkimTreeMerger::beginJob() { } //end loop on ent - entries in the chain - std::cout << "Nhits in the chain: " << totnhits << std::endl; - std::cout << "NOverlaps in the chain: " << totnoverlaps << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Nhits in the chain: " << totnhits << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "NOverlaps in the chain: " << totnoverlaps << std::endl; myclock.Stop(); - std::cout << "Finished beginJob after " << myclock.RealTime() << " s (real time) / " << myclock.CpuTime() - << " s (cpu time)" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Finished beginJob after " << myclock.RealTime() << " s (real time) / " + << myclock.CpuTime() << " s (cpu time)" << std::endl; myclock.Continue(); } //end beginJob // ------------ method called to for each event ------------ void TkAlCaSkimTreeMerger::analyze(const edm::Event &, const edm::EventSetup &) { - // std::cout<GetEntries()<GetEntries() << std::endl; } //end analyze // ------------ method called after having analyzed all the events ------------ @@ -172,7 +164,7 @@ void TkAlCaSkimTreeMerger::endJob() { //address variables in the first tree and in the chain TFile *firstfile = new TFile(firstfilename_.c_str(), "READ"); firsttree_ = (TTree *)firstfile->Get(treename_.c_str()); - std::cout << "the first tree has " << firsttree_->GetEntries() << " entries" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "the first tree has " << firsttree_->GetEntries() << " entries" << std::endl; unsigned int id = 0; uint32_t nhits = 0, noverlaps = 0; float posX(-99999.0), posY(-77777.0), posZ(-88888.0); @@ -235,7 +227,7 @@ void TkAlCaSkimTreeMerger::endJob() { firsttree_->GetEntry(mod); nhits_out = hitmap_[id]; noverlaps_out = overlapmap_[id]; - // if(mod<25)std::cout<<"Nhits 1st tree: "<Write(); - std::cout << "Deleting..." << std::flush; + LogDebug("TkAlCaSkimTreeMerger") << "Deleting..." << std::flush; delete firstfile; delete outfile; - } //end endJob +void TkAlCaSkimTreeMerger::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Merger of TkAlCaSkim Trees"); + desc.add("FileList", "DQMHitMapsList.txt"); + desc.add("TreeName", "AlignmentHitMaps"); + desc.add("OutputFile", "AlignmentHitMapsMerged.root"); + desc.add("NhitsMaxLimit", 0); + + edm::ParameterSetDescription tkAlCaSkimTreeParamsDesc; + std::vector tkAlCaSkimDefaults(1); + tkAlCaSkimDefaults[0].addParameter("PXBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("PXFmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TIBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TIDmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TOBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TECmaxhits", -1); + desc.addVPSet("NhitsMaxSet", tkAlCaSkimTreeParamsDesc, tkAlCaSkimDefaults); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" From e2b80b8c4ad96104b4d90a4f85b99501c5bfe765 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 12 Sep 2021 15:41:52 +0200 Subject: [PATCH 556/923] Split HOCalibAnalyzer.cc to take out the post analysis part in separate macros Try to avoid clang error Code check Take care of Andrea's comment comment the debug Handle clang error Code check --- .../plugins/AlCaHBHEMuonFilter.cc | 28 +- .../plugins/AlCaIsoTracksFilter.cc | 42 +- .../HcalCalibAlgos/macros/hocalib_pl18.C | 4005 +++++++++++++++++ .../HcalCalibAlgos/macros/hocalib_tmpfit.C | 943 ++++ .../HcalCalibAlgos/plugins/HOCalibAnalyzer.cc | 3089 +++---------- 5 files changed, 5571 insertions(+), 2536 deletions(-) create mode 100644 Calibration/HcalCalibAlgos/macros/hocalib_pl18.C create mode 100644 Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc index d641028461442..1b099430b64cc 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc @@ -70,6 +70,7 @@ class AlCaHBHEMuonFilter : public edm::stream::EDFilter tok_trigEvt; @@ -104,6 +105,7 @@ AlCaHBHEMuonFilter::AlCaHBHEMuonFilter(edm::ParameterSet const& iConfig, const A preScale_ = iConfig.getParameter("PreScale"); if (preScale_ < 1) preScale_ = 1; + onlyOuterTrack_ = iConfig.getParameter("OnlyOuterTrack"); // define tokens for access tok_trigRes_ = consumes(triggerResults_); @@ -112,9 +114,11 @@ AlCaHBHEMuonFilter::AlCaHBHEMuonFilter(edm::ParameterSet const& iConfig, const A tok_geom_ = esConsumes(); tok_magField_ = esConsumes(); - edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n" - << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " - << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \nProcess " << processName_ << " Prescale " + << preScale_ << " Isolation Cuts " << pfCut_ << ":" << pfIsoCut_ << ":" << trackIsoCut_ + << ":" << caloIsoCut_ << " OnlyOuterTrack " << onlyOuterTrack_ << "\nInput tags " + << labelMuon_ << " and " << triggerResults_ << "\nStudy " << trigNames_.size() + << " triggers: "; for (unsigned int k = 0; k < trigNames_.size(); ++k) edm::LogVerbatim("HBHEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; } // AlCaHBHEMuonFilter::AlCaHBHEMuonFilter constructor @@ -171,9 +175,12 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu edm::Handle _Muon; iEvent.getByToken(tok_Muon_, _Muon); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << _Muon.isValid(); #endif if (_Muon.isValid()) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Size of collection " << _Muon->size(); +#endif for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() @@ -181,9 +188,11 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu << RecMuon->outerTrack().isNonnull() << " globalTrack " << RecMuon->globalTrack().isNonnull() << std::endl; #endif - if ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && - (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())) { - const reco::Track* pTrack = (RecMuon->innerTrack()).get(); + bool check = (onlyOuterTrack_) ? (RecMuon->outerTrack().isNonnull()) + : ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && + (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())); + if (check) { + const reco::Track* pTrack = (onlyOuterTrack_) ? (RecMuon->outerTrack()).get() : (RecMuon->innerTrack()).get(); spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, false); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " @@ -198,6 +207,10 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu (0.5 * RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()); bool isoCut = (pfCut_) ? (isolR04 < pfIsoCut_) : ((trackIso < trackIsoCut_) && (caloIso < caloIsoCut_)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Isolation: " << trackIso << ":" << caloIso << ":" + << isolR04 << " --> " << isoCut; +#endif if ((trackID.okECAL) && (trackID.okHCAL) && isoCut) { accept = true; break; @@ -260,6 +273,7 @@ void AlCaHBHEMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("TrackIsolationCut", 3.0); desc.add("CaloIsolationCut", 5.0); desc.add("PreScale", 2); + desc.add("OnlyOuterTrack", false); descriptions.add("AlcaHBHEMuonFilter", desc); } diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index c3a8ea75e6c5f..c68147717d559 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -53,6 +53,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -266,6 +267,9 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet } } } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: triggerSatisfied: " << triggerSatisfied; +#endif //Step2: Get geometry/B-field information if (triggerSatisfied) { @@ -315,6 +319,9 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_; foundCollections = false; } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: foundCollections: " << foundCollections; +#endif //Step3 propagate the tracks to calorimeter surface and find // candidates for isolated tracks @@ -324,14 +331,20 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false); std::vector::const_iterator trkDetItr; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: Has " << trkCaloDirections.size() + << " propagated tracks from a total of " << trkCollection->size(); +#endif unsigned int nTracks(0), nselTracks(0), ntrin(0), ntrout(0), ntrH(0); for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end(); trkDetItr++, nTracks++) { const reco::Track* pTrack = &(*(trkDetItr->trkItr)); math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); - + << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p() << " OK HCAL " + << trkDetItr->okHCAL; +#endif //Selection of good track int ieta(0); if (trkDetItr->okHCAL) { @@ -339,23 +352,28 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet ieta = detId.ietaAbs(); } bool qltyFlag = spr::goodTrack(pTrack, leadPV, selectionParameter_, false); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|" << trkDetItr->okHCAL; +#endif if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) { double t_p = pTrack->p(); nselTracks++; int nNearTRKs(0); std::vector eIds; std::vector eHit; - double eEcal = spr::eCone_ecal(geo, - barrelRecHitsHandle, - endcapRecHitsHandle, - trkDetItr->pointHCAL, - trkDetItr->pointECAL, - a_mipR_, - trkDetItr->directionECAL, - eIds, - eHit); +#ifdef EDM_ML_DEBUG + double eEcal = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR_, + trkDetItr->directionECAL, + eIds, + eHit); double eMipDR(0); for (unsigned int k = 0; k < eIds.size(); ++k) { const GlobalPoint& pos = geo->getPosition(eIds[k]); @@ -375,9 +393,11 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet double eIsolation = (maxRestrictionP_ * exp(slopeRestrictionP_ * ((double)(ieta)))); if (eIsolation < eIsolate_) eIsolation = eIsolate_; +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << "e_MIP " << eMipDR << ":" << eEcal << " Chg Isolation " << hmaxNearP << ":" << eIsolation; +#endif if (t_p > pTrackMin_ && eMipDR < eEcalMax_ && hmaxNearP < eIsolation) { if (t_p > pTrackLow_ && t_p < pTrackHigh_) ntrin++; diff --git a/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C b/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C new file mode 100644 index 0000000000000..4b383859b1ff7 --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C @@ -0,0 +1,4005 @@ +/* +Identify digi and other correlaions +Increase range of Digi plots +Swap digi reco option +Noise : Second TS has sharp fall +Previous postion of SiPM : Problematic + + +hadd hist_hoprompt_r2017ae.root hist_r2017a_hoprompt_v2a_1.root hist_r2017a_hoprompt_v3a_1.root hist_hoprompt_r2017b_v1.root hist_r2017b_hoprompt_v2a_1.root hist_r2017c_hoprompt_v1a_1.root hist_hoprompt_r2017c_v2.root hist_hoprompt_r2017c_v3.root hist_hoprompt_r2017d_v1.root hist_hoprompt_r2017e_v1.root + + +*/ +const int netamx = 30; +const int nphimx = 72; +int getieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } +int invert_ieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } + +const int ncut = 14; +const int ringmx = 5; +const int nchnmx = 10; +const int routmx = 36; +const int rout12mx = 24; + +const int rbxmx = 12; // HO readout box in Ring 0 +const int rbx12mx = 6; //HO readout box in Ring+-1/2 +const int nprojtype = 5; // Varities due to types of muon projection +const char* projname[nprojtype] = {"Noise", "In RM", "3x3", "Proj", "Signal"}; +const int nprojmx = 4; +const int nseltype = 4; //Different crit for muon selection +const int nadmx = 18; +const int shapemx = 10; //checking shape + +static const int nhothresh = 10; // set threshold for noise filter + +TH2F* totalmuon; +TH2F* totalproj[9]; +TH2F* totalhpd[18]; + +TH2F* totalprojsig[9]; +TH2F* totalhpdsig[18]; + +TH2F* total2muon; +TH2F* total2proj[9]; +TH2F* total2hpd[18]; + +TH2F* total2projsig[9]; +TH2F* total2hpdsig[18]; + +Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } + +Double_t landX(Double_t* x, Double_t* par) { return par[0] * (TMath::Landau(x[0], par[1], par[2])); } + +Double_t completefit(Double_t* x, Double_t* par) { return gausX(x, par) + landX(x, &par[3]); } + +Double_t langaufun(Double_t* x, Double_t* par) { + //Fit parameters: + //par[0]*par[1]=Width (scale) parameter of Landau density + //par[1]=Most Probable (MP, location) parameter of Landau density + //par[2]=Total area (integral -inf to inf, normalization constant) + //par[3]=Width (sigma) of convoluted Gaussian function + // + //In the Landau distribution (represented by the CERNLIB approximation), + //the maximum is located at x=-0.22278298 with the location parameter=0. + //This shift is corrected within this function, so that the actual + //maximum is identical to the MP parameter. + // /* + // Numeric constants + Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) + Double_t mpshift = -0.22278298; // Landau maximum location + + // Control constants + Double_t np = 100.0; // number of convolution steps + Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas + + // Variables + Double_t xx; + Double_t mpc; + Double_t fland; + Double_t sum = 0.0; + Double_t xlow, xupp; + Double_t step; + + // MP shift correction + mpc = par[1] - mpshift * par[0] * par[1]; + double scale = 1; // par[1]; + double scale2 = 1; //anormglb; // for notmalisation this is one, otehrwise use the normalisation; + if (scale2 < .1) + scale2 = 0.1; + // double scale=par[1]; + // Range of convolution integral + xlow = x[0] - sc * scale * par[3]; + xupp = x[0] + sc * scale * par[3]; + + step = (xupp - xlow) / np; + + // Convolution integral of Landau and Gaussian by sum + for (double ij = 1.0; ij <= np / 2; ij++) { + xx = xlow + (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + xx = xupp - (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + } + return (par[2] * step * sum * invsq2pi / (scale2 * par[3])); +} + +Double_t totalfunc(Double_t* x, Double_t* par) { + return gausX(x, par) + langaufun(x, &par[3]); // /max(.001,anormglb); +} +// binroot hocalib_r2017e_hoprompt_v1a_1.root hocalib_r2017g_hoprompt_v1a_1.root hocalib_r2017h_hoprompt_v1a_1.root +void momentum() { + gStyle->SetOptStat(1110); + const int nfile = 3; + TH1F* histx[nfile]; + TTree* T1x; + char name[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700, 300); + c1->Divide(3, 1); + + for (int ij = 0; ij < nfile; ij++) { + c1->cd(ij + 1); + sprintf(name, "hist_%i", ij); + histx[ij] = new TH1F(name, name, 120, -150., 150.); + if (ij == 0) { + // _file2->cd(); // T1x = (TTree*)_file0->Get("T1"); + } else if (ij == 1) { + // _file0->cd(); // T1x = (TTree*)_file1->Get("T1"); + } else { + // _file2->cd();// T1x = (TTree*)_file2->Get("T1"); + } + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + } + + T1x = (TTree*)gDirectory->Get("T1"); + T1x->Project(name, "trkmm"); + // histx[ij]->Scale(1./TMath::Max(1.,histx[ij]->Integral())); + histx[ij]->Draw(); + // T1x->Draw("trkmm"); + } +} + +/* +binroot histalla_hcalcalho_2016btog.root + .L tdrstyle.C +setTDRStyle() +.L hocalib_pl16.C +plot_fitres(23, 42); + + +*/ + +void plot_fitres(int ieta = 13, int iphi = 70) { + gStyle->SetOptTitle(0); + gStyle->SetOptLogy(1); + // gStyle->SetOptStat(0); //1110); + // gStyle->SetLabelSize(0.095,"XYZ"); + // gStyle->SetLabelOffset(0.01,"XYZ"); + // gStyle->SetHistLineColor(1); + // gStyle->SetHistLineWidth(3); + // gStyle->SetPadTopMargin(0.02); + // gStyle->SetPadBottomMargin(0.12); + // gStyle->SetPadLeftMargin(0.14); + // gStyle->SetPadRightMargin(0.04); + // gStyle->SetPadGridX(3); + // gStyle->SetPadGridY(3); + // gStyle->SetGridStyle(2); + // gStyle->SetMarkerColor(1); + // gStyle->SetMarkerStyle(20); + // gStyle->SetMarkerSize(0.95); + // gStyle->SetNdivisions(506,"XY"); + // gStyle->SetLabelSize(0.095,"XYZ"); + // gStyle->SetLabelOffset(0.01,"XYZ"); + // gStyle->SetStatH(.1); + // gStyle->SetStatW(.4); + + // -14, 1 plot_fitres(1,0); + // double par[8]={139.1, 0.0327856, 0.070529, 0.137647, 1.69858, 79549.1, 0.307275, 5.71755}; + + // -8, 1 plot_fitres(7,0); + // double par[8]={31.5185, 0.0342954, 0.0599271, 0.151538, 1.10591, 91530.5, 0.22909, 8.65218}; + // -1, 1 plot_fitres(14,0); + double par[8] = {23.6947, 0.0178834, 0.0318413, 0.160218, 0.985584, 77652.5, 0.15613, 10.0053}; + + //-15, 1 + // double par[8]={89.055, 0.0277592, 0.057265, 0.106515, 1.80511, 36326, 0.36995, 6.04276}; + // 9, 43 plot_fitres(23,42) + // double par[8]={ 29.3954, 0.0339121, 0.0644736, 0.160249, 1.15268, 94723.6, 0.239194, 10.5442}; + // 10, 43 plot_fitres(24,42) + // double par[8]={0.100621, 0.0413684, 0.077322, 0.154082, 1.22422, 80333, 0.315477, 12.1145}; + // 11, 43 plot_fitres(25,42) + // double par[8]={0.91, 0.0523604, 0.1, 0.25, 1.24822, 71042.8, 0.373684, 5.42163}; + // 12, 43 plot_fitres(26,42) + // double par[8]={0.550151, 0.0584881, 0.1, 0.246599, 1.38702, 84966.5, 0.35758, 4.92687}; + + par[0] /= 18.0; + par[5] /= 18.0; + + const char title[100]; + TH1F* histx[2]; + TH1F* histy[2]; + + TF1* ped0fun; + TF1* pedfun; + TF1* sigfun; + TF1* signalx; + double xmn = -15.; + double xmx = 20.; + + TCanvas* c1 = new TCanvas("c1", "runfile", 600, 600); + // c1->Divide(2,1); + for (int i = 1; i < 2; i++) { + // c1->cd(i+1); + switch (i) { + case 0: + sprintf(title, "hoCalibc/ped_eta%i_phi%i", ieta, iphi); + break; + case 1: + sprintf(title, "hoCalibc/sig_eta%i_phi%i", ieta, iphi); + break; + } + + histy[i] = (TH1F*)gDirectory->Get(title); + histx[i] = (TH1F*)histy[i]->Clone(); + cout << "name " << title << " " << histx[i]->GetBinWidth(100) << " " << histx[i]->GetTitle() << endl; + // histx[i]->GetXaxis()->SetRangeUser(xmn, (i+1)*xmx); + histx[i]->SetLineColor(2 * (i + 1)); + histx[i]->SetLineWidth(2); + histx[i]->Rebin(10); + + histx[i]->SetMaximum(1.52 * histx[i]->GetMaximum()); + + // histx[i]->SetNdivisions(506,"XY"); + + // histx[i]->GetXaxis()->SetLabelSize(.055); + // histx[i]->GetYaxis()->SetLabelSize(.055); + // histx[i]->GetYaxis()->SetTitleOffset(1.4); + + switch (i) { + case 0: + histx[i]->GetXaxis()->SetRangeUser(-16., 16.); + histx[i]->GetXaxis()->SetTitle("HO Pedestal (GeV)"); + break; + case 1: + histx[i]->GetXaxis()->SetRangeUser(-20., 40.); + histx[i]->GetXaxis()->SetTitle("HO Signal (GeV)"); + break; + } + // histx[i]->GetXaxis()->SetTitleSize(.055); + // // histx[i]->GetXaxis()->CenterTitle(); + histx[i]->GetYaxis()->SetTitle("Nevents"); + // histx[i]->GetYaxis()->SetTitleSize(.055); + // if (i==0) histx[i]->GetXaxis()->SetRangeUser(-5., 5.); + histx[i]->Draw(); + } + + // c1->cd(1); + // TPaveText *ptst1 = new TPaveText(.85,0.9,.90,.95,"brNDC"); + // ptst1->SetFillColor(10); + // TText* text1 = ptst1->AddText("(a)"); + // text1->SetTextSize(0.062); + // ptst1->SetBorderSize(0); + // ptst1->Draw(); + + // ped0fun = new TF1("temp", gausX, xmn, xmx, 3); + // ped0fun->SetParameters(gaupr); + // ped0fun->SetLineColor(3); + // ped0fun->SetLineWidth(2); + // ped0fun->Draw("same"); + + // c1->cd(2); + + // TPaveText *ptst = new TPaveText(0.85,0.9,0.90,.95,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText("(b)"); + // text->SetTextSize(0.062); + // ptst->SetBorderSize(0); + // ptst->Draw(); + + pedfun = new TF1("ped0", gausX, xmn, 4 * xmx, 3); + pedfun->SetParameters(par); + pedfun->SetLineWidth(2); + pedfun->SetLineColor(3); + pedfun->Draw("same"); + + sigfun = new TF1("signalfun", langaufun, xmn, 4 * xmx, 5); + sigfun->SetParameters(&par[3]); + sigfun->SetLineWidth(2); + sigfun->SetLineColor(4); + sigfun->Draw("same"); + + signalx = new TF1("total", totalfunc, xmn, 4 * xmx, 8); + signalx->SetParameters(par); + signalx->SetLineWidth(2); + signalx->SetLineWidth(1); + signalx->Draw("same"); + + cmsPrel(.55, .75, .55, .75, 0.045, 35); +} + +/* + binroot fit_2016btog_ar1_float_par8_rng30.root + .L tdrstyle.C +setTDRStyle() +.L hocalib_pl16.C +const_term_1dx("const_eta_phi") +const_term_2d() +*/ + +/* +binroot fit_r2017a_v2_ar1_float_par8_rng25.root fit_r2017a_v3_ar1_float_par8_rng25.root fit_r2017b_v1_ar1_float_par8_rng25.root fit_r2017b_v2_ar1_float_par8_rng25.root fit_r2017c_v1_ar1_float_par8_rng25.root fit_r2017c_v2_ar1_float_par8_rng25.root fit_r2017c_v3_ar1_float_par8_rng25.root fit_r2017d_v1_ar1_float_par8_rng25.root fit_r2017e_v1_ar1_float_par8_rng25.root fit_r2017f_v1_ar1_float_par8_rng25.root fit_r2017g_v1_ar1_float_par8_rng25.root fit_r2017h_v1_ar1_float_par8_rng25.root fit_r2017ae_ar1_float_par8_rng25.root fit_r2017af_ar1_float_par8_rng25.root + + + + +*/ + +void all_1d4x() { + TCanvas* c1 = new TCanvas("c1", "c1", 700, 500); + c1->Divide(2, 2); + + _file0->cd(); + const_term_1d4x(); + _file1->cd(); + const_term_1d4x(); + _file2->cd(); + const_term_1d4x(); + _file3->cd(); + const_term_1d4x(); + _file4->cd(); + const_term_1d4x(); + _file5->cd(); + const_term_1d4x(); + _file6->cd(); + const_term_1d4x(); + _file7->cd(); + const_term_1d4x(); + _file8->cd(); + const_term_1d4x(); + _file9->cd(); + const_term_1d4x(); + _file10->cd(); + const_term_1d4x(); + _file11->cd(); + const_term_1d4x(); + _file12->cd(); + const_term_1d4x(); + _file13->cd(); + const_term_1d4x(); + + /* +fit_r2017a_v2_a +val 0.363+- 0.294 0.211+- 0.173 0.468+- 0.184 0.282+- 0.11 +err 5.461+- 0.27 4.622+- 0.155 4.444+- 0.177 4.765+- 0.092 +fit_r2017a_v3_a +val 0.554+- 0.105 -0.372+- 0.073 -0.165+- 0.08 -0.063+- 0.047 +err 2.205+- 0.096 2.039+- 0.06 2.029+- 0.066 2.159+- 0.037 +fit_r2017b_v1_a +val 1.577+- 0.043 0.964+- 0.032 1.234+- 0.035 1.208+- 0.021 +err 0.944+- 0.036 0.9+- 0.027 0.934+- 0.028 0.974+- 0.018 +fit_r2017b_v2_a +val 2.209+- 0.072 1.826+- 0.05 2.038+- 0.055 1.969+- 0.032 +err 1.54+- 0.073 1.37+- 0.039 1.397+- 0.047 1.485+- 0.026 +fit_r2017c_v1_a +val 2.439+- 0.056 1.933+- 0.04 2.125+- 0.046 2.118+- 0.027 +err 1.208+- 0.05 1.12+- 0.032 1.225+- 0.038 1.22+- 0.022 +fit_r2017c_v2_a +val 2.569+- 0.045 1.996+- 0.032 2.289+- 0.038 2.247+- 0.022 +err 0.969+- 0.035 0.93+- 0.028 0.97+- 0.034 0.995+- 0.018 +fit_r2017c_v3_a +val 2.657+- 0.044 2.128+- 0.033 2.349+- 0.036 2.332+- 0.021 +err 0.909+- 0.034 0.952+- 0.03 0.955+- 0.03 0.985+- 0.019 +fit_r2017d_v1_a +val 2.852+- 0.044 2.287+- 0.037 2.512+- 0.037 2.512+- 0.023 +err 0.925+- 0.042 1.019+- 0.032 0.925+- 0.031 1.018+- 0.02 +fit_r2017e_v1_a +val 3.04+- 0.042 2.448+- 0.034 2.836+- 0.036 2.742+- 0.021 +err 0.872+- 0.034 0.856+- 0.028 0.9+- 0.03 0.932+- 0.017 +fit_r2017f_v1_a +val 3.18+- 0.048 2.541+- 0.037 2.868+- 0.039 2.817+- 0.024 +err 1.036+- 0.037 1.038+- 0.033 1.038+- 0.035 1.092+- 0.021 +fit_r2017g_v1_a +val 0.035+- 0.155 -2.666+- 0.116 -4.415+- 0.099 -2.728+- 0.084 +err 3.17+- 0.141 3.098+- 0.102 2.42+- 0.087 3.351+- 0.062 +fit_r2017h_v1_a +val 0.116+- 0.079 -2.594+- 0.057 -4.639+- 0.055 -2.684+- 0.061 +err 1.705+- 0.077 1.531+- 0.052 1.43+- 0.041 2.384+- 0.041 +fit_r2017ae_ar1 +val 2.569+- 0.032 1.989+- 0.027 2.265+- 0.029 2.238+- 0.017 +err 0.711+- 0.027 0.738+- 0.023 0.761+- 0.026 0.795+- 0.015 +fit_r2017af_ar1 +val 2.68+- 0.032 2.064+- 0.027 2.36+- 0.029 2.328+- 0.018 +err 0.694+- 0.025 0.748+- 0.023 0.76+- 0.025 0.804+- 0.014 + + + + + */ +} + +void all_2d() { + TCanvas* c1 = new TCanvas("c1", "c1", 700, 400); + // c1->Divide(2,2); + + _file0->cd(); + const_term_2d(); + _file1->cd(); + const_term_2d(); + _file2->cd(); + const_term_2d(); + _file3->cd(); + const_term_2d(); + _file4->cd(); + const_term_2d(); + _file5->cd(); + const_term_2d(); + _file6->cd(); + const_term_2d(); + _file7->cd(); + const_term_2d(); + _file8->cd(); + const_term_2d(); + _file9->cd(); + const_term_2d(); + _file10->cd(); + const_term_2d(); + _file11->cd(); + const_term_2d(); + _file12->cd(); + const_term_2d(); + _file13->cd(); + const_term_2d(); +} + +void const_term_1d4x(const char* varname = "const_eta_phi") { + gStyle->SetOptTitle(0); + gStyle->SetOptFit(111); + gStyle->SetOptStat(1110); + gStyle->SetOptLogy(1); + gStyle->SetPadTopMargin(0.01); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.12); + gStyle->SetPadRightMargin(0.01); + gStyle->SetStatY(.99); //89); + gStyle->SetStatX(.99); //94); + gStyle->SetStatH(.22); + gStyle->SetStatW(.27); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.075); + latex.SetTextFont(42); + latex.SetTextAlign(31); // align right + + TCanvas* c1 = new TCanvas("c1", "c1", 700, 400); + c1->Divide(2, 2); + + // for (int ixj=0; ixj<14; ixj++) { + // switch(ixj) { + // case 0 : _file0->cd(); break; + // case 1 : _file1->cd(); break; + // case 2 : _file2->cd(); break; + // case 3 : _file3->cd(); break; + // case 4 : _file4->cd(); break; + // case 5 : _file5->cd(); break; + // case 6 : _file6->cd(); break; + // case 7 : _file7->cd(); break; + // case 8 : _file8->cd(); break; + // case 9 : _file9->cd(); break; + // case 10 : _file10->cd(); break; + // case 11 : _file11->cd(); break; + // case 12 : _file12->cd(); break; + // case 13 : _file13->cd(); break; + // default : _file0->cd(); break; + // } + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + TH1F* histx[4]; + histx[0] = new TH1F("histx0", "Correction factor - 1 (R0)", 120, -0.11, 0.29); //.9, 1.3); + histx[1] = new TH1F("histx1", "Correction factor - 1 (R#pm1)", 120, -0.11, 0.29); //.9, 1.3); + histx[2] = new TH1F("histx2", "Correction factor - 1 (R#pm2)", 120, -0.11, 0.29); //.9, 1.3); + histx[3] = new TH1F("histx3", "Correction factor - 1 (All)", 120, -0.11, 0.29); //.9, 1.3); + + char name[100] = gDirectory->GetName(); + char namex[20]; + char namey[50]; + strncpy(namex, name, 15); + char* pchy = strchr(namex, '_'); + int len = pchy - namex; + strncpy(namey, namex, len); + + cout << namex << " " << namey << endl; + float value[2][4] = {0}; + float error[2][4] = {0}; + + for (int ij = 0; ij < hist2d->GetNbinsX(); ij++) { + int ieta = getieta(ij); + for (int jk = 0; jk < hist2d->GetNbinsY(); jk++) { + double xx = hist2d->GetBinContent(ij + 1, jk + 1) - 1.0; + if (xx > -0.5) { + if (abs(ieta) <= 4) { + histx[0]->Fill(xx); + } else if (abs(ieta) <= 10) { + histx[1]->Fill(xx); + } else if (abs(ieta) <= 15) { + histx[2]->Fill(xx); + } + histx[3]->Fill(xx); + } + } + } + for (int ij = 0; ij < 4; ij++) { + c1->cd(ij + 1); + histx[ij]->GetXaxis()->SetTitle(histx[ij]->GetTitle()); + histx[ij]->GetXaxis()->SetLabelOffset(.001); + histx[ij]->GetXaxis()->SetLabelSize(0.0645); + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.99); + + histx[ij]->GetYaxis()->SetTitle("Entries/0.005"); + histx[ij]->GetYaxis()->SetLabelOffset(.001); + histx[ij]->GetYaxis()->SetLabelSize(0.0645); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(0.85); + + histx[ij]->SetLineWidth(1); + TFitResultPtr ptr = histx[ij]->Fit("gaus", "QS"); + Int_t fitStatus = ptr; + if (fitStatus == 0) { + value[0][ij] = int(100000 * ptr->Parameter(1)) / 1000.; + value[1][ij] = int(100000 * ptr->Parameter(2)) / 1000.; + error[0][ij] = int(100000 * ptr->ParError(1)) / 1000.; + error[1][ij] = int(100000 * ptr->ParError(2)) / 1000.; + + // cout<Parameter(1))/1000.<<"+-"<< int(100000*ptr->ParError(1))/1000.<<" "<Parameter(2))/1000.<<"+-"<< int(100000*ptr->ParError(2))/1000.<SaveAs(namey); + + cout << "val "; + for (int ij = 0; ij < 4; ij++) { + cout << " " << setw(6) << value[0][ij] << "+-" << setw(6) << error[0][ij]; + } + cout << endl; + cout << "err "; + for (int ij = 0; ij < 4; ij++) { + cout << " " << setw(6) << value[1][ij] << "+-" << setw(6) << error[1][ij]; + } + cout << endl; + for (int ij = 0; ij < 4; ij++) { + if (histx[ij]) { + delete histx[ij]; + histx[ij] = 0; + } + } + // } +} + +void const_term_1dx(const char* varname = "const_eta_phi") { + ofstream file_out("test_output.log"); + gStyle->SetOptFit(101); + gStyle->SetOptStat(0); + gStyle->SetOptLogy(1); + gStyle->SetPadTopMargin(0.1); + gStyle->SetPadBottomMargin(0.11); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.03); + gStyle->SetStatY(.93); //89); + gStyle->SetStatX(.98); //94); + gStyle->SetStatH(.16); + gStyle->SetStatW(.19); + + TH2F* hist2d[3]; + + hist2d[0] = (TH2F*)gDirectory->Get(varname); + hist2d[1] = (TH2F*)gDirectory->Get("const_eta_phisum"); + TH1F* histx[3]; + histx[0] = new TH1F("histx0", "const_eta_phi", 120, .7, 1.3); + histx[1] = new TH1F("histx1", "const_eta_phisum", 120, .7, 1.3); + histx[2] = new TH1F("histx2", "Correction term", 120, -.2, .2); + hist2d[2] = new TH2F("hist2d2", "hist2d2", 120, .9, 1.1, 120, .9, 1.1); + for (int ij = 0; ij < hist2d[0]->GetNbinsX(); ij++) { + // if (hist2d[0]->GetBinCenter(ij+1)==0) continue; + for (int jk = 0; jk < hist2d[0]->GetNbinsY(); jk++) { + double xx = hist2d[0]->GetBinContent(ij + 1, jk + 1); + if (xx > 0.5) { + histx[0]->Fill(xx); + } + if (ij != 15) + file_out << hist2d[0]->GetXaxis()->GetBinCenter(ij + 1) << "\t" << jk + 1 << "\t " << xx << endl; + + double yy = hist2d[1]->GetBinContent(ij + 1, jk + 1); + if (yy > 0.5) { + histx[1]->Fill(yy); + } + if (xx > .5 && yy > .5) { + histx[2]->Fill(yy - xx); + hist2d[2]->Fill(xx, yy); + } + } + } + TCanvas* c1 = new TCanvas("c1", "c1", 500, 500); + // c1->Divide(2,2); + /* c1->cd(1); histx[0]->Fit("gaus"); + c1->cd(2); histx[1]->Fit("gaus"); + c1->cd(3); histx[2]->Fit("gaus"); + */ + + histx[0]->GetXaxis()->SetTitle("Correction factor"); + histx[0]->GetXaxis()->SetLabelOffset(.001); + histx[0]->GetXaxis()->SetLabelSize(0.0645); + histx[0]->GetXaxis()->SetTitleSize(0.065); + histx[0]->GetXaxis()->SetTitleOffset(0.75); + + histx[0]->GetYaxis()->SetTitle("Entries/0.005"); + histx[0]->GetYaxis()->SetLabelOffset(.001); + histx[0]->GetYaxis()->SetLabelSize(0.0645); + histx[0]->GetYaxis()->SetTitleSize(0.065); + histx[0]->GetYaxis()->SetTitleOffset(1.05); + + histx[0]->SetLineWidth(1); + histx[0]->Fit("gaus"); + // c1->cd(4); gPad->SetLogy(0); hist2d[2]->Draw("colz"); + // cmsPrel(.25, .45, .85, .62, 0.04, 35); + file_out.close(); +} + +void const_term_2dx(const char* varname = "const_eta_phi") { + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptLogy(0); + + gStyle->SetPalette(1, 0); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.12); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.15); + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + + hist2d->SetMaximum(1.5); + hist2d->SetMinimum(0.7); + hist2d->GetXaxis()->SetTitle("i#eta"); + hist2d->GetYaxis()->SetTitle("i#phi"); + + hist2d->Draw("colz"); + + cmsPrel2(.75, .5, .15, .92, 0.025, 35); +} + +double hothreshs[nhothresh + 1] = {0.15, 0.25, 0.5, 1.0, 2.0, 5.0, 10.0, 20., 50, 100., 10000.}; +void def_setting() { + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.16); + gStyle->SetOptStat(0); + // gStyle->SetPadGridX(1); + // gStyle->SetPadGridY(1); + // gStyle->SetGridStyle(3); + gStyle->SetGridWidth(1); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.09); + gStyle->SetTitleBorderSize(1); + gStyle->SetLabelSize(0.095, "XY"); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(0); + gStyle->SetNdivisions(404, "XYZ"); + + gStyle->SetStatTextColor(1); + gStyle->SetStatX(.99); + gStyle->SetStatY(.99); + gStyle->SetStatW(.3); + gStyle->SetStatH(.2); + + gStyle->SetOptLogy(0); +} + +void const_term(const char* varname = "const_eta_phi") { + ofstream file_out("test_output.log"); + gStyle->SetOptFit(101); + gStyle->SetOptStat(0); + gStyle->SetOptLogy(1); + gStyle->SetLabelSize(.065, "XY"); + + TH2F* hist2d[3]; + + hist2d[0] = (TH2F*)gDirectory->Get("const_eta_phi"); + hist2d[1] = (TH2F*)gDirectory->Get("const_eta_phisum"); + + TH1F* histx[3]; + histx[0] = new TH1F("histx0", "const_eta_phi", 120, .7, 1.3); + histx[1] = new TH1F("histx1", "const_eta_phisum", 120, .7, 1.3); + histx[2] = new TH1F("histx2", "diff", 120, -.2, .2); + hist2d[2] = new TH2F("hist2d2", "hist2d2", 120, .9, 1.1, 120, .9, 1.1); + + for (int ij = 0; ij < hist2d[0]->GetNbinsX(); ij++) { + // if (hist2d[0]->GetBinCenter(ij+1)==0) continue; + for (int jk = 0; jk < hist2d[0]->GetNbinsY(); jk++) { + double xx = hist2d[0]->GetBinContent(ij + 1, jk + 1); + if (xx > 0.5) { + histx[0]->Fill(xx); + } + if (ij != 15) + file_out << hist2d[0]->GetXaxis()->GetBinCenter(ij + 1) << "\t" << jk + 1 << "\t " << xx << endl; + + double yy = hist2d[1]->GetBinContent(ij + 1, jk + 1); + if (yy > 0.5) { + histx[1]->Fill(yy); + } + if (xx > .5 && yy > .5) { + histx[2]->Fill(yy - xx); + hist2d[2]->Fill(xx, yy); + } + } + } + TCanvas* c1 = new TCanvas("c1", "c1", 700, 900); + c1->Divide(2, 2); + c1->cd(1); + histx[0]->Fit("gaus"); + c1->cd(2); + histx[1]->Fit("gaus"); + c1->cd(3); + histx[2]->Fit("gaus"); + c1->cd(4); + gPad->SetLogy(0); + hist2d[2]->Draw("colz"); + file_out.close(); +} + +void const_term_2d(const char* varname = "const_eta_phi") { + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetPalette(1, 0); + gStyle->SetPadTopMargin(0.09); + gStyle->SetPadBottomMargin(0.11); + gStyle->SetPadLeftMargin(0.11); + gStyle->SetPadRightMargin(0.15); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.065); + latex.SetTextFont(42); + latex.SetTextAlign(31); // align right + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + + hist2d->GetXaxis()->SetLabelOffset(.001); + hist2d->GetXaxis()->SetLabelSize(0.064); + hist2d->GetXaxis()->SetTitle("i#eta"); + hist2d->GetXaxis()->SetTitleSize(0.065); + hist2d->GetXaxis()->SetTitleOffset(0.75); + hist2d->GetXaxis()->SetTitleColor(1); + hist2d->GetXaxis()->CenterTitle(); + + hist2d->GetYaxis()->SetLabelOffset(.001); + hist2d->GetYaxis()->SetLabelSize(0.064); + hist2d->GetYaxis()->SetTitleSize(0.065); + hist2d->GetYaxis()->SetTitle("i#phi"); + hist2d->GetYaxis()->SetTitleOffset(0.68); + hist2d->GetYaxis()->CenterTitle(); + + hist2d->GetZaxis()->SetLabelSize(0.045); + + // hist2d->SetMaximum(1.2); + hist2d->SetMinimum(0.7); + hist2d->Draw("colz"); //"colz"); + // //c1->SaveAs("test.png"); + // cout <<"XX "<SetLabelColor(1); + // palette->SetLabelFont(22); + // palette->SetLabelOffset(0.005); + // palette->SetLabelSize(0.0436); + // palette->SetTitleOffset(1); + // palette->SetTitleSize(0.08); + // palette->SetFillColor(100); + // palette->SetFillStyle(1001); + // hist2d->GetListOfFunctions()->Add(palette,"br"); + // hist2d->Draw("colz"); + // // cmsPrel2(.75, .5, .15, .92, 0.03, 35); + + char name[100] = gDirectory->GetName(); + char namex[20]; + char namey[50]; + strncpy(namex, name, 15); + cout << namex << endl; + latex.DrawLatex(0.65, 0.92, namex); + sprintf(namey, "statistics_2d_%s.png", namex); + c1->SaveAs(namey); +} + +void signal4(int ival = 0, int ndvy = 3) { + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.11); + gStyle->SetPadBottomMargin(0.08); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.20); + TCanvas* c1 = new TCanvas("c1", "c1", 700, 900); + + char name[100]; + + c1->Divide(3, ndvy); + + TH2F* histx[100]; + for (int ij = 0; ij < 3 * ndvy; ij++) { + // sprintf(name, "hoCalibc/%s_%i", varnam, ij); + histx[ij] = (TH2F*)gDirectory->Get(name); + switch (ival) { + case 0: + histx[ij] = (TH2F*)totalproj[ij]->Clone(); + break; + case 1: + histx[ij] = (TH2F*)total2proj[ij]->Clone(); + break; + case 2: + histx[ij] = (TH2F*)totalprojsig[ij]->Clone(); + break; + case 3: + histx[ij] = (TH2F*)total2projsig[ij]->Clone(); + break; + case 4: + histx[ij] = (TH2F*)totalhpd[ij]->Clone(); + break; + case 5: + histx[ij] = (TH2F*)total2hpd[ij]->Clone(); + break; + case 6: + histx[ij] = (TH2F*)totalhpdsig[ij]->Clone(); + break; + case 7: + histx[ij] = (TH2F*)total2hpdsig[ij]->Clone(); + break; + default: + break; + } + c1->cd(ij + 1); + if (strstr(histx[ij]->GetName(), "sig")) { + histx[ij]->SetMaximum(TMath::Min(3., histx[ij]->GetMaximum())); + } + histx[ij]->GetXaxis()->SetLabelSize(0.075); + histx[ij]->GetYaxis()->SetLabelSize(0.075); + histx[ij]->GetZaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetNdivisions(404); + histx[ij]->GetYaxis()->SetNdivisions(404); + histx[ij]->Draw("colz"); + } + c1->Update(); +} + +// plot_var("sigvsacc") +void plot_var(int icut) { + const int nvar = 15; + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.10); + gStyle->SetPadBottomMargin(0.10); + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 3, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[nvar]; + for (int ij = 0; ij < nvar; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigring_%i_%i", icut, ij); + + fprofx[ij] = (TH2F*)gDirectory->Get(title); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.03); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.075); + fprofx[ij]->GetZaxis()->SetLabelSize(0.065); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw("colz"); + fprofx[ij]->ProfileX()->Draw("same"); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +// plot_var("sigvsacc") +void plot_varprof(int icut) { + const int nvar = 15; + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 3, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[nvar]; + for (int ij = 0; ij < nvar; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigring_%i_%i", icut, ij); + + fprofx[ij] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.03); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.075); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw(); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +void plot_var_tray(int id = 0, int icut = 0) { + //plot_var_tray(0,1) + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[30]; + int itag = 0; + for (int jk = 0; jk < 6; jk++) { + for (int ij = 0; ij < 5; ij++) { + c1->cd(itag + 1); + sprintf(title, "hoCalibc/sigtray_%i_%i_%i", icut, 5 * id + ij, jk); + + fprofx[itag] = (TH2F*)gDirectory->Get(title); + fprofx[itag]->GetXaxis()->SetLabelOffset(-.001); + fprofx[itag]->GetXaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetLabelSize(0.085); + fprofx[itag]->GetZaxis()->SetLabelSize(0.065); + fprofx[itag]->GetYaxis()->SetNdivisions(404); + fprofx[itag]->GetXaxis()->SetNdivisions(404); + fprofx[itag]->SetLineColor(2); + fprofx[itag]->SetLineWidth(2); + + fprofx[itag]->Draw("colz"); + fprofx[itag]->ProfileX()->Draw("same"); + // if (itag==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + + itag++; + } + } + c1->Update(); +} + +void plot_var_trayprof(int id = 0, int icut = 0) { + //plot_var_tray(0,1) + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[30]; + int itag = 0; + for (int jk = 0; jk < 6; jk++) { + for (int ij = 0; ij < 5; ij++) { + c1->cd(itag + 1); + sprintf(title, "hoCalibc/sigtray_%i_%i_%i", icut, 5 * id + ij, jk); + + fprofx[itag] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[itag]->GetXaxis()->SetLabelOffset(-.001); + fprofx[itag]->GetXaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetNdivisions(404); + fprofx[itag]->GetXaxis()->SetNdivisions(404); + fprofx[itag]->SetLineColor(2); + fprofx[itag]->SetLineWidth(2); + + fprofx[itag]->Draw(); + // if (itag==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + + itag++; + } + } + c1->Update(); +} + +void plot_var_eta(int id = 0, int icut = 0) { + //plot_var_eta(0,1) + + const int netamx = 30; + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[netamx]; + for (int ij = 0; ij < netamx; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigeta_%i_%i_%i", icut, id, ij); + fprofx[ij] = (TH2F*)gDirectory->Get(title); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.001); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.085); + fprofx[ij]->GetZaxis()->SetLabelSize(0.065); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw("colz"); + fprofx[ij]->ProfileX()->Draw("same"); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +void plot_var_etaprof(int id = 0, int icut = 0) { + //plot_var_eta(0,1) + + const int netamx = 30; + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[netamx]; + for (int ij = 0; ij < netamx; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigeta_%i_%i_%i", icut, id, ij); + fprofx[ij] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.001); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw(); + } + c1->Update(); +} + +void plotyx() { + // // sprintf (outfile,"%s.ps",outfilx); + // TPostScript ps("test.ps",111); + // ps.Range(20,28); + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + + for (int kl = 0; kl < ncut; kl++) { + // ps.NewPage(); + plot_var(kl); + } + // ps.Close(); +} + +void plotallx() { + // // gDirectory->DeleteAll(); + // gStyle->Reset(); + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadGridX(1); + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + gStyle->SetOptStat(0); + gStyle->SetTitleBorderSize(1); + + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + int ips = 111; + // // sprintf (outfile,"%s.ps",outfilx); + TPostScript ps("test_2016e.ps", ips); + ps.Range(20, 28); + bool m_select_plot = true; + // cout<<"1xx "<SetTitleFontSize(0.095); + for (int ix = 0; ix < 3; ix++) { + for (int iy = 0; iy < ncut; iy++) { + ps.NewPage(); + plot_var_eta(ix, iy); + ps.NewPage(); + plot_var_etaprof(ix, iy); + } + } + + for (int ix = 0; ix < 3; ix++) { + for (int iy = 0; iy < ncut; iy++) { + ps.NewPage(); + plot_var_tray(ix, iy); + ps.NewPage(); + plot_var_trayprof(ix, iy); + } + } + } + + char name[100]; + totalmuon = (TH2F*)gDirectory->Get("hoCalibc/totalmuon"); + total2muon = (TH2F*)gDirectory->Get("hoCalibc/total2muon"); + + for (int ij = 0; ij < 9; ij++) { + sprintf(name, "hoCalibc/totalproj_%i", ij); + totalproj[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/totalprojsig_%i", ij); + totalprojsig[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2proj_%i", ij); + total2proj[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2projsig_%i", ij); + total2projsig[ij] = (TH2F*)gDirectory->Get(name); + + total2projsig[ij]->Divide(total2proj[ij]); + totalprojsig[ij]->Divide(totalproj[ij]); + + total2proj[ij]->Divide(total2muon); + totalproj[ij]->Divide(totalmuon); + } + + for (int ij = 0; ij < 18; ij++) { + sprintf(name, "hoCalibc/totalhpd_%i", ij); + totalhpd[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/totalhpdsig_%i", ij); + totalhpdsig[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2hpd_%i", ij); + total2hpd[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2hpdsig_%i", ij); + total2hpdsig[ij] = (TH2F*)gDirectory->Get(name); + + total2hpdsig[ij]->Divide(total2hpd[ij]); + totalhpdsig[ij]->Divide(totalhpd[ij]); + + total2hpd[ij]->Divide(total2muon); + totalhpd[ij]->Divide(totalmuon); + } + for (int ij = 0; ij < 8; ij++) { + ps.NewPage(); + signal4(ij, (ij <= 3) ? 3 : 6); + } + // cout<<"8xx "<Divide(4, 2); + c1->cd(1); + totalmuon->Draw("colz"); + c1->cd(2); + totalproj_3->Draw("colz"); + c1->cd(3); + totalproj_4->Draw("colz"); + c1->cd(4); + totalproj_5->Draw("colz"); + c1->cd(5); + total2muon->Draw("colz"); + c1->cd(6); + total2proj_3->Draw("colz"); + c1->cd(7); + total2proj_4->Draw("colz"); + c1->cd(8); + total2proj_5->Draw("colz"); +} + +void signal2() { + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(4, 2); + c1->cd(1); + totalmuon->Draw("colz"); + c1->cd(2); + totalproj_3->Draw("colz"); + c1->cd(3); + totalproj_4->Draw("colz"); + c1->cd(4); + totalproj_5->Draw("colz"); + + c1->cd(6); + totalprojsig_3->Draw("colz"); + c1->cd(7); + totalprojsig_4->Draw("colz"); + c1->cd(8); + totalprojsig_5->Draw("colz"); +} +void signal3() { + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(4, 2); + c1->cd(1); + total2muon->Draw("colz"); + c1->cd(2); + total2proj_3->Draw("colz"); + c1->cd(3); + total2proj_4->Draw("colz"); + c1->cd(4); + total2proj_5->Draw("colz"); + + c1->cd(6); + total2projsig_3->Draw("colz"); + c1->cd(7); + total2projsig_4->Draw("colz"); + c1->cd(8); + total2projsig_5->Draw("colz"); +} + +//signal4("totalproj",3); +//signal4("total2proj",3); +//signal4("totalprojsig",3); +//signal4("total2projsig",3); + +//signal4("totalhpd",6); +//signal4("total2hpd",6); +//signal4("totalhpdsig",6); +//signal4("total2hpdsig",6); + +// void signal4(const char* varnam="total2proj", int ndvy=3) { +// gStyle->SetOptStat(0); + +// TCanvas* c1 = new TCanvas("c1", "c1", 1200., 600.); + +// char name[100]; +// TH2F* histx[100]; +// c1->Divide(ndvy, 3); +// for (int ij=0; ij <3*ndvy; ij++) { +// sprintf(name, "%s_%i", varnam, ij); +// histx[ij] = (TH2F*)gDirectory->Get(name); +// c1->cd(ij+1); +// histx[ij]->Draw("colz"); +// } +// } + +void testplotx2(int thmn = 2, int thmx = 6) { + gStyle->SetPadTopMargin(0.11); + gStyle->SetPadBottomMargin(0.04); + gStyle->SetPadLeftMargin(0.06); + gStyle->SetPadRightMargin(0.02); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(); + gStyle->SetPadGridX(1); + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + gStyle->SetGridWidth(1); + gStyle->SetTitleColor(10); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.09); + gStyle->SetTitleBorderSize(1); + gStyle->SetLabelSize(0.095, "XY"); + + // const int nfile=3; + // char* indexx[nfile]={"1_27", "28_122", "123_181"}; + + const int nringmx = 5; + + const int routmx = 36; + const int rout12mx = 24; + + const int rbxmx = 12; // HO readout box in Ring 0 + const int rbx12mx = 6; //HO readout box in Ring+-1/2 + + const int nprojmx = 4; + const int nseltype = 4; //Different crit for muon selection + const int nadmx = 18; + const int shapemx = 10; //checking shape + + char* projname[nprojmx] = {"totalproj", "totalprojsig", "totalhpd", "totalhpdsig"}; + + // TH2F* total2muon; + + TH2F* totalmuon[nseltype]; + TH2F* totalproj[nseltype][nprojmx][nadmx]; + + const int nprojtype = 5; // Varities due to types of muon projection + TH2F* histent[nprojtype + 3]; + TH2F* histen[nprojtype + 3]; + TH2F* histen2[nprojtype + 3]; + TH2F* histerr[nprojtype]; + + const int nhothresh = 10; + TH2F* h_allmucorrel[nhothresh]; + TH2F* hnorm_allmucorrel[nhothresh]; + + TH1F* endigicnt[nprojtype + 1][nhothresh]; + TH1F* endigisig[nprojtype + 1][nhothresh]; + + TH2F* rmdigicnt[nprojtype + 1][nhothresh]; + TH2F* rmdigisig[nprojtype + 1][nhothresh]; + + TH2F* ringdigicnt[nprojtype + 1][nhothresh]; + TH2F* ringdigisig[nprojtype + 1][nhothresh]; + + TH2F* inddigicnt[nprojtype + 1][nhothresh]; + TH2F* inddigisig[nprojtype + 1][nhothresh]; + + TH2F* indrecocnt[nprojtype + 1][nhothresh]; + TH2F* indrecosig[nprojtype + 1][nhothresh]; + + TH1F* rout_mult[nhothresh][nringmx][routmx + 1]; + TH1F* rbx_mult[nhothresh][nringmx][rbxmx + 1]; + + TH1F* rout_ind_energy[nringmx][routmx + 1]; + + TH2F* h_correlht[nhothresh]; + TH2F* h_correlsig[nringmx][nhothresh]; + TH2F* h_rmoccu[nhothresh]; + TH2F* h_rmcorrel[nhothresh]; + + TH2F* h_allcorrelsig[nhothresh]; + + TH2F* rbx_shape[shapemx][nringmx][routmx + 1]; + + char name[100]; + + int ips = 111; + TPostScript ps("allmuho.ps", ips); + ps.Range(20, 28); + + TFile* fx = new TFile("histall_apr14b_cosmic_csa14_cosmic.root", "read"); + // TFile* fx = new TFile("hist_apr14c_cosmic_csa14_cosmic.root", "read"); + // TFile* fx = new TFile("histall_cosmic_csa14_cosmic_set.root", "read"); + // TFile* fx = new TFile("apr14/apr14b/hist_cosmic_csa14_cosmic_set52.root", "read"); + for (int isel = 0; isel < nseltype; isel++) { + sprintf(name, "hoCalibc/totalmuon_%i", isel); + totalmuon[isel] = (TH2F*)fx->Get(name); + } + // total2muon = (TH2F*) fx->Get("hoCalibc/total2muon"); + + TCanvas* c0 = new TCanvas("c0", "mean rms", 600, 800); + c0->Divide(2, 2); + + TCanvas* c3 = new TCanvas("c3", "mean rms", 600, 800); + + TCanvas* c1 = new TCanvas("c1", "c1", 600, 900); + c1->Divide(3, 3); + + TCanvas* c2 = new TCanvas("c2", "c2", 600, 900); + c2->Divide(3, 6); + + TCanvas* c4x = new TCanvas("c4x", "c4x", 600., 800.); + c4x->Divide(2, 6); + + TCanvas* c4 = new TCanvas("c4", "c4", 600., 800.); + c4->Divide(2, 6); + + TCanvas* c5 = new TCanvas("c5", "c5", 600., 800.); + c5->Divide(6, 6); + + TCanvas* c6 = new TCanvas("c6", "c6", 600., 800.); + c6->Divide(2, 5); + + TH2F* h2d_nhocapid[nprojtype]; + TH2F* h2d_hocapidsig[nprojtype]; + TH2F* h2d_hocapidsigwo[nprojtype]; + + for (int ij = 0; ij < nprojtype; ij++) { + sprintf(name, "hoCalibc/nhocapid_%i", ij); + h2d_nhocapid[ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/hocapidsig_%i", ij); + h2d_hocapidsig[ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/hocapidsigwo_%i", ij); + h2d_hocapidsigwo[ij] = (TH2F*)fx->Get(name); + + h2d_hocapidsig[ij]->Divide(h2d_nhocapid[ij]); + h2d_hocapidsigwo[ij]->Divide(h2d_nhocapid[ij]); + + ps.NewPage(); + c3->cd(); + h2d_hocapidsig[ij]->Draw("colz"); + c3->Update(); + + ps.NewPage(); + c3->cd(); + h2d_hocapidsigwo[ij]->Draw("colz"); + c3->Update(); + } + + for (int ij = 0; ij < nprojtype; ij++) { + sprintf(name, "hoCalibc/hbentry_d%i", ij + 3); + cout << "ij " << name << endl; + histent[ij] = (TH2F*)fx->Get(name); + // histent[ij]->Draw(); + sprintf(name, "hoCalibc/hbsig_d%i", ij + 3); + histen[ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/hbsig2_d%i", ij + 3); + histen2[ij] = (TH2F*)fx->Get(name); + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + cout << "ij " << nentry << endl; + + histen[ij]->Divide(histent[ij]); + histen2[ij]->Divide(histent[ij]); + + histent[ij]->Scale(1. / nentry); + + int xbin = histen[ij]->GetNbinsX(); + int ybin = histen[ij]->GetNbinsY(); + sprintf(name, "histerr_%i", ij); //, indexx[ij]); + histerr[ij] = new TH2F(name, + name, + xbin, + histent[ij]->GetXaxis()->GetXmin(), + histent[ij]->GetXaxis()->GetXmax(), + ybin, + histent[ij]->GetYaxis()->GetXmin(), + histent[ij]->GetYaxis()->GetXmax()); + + for (int jk = 1; jk <= xbin; jk++) { + for (int kl = 1; kl <= ybin; kl++) { + double err = sqrt(histen2[ij]->GetBinContent(jk, kl) - + histen[ij]->GetBinContent(jk, kl) * histen[ij]->GetBinContent(jk, kl)); + + histerr[ij]->Fill(histent[ij]->GetXaxis()->GetBinCenter(jk), histent[ij]->GetYaxis()->GetBinCenter(kl), err); + } + } + + ps.NewPage(); + cout << "ij11 " << ij << " " << histent[ij]->GetBinContent(22, 22) << endl; + c0->cd(1); /*histent[ij]->GetXaxis()->SetRangeUser(-15.49,15.49);*/ + histent[ij]->Draw("colz"); + cout << "ij12 " << ij << " " << histen[ij]->GetBinContent(22, 22) << endl; + c0->cd(2); + histen[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histen[ij]->Draw("colz"); + cout << "ij13 " << ij << endl; + c0->cd(3); + histen2[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histen2[ij]->Draw("colz"); + cout << "ij14 " << ij << endl; + c0->cd(4); + histerr[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histerr[ij]->Draw("colz"); + cout << "ij15 " << ij << endl; + c0->Update(); + cout << "ij16 " << ij << endl; + } + + for (int jk = 0; jk < nringmx; jk++) { + for (int kl = 0; kl <= rbxmx; kl++) { + if (jk != 2 && kl > rbx12mx) + continue; + ps.NewPage(); + for (int lm = 0; lm < shapemx; lm++) { + if (kl == 0) { + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_allrbx", lm, jk); + } else { + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_%i", lm, jk, kl); + } + rbx_shape[lm][jk][kl] = (TH2F*)fx->Get(name); + c6->cd(int(lm / 5) + 2 * (lm % 5) + 1); + + rbx_shape[lm][jk][kl]->Draw("colz"); + } + c6->Update(); + } + } + + //Correlations + for (int ij = thmn; ij < thmx; ij++) { + sprintf(name, "hoCalibc/hocorrelht_%i", ij); + h_correlht[ij] = (TH2F*)fx->Get(name); + + h_correlht[ij]->Scale(1. / nentry); + + sprintf(name, "hoCalibc/hormoccu_%i", ij); + h_rmoccu[ij] = (TH2F*)fx->Get(name); + h_rmoccu[ij]->Scale(1. / nentry); + + sprintf(name, "hoCalibc/hormcorrel_%i", ij); + h_rmcorrel[ij] = (TH2F*)fx->Get(name); + h_rmcorrel[ij]->Scale(1. / nentry); + + for (int jk = 0; jk < nringmx; jk++) { + sprintf(name, "hoCalibc/hocorrelsig_%i_%i", jk, ij); + h_correlsig[jk][ij] = (TH2F*)fx->Get(name); + h_correlsig[jk][ij]->Scale(1. / nentry); + } + + cout << "ij2 " << ij << endl; + ps.NewPage(); + + c1->cd(1); + h_correlht[ij]->Draw("colz"); + // c1->cd(2); h_correlhten[ij][ij]->Draw("colz"); + c1->cd(2); + h_rmoccu[ij]->Draw("colz"); + c1->cd(3); + h_rmcorrel[ij]->Draw("colz"); + cout << "ij23 " << ij << endl; + for (int jk = 0; jk < nringmx; jk++) { + cout << "ij22 " << ij << endl; + c1->cd(jk + 4); + h_correlsig[jk][ij]->Draw("colz"); + } + cout << "ij21 " << ij << endl; + c1->Update(); + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ij); + cout << "ij24 " << ij << " " << name << endl; + h_allcorrelsig[ij] = (TH2F*)fx->Get(name); + h_allcorrelsig[ij]->Scale(1. / nentry); + cout << "ij25 " << ij << endl; + ps.NewPage(); + c3->cd(); + h_allcorrelsig[ij]->Draw("colz"); + c3->Update(); + cout << "ij2 " << ij << endl; + } + + for (int jk = 0; jk < nringmx; jk++) { + ps.NewPage(); + for (int kl = 1; kl <= routmx; kl++) { + if (jk != 2 && kl > rout12mx) + continue; + c5->cd(kl); + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_allrout", jk); + } else { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_%i", jk, kl); + } + rout_ind_energy[jk][kl] = (TH1F*)fx->Get(name); + rout_ind_energy[jk][kl]->Draw(); + } + c5->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + // int klx=0; + for (int jk = 0; jk < nringmx; jk++) { + ps.NewPage(); + for (int kl = 1; kl <= routmx; kl++) { + if (jk != 2 && kl > rout12mx) + continue; + c5->cd(kl); + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_allrout", ij, jk); + } else { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_%i", ij, jk, kl); + } + rout_mult[ij][jk][kl] = (TH1F*)fx->Get(name); + rout_mult[ij][jk][kl]->Draw(); + } + c5->Update(); + } + } + + for (int ij = thmn; ij < thmx; ij++) { + int klx = 0; + for (int jk = 0; jk < nringmx; jk++) { + if (klx % 12 == 0) + ps.NewPage(); + for (int kl = 1; kl <= rbxmx; kl++) { + if (jk != 2 && kl > rbx12mx) + continue; + c4x->cd(klx % 12 + 1); + klx++; + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_allrbx", ij, jk); + } else { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_%i", ij, jk, kl); + } + rbx_mult[ij][jk][kl] = (TH1F*)fx->Get(name); + rbx_mult[ij][jk][kl]->Draw(); + } + if (klx % 12 == 0) + c4x->Update(); + } + } + + for (int ij = thmn; ij < thmx; ij++) { + for (int jk = 0; jk < nprojtype + 1; jk++) { + sprintf(name, "hoCalibc/endigisig_%i_%i", jk, ij); + cout << "name " << name << endl; + endigisig[jk][ij] = (TH1F*)fx->Get(name); + sprintf(name, "hoCalibc/endigicnt_%i_%i", jk, ij); + endigicnt[jk][ij] = (TH1F*)fx->Get(name); + + sprintf(name, "hoCalibc/rmdigisig_%i_%i", jk, ij); + rmdigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", jk, ij); + rmdigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/ringdigisig_%i_%i", jk, ij); + ringdigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/ringdigicnt_%i_%i", jk, ij); + ringdigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/inddigisig_%i_%i", jk, ij); + inddigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/inddigicnt_%i_%i", jk, ij); + inddigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/indrecosig_%i_%i", jk, ij); + indrecosig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/indrecocnt_%i_%i", jk, ij); + indrecocnt[jk][ij] = (TH2F*)fx->Get(name); + + endigisig[jk][ij]->Divide(endigicnt[jk][ij]); + rmdigisig[jk][ij]->Divide(rmdigicnt[jk][ij]); + ringdigisig[jk][ij]->Divide(ringdigicnt[jk][ij]); + inddigisig[jk][ij]->Divide(inddigicnt[jk][ij]); + indrecosig[jk][ij]->Divide(indrecocnt[jk][ij]); + } + } + + ps.NewPage(); + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + endigicnt[jk][ij]->Draw(); + c4->cd(2 * jk + 2); + endigisig[jk][ij]->Draw(); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + rmdigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + rmdigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + ringdigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + ringdigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + inddigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + inddigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + indrecocnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + indrecosig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + sprintf(name, "hoCalibc/hoallmucorrel_%i", ij); + + double total = 0; + h_allmucorrel[ij] = (TH2F*)fx->Get(name); + hnorm_allmucorrel[ij] = (TH2F*)h_allmucorrel[ij]->Clone(); + for (int ix = 1; ix <= h_allmucorrel[ij]->GetNbinsX(); ix++) { + float anent = h_allmucorrel[ij]->GetBinContent(ix, 0); + total += anent; + cout << "ix " << ij << " " << ix << " " << anent << " " << total << endl; + if (anent < 1.) + anent = 1.; + for (int iy = 1; iy <= h_allmucorrel[ij]->GetNbinsY(); iy++) { + hnorm_allmucorrel[ij]->SetBinContent(ix, iy, h_allmucorrel[ij]->GetBinContent(ix, iy) / anent); + } + } + ps.NewPage(); + c3->cd(); + hnorm_allmucorrel[ij]->Draw("colz"); + c3->Update(); + } + + cout << "ij116 " << endl; + + for (int isel = 0; isel < nseltype; isel++) { + for (int ij = 0; ij < nprojmx / 2; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx / 2; jk++) { + sprintf(name, "hoCalibc/%s_%i_%i", projname[ij], isel, jk); + cout << "name " << name << endl; + totalproj[isel][ij][jk] = (TH2F*)fx->Get(name); + } + } + cout << "1ij116 " << endl; + for (int jk = 0; jk < nadmx / 2; jk++) { + totalproj[isel][1][jk]->Divide(totalproj[isel][0][jk]); + totalproj[isel][0][jk]->Divide(totalmuon[isel]); + } + + for (int ij = 0; ij < nprojmx / 2; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx / 2; jk++) { + c1->cd(jk + 1); + totalproj[isel][ij][jk]->Draw("colz"); + } + c1->Update(); + } + + cout << "2ij116 " << endl; + for (int ij = 2; ij < nprojmx; ij++) { + for (int jk = 0; jk < nadmx; jk++) { + sprintf(name, "hoCalibc/%s_%i_%i", projname[ij], isel, jk); + cout << "ij2 " << ij << " " << jk << " " << name << endl; + totalproj[isel][ij][jk] = (TH2F*)fx->Get(name); + } + } + cout << "3ij116 " << endl; + for (int jk = 0; jk < nadmx / 2; jk++) { + totalproj[isel][3][jk]->Divide(totalproj[isel][2][jk]); + totalproj[isel][2][jk]->Divide(totalmuon[isel]); + } + cout << "4ij116 " << endl; + + for (int ij = 2; ij < nprojmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx; jk++) { + c2->cd(jk + 1); + totalproj[isel][ij][jk]->Draw("colz"); + } + c2->Update(); + } + + cout << "5ij116 " << endl; + } + + ps.Close(); +} + +void testxx(int nproj = 1) { + def_setting(); + const int nprojtype = 5; // Varities due to types of muon projection + TH2F* histent[nprojtype + 3]; + TH2F* histen[nprojtype + 3]; + TH2F* histen2[nprojtype + 3]; + TH2F* histerr[nprojtype]; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.10); + gStyle->SetPadRightMargin(0.12); + gStyle->SetLabelSize(0.065, "XY"); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.07); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + cout << "testxxxx1 " << endl; + TCanvas* c1 = new TCanvas("c1", "c1", 800, 550); + cout << "testxxxx2 " << endl; + c1->Divide(2, 2); + // TFile* fx = new TFile("histall_apr14b_cosmic_csa14_cosmic.root", "read"); + char name[100]; + + for (int ij = 0; ij < nproj; ij++) { + sprintf(name, "hoCalibc/hbentry_d%i", ij + 3); + cout << "ij " << name << endl; + histent[ij] = (TH2F*)gDirectory->Get(name); + sprintf(name, "hoCalibc/hbsig_d%i", ij + 3); + histen[ij] = (TH2F*)gDirectory->Get(name); + sprintf(name, "hoCalibc/hbsig2_d%i", ij + 3); + histen2[ij] = (TH2F*)gDirectory->Get(name); + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + histen[ij]->Divide(histent[ij]); + histen2[ij]->Divide(histent[ij]); + + histent[ij]->Scale(1. / nentry); + + histen[ij]->GetXaxis()->SetLabelSize(0.065); + histen[ij]->GetYaxis()->SetLabelSize(0.065); + histen2[ij]->GetXaxis()->SetLabelSize(0.065); + histen2[ij]->GetYaxis()->SetLabelSize(0.065); + histent[ij]->GetXaxis()->SetLabelSize(0.065); + histent[ij]->GetYaxis()->SetLabelSize(0.065); + + int xbin = histen[ij]->GetNbinsX(); + int ybin = histen[ij]->GetNbinsY(); + sprintf(name, "histerr_%i", ij); //, indexx[ij]); + histerr[ij] = new TH2F(name, + name, + xbin, + histent[ij]->GetXaxis()->GetXmin(), + histent[ij]->GetXaxis()->GetXmax(), + ybin, + histent[ij]->GetYaxis()->GetXmin(), + histent[ij]->GetYaxis()->GetXmax()); + + for (int jk = 1; jk <= xbin; jk++) { + for (int kl = 1; kl <= ybin; kl++) { + double err = sqrt(histen2[ij]->GetBinContent(jk, kl) - + histen[ij]->GetBinContent(jk, kl) * histen[ij]->GetBinContent(jk, kl)); + + histerr[ij]->Fill(histent[ij]->GetXaxis()->GetBinCenter(jk), histent[ij]->GetYaxis()->GetBinCenter(kl), err); + } + } + + cout << "ij11 " << ij << " " << histent[ij]->GetBinContent(22, 22) << endl; + histent[ij]->GetXaxis()->SetTitle("i#eta"); + histent[ij]->GetXaxis()->SetTitleSize(0.075); + histent[ij]->GetXaxis()->SetTitleOffset(0.8); + histent[ij]->GetXaxis()->CenterTitle(); + histent[ij]->GetYaxis()->SetTitle("i#phi"); + histent[ij]->GetYaxis()->SetTitleSize(0.075); + histent[ij]->GetYaxis()->SetTitleOffset(0.6); + histent[ij]->GetYaxis()->CenterTitle(); + + c1->cd(1); + histent[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "Occupancy"); + cout << "ij12 " << ij << " " << histen[ij]->GetBinContent(22, 22) << endl; + histen[ij]->GetXaxis()->SetTitle("i#eta"); + histen[ij]->GetXaxis()->SetTitleSize(0.075); + histen[ij]->GetXaxis()->SetTitleOffset(0.8); + histen[ij]->GetXaxis()->CenterTitle(); + histen[ij]->GetYaxis()->SetTitle("i#phi"); + histen[ij]->GetYaxis()->SetTitleSize(0.075); + histen[ij]->GetYaxis()->SetTitleOffset(0.6); + histen[ij]->GetYaxis()->CenterTitle(); + + c1->cd(2); + histen[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "Mean"); + histen2[ij]->GetXaxis()->SetTitle("i#eta"); + histen2[ij]->GetXaxis()->SetTitleSize(0.075); + histen2[ij]->GetXaxis()->SetTitleOffset(0.8); + histen2[ij]->GetXaxis()->CenterTitle(); + histen2[ij]->GetYaxis()->SetTitle("i#phi"); + histen2[ij]->GetYaxis()->SetTitleSize(0.075); + histen2[ij]->GetYaxis()->SetTitleOffset(0.6); + histen2[ij]->GetYaxis()->CenterTitle(); + + c1->cd(3); + histen2[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "(Mean^{2})"); + cout << "ij14 " << ij << endl; + histerr[ij]->GetXaxis()->SetTitle("i#eta"); + histerr[ij]->GetXaxis()->SetTitleSize(0.075); + histerr[ij]->GetXaxis()->SetTitleOffset(0.8); + histerr[ij]->GetXaxis()->CenterTitle(); + histerr[ij]->GetYaxis()->SetTitle("i#phi"); + histerr[ij]->GetYaxis()->SetTitleSize(0.075); + histerr[ij]->GetYaxis()->SetTitleOffset(0.6); + histerr[ij]->GetYaxis()->CenterTitle(); + + c1->cd(4); + histerr[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "RMS"); + + cout << "ij15 " << ij << endl; + c1->Update(); + cout << "ij16 " << ij << endl; + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + cout << "ij " << nentry << endl; + } +} + +// plot000(-1,6,7,5) +// plot000(0,6,7,5) +// plot000(2,12,13,5) +// plot000(2,1,2,5) +// plot000(-1,1,2,5) +// plot000(3) +// plot000(2,5,10,5) + +void plot000(int irng = -1, int isect = 0, int isect2 = 5, int ntype = 1, const char* tag = "", int extcol = 0) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.12); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.12); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.07); + // latex.SetTextColor(extcol+1); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + /* + char pch1[200]; + cout<<" namec "<GetName()<GetName(); + int len =strstr(namex, "."); + int len1 =strstr(namex, "\\"); + int len2=strlen(namex); + + strncpy (pch1, namex+17, len2-22); + cout <<"name "<< namex<<" "<SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + + char name[100]; + if (!strstr(tag, "same")) { + TCanvas* c1 = new TCanvas("c1", "c1", 1000, 600); + if (irng >= 0 && isect2 - isect < 2) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + tleg->SetTextSize(0.06); + } else { + if (irng < 0) { + c1->Divide(nchnmx, ringmx, 1.e-6, 1.e-6); + } else { + c1->Divide(nchnmx, ringmx + 1, 1.e-6, 1.e-6); + } + tleg->SetTextSize(0.10); + } + } + + TH1F* histx[nprojtype][ringmx][nchnmx]; + TH1F* histy[nprojtype][ringmx][nchnmx]; + + int nloop = (irng < 0) ? ringmx : isect2 - isect + 1; + cout << "nloop " << nloop << endl; + bool iscomb = false; //For combined sect + // for (int kl=0; kl= 5) + icol++; + if (icol >= 10) + icol++; + if (extcol > 0) + latex.SetTextColor(icol); + for (int ij = 0; ij < nloop; ij++) { + for (int jk = 0; jk < nchnmx; jk++) { + if (irng < 0) { + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", kl, ij, (ij == 2) ? rbxmx : rbx12mx, jk); + iscomb = true; + } else { + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", kl, irng, isect + ij, jk); + if ((irng == 2 && isect + ij == rbxmx) || (irng != 2 && isect + ij == rbx12mx)) + iscomb = true; + } + // cout<<"ij "<Get(name); + histx[kl][ij][jk] = (TH1F*)histy[kl][ij][jk]->Clone(); + histx[kl][ij][jk]->Rebin(3); + histx[kl][ij][jk]->Scale(1. / TMath::Max(1., histx[kl][ij][jk]->Integral())); + c1->cd(++ipad); + histx[kl][ij][jk]->GetXaxis()->SetTitle("HO digi"); + histx[kl][ij][jk]->GetXaxis()->SetTitleSize(0.075); + histx[kl][ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[kl][ij][jk]->GetXaxis()->CenterTitle(); + histx[kl][ij][jk]->GetXaxis()->SetLabelSize(0.075); + histx[kl][ij][jk]->GetXaxis()->SetLabelOffset(-0.005); + + histx[kl][ij][jk]->GetYaxis()->SetTitle(); + histx[kl][ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[kl][ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[kl][ij][jk]->GetYaxis()->CenterTitle(); + histx[kl][ij][jk]->GetYaxis()->SetLabelSize(0.065); + histx[kl][ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[kl][ij][jk]->GetXaxis()->SetNdivisions(404); + histx[kl][ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[kl][ij][jk]->SetLineColor(icol); + if (kl == 0) { + // histx[kl][ij][jk]->GetXaxis()->SetRangeUser(-1,300); + histx[kl][ij][jk]->Draw(tag); + if (jk == 0) { + if (irng < 0) { + latex.DrawLatex(0.65, 0.62, Form("Ring %i", ij - 2)); + } else { + if (iscomb) { + latex.DrawLatex(0.65, 0.85 - 0.08 * extcol, Form("R %i", irng - 2)); + } else { + latex.DrawLatex(0.65, 0.90 - 0.045 * extcol, Form("R%i Rbx%i", irng - 2, isect + ij)); + } + } + } + if (ij == 0 && (!strstr(tag, "same"))) + latex.DrawLatex(0.45, 0.88, Form("TS %i", jk)); + } else { + histx[kl][ij][jk]->Draw("same"); + } + + if (ij == 0 && jk == 0 && (!strstr(tag, "same"))) { + tleg->AddEntry(histx[kl][ij][jk], projname[kl], "lpfe"); + } + + cout << "kl " << kl << "" << ij << "" << jk << " " << histx[kl][ij][jk]->Integral() << " " + << histx[kl][ij][jk]->GetTitle() << endl; + } + } + } + if (!strstr(tag, "same")) { + tleg->Draw(); + } + if (strstr(tag, "sames")) { + c1->Update(); + } +} + +void plot000r(int irng = -1, int isup = 0, double xup = 200) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.12); + TLatex latex; + latex.SetNDC(); + if (irng < 0) { + latex.SetTextSize(0.08); + } else { + latex.SetTextSize(0.075); + } + // latex.SetTextColor(extcol+1); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + TLegend* tleg = new TLegend(.5, 0.3, 0.8, 0.9, "", "brNDC"); + tleg->SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + + cout << "xx1x " << endl; + char name[100]; + int ysiz = (irng < 0) ? 350 : 450; + TCanvas* c1 = new TCanvas("c1", "c1", 900., ysiz); + tleg->SetTextSize(0.035); + if (irng < 0) { + tleg->SetTextSize(0.045); + c1->Divide(5, 1, 1.e-6, 1.e-6); + } else if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + + cout << "xxx " << endl; + TH1F* histx[ringmx][routmx + 1]; + TH1F* histy[ringmx][routmx + 1]; + + int nloop11 = (irng < 0) ? 0 : irng; + int nloop12 = (irng < 0) ? ringmx : irng + 1; + int nloop2 = (irng < 0 && isup == 0) ? 1 : ((irng == 2 || isup > 0) ? 36 : 24); //12 : 6); + + bool iscomb = false; //For combined sect + cout << "xxx2 " << nloop11 << " " << nloop12 << " " << nloop2 << endl; + int ipad = 0; + for (int ij = nloop11; ij < nloop12; ij++) { + if (isup > 0) + c1->cd(++ipad); + for (int jk = 0; jk < nloop2; jk++) { + if (ij != 2 && jk >= 24) + continue; + cout << "xxx3 " << ij << " " << jk << endl; + if (irng < 0 && isup == 0) { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_0", ij); + iscomb = true; + } else { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_%i", ij, jk + 1); + } + + cout << "name " << name << endl; + histy[ij][jk] = (TH1F*)gDirectory->Get(name); + histx[ij][jk] = (TH1F*)histy[ij][jk]->Clone(); + // histx[ij][jk]->Rebin(2); + histx[ij][jk]->Scale(1. / TMath::Max(1., histx[ij][jk]->Integral())); + if (isup <= 0) + c1->cd(++ipad); + histx[ij][jk]->GetXaxis()->SetTitle("HO RECO (GeV)"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.065); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.85); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.003); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + histx[ij][jk]->GetXaxis()->SetRangeUser(0., xup); + // histx[ij][jk]->SetMinimum(1.e-8); + if (isup > 0) + histx[ij][jk]->SetLineColor(jk + 1); + histx[ij][jk]->Draw((jk > 0 && isup > 0) ? "same" : ""); + + if (isup > 0 && ij == 2) { + cout << "jk " << jk << endl; + tleg->AddEntry(histx[ij][jk], Form("RM %i", jk), "lpfe"); + } + + if (irng < 0) { + latex.DrawLatex(0.55, 0.92, Form("Ring %i", ij - 2)); + } else { + latex.DrawLatex(0.55, 0.92, Form("Ring %i Sec%i", ij - 2, jk)); + } + } + if (isup > 0 && ij == 2) + tleg->Draw(); + } + // if (!strstr(tag,"same")) tleg->Draw(); + c1->Update(); +} + +void plot00(int ityp = 0, int isect = 0) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(1100); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.09); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.07); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.11); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 1000., 600.); + c1->Divide(nchnmx, ringmx, 1.e-6, 1.e-6); + + TH1F* histx[ringmx][nchnmx]; + int icol = 0; + for (int ij = 0; ij < ringmx; ij++) { + for (int jk = 0; jk < nchnmx; jk++) { + // sprintf(name, "hoCalibc/ringavedigi_%i_%i", ij, jk); + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", ityp, ij, isect, jk); + // cout<<"ij "<Get(name); + + c1->cd(++icol); + histx[ij][jk]->GetXaxis()->SetTitle("HO digi"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.095); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->SetLineColor(3); + histx[ij][jk]->Draw(); + if (jk == 0) + latex.DrawLatex(0.65, 0.62, Form("Ring %i", ij - 2)); + if (ij == 0) + latex.DrawLatex(0.65, 0.42, Form("TS %i", jk)); + } + } + c1->Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +// plot01(0) : //signal refion +// plot01(1) : //noise region +// plot01(2) : //total region +void plot01(int ityp = 0, int islocal = 1) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + + gStyle->SetPadTopMargin(0.02); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 400.); + c1->Divide(5, 1); + + TH1F* histx[ringmx][nprojtype]; + TH1F* histy[ringmx][nprojtype]; + + int nloop = (islocal == 1) ? 1 : nprojtype; + for (int jk = 0; jk < nloop; jk++) { + for (int ij = 0; ij < ringmx; ij++) { + sprintf(name, "hoCalibc/hoindringen_%i_%i", ij, jk); + + cout << "name " << name << endl; + histy[ij][jk] = (TH1F*)gDirectory->Get(name); + histx[ij][jk] = (TH1F*)histy[ij][jk]->Clone(); + histx[ij][jk]->Rebin(4); + histx[ij][jk]->Scale(1. / histx[ij][jk]->Integral()); + } + } + for (int jk = 0; jk < nloop; jk++) { + for (int ij = 0; ij < ringmx; ij++) { + c1->cd(ij + 1); + histx[ij][jk]->GetXaxis()->SetTitle((islocal) ? "Noise (GeV)" : "HO signal/noise (GeV)"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.65); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.065); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.001); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.05); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->SetLineColor(jk + 1); + if (jk == 0) { + double xmn = histx[ij][jk]->GetXaxis()->GetXmin(); + double xmx = histx[ij][jk]->GetXaxis()->GetXmax(); + if (ityp == 0) { + histx[ij][jk]->GetXaxis()->SetRangeUser(xmn, 5.); + } else if (ityp == 1) { + histx[ij][jk]->GetXaxis()->SetRangeUser(2, xmx); + } else { + histx[ij][jk]->GetXaxis()->SetRangeUser(xmn, xmx); + } + // histx[ij][jk]->Scale(1./histx[ij][jk]->GetEntries()); + histx[ij][jk]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + } else { + histx[ij][jk]->Draw("same"); + } + // cout<<"ijjk "<< ij<<" "<GetEntries()<<" " <Integral()<<" "<GetTitle()<Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +void plot1() { + def_setting(); + gStyle->SetOptStat(1100); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + + gStyle->SetPadTopMargin(0.05); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + + TH1F* histx[8]; + for (int ij = 0; ij < 8; ij++) { + sprintf(name, "signal_%i", ij); + histx[ij] = new TH1F(name, name, 100, -0.2, 5.8); + // histx[1] = new TH1F("noise", "noise", 100, -.2, 5.8); + + // TTree Ttree = gDirectory->Get("T1"); + switch (ij) { + case 0: + T1->Project(name, "hosig[4]", "isect>0&&(int(isect/100)-50)<-10&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 1: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=-10&&(int(isect/100)-50)<-5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 2: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=-4&&(int(isect/100)-50)<5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 3: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=4&&(int(isect/100)-50)<11&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 4: + T1->Project(name, "hocro", "isect>0&&(int(isect/100)-50)<-10&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 5: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=-10&&(int(isect/100)-50)<-5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 6: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=-4&&(int(isect/100)-50)<5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 7: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=4&&(int(isect/100)-50)<11&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + } + } + for (int ij = 0; ij < 8; ij++) { + c1->cd(ij % 4 + 1); + histx[ij]->GetXaxis()->SetTitle("HO signal/noise (GeV)"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitle(); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.9); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.05); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + if (ij < 4) { + histx[ij]->SetLineColor(3); + histx[ij]->SetMaximum(1.1 * histx[ij + 4]->GetMaximum()); + histx[ij]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + } else { + if (ij == 4) { + c1->Update(); + gStyle->SetStatTextColor(2); + gStyle->SetStatY(.79); + } + histx[ij]->SetLineColor(2); + histx[ij]->Draw("sames"); + } + // histx[1]->Draw("sames"); + } + c1->Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +void plot1a() { + def_setting(); + gStyle->SetOptStat(1100); + gStyle->SetOptLogy(1); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + + TH1F* histx[8]; + for (int ij = 0; ij < 8; ij++) { + sprintf(name, "signal_%i", ij); + histx[ij] = new TH1F(name, name, 100, 0.5, 19.5); + // histx[1] = new TH1F("noise", "noise", 100, -.2, 5.8); + + // TTree Ttree = gDirectory->Get("Tcor1"); + switch (ij) { + case 0: + Tcor1->Project(name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)<-10&&int(icapid/10.)==4"); + break; + case 1: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-10&&(int(hocomu/100)-50)<-5&&int(icapid/10.)==4"); + break; + case 2: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-4&&(int(hocomu/100)-50)<5&&int(icapid/10.)==4"); + break; + case 3: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=4&&(int(hocomu/100)-50)<11&&int(icapid/10.)==4"); + break; + case 4: + Tcor1->Project(name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)<-10&&int(icapid/10.)==0"); + break; + case 5: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-10&&(int(hocomu/100)-50)<-5&&int(icapid/10.)==0"); + break; + case 6: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-4&&(int(hocomu/100)-50)<5&&int(icapid/10.)==0"); + break; + case 7: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=4&&(int(hocomu/100)-50)<11&&int(icapid/10.)==0"); + break; + } + + c1->cd(ij % 4 + 1); + histx[ij]->GetXaxis()->SetTitle("HO signal/noise (GeV)"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitle(); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.9); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.055); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + if (ij < 4) { + histx[ij]->SetLineColor(3); + + histx[ij]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + + } else { + if (ij == 4) { + c1->Update(); + gStyle->SetStatTextColor(2); + gStyle->SetStatY(.79); + } + + histx[ij]->SetLineColor(2); + histx[ij]->Draw("sames"); + } + // histx[1]->Draw("sames"); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +//plot2(1,4,0) + +void plot2(int ith1 = 1, int ith2 = 4, int iproj = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.07); + gStyle->SetPadBottomMargin(0.12); + gStyle->SetPadLeftMargin(0.11); + gStyle->SetPadRightMargin(0.14); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TH2F* histx[10]; + TH2F* histy[10]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + TH2F* histz = (TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"); + int nentry = histz->GetBinContent(0, 0); + + icnt = 0; + cout << "nentry = " << nentry << endl; + for (int ij = ith1; ij <= ith2; ij++) { + // sprintf(name, "hoCalibc/indrecosig_%i_%i", iproj, ij); + // indrecosig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/indrecocnt_%i_%i", iproj, ij); + histy[icnt] = (TH2F*)gDirectory->Get(name); + histx[icnt] = (TH2F*)histy[icnt]->Clone(); + + c1->cd(icnt + 1); + cout << "icnt " << icnt << " " << histx[icnt]->GetTitle() << endl; + histx[icnt]->Scale(1. / nentry); + histx[icnt]->GetXaxis()->SetTitle("i#eta"); + histx[icnt]->GetXaxis()->SetTitleSize(0.075); + histx[icnt]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[icnt]->GetXaxis()->CenterTitle(); + histx[icnt]->GetXaxis()->SetLabelSize(0.065); + histx[icnt]->GetXaxis()->SetLabelOffset(0.001); + + histx[icnt]->GetYaxis()->SetTitle("i#phi"); + histx[icnt]->GetYaxis()->SetTitleSize(0.075); + histx[icnt]->GetYaxis()->SetTitleOffset(0.7); + histx[icnt]->GetYaxis()->CenterTitle(); + histx[icnt]->GetYaxis()->SetLabelSize(0.065); + histx[icnt]->GetYaxis()->SetLabelOffset(0.01); + + histx[icnt]->GetZaxis()->SetLabelSize(0.048); + histx[icnt]->GetZaxis()->SetLabelOffset(0.01); + histx[icnt]->GetZaxis()->SetNdivisions(406); + + histx[icnt]->Draw("colz"); + latex.DrawLatex(.4, .95, Form("%g Update(); +} +// root histall_apr14b_cosmic_csa14_cosmic.root +//xx plot3(0) +//xx plot3(1) +//xx plot3(2) +//xx plot3(3) + +void plot3(int isel = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.05); + gStyle->SetPadBottomMargin(0.1); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.14); + char name[100]; + TH2F* histx[9]; + TH2F* histy[9]; + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + sprintf(name, "hoCalibc/totalmuon_%i", isel); + TH2F* totalmuon = (TH2F*)gDirectory->Get(name); + + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(3, 3, 1.e-6, 1.e-6); + for (int ij = 0; ij < 9; ij++) { + sprintf(name, "hoCalibc/totalproj_%i_%i", isel, ij); + histy[ij] = (TH2F*)gDirectory->Get(name); + histx[ij] = (TH2F*)histy[ij]->Clone(); + + histx[ij]->Divide(totalmuon); + + c1->cd(ij + 1); + // histx[ij]->GetXaxis()->SetTitle("i#eta"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + // histx[ij]->GetYaxis()->SetTitle("i#phi"); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.7); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.055); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + histx[ij]->GetZaxis()->SetNdivisions(406); + histx[ij]->Draw("colz"); + } + c1->Update(); +} +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot4(1,3,0,0) +void plot4(int ith1 = 0, int ith2 = 8, int isel1 = 0, int isel2 = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TH1F* histx[10][9]; + TH1F* histy[10][9]; + TH1F* histz[10][9]; + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.055); + latex.SetTextFont(42); + latex.SetTextAlign(3); //(31); // align right + + int nydiv = (isel2 == isel1) ? 1 : 2; + // TCanvas* c1 = new TCanvas("c1", "c1", 800., (nydiv==1) ? 350 : 600.); + // c1->Divide(3,nydiv,1.e-6,1.e-6); + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(3, 3, 1.e-6, 1.e-6); + + const int nbin = 5; + TString labels[nbin] = {"Ring-2", "Ring-1", "Ring0", "Ring+1", "Ring+2"}; + + for (int ij = ith1; ij <= ith2; ij++) { + sprintf(name, "hoCalibc/endigisig_%i_%i", isel1, ij); + histz[0][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigisig_%i_%i", isel2, ij); + histz[1][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigicnt_%i_%i", isel1, ij); + histy[0][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigicnt_%i_%i", isel2, ij); + histy[1][ij] = (TH1F*)gDirectory->Get(name); + } + + int icol = 0; + for (int jk = 0; jk < nydiv; jk++) { + for (int ij = ith1; ij <= ith2; ij++) { + histx[jk][ij] = (TH1F*)histz[jk][ij]->Clone(); + histx[jk][ij]->Divide(histy[jk][ij]); + c1->cd(++icol); + cout << "ij " << icol << " " << ij << " " << jk << " " << histy[jk][ij]->GetTitle() << endl; + + histx[jk][ij]->GetXaxis()->SetLabelSize(0.05); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[jk][ij]->GetYaxis()->SetLabelSize(0.045); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetTitle("Time slice in Five rings"); + histx[jk][ij]->GetXaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetXaxis()->SetTitleOffset(1.2); //0.85 + histx[jk][ij]->GetXaxis()->CenterTitle(); + histx[jk][ij]->GetXaxis()->SetLabelSize(0.075); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetYaxis()->SetTitle("Signal (fC/GeV)"); + histx[jk][ij]->GetYaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetYaxis()->SetTitleOffset(1.3); + histx[jk][ij]->GetYaxis()->CenterTitle(); + histx[jk][ij]->GetYaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetNdivisions(406); + histx[jk][ij]->GetYaxis()->SetNdivisions(406); + + for (int kl = 0; kl < nbin; kl++) { + histx[jk][ij]->GetXaxis()->SetBinLabel(10 * kl + 6, labels[kl]); + } + histx[jk][ij]->GetXaxis()->LabelsOption("h"); + histx[jk][ij]->Draw(); + + latex.DrawLatex(0.40, 0.93, Form("%g Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot5(1,3,0,0) +void plot5(int ith1 = 1, int ith2 = 3, int isel1 = 0, int isel2 = 4, double amx = -1.0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.14); + + char name[100]; + TH2F* histx[5][9]; + TH2F* histy[5][9]; + TH2F* histz[5][9]; + + const int nbin = 5; + TString labels[nbin] = {"Ring-2", "Ring-1", "Ring0", "Ring+1", "Ring+2"}; + + int nydiv = (isel1 == isel2) ? 1 : 2; + TCanvas* c1 = new TCanvas("c1", "c1", 800., (nydiv == 1) ? 350 : 600.); + c1->Divide(3, nydiv, 1.e-6, 1.e-6); + + for (int ij = ith1; ij <= ith2; ij++) { + sprintf(name, "hoCalibc/rmdigisig_%i_%i", isel1, ij); + histz[0][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigisig_%i_%i", isel2, ij); + histz[1][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", isel1, ij); + histy[0][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", isel2, ij); + histy[1][ij] = (TH2F*)gDirectory->Get(name); + } + + int icol = 0; + for (int jk = 0; jk < nydiv; jk++) { + for (int ij = ith1; ij <= ith2; ij++) { + histx[jk][ij] = (TH2F*)histz[jk][ij]->Clone(); + histx[jk][ij]->Divide(histy[jk][ij]); + c1->cd(++icol); + cout << "ij " << icol << " " << ij << " " << jk << " " << histy[jk][ij]->GetTitle() << endl; + + histx[jk][ij]->GetXaxis()->SetTitle("Time slice in Five rings"); + histx[jk][ij]->GetXaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetXaxis()->SetTitleOffset(1.2); //0.85 + histx[jk][ij]->GetXaxis()->CenterTitle(); + histx[jk][ij]->GetXaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetYaxis()->SetTitle("RM#"); + histx[jk][ij]->GetYaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetYaxis()->SetTitleOffset(1.3); + histx[jk][ij]->GetYaxis()->CenterTitle(); + histx[jk][ij]->GetYaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetZaxis()->SetLabelSize(0.048); + histx[jk][ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetNdivisions(202); + // histx[jk][ij]->GetYaxis()->SetNdivisions(406); + // histx[jk][ij]->GetZaxis()->SetNdivisions(406); + if (amx > 0) + histx[jk][ij]->SetMaximum(amx); + // for (int kl=0; klGetXaxis()->SetBinLabel(10*kl+6, labels[kl]); + // } + // histx[jk][ij]->GetXaxis()->LabelsOption("h"); + histx[jk][ij]->GetXaxis()->SetNdivisions(810); + histx[jk][ij]->Draw("colz"); + } + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot6(-2,3) +void plot6(int iring = -2, int irbx = 3) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.10); + gStyle->SetPadBottomMargin(0.08); + gStyle->SetPadLeftMargin(0.20); + gStyle->SetPadRightMargin(0.20); + char name[100]; + const int shapemx = 10; + TH2F* histx[shapemx]; + // const char* shape_name[shapemx]={"N:T3/T34", "N:T34/Sum2-5", "N:T3/Sum2-5", "N:T4/Sum2-5", "N:Oth/Sum2-5", + // "S:T3/T34", "S:T34/Sum2-5", "S:T3/Sum2-5", "S:T4/Sum2-5", "S:Oth/Sum2-5"}; + + const char* shape_name[shapemx] = { + "T3/T4", "T4/Sum45", "T45/Sum4-7", "T4-7/All", "T0-3/T4-7", "T0-3/All", "T0-3/T4-7", "T67/T45", "xx", "xx"}; + + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(4, 2, 1.e-6, 1.e-6); + + for (int ij = 0; ij < shapemx - 2; ij++) { + c1->cd(ij + 1); + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_%i", ij, iring + 2, irbx); + histx[ij] = (TH2F*)gDirectory->Get(name); + cout << "ij " << ij << " " << histx[ij]->GetTitle() << endl; + + if (ij == 0 || ij == 5) { + // histx[ij]->GetXaxis()->SetTitle("T2+T3"); + } else { + // histx[ij]->GetXaxis()->SetTitle("Sum T2-5"); + } + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.65); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij]->GetYaxis()->SetTitle(shape_name[ij]); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.3); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.07); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + + histx[ij]->Draw("colz"); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot7(2,0) +void plot7(int ith = 2, int irbx = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(5, 2, 1.e-6, 1.e-6); + + TH1F* histx[2][nringmx]; + + int icol = 0; + + for (int ij = 0; ij < 2; ij++) { + for (int jk = 0; jk < nringmx; jk++) { + if (ij == 0) { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_%i", ith, jk, irbx); + } else { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_%i", ith, jk, irbx); + } + + histx[ij][jk] = (TH1F*)gDirectory->Get(name); + cout << "name " << name << endl; + c1->cd(++icol); + + if (ij == 0) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } + histx[ij][jk]->GetXaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk]->GetYaxis()->SetTitle(); //shape_name[ij][jk]); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk]->Draw(); + cout << "ijjk " << ij << " " << jk << " " << histx[ij][jk]->GetTitle() << endl; + latex.DrawLatex(0.35, 0.8, Form("Ring %i", jk - 2)); + } + } + c1->Update(); +} + +void plot7a(int irng = -1, int ith = 2, int isrm = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + if (irng < 0) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + } else if (isrm) { + if (irng == 2) { + c1->Divide(6, 6, 1.e-6, 1.e-6); + } else { + c1->Divide(6, 4, 1.e-6, 1.e-6); + } + } else { + if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + } + TH1F* histx[routmx + 1][routmx + 1]; + + int icol = 0; + + int nloop1 = 2; + int nloop2 = nringmx; + if (irng >= 0) { + nloop1 = 1; + if (isrm) { + nloop2 = (irng == 2) ? 36 : 24; + } else { + nloop2 = (irng == 2) ? 12 : 6; + } + } + + for (int ij = 0; ij < nloop1; ij++) { //ij<2 + for (int jk = 0; jk < nloop2; jk++) { //ijGet(name); + cout << "name " << name << endl; + c1->cd(++icol); + if (irng < 0) { + if (ij == 0) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } + } else if (isrm) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } + + histx[ij][jk]->GetXaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk]->GetYaxis()->SetTitle(); //shape_name[ij][jk]); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk]->Draw(); + cout << "ijjk " << ij << " " << jk << " " << histx[ij][jk]->GetTitle() << endl; + if (irng < 0) { + latex.DrawLatex(0.35, 0.8, Form("Ring %i E>%g", jk - 2, hothreshs[ith])); + } else if (isrm) { + latex.DrawLatex(0.35, 0.8, Form("Ring %i RM%i E>%g", irng, jk, hothreshs[ith])); + } else { + latex.DrawLatex(0.35, 0.8, Form("Ring %i RBX%i E>%g", irng, jk, hothreshs[ith])); + } + } + } + c1->Update(); +} + +void plot7b(int irng = -1, int th1 = 2, int th2 = 5, int isrm = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.065); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + TLegend* tleg = new TLegend(.75, 0.35, 0.95, 0.9, "", "brNDC"); + tleg->SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + tleg->SetTextSize(0.07); + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + if (irng < 0) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + } else if (isrm) { + if (irng == 2) { + c1->Divide(6, 6, 1.e-6, 1.e-6); + } else { + c1->Divide(6, 4, 1.e-6, 1.e-6); + } + } else { + if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + } + TH1F* histx[routmx + 1][routmx + 1][nhothresh]; + + int icol = 0; + + int nloop1 = 2; + int nloop2 = nringmx; + if (irng >= 0) { + nloop1 = 1; + if (isrm) { + nloop2 = (irng == 2) ? 36 : 24; + } else { + nloop2 = (irng == 2) ? 12 : 6; + } + } + + for (int ij = 0; ij < nloop1; ij++) { //ij<2 + for (int jk = 0; jk < nloop2; jk++) { //ijGet(name); + cout << "name " << name << endl; + if (kl == th1) + c1->cd(++icol); + if (irng < 0) { + if (ij == 0) { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RM"); + } + } else if (isrm) { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RM"); + } else { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RBX"); + } + + histx[ij][jk][kl]->GetXaxis()->SetTitleSize(0.065); + histx[ij][jk][kl]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij][jk][kl]->GetXaxis()->CenterTitle(); + histx[ij][jk][kl]->GetXaxis()->SetLabelSize(0.075); + histx[ij][jk][kl]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk][kl]->GetYaxis()->SetTitle(); //shape_name[ij][jk][kl]); + histx[ij][jk][kl]->GetYaxis()->SetTitleSize(0.065); + histx[ij][jk][kl]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk][kl]->GetYaxis()->CenterTitle(); + histx[ij][jk][kl]->GetYaxis()->SetLabelSize(0.075); + histx[ij][jk][kl]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk][kl]->GetXaxis()->SetNdivisions(404); + histx[ij][jk][kl]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk][kl]->SetLineColor(kl - th1 + 1); + histx[ij][jk][kl]->Draw((kl == th1) ? "" : "same"); + cout << "ijjk " << ij << " " << jk << " " << kl - th1 + 1 << " " << histx[ij][jk][kl]->GetTitle() << endl; + if (kl == th1) { + if (irng < 0) { + latex.DrawLatex(0.35, 0.85, Form("R%i", jk - 2)); + } else if (isrm) { + latex.DrawLatex(0.35, 0.85, Form("R%i RM%i", irng - 2, jk)); + } else { + latex.DrawLatex(0.35, 0.85, Form("R%i RBX%i", irng - 2, jk)); + } + } + if (ij == 0 && jk == 0) { + tleg->AddEntry(histx[ij][jk][kl], Form("th>%g", hothreshs[kl]), "lpfe"); + } + } + } + } + tleg->Draw(); + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot8(0,5,0) +// plot8(0,5,1) +void plot8(int ith1 = 1, int ith2 = 8, int ityp = 1) { + def_setting(); + + gStyle->SetPadGridX(0); + gStyle->SetPadGridY(0); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.16); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(4, 2, 1.e-6, 1.e-6); + // sprintf(name, "hoCalibc/hbentry_d%i", ij+3); + int nentry = ((TH1F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[11]; + TH2F* histy[11]; + + int icol = 0; + for (int ij = ith1; ij <= ith2; ij++) { + // histx[1] = (TH2F*)gDirectory->Get(name); + if (ityp == 0) { + sprintf(name, "hoCalibc/hormoccu_%i", ij); + } else { + sprintf(name, "hoCalibc/hocorrelht_%i", ij); + } + cout << "nentry " << nentry << endl; + histy[ij] = (TH2F*)gDirectory->Get(name); + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + histx[ij]->GetXaxis()->SetTitle((ityp == 0) ? "iRing" : "i#eta"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.85); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.075); + histx[ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[ij]->GetYaxis()->SetTitle((ityp == 0) ? "RM" : "i#phi"); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.1); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(202); + histx[ij]->GetYaxis()->SetNdivisions(202); + histx[ij]->GetZaxis()->SetNdivisions(202); + + c1->cd(++icol); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.58, 0.85, Form("E_{th}=%g GeV", hothreshs[ij])); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot9(2,0) +// plot9(2,1) +void plot9(int ith = 2, int ityp = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.075); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.07); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.20); + gStyle->SetPadRightMargin(0.17); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(3, 2, 1.e-6, 1.e-6); + + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[6]; + TH2F* histy[6]; + + sprintf(name, "hoCalibc/hormcorrel_%i", ith); + + histy[0] = (TH2F*)gDirectory->Get(name); + for (int jk = 0; jk < nringmx; jk++) { + if (ityp == 0) { + sprintf(name, "hoCalibc/hocorrelsig_%i_%i", jk, ith); + } else { + sprintf(name, "hoCalibc/hocorrel2sig_%i_%i", jk, ith); + } + histy[1 + jk] = (TH2F*)gDirectory->Get(name); + } + + for (int ij = 0; ij < 6; ij++) { + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + + if (ij == 0) { + histx[ij]->GetXaxis()->SetTitle("# of RM in Rings"); + histx[ij]->GetYaxis()->SetTitle("# of RM in Rings"); + } else { + if (ityp == 0) { + histx[ij]->GetXaxis()->SetTitle("72 #times i#eta + i#phi"); + histx[ij]->GetYaxis()->SetTitle("72 #times i#eta + i#phi"); + } else { + sprintf(name, "%i #times i#phi + i#eta", (ij == 1 || ij == 5) ? 5 : ((ij == 3) ? 8 : 6)); + histx[ij]->GetXaxis()->SetTitle(name); + histx[ij]->GetYaxis()->SetTitle(name); + } + } + + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.3); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(404); + histx[ij]->GetYaxis()->SetNdivisions(404); + histx[ij]->GetZaxis()->SetNdivisions(406); + + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + if (ij == 0) + latex.DrawLatex(0.24, 0.85, Form("E_{th}=%g GeV", hothreshs[ith])); + cout << "ij " << ij << " " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot10(4,5) +void plot10(int ith1 = 2, int ith2 = 3) { + def_setting(); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.05); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(2, 1, 1.e-6, 1.e-6); + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[2]; + TH2F* histy[2]; + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ith1); + histy[0] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ith2); + histy[1] = (TH2F*)gDirectory->Get(name); + + for (int ij = 0; ij < 2; ij++) { + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + + histx[ij]->GetXaxis()->SetTitle("72 #times i#eta+i#phi"); + histx[ij]->GetYaxis()->SetTitle("72 #times i#eta+i#phi"); + + histx[ij]->GetXaxis()->SetTitleSize(0.045); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.045); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.045); + histx[ij]->GetYaxis()->SetTitleOffset(1.65); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.045); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.045); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + if (ij == 0) + histx[ij]->SetMaximum(0.000001); + // if (ij==1) histx[ij]->SetMaximum(0.0000005); + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.28, 0.85, Form("E_{th}=%g GeV", hothreshs[(ij == 0) ? ith1 : ith2])); + + cout << "ij " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +//NO plot11(2,3) +void plot11(int ith1 = 2, int ith2 = 3) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.05); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(2, 1, 1.e-6, 1.e-6); + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[2]; + TH2F* histy[2]; + + sprintf(name, "hoCalibc/hoallmucorrel_%i", ith1); + histy[0] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/hoallmucorrel_%i", ith2); + histy[1] = (TH2F*)gDirectory->Get(name); + + for (int ij = 0; ij < 2; ij++) { + double total = 0; + histx[ij] = (TH2F*)histy[ij]->Clone(); + for (int ix = 1; ix <= histy[ij]->GetNbinsX(); ix++) { + float anent = histy[ij]->GetBinContent(ix, 0); + total += anent; + // cout<<"ix "<< ij<<" "<GetNbinsY(); iy++) { + histx[ij]->SetBinContent(ix, iy, histy[ij]->GetBinContent(ix, iy) / anent); + } + } + + histx[ij]->GetXaxis()->SetTitle("Projected muon (72 #times i#eta+i#phi)"); + histx[ij]->GetYaxis()->SetTitle("Signal in HO tower (72 #times i#eta+i#phi)"); + + histx[ij]->GetXaxis()->SetTitleSize(0.045); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.04); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.045); + histx[ij]->GetYaxis()->SetTitleOffset(1.65); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.04); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.04); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + // if (ij==0) histx[ij]->SetMaximum(0.002); + // if (ij==1) histx[ij]->SetMaximum(0.001); + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.28, 0.85, Form("E_{th}=%g GeV", hothreshs[(ij == 0) ? ith1 : ith2])); + cout << "ij " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +/* + +root ../local/loc2014/hist_local_*_Cosmics.root + .L anal_csa14_pl.C +alllocal(6); +root ../local/loc2014/hist_local_*_40fC.root + .L anal_csa14_pl.C +alllocal(6); +root ../local/loc2014/hist_local_*_50fC.root + .L anal_csa14_pl.C +alllocal(3); +root ../local/loc2014/hist_local_*_60fC.root + .L anal_csa14_pl.C +alllocal(9); +root ../local/loc2014/hist_local_*_peds.root + .L anal_csa14_pl.C +alllocal(3); +*/ + +void alllocal(int nfile = 9) { + char pch1[200]; + for (int ij = 0; ij < nfile; ij++) { + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + case 3: + _file3->cd(); + break; + case 4: + _file4->cd(); + break; + case 5: + _file5->cd(); + break; + case 6: + _file6->cd(); + break; + case 7: + _file7->cd(); + break; + case 8: + _file8->cd(); + break; + case 9: + _file9->cd(); + break; + default: + _file0->cd(); + break; + } + + cout << "xx1 " << endl; + char* namex = gDirectory->GetName(); + int len2 = strlen(namex); + strncpy(pch1, namex + 17, len2 - 22); + pch1[len2 - 22] = '\0'; + sprintf(pch1, "%s.ps", pch1); + TPostScript pss(pch1, 112); + pss.Range(28, 20); //pss.Range(20,28); + cout << "xx2 " << endl; + pss.NewPage(); + pss.NewPage(); + testxx(); + pss.NewPage(); + /* + pss.NewPage(); plot000(-1,6,6,1); + pss.NewPage(); plot000(0,6,6,1); + pss.NewPage(); plot000(1,6,6,1); + pss.NewPage(); plot000(2,12,12,1); + pss.NewPage(); plot000(3,6,6,1); + pss.NewPage(); plot000(4,6,6,1); + */ + + pss.NewPage(); + plot000(0, 6, 6, 1); + plot000(1, 6, 6, 1, "same", 1); + plot000(2, 12, 12, 1, "same", 2); + plot000(3, 6, 6, 1, "same", 3); + plot000(4, 6, 6, 1, "sames", 4); + + for (int jk = 0; jk < 5; jk++) { + pss.NewPage(); + plot000(jk, 0, 0, 1); + for (int kl = 1; kl < 12; kl++) { + if (jk != 2 && kl > 5) + continue; + cout << "jk " << jk << " " << kl << endl; + if ((jk == 2 && kl == 11) || (jk != 2 && kl == 5)) { + plot000(jk, kl, kl, 1, "sames", kl); + } else { + plot000(jk, kl, kl, 1, "same", kl); + } + } + } + + // // pss.NewPage(); plot000(1,0,0,1); + // // plot000(1,1,1,1, "same",1); + // // plot000(1,2,2,1, "same",2); + // // plot000(1,3,3,1, "same",3); + // // plot000(1,4,4,1, "same",4); + // // plot000(1,5,5,1, "sames",5); + + // // /* + // // pss.NewPage(); plot000(0,0,5,1); + // // pss.NewPage(); plot000(1,0,5,1); + // // pss.NewPage(); plot000(2,0,5,1); + // // pss.NewPage(); plot000(2,6,11,1); + // // pss.NewPage(); plot000(3,0,5,1); + // // pss.NewPage(); plot000(4,0,5,1); + // // */ + + pss.NewPage(); + plot000r(-1); + pss.NewPage(); + plot000r(0); + pss.NewPage(); + plot000r(1); + pss.NewPage(); + plot000r(2); + pss.NewPage(); + plot000r(3); + pss.NewPage(); + plot000r(4); + + // // /* + // // pss.NewPage(); plot01(0,1); + // // pss.NewPage(); plot01(1,1); + // // */ + pss.NewPage(); + plot01(2, 1); + + pss.NewPage(); + plot2(0, 4, 0); + pss.NewPage(); + plot2(4, 8, 0); + + // // pss.NewPage(); plot4(0,8,0,0); + // // // pss.NewPage(); plot4(3,5,0,0); + // // // pss.NewPage(); plot4(6,8,0,0); + + // // // pss.NewPage(); plot5(0,2,0,0); + // // // pss.NewPage(); plot5(3,5,0,0); + // // // pss.NewPage(); plot5(6,8,0,0); + + pss.NewPage(); + plot6(-2, 0); + pss.NewPage(); + plot6(-1, 0); + pss.NewPage(); + plot6(0, 0); + pss.NewPage(); + plot6(1, 0); + pss.NewPage(); + plot6(2, 0); + + // // // pss.NewPage(); plot7(0,0); + // // // pss.NewPage(); plot7(1,0); + // // // pss.NewPage(); plot7(2,0); + // // // pss.NewPage(); plot7(3,0); + // // // pss.NewPage(); plot7(4,0); + // // // pss.NewPage(); plot7(2,2); + + pss.NewPage(); + plot7b(-1, 3); + pss.NewPage(); + plot7b(0, 2, 8, 0); + pss.NewPage(); + plot7b(1, 2, 8, 0); + pss.NewPage(); + plot7b(2, 2, 8, 0); + pss.NewPage(); + plot7b(3, 2, 8, 0); + pss.NewPage(); + plot7b(4, 2, 8, 0); + pss.NewPage(); + plot7b(0, 2, 8, 1); + pss.NewPage(); + plot7b(1, 2, 8, 1); + pss.NewPage(); + plot7b(2, 2, 8, 1); + pss.NewPage(); + plot7b(3, 2, 8, 1); + pss.NewPage(); + plot7b(4, 2, 8, 1); + + pss.NewPage(); + plot8(1, 8, 0); + pss.NewPage(); + plot8(1, 8, 1); + + pss.NewPage(); + plot9(2, 0); + pss.NewPage(); + plot9(2, 1); + + // pss.NewPage(); plot10(4,5); + + pss.Close(); + } +} +/* +hadd histall_local_peds.root hist_local_*_peds.root +hadd histall_local_40fc.root hist_local_22*_40fC.root +hadd histall_local_50fc.root hist_local_22*_50fC.root +hadd histall_local_60fc.root hist_local_221848_60fC.root hist_local_221945_60fC.root hist_local_222770_60fC.root +hadd histall_local_cosmics.root hist_local_220619_Cosmics.root hist_local_220620_Cosmics.root hist_local_220625_Cosmics.root +*/ + +void alllocalx(int nfile = 9) { + char pch1[200]; + for (int ij = 0; ij < nfile; ij++) { + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + case 3: + _file3->cd(); + break; + case 4: + _file4->cd(); + break; + case 5: + _file5->cd(); + break; + case 6: + _file6->cd(); + break; + case 7: + _file7->cd(); + break; + case 8: + _file8->cd(); + break; + case 9: + _file9->cd(); + break; + case 10: + _file10->cd(); + break; + case 11: + _file11->cd(); + break; + case 12: + _file12->cd(); + break; + case 13: + _file13->cd(); + break; + case 14: + _file14->cd(); + break; + case 15: + _file15->cd(); + break; + case 16: + _file16->cd(); + break; + case 17: + _file17->cd(); + break; + case 18: + _file18->cd(); + break; + case 19: + _file19->cd(); + break; + case 20: + _file20->cd(); + break; + case 21: + _file21->cd(); + break; + case 22: + _file22->cd(); + break; + case 23: + _file23->cd(); + break; + case 24: + _file24->cd(); + break; + case 25: + _file25->cd(); + break; + case 26: + _file26->cd(); + break; + case 27: + _file27->cd(); + break; + case 28: + _file28->cd(); + break; + case 29: + _file29->cd(); + break; + + default: + _file0->cd(); + break; + } + + char* namex = gDirectory->GetName(); + int len2 = strlen(namex); + strncpy(pch1, namex + 17, len2 - 22); + pch1[len2 - 22] = '\0'; + sprintf(pch1, "xx_%s.ps", pch1); + TPostScript pss(pch1, 112); + pss.Range(28, 20); //pss.Range(20,28); + + pss.NewPage(); + pss.NewPage(); + testxx(); + pss.NewPage(); + testxx(); + + pss.NewPage(); + plot000r(-1, 0, 140); + pss.NewPage(); + plot000r(-1, 1, 140); + + // pss.NewPage(); plot000r(0); + // pss.NewPage(); plot000r(1); + // pss.NewPage(); plot000r(2); + // pss.NewPage(); plot000r(3); + // pss.NewPage(); plot000r(4); + + pss.NewPage(); + plot2(0, 4, 0); + pss.NewPage(); + plot2(4, 8, 0); + + // pss.NewPage(); plot000r(0); + // pss.NewPage(); plot000r(1); + // pss.NewPage(); plot000r(2); + // pss.NewPage(); plot000r(3); + // pss.NewPage(); plot000r(4); + + pss.NewPage(); + plot01(2, 1); + + pss.NewPage(); + plot7b(-1, 2, 8); + pss.NewPage(); + plot7b(0, 2, 8, 0); + pss.NewPage(); + plot7b(1, 2, 8, 0); + pss.NewPage(); + plot7b(2, 2, 8, 0); + pss.NewPage(); + plot7b(3, 2, 8, 0); + pss.NewPage(); + plot7b(4, 2, 8, 0); + pss.NewPage(); + plot7b(0, 2, 8, 1); + pss.NewPage(); + plot7b(1, 2, 8, 1); + pss.NewPage(); + plot7b(2, 2, 8, 1); + pss.NewPage(); + plot7b(3, 2, 8, 1); + pss.NewPage(); + plot7b(4, 2, 8, 1); + + pss.NewPage(); + plot8(1, 8, 0); + pss.NewPage(); + plot8(1, 8, 1); + + pss.NewPage(); + plot9(2, 0); + // pss.NewPage(); plot9(2,1); + + // pss.NewPage(); plot10(4,5); + + pss.NewPage(); + plot4(0, 8, 0, 0); + + // // // pss.NewPage(); plot5(0,2,0,0); + // // // pss.NewPage(); plot5(3,5,0,0); + // // // pss.NewPage(); plot5(6,8,0,0); + + pss.NewPage(); + plot000(0, 6, 6, 1); + plot000(1, 6, 6, 1, "same", 1); + plot000(2, 12, 12, 1, "same", 2); + plot000(3, 6, 6, 1, "same", 3); + plot000(4, 6, 6, 1, "sames", 4); + + for (int jk = 0; jk < 5; jk++) { + pss.NewPage(); + plot000(jk, 0, 0, 1); + for (int kl = 1; kl < 12; kl++) { + if (jk != 2 && kl > 5) + continue; + cout << "jk " << jk << " " << kl << endl; + if ((jk == 2 && kl == 11) || (jk != 2 && kl == 5)) { + plot000(jk, kl, kl, 1, "sames", kl); + } else { + plot000(jk, kl, kl, 1, "same", kl); + } + } + } + + pss.NewPage(); + plot6(-2, 0); + pss.NewPage(); + plot6(-1, 0); + pss.NewPage(); + plot6(0, 0); + pss.NewPage(); + plot6(1, 0); + pss.NewPage(); + plot6(2, 0); + + pss.Close(); + } +} + +// scp hcal_local_*_peds.root hcal_local_*_40fC.root hcal_local_*_50fC.root hcal_local_*_60fC.root hist_local_*_peds.root hist_local_*_40fC.root hist_local_*_50fC.root hist_local_*_60fC.root gobinda@158.144.54.116:/data/gobinda/anal/hcal/local/loc2014/ + +void test1x() { + for (int ij = 1; ij < 14; ij++) { + cout << "INR " << 6200 * ij + 4000 << " (for " << ij << " nights)" << endl; + } +} + +void sigpedrun(int nrn = 100) { + TPostScript ps("testxx.ps", 111); + ps.Range(20, 28); + TCanvas* c0x = new TCanvas("c0x", " Pedestal and signal", 900, 1200); + c0x->Divide(5, 4, 1.e-5, 1.e-5, 0); + + TH1F* signal_run[5][3000]; + char name[100]; + + for (int ix = 0; ix < nrn; ix++) { + int ixxy = ix % 4; + if (ixxy == 0) { + ps.NewPage(); + } + for (int iy = 0; iy < ringmx; iy++) { + sprintf(name, "noise_ring_%i_run%i", iy, ix); + signal_run[iy][ix] = (TH1F*)gDirectory->Get(name); + double mean = signal_run[iy][ix]->GetMean(); + double rms = signal_run[iy][ix]->GetRMS(); + if (iy == 0) + cout << ix << " " << signal_run[iy][ix]->GetTitle() << " "; + // cout <<" "<GetEntries()<<" "<cd(ringmx * ixxy + iy + 1); + signal_run[iy][ix]->SetLineColor(3); + signal_run[iy][ix]->GetXaxis()->SetLabelSize(0.095); + signal_run[iy][ix]->GetXaxis()->SetNdivisions(404); + signal_run[iy][ix]->GetYaxis()->SetLabelSize(0.095); + signal_run[iy][ix]->GetXaxis()->SetLabelOffset(-0.02); + signal_run[iy][ix]->Draw(); + if (ixxy == 3) { + c0x->Update(); + } + } + cout << endl; + } + + ps.Close(); +} +/* + Run # 297180 Evt # 102392070 1 7024424 + +All 94.67 92.49 95.35 92.7 94.71 + +ndof 93.37 92 94.58 92.21 93.3 +chisq 93.34 91.96 94.53 92.16 93.27 +angle 93.33 91.96 94.53 92.16 93.27 +pt 92.13 90.45 92.22 90.63 92.01 +isol 62.28 56 55.51 56.17 62.68 +phi 56.27 50.7 47.38 50.85 56.58 +eta 52.41 46.51 36.64 46.69 52.7 +Time 52.24 46.4 36.63 46.54 52.54 + + +hodx 99.31 97.74 99.62 98.03 99.32 +iso 96.61 94.44 97 94.67 96.68 +pt 96.4 94.17 96.81 94.4 96.48 + + + + 1 Constant 8.56917e+01 2.42013e+00 7.85930e-03 3.06102e-06 + 2 Mean 1.00342e+00 1.07020e-03 4.43892e-06 3.20972e-03 + 3 Sigma 4.79270e-02 8.60831e-04 1.86192e-05 -5.88994e-03 + + 1 Constant 1.92784e+02 5.34817e+00 1.63458e-02 -1.85787e-06 + 2 Mean 9.99574e-01 4.75653e-04 1.82064e-06 2.98504e-02 + 3 Sigma 2.14641e-02 3.63935e-04 1.51944e-05 -3.40005e-03 + + 1 Constant 4.23168e+02 1.23598e+01 3.79784e-02 -4.19190e-05 + 2 Mean 1.01199e+00 2.17199e-04 8.81854e-07 -3.90635e-01 + 3 Sigma 9.80276e-03 1.89893e-04 1.59833e-05 -2.89784e-02 + + 1 Constant 2.73388e+02 7.95311e+00 2.29623e-02 1.00544e-07 + 2 Mean 1.01965e+00 3.34716e-04 1.28072e-06 1.32401e-01 + 3 Sigma 1.52308e-02 2.92214e-04 1.60562e-05 -4.93738e-03 + + 1 Constant 3.33148e+02 9.67580e+00 2.88215e-02 -1.45420e-05 + 2 Mean 1.02102e+00 2.74804e-04 1.08052e-06 -2.43768e+00 + 3 Sigma 1.24753e-02 2.37824e-04 1.60597e-05 3.78574e-02 + + 1 Constant 4.11514e+02 1.19379e+01 3.34777e-02 -1.48396e-07 + 2 Mean 1.02247e+00 2.23653e-04 8.24581e-07 3.21928e-03 + 3 Sigma 1.01355e-02 1.93182e-04 1.45150e-05 -2.31771e-04 + + 1 Constant 4.17155e+02 1.22384e+01 3.67076e-02 -3.41070e-05 + 2 Mean 1.02334e+00 2.19820e-04 8.75434e-07 -4.30174e+00 + 3 Sigma 9.95279e-03 1.94035e-04 1.57779e-05 1.98571e-02 + + 1 Constant 3.99846e+02 1.20076e+01 4.10521e-02 1.64058e-06 + 2 Mean 1.02511e+00 2.34554e-04 1.05387e-06 4.74777e-02 + 3 Sigma 1.02668e-02 2.09319e-04 1.83947e-05 1.76225e-02 + + +CRO_pulse->Draw("c2PeakTime_1[0]","c1PeakTime_1[0]>-100&&c2PeakTime_1[0]>-100&&") + +CRO_pulse->Draw("c4PeakTime_1[1]","c3PeakTime_1[1]>-100&&c4PeakTime_1[1]>-100&&c3PeakTime_1[1]>1.e-6&&c4PeakTime_1[1]>1.e-6") + + +*/ diff --git a/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C b/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C new file mode 100644 index 0000000000000..25dcfd5ab353c --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C @@ -0,0 +1,943 @@ +#include "TFile.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TTree.h" +#include "TProfile.h" +#include "TPostScript.h" +#include "TCanvas.h" +#include "TF1.h" +#include "TStyle.h" +#include "TLatex.h" +#include "TLegend.h" +#include "TPaveStats.h" + +#include "TRandom.h" + +#include + +#include +#include +#include +#include +#include "TMinuit.h" +#include "TMath.h" + +const char* prehist = "hoCalibc/"; + +using namespace std; +static unsigned int mypow_2[32]; + +int irunold = 1000; +const int nmxbin = 40000; +float yvalft[nmxbin]; +float xvalft[nmxbin]; +int nvalft = 0; + +float alowx = -1.0; +float ahighx = 29.0; +int auprange = 25; + +double fitchisq; +int fitndof; +double anormglb = -1; +Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } + +// Double_t landX(Double_t* x, Double_t* par) { +// return par[0]*(TMath::Landau(x[0], par[1], par[2])); +// } + +// Double_t completefit(Double_t* x, Double_t* par) { +// return gausX(x, par) + landX(x, &par[3]); +// } + +Double_t langaufun(Double_t* x, Double_t* par) { + //Fit parameters: + //par[0]*par[1]=Width (scale) parameter of Landau density + //par[1]=Most Probable (MP, location) parameter of Landau density + //par[2]=Total area (integral -inf to inf, normalization constant) + //par[3]=Width (sigma) of convoluted Gaussian function + // + //In the Landau distribution (represented by the CERNLIB approximation), + //the maximum is located at x=-0.22278298 with the location parameter=0. + //This shift is corrected within this function, so that the actual + //maximum is identical to the MP parameter. + // /* + // Numeric constants + Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) + Double_t mpshift = -0.22278298; // Landau maximum location + + // Control constants + Double_t np = 100.0; // number of convolution steps + Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas + + // Variables + Double_t xx; + Double_t mpc; + Double_t fland; + Double_t sum = 0.0; + Double_t xlow, xupp; + Double_t step; + + // MP shift correction + mpc = par[1] - mpshift * par[0] * par[1]; + double scale = 1; // par[1]; + double scale2 = anormglb; // for notmalisation this is one, otehrwise use the normalisation; + if (scale2 < .1) + scale2 = 0.1; + // double scale=par[1]; + // Range of convolution integral + xlow = x[0] - sc * scale * par[3]; + xupp = x[0] + sc * scale * par[3]; + + step = (xupp - xlow) / np; + + // Convolution integral of Landau and Gaussian by sum + for (double ij = 1.0; ij <= np / 2; ij++) { + xx = xlow + (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + xx = xupp - (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + } + return (par[2] * step * sum * invsq2pi / (scale2 * par[3])); +} + +Double_t totalfunc(Double_t* x, Double_t* par) { + return gausX(x, par) + langaufun(x, &par[3]); // /max(.001,anormglb); +} + +const int netamx = 30; +const int nphimx = 72; + +int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } +int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } + +int ietafit; +int iphifit; + +void fcnsg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { + double xval[2]; + + anormglb = 1; + double tmpnorm = 0; + for (int ij = 0; ij < 600; ij++) { + xval[0] = -5 + (ij + 0.5) * .1; + tmpnorm += 0.1 * langaufun(xval, &par[3]) / par[5]; + } + anormglb = tmpnorm; + + double fval = -(par[0] + par[5]); + for (int ij = 0; ij < nvalft; ij++) { + if (yvalft[ij] < 1 || xvalft[ij] > auprange) + continue; + xval[0] = xvalft[ij]; + fval += yvalft[ij] * log(max(1.e-30, totalfunc(xval, par))); + } + f = -fval; +} + +int main() { + int icol = 0; + int ntotal = 0; + int irebin = 1; + int ifile = 0; + for (int ij = 0; ij < 32; ij++) { + mypow_2[ij] = (int)pow(float(2), ij); + } + + int max_nEvents = 300000000; + int ityp = 1; + bool m_cosmic = false; + bool m_histFill = true; + bool m_treeFill = false; + bool m_zeroField = false; + float pival = acos(-1.); + + int nsize; + char outfile[100]; + char outfilx[100]; + char nametag[100]; + char nametag2[100]; + char infile[200]; + char datafile[100]; + char histname[100]; + char name[100]; + char title[100]; + + cout << "Give the value of rebinning: a nonzero positive integer" << endl; + cin >> irebin; + if (irebin < 1) { + irebin = 1; + } + cout << "Give the upper range of signal for fit [5 - 29]" << endl; + cin >> auprange; + + cout << "Give the histname, e.g., 2017b_v2 2018a_v3a" << endl; + cin >> nametag2; + + int len = strlen(nametag2); + nametag2[len] = '\0'; + + sprintf(outfilx, "hist_hoprompt_%s.root", nametag2); + len = strlen(outfilx); + outfilx[len] = '\0'; + + // TFile* fileIn = new TFile("histalla_hcalcalho_2016bcde_v2a.root", "read"); + + TFile* fileIn = new TFile(outfilx, "read"); + // const char* nametag="2016e_ar1"; + // sprintf(nametag, "2016b_ar%i", irebin); + + unsigned ievt, hoflag; + int irun, ilumi, nprim, isect, isect2, ndof, nmuon; + + float inslumi, trkdr, trkdz, trkvx, trkvy, trkvz, trkmm, trkth, trkph, chisq, therr, pherr, hodx, hody, hoang, htime, + hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3]; + float momatho, tkpt03, ecal03, hcal03; + float tmphoang; + + TTree* Tin; + if (m_treeFill) { + Tin = (TTree*)fileIn->Get("T1"); + + Tin->SetBranchAddress("irun", &irun); + Tin->SetBranchAddress("ievt", &ievt); + + Tin->SetBranchAddress("isect", &isect); + Tin->SetBranchAddress("isect2", &isect2); + Tin->SetBranchAddress("ndof", &ndof); + Tin->SetBranchAddress("nmuon", &nmuon); + + Tin->SetBranchAddress("ilumi", &ilumi); + if (!m_cosmic) { + Tin->SetBranchAddress("inslumi", &inslumi); + Tin->SetBranchAddress("nprim", &nprim); + Tin->SetBranchAddress("tkpt03", &tkpt03); + Tin->SetBranchAddress("ecal03", &ecal03); + Tin->SetBranchAddress("hcal03", &hcal03); + } + + Tin->SetBranchAddress("trkdr", &trkdr); + Tin->SetBranchAddress("trkdz", &trkdz); + + Tin->SetBranchAddress("trkvx", &trkvx); + Tin->SetBranchAddress("trkvy", &trkvy); + Tin->SetBranchAddress("trkvz", &trkvz); + Tin->SetBranchAddress("trkmm", &trkmm); + Tin->SetBranchAddress("trkth", &trkth); + Tin->SetBranchAddress("trkph", &trkph); + + Tin->SetBranchAddress("chisq", &chisq); + Tin->SetBranchAddress("therr", &therr); + Tin->SetBranchAddress("pherr", &pherr); + Tin->SetBranchAddress("hodx", &hodx); + Tin->SetBranchAddress("hody", &hody); + Tin->SetBranchAddress("hoang", &hoang); + + Tin->SetBranchAddress("momatho", &momatho); + Tin->SetBranchAddress("hoflag", &hoflag); + Tin->SetBranchAddress("htime", &htime); + Tin->SetBranchAddress("hosig", hosig); + Tin->SetBranchAddress("hocro", &hocro); + Tin->SetBranchAddress("hocorsig", hocorsig); + Tin->SetBranchAddress("caloen", caloen); + } + + sprintf(nametag, "%s_ar%i_float_par8_rng%i", nametag2, irebin, auprange); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(22); + latex.SetTextAlign(11); // 11 left; // 21 centre, // (31); // align right, 22, 23, shift bottom + + //Related fitting, not for storing + const int nsample = 16; //# of signal plots in the .ps page + TF1* pedfun[nsample] = {0}; + TF1* sigfun[nsample] = {0}; + TF1* signalx[nsample] = {0}; + + TH1F* signall[nsample] = {0}; + + TH1F* signallunb[nsample] = {0}; + + const int nbgpr = 3; + const int nsgpr = 8; + double fitprm[nsgpr][netamx]; + double xmn = -1.0; + double xmx = 29.0; + + sprintf(outfilx, "fit_%s", nametag); + len = strlen(outfilx); + outfilx[len] = '\0'; + + sprintf(outfile, "%s.txt", outfilx); + ofstream file_out(outfile); + + sprintf(outfile, "%s.root", outfilx); + + TFile* fileOut = new TFile(outfile, "recreate"); + + TTree* Tout; + + TH1F* sigrsg[netamx][nphimx]; + + TH1F* fit_chi; + TH1F* sig_evt; + TH1F* fit_sigevt; + TH1F* fit_bkgevt; + TH1F* sig_mean; + TH1F* sig_diff; + TH1F* sig_width; + TH1F* sig_sigma; + TH1F* sig_expo; + TH1F* sig_meanerr; + TH1F* sig_meanerrp; + TH1F* sig_signf; + + TH1F* sig_statmean; + TH1F* sig_rms; + + TH2F* ped2d_evt; + TH2F* ped2d_mean; + TH2F* ped2d_width; + TH2F* fit2d_chi; + TH2F* sig2d_evt; + TH2F* fit2d_sigevt; + TH2F* fit2d_bkgevt; + TH2F* sig2d_mean; + TH2F* sig2d_diff; + TH2F* sig2d_width; + TH2F* sig2d_sigma; + TH2F* sig2d_expo; + TH2F* sig2d_meanerr; + TH2F* sig2d_meanerrp; + TH2F* sig2d_signf; + TH2F* sig2d_rms; + TH2F* sig2d_statmean; + + fit_chi = new TH1F("fit_chi", "fit_chi", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_evt = new TH1F("sig_evt", "sig_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + fit_sigevt = new TH1F("fit_sigevt", "fit_sigevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + fit_bkgevt = new TH1F("fit_bkgevt", "fit_bkgevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_mean = new TH1F("sig_mean", "sig_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_diff = new TH1F("sig_diff", "sig_diff", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_width = new TH1F("sig_width", "sig_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_sigma = new TH1F("sig_sigma", "sig_sigma", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_expo = new TH1F("sig_expo", "sig_expo", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + sig_meanerr = new TH1F("sig_meanerr", "sig_meanerr", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_meanerrp = new TH1F("sig_meanerrp", "sig_meanerrp", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_signf = new TH1F("sig_signf", "sig_signf", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + sig_statmean = new TH1F("sig_statmean", "sig_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_rms = new TH1F("sig_rms", "sig_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + fit2d_chi = + new TH2F("fit2d_chi", "fit2d_chi", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_evt = + new TH2F("sig2d_evt", "sig2d_evt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + fit2d_sigevt = new TH2F( + "fit2d_sigevt", "fit2d_sigevt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + fit2d_bkgevt = new TH2F( + "fit2d_bkgevt", "fit2d_bkgevt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_mean = new TH2F( + "sig2d_mean", "sig2d_mean", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_diff = new TH2F( + "sig2d_diff", "sig2d_diff", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_width = new TH2F( + "sig2d_width", "sig2d_width", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_sigma = new TH2F( + "sig2d_sigma", "sig2d_sigma", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_expo = new TH2F( + "sig2d_expo", "sig2d_expo", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + sig2d_statmean = new TH2F( + "sig2d_statmean", "sig2d_statmean", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_rms = + new TH2F("sig2d_rms", "sig2d_rms", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + sig2d_meanerr = new TH2F( + "sig2d_meanerr", "sig2d_meanerr", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_meanerrp = new TH2F( + "sig2d_meanerrp", "sig2d_meanerrp", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_signf = new TH2F( + "sig2d_signf", "sig2d_signf", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + if (m_histFill) { + for (int jk = 0; jk < netamx; jk++) { + for (int ij = 0; ij < nphimx; ij++) { + // sprintf(name, "%sho_indenergy_%i_%i", prehist, jk, ij); + sprintf(name, "%ssig_eta%i_phi%i", prehist, jk, ij); + sigrsg[jk][ij] = (TH1F*)fileIn->Get(name); + cout << "jkij " << jk << " " << ij << " " << name << endl; + } + } + } else if (m_treeFill) { + for (int jk = 0; jk < netamx; jk++) { + int ieta = getHOieta(jk); + for (int ij = 0; ij < nphimx; ij++) { + sprintf(name, "ho_indenergy_%i_%i", jk, ij); + sprintf(title, "signal (i#eta=%i - i#phi=%i", ieta, ij + 1); + sigrsg[jk][ij] = new TH1F(name, name, 120, -1.0, 14.0); //1200, -1.0, 29.0); + } + } + + int nentries = Tin->GetEntries(); + for (int iev = 0; iev < nentries; iev++) { + fileIn->cd(); + Tin->GetEntry(iev); + fileOut->cd(); + int ieta = int((abs(isect) % 10000) / 100.) - 50; + int iphi = abs(isect) % 100; + int tmpxet = invert_HOieta(ieta); + + //event selection + if (hosig[4] > -90) { + sigrsg[tmpxet][iphi - 1]->Fill(hosig[4]); + } + } + } else { + cout << " You must read either histogramme or tree " << endl; + return 1; + } + + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.03); + + gStyle->SetOptStat(1110); + gStyle->SetLabelSize(0.095, "XYZ"); + gStyle->SetLabelOffset(-0.01, "XYZ"); + gStyle->SetHistLineColor(1); + gStyle->SetHistLineWidth(2); + gStyle->SetPadGridX(0); + gStyle->SetPadGridY(0); + gStyle->SetGridStyle(0); + gStyle->SetOptLogy(1); + + int ips = 111; + sprintf(outfile, "%s.ps", outfilx); + TPostScript ps(outfile, ips); + ps.Range(20, 28); + gStyle->SetOptLogy(0); + gStyle->SetPadLeftMargin(0.17); + + gStyle->SetPadGridX(3); + gStyle->SetPadGridY(3); + gStyle->SetGridStyle(2); + gStyle->SetPadRightMargin(0.17); + gStyle->SetPadLeftMargin(0.10); + + gStyle->SetTitleFontSize(0.045); + gStyle->SetPadTopMargin(0.10); //.12 + gStyle->SetPadBottomMargin(0.12); //.14 + gStyle->SetPadLeftMargin(0.17); + gStyle->SetPadRightMargin(0.03); + + gStyle->SetOptStat(0); //GMA (1110); + + gStyle->SetOptFit(101); + gStyle->SetCanvasBorderMode(0); + gStyle->SetPadBorderMode(0); + gStyle->SetStatBorderSize(1); + gStyle->SetStatStyle(1001); + gStyle->SetTitleColor(10); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.05); + gStyle->SetTitleFillColor(10); + gStyle->SetTitleBorderSize(1); + + gStyle->SetCanvasColor(10); + gStyle->SetPadColor(10); + gStyle->SetStatColor(10); + // gStyle->SetStatFontSize(.07); + gStyle->SetStatX(0.99); + gStyle->SetStatY(0.99); + gStyle->SetStatW(0.44); + gStyle->SetStatH(0.16); + gStyle->SetTitleSize(0.065, "XYZ"); + gStyle->SetLabelSize(0.075, "XYZ"); + gStyle->SetLabelOffset(0.012, "XYZ"); + gStyle->SetPadGridX(0); //(1) + gStyle->SetPadGridY(0); //(1) + gStyle->SetGridStyle(3); + gStyle->SetNdivisions(101, "XY"); + gStyle->SetOptLogy(1); //0); //GMA 1 + int iiter = 0; + + ps.NewPage(); + + int xsiz = 900; //900; + int ysiz = 1200; //600; + TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz); + c0->Divide(4, 4); + fileOut->cd(); + for (int ij = 0; ij < nphimx; ij++) { + int iphi = ij + 1; + // for (int jk=0; jkClone("hnew"); + if (irebin > 1) { + signall[izone]->Rebin(irebin); + } + + signallunb[izone] = (TH1F*)signall[izone]->Clone("hnew"); + signall[izone]->Rebin(10 / irebin); + + if (izone == 0) { //iiter%8 ==0) { + ps.NewPage(); + } + c0->cd(izone + 1); + if (signall[izone]->GetEntries() / 2. > 5) { + double binwid = signall[izone]->GetBinWidth(1); + + Double_t parall[nsgpr]; + double parserr[nsgpr]; + double fitres[nsgpr]; + double pedht = 0; + + char temp[20]; + xmn = signall[izone]->GetXaxis()->GetXmin(); + xmx = signall[izone]->GetXaxis()->GetXmax(); + int nbn = signall[izone]->FindBin(0); + + cout << "bincenter ===================================== " << signall[izone]->GetBinCenter(nbn) << endl; + pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) + + signall[izone]->GetBinContent(nbn + 1)) / + 3.; + + parall[0] = max(1.0, 0.9 * pedht); //Pedestal peak + parall[1] = 0.00; //pedestal mean + parall[2] = 0.03; //pedestal width + parall[3] = 0.135; //Gaussian smearing of Landau function + parall[4] = 0.7 * signallunb[izone]->GetMean(); //fitprm[4][jk]; //from 2015 cosmic data + parall[5] = signallunb[izone]->GetEntries() / 2.; + parall[6] = 0.2238; // from 2015 cosmic data + parall[7] = 5.0; + + nvalft = min(nmxbin, signallunb[izone]->GetNbinsX()); + + for (int lm = 0; lm < nvalft; lm++) { + xvalft[lm] = signallunb[izone]->GetBinCenter(lm + 1); + yvalft[lm] = signallunb[izone]->GetBinContent(lm + 1); + } + + TMinuit* gMinuit = new TMinuit(nsgpr); + TString namex[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma", "Exp"}; + double strt[nsgpr] = {parall[0], parall[1], parall[2], parall[3], parall[4], parall[5], parall[6], parall[7]}; + double alx = max(0.0, 0.1 * parall[0] - 1.1); + double alowmn[nsgpr] = { + alx, -0.1, -0.1, 0.06, 0.5 * strt[4] - 0.5, 0.1 * strt[5], 0.1 * strt[6], 0.5 * parall[7]}; + double ahighmn[nsgpr] = { + 5.0 * parall[0] + 10.1, 0.1, 0.1, 0.25, 1.5 * strt[4] + 0.5, 1.5 * strt[5], 3.2 * strt[6], 10.0 * parall[7]}; + + double step[nsgpr] = {0.1, 0.01, 0.01, 0.001, 0.001, 1.0, 0.001, 0.01}; + + gMinuit->SetFCN(fcnsg); + + double arglist[10]; + int ierflg = 0; + arglist[0] = 0.5; + gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); + + for (int lm = 0; lm < nsgpr; lm++) { + gMinuit->mnparm(lm, namex[lm], strt[lm], step[lm], alowmn[lm], ahighmn[lm], ierflg); + } + + arglist[0] = 0; + gMinuit->mnexcm("MINIMIZE", arglist, 0, ierflg); + + arglist[0] = 0; + gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); + + TString chnam; + double parv, err, xlo, xup, plerr, mierr, eparab, gcc; + int iuit; + + for (int lm = 0; lm < nsgpr; lm++) { + gMinuit->mnpout(lm, chnam, parv, err, xlo, xup, iuit); + gMinuit->mnerrs(lm, plerr, mierr, eparab, gcc); + fitres[lm] = fitprm[lm][jk] = parv; + parserr[lm] = err; + } + + fitres[0] *= binwid; + fitres[5] *= binwid; + + double fedm, errdef; + int nparx, istat; + gMinuit->mnstat(fitchisq, fedm, errdef, fitndof, nparx, istat); + + delete gMinuit; + + anormglb = 1; + double tmpnorm = 0; + for (int ix = 0; ix < 600; ix++) { + double xval[2]; + xval[0] = -5 + (ix + 0.5) * .1; + tmpnorm += 0.1 * langaufun(xval, &fitres[3]) / fitres[5]; + } + anormglb = tmpnorm; + + double stp = 30 * fitres[3] * fitres[4] / 1000.; + double str = fitres[4] * (1. - 5. * fitres[3]); + double xx[2]; + double sum1 = 0; + double sum2 = 0; + + for (int lm = 0; lm < 1000; lm++) { + xx[0] = str + (lm + 0.5) * stp; + double landf = langaufun(xx, &fitres[3]); //No need of normalisation + sum1 += landf; + sum2 += xx[0] * landf; + } + + sum2 /= TMath::Max(0.1, sum1); + // signall[izone]->GetXaxis()->SetRangeUser(-0.25, 4.75); + signall[izone]->Draw("hist"); + + sprintf(temp, "pedfun_%i", izone); + pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); + pedfun[izone]->SetParameters(fitres); + pedfun[izone]->SetLineColor(3); + pedfun[izone]->SetLineWidth(1); + pedfun[izone]->Draw("same"); + + sprintf(temp, "signalfun_%i", izone); + + sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr); + sigfun[izone]->SetParameters(&fitres[3]); + sigfun[izone]->SetLineWidth(1); + sigfun[izone]->SetLineColor(4); + sigfun[izone]->Draw("same"); + + cout << "sum2 " << sum2 << " " << sigfun[izone]->Integral(fitres[4] * (1. - 5. * fitres[3]), str + 1000.5 * stp) + << " " << binwid << endl; + + sprintf(temp, "total_%i", izone); + signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); + signalx[izone]->SetParameters(fitres); + signalx[izone]->SetLineWidth(1); + signalx[izone]->Draw("same"); + + latex.DrawLatex( + 0.60, 0.83, Form("#mu: %g#pm%g", int(1000 * fitres[4]) / 1000., int(1000 * parserr[4]) / 1000.)); + latex.DrawLatex(0.60, + 0.765, + Form("#Gamma: %g#pm%g", + int(1000 * fitres[3] * fitres[4]) / 1000., + int(1000 * (sqrt((fitres[3] * parserr[4]) * (fitres[3] * parserr[4]) + + (fitres[4] * parserr[3]) * (fitres[4] * parserr[3])))) / + 1000.)); + latex.DrawLatex( + 0.60, 0.70, Form("#sigma: %g#pm%g", int(1000 * fitres[6]) / 1000., int(1000 * parserr[6]) / 1000.)); + latex.DrawLatex(0.65, 0.64, Form("A: %g#pm%g", int(1 * fitres[5]) / 1., int(10 * parserr[5]) / 10.)); + latex.DrawLatex(0.67, 0.58, Form("Ex: %g#pm%g", int(10 * fitres[7]) / 10., int(10 * parserr[7]) / 10.)); + + latex.DrawLatex(0.67, 0.52, Form("Mean: %g ", int(100 * sum2) / 100.)); + + cout << "histinfo fit " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << " " << std::setw(6) << fitchisq << " " << std::setw(3) + << fitndof << endl; + + file_out << "histinfo fit " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << endl; + + file_out << "fitresx " << ieta << " " << ij + 1 << " " << fitres[0] / binwid << " " << fitres[1] << " " + << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] / binwid << " " << fitres[6] + << " " << signallunb[izone]->GetEntries() / 2. << " " << fitchisq << " " << fitndof << " " << binwid + << " " << sum2 << " " << fitres[7] << endl; + file_out << "parserr " << ieta << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " " << parserr[2] + << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6] << " " + << parserr[7] << endl; + + double diff = fitres[4] - fitres[1]; + if (diff <= 0) + diff = 0.000001; + + int ifl = nphimx * jk + ij; + + fit_chi->Fill(ifl, fitchisq); //signal[izone]->GetChisquare()); + sig_evt->Fill(ifl, signallunb[izone]->GetEntries() / 2.); + fit_sigevt->Fill(ifl, fitres[5] / binwid); + fit_bkgevt->Fill(ifl, fitres[0] / binwid); + + sig_mean->Fill(ifl, fitres[4]); + sig_diff->Fill(ifl, fitres[4] - fitres[1]); + sig_width->Fill(ifl, fitres[3]); + sig_sigma->Fill(ifl, fitres[6]); + sig_expo->Fill(ifl, fitres[7]); + sig_meanerr->Fill(ifl, parserr[4]); + if (fitres[4] - fitres[1] > 1.e-4) + sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1])); + if (fitres[2] > 1.e-4) + sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / fitres[2]); + + sig_statmean->Fill(ifl, signallunb[izone]->GetMean()); + sig_rms->Fill(ifl, signallunb[izone]->GetRMS()); + + fit2d_chi->Fill(ieta, iphi, fitchisq); //signal[izone]->GetChisquare()); + sig2d_evt->Fill(ieta, iphi, signallunb[izone]->GetEntries() / 2.); + fit2d_sigevt->Fill(ieta, iphi, fitres[5] / binwid); + fit2d_bkgevt->Fill(ieta, iphi, fitres[0] / binwid); + + sig2d_mean->Fill(ieta, iphi, fitres[4]); + sig2d_diff->Fill(ieta, iphi, fitres[4] - fitres[1]); + sig2d_width->Fill(ieta, iphi, fitres[3]); + sig2d_sigma->Fill(ieta, iphi, fitres[6]); + sig2d_expo->Fill(ieta, iphi, fitres[7]); + + sig2d_meanerr->Fill(ieta, iphi, parserr[4]); + if (fitres[4] - fitres[1] > 1.e-4) + sig2d_meanerrp->Fill(ieta, iphi, 100 * parserr[4] / (fitres[4] - fitres[1])); + if (fitres[2] > 1.e-4) + sig2d_signf->Fill(ieta, iphi, (fitres[4] - fitres[1]) / fitres[2]); + + sig2d_statmean->Fill(ieta, iphi, signallunb[izone]->GetMean()); + sig2d_rms->Fill(ieta, iphi, signallunb[izone]->GetRMS()); + } else { //if (signallunb[izone]->GetEntries()/2. >10) { + signall[izone]->Draw(); + float varx = 0.000; + + file_out << "histinfo nof " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << endl; + + file_out << "fitresx " << ieta << " " << ij + 1 << " " << varx << " " << varx << " " << varx << " " << varx + << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << " " + << varx << " " << varx << " " << varx << endl; + file_out << "parserr " << ieta << " " << ij + 1 << " " << varx << " " << varx << " " << varx << " " << varx + << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << endl; + } + iiter++; + if (iiter % nsample == 0) { + c0->Update(); + + for (int lm = 0; lm < nsample; lm++) { + if (pedfun[lm]) { + delete pedfun[lm]; + pedfun[lm] = 0; + } + if (sigfun[lm]) { + delete sigfun[lm]; + sigfun[lm] = 0; + } + if (signalx[lm]) { + delete signalx[lm]; + signalx[lm] = 0; + } + if (signall[lm]) { + delete signall[lm]; + signall[lm] = 0; + } + if (signallunb[lm]) { + delete signallunb[lm]; + signallunb[lm] = 0; + } + } + } + } //for (int jk=0; jkUpdate(); + for (int lm = 0; lm < nsample; lm++) { + if (pedfun[lm]) { + delete pedfun[lm]; + pedfun[lm] = 0; + } + if (sigfun[lm]) { + delete sigfun[lm]; + sigfun[lm] = 0; + } + if (signalx[lm]) { + delete signalx[lm]; + signalx[lm] = 0; + } + if (signall[lm]) { + delete signall[lm]; + signall[lm] = 0; + } + if (signallunb[lm]) { + delete signallunb[lm]; + signallunb[lm] = 0; + } + } + } + + if (c0) { + delete c0; + c0 = 0; + } + + xsiz = 600; //int xsiz = 600; + ysiz = 800; //int ysiz = 800; + + ps.NewPage(); + gStyle->SetOptLogy(0); + gStyle->SetTitleFontSize(0.05); + gStyle->SetTitleSize(0.025, "XYZ"); + gStyle->SetLabelSize(0.025, "XYZ"); + gStyle->SetStatFontSize(.045); + + gStyle->SetPadGridX(1); //bool input yes/no, must give an input + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(.07); + gStyle->SetPadLeftMargin(0.07); + + ps.NewPage(); + TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz); + sig_evt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_statmean->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_rms->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_chi->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_sigevt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_bkgevt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_mean->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_width->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_sigma->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_expo->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_meanerr->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_meanerrp->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_signf->Draw("hist"); + c1->Update(); + + gStyle->SetPadLeftMargin(0.06); + gStyle->SetPadRightMargin(0.15); + + ps.NewPage(); + TCanvas* c2y = new TCanvas("c2y", " Pedestal vs Signal", xsiz, ysiz); + + sig2d_evt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_statmean->SetMaximum(min(3.0, sig2d_statmean->GetMaximum())); + sig2d_statmean->SetMinimum(max(-2.0, sig2d_statmean->GetMinimum())); + sig2d_statmean->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_rms->SetMaximum(min(3.0, sig2d_rms->GetMaximum())); + sig2d_rms->SetMinimum(max(0.0, sig2d_rms->GetMinimum())); + sig2d_rms->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + + fit2d_chi->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + fit2d_sigevt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + fit2d_bkgevt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_mean->SetMaximum(min(2.0, sig2d_mean->GetMaximum())); + sig2d_mean->SetMinimum(max(0.1, sig2d_mean->GetMinimum())); + sig2d_mean->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_width->SetMaximum(min(0.5, sig2d_width->GetMaximum())); + sig2d_width->SetMinimum(max(0.01, sig2d_width->GetMinimum())); + sig2d_width->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_sigma->SetMaximum(min(0.5, sig2d_sigma->GetMaximum())); + sig2d_sigma->SetMinimum(max(0.01, sig2d_sigma->GetMinimum())); + sig2d_sigma->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_expo->SetMaximum(min(20., sig2d_expo->GetMaximum())); + sig2d_expo->SetMinimum(max(2.0, sig2d_expo->GetMinimum())); + sig2d_expo->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_meanerr->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_meanerrp->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_signf->Draw("colz"); + c2y->Update(); + + ps.Close(); + + delete c1; + delete c2y; + + file_out.close(); + + fileOut->cd(); + fileOut->Write(); + fileOut->Close(); + + fileIn->cd(); + fileIn->Close(); +} diff --git a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc index 16b01a3e24890..4a31eb7b57993 100644 --- a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc @@ -31,27 +31,20 @@ April 2015 #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.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" #include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "TMath.h" #include "TFile.h" #include "TH1F.h" #include "TH2F.h" #include "TTree.h" #include "TProfile.h" -#include "TPostScript.h" -#include "TCanvas.h" -#include "TF1.h" -#include "TStyle.h" -#include "TMinuit.h" -#include "TMath.h" #include @@ -59,190 +52,48 @@ April 2015 #include #include -// -// Look for nearby pixel through eta, phi informations for pixel cross-talk -// 1. Look PIXEL code from (eta,phi) -// 2. Go to nearby pixel code -// 3. Come back to (eta,phi) from pixel code -// Though it works, it is a very ugly/crude way to get cross talk, need better algorithms -// - -static const int mapx1[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {19, 18, 17}}; - -static const int mapx2[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {-1, -1, -1}}; - -static const int mapx0p[9][2] = {{3, 1}, {7, 4}, {6, 5}, {12, 8}, {0, 0}, {11, 9}, {16, 13}, {15, 14}, {19, 17}}; -static const int mapx0m[9][2] = {{17, 19}, {14, 15}, {13, 16}, {9, 11}, {0, 0}, {8, 12}, {5, 6}, {4, 7}, {1, 3}}; - -static const 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 - -static const 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) - -static const int npixleft[21] = {0, 0, 1, 2, 0, 4, 5, 6, 0, 8, 0, 0, 11, 0, 13, 14, 15, 0, 17, 18, 0}; -static const int npixrigh[21] = {0, 2, 3, 0, 5, 6, 7, 0, 9, 0, 0, 12, 0, 14, 15, 16, 0, 18, 19, 0, 0}; -static const int npixlebt[21] = {0, 0, 0, 0, 0, 1, 2, 3, 0, 4, 0, 6, 7, 8, 9, 0, 11, 13, 14, 15, 0}; -static const int npixribt[21] = {0, 0, 0, 0, 1, 2, 3, 0, 4, 5, 0, 7, 0, 9, 0, 11, 12, 14, 15, 16, 0}; -static const int npixleup[21] = {0, 4, 5, 6, 8, 9, 0, 11, 0, 13, 0, 15, 16, 0, 17, 18, 19, 0, 0, 0, 0}; -static const int npixriup[21] = {0, 5, 6, 7, 9, 0, 11, 12, 13, 14, 0, 16, 0, 17, 18, 19, 0, 0, 0, 0, 0}; - -static const int netamx = 30; -static const int nphimx = 72; -static const int nbgpr = 3; -static const int nsgpr = 7; - -int ietafit; -int iphifit; -std::vector sig_reg[netamx][nphimx + 1]; -std::vector cro_ssg[netamx][nphimx + 1]; +using namespace std; +using namespace edm; -//#define CORREL // // class decleration // -Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } - -Double_t langaufun(Double_t* x, Double_t* par) { - //Fit parameters: - //par[0]*par[1]=Width (scale) parameter of Landau density - //par[1]=Most Probable (MP, location) parameter of Landau density - //par[2]=Total area (integral -inf to inf, normalization constant) - //par[3]=Width (sigma) of convoluted Gaussian function - // - //In the Landau distribution (represented by the CERNLIB approximation), - //the maximum is located at x=-0.22278298 with the location parameter=0. - //This shift is corrected within this function, so that the actual - //maximum is identical to the MP parameter. - // /* - // Numeric constants - Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) - Double_t mpshift = -0.22278298; // Landau maximum location - - // Control constants - Double_t np = 100.0; // number of convolution steps - Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas - - // Variables - Double_t xx; - Double_t mpc; - Double_t fland; - Double_t sum = 0.0; - Double_t xlow, xupp; - Double_t step; - - // MP shift correction - mpc = par[1] - mpshift * par[0] * par[1]; - - // Range of convolution integral - xlow = x[0] - sc * par[3]; - xupp = x[0] + sc * par[3]; - - step = (xupp - xlow) / np; - - // Convolution integral of Landau and Gaussian by sum - for (double ij = 1.0; ij <= np / 2; ij++) { - xx = xlow + (ij - .5) * step; - fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; - sum += fland * TMath::Gaus(x[0], xx, par[3]); - xx = xupp - (ij - .5) * step; - fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; - sum += fland * TMath::Gaus(x[0], xx, par[3]); - } - - return (par[2] * step * sum * invsq2pi / par[3]); -} - -Double_t totalfunc(Double_t* x, Double_t* par) { return gausX(x, par) + langaufun(x, &par[3]); } - -void fcnbg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { - double fval = -par[0]; - 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))); - } - f = -fval; -} - -void fcnsg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { - double xval[2]; - double fval = -(par[0] + par[5]); - for (unsigned ij = 0; ij < sig_reg[ietafit][iphifit].size(); ij++) { - xval[0] = (double)sig_reg[ietafit][iphifit][ij]; - fval += std::log(totalfunc(xval, par)); - } - f = -fval; -} - -void set_mean(double& x, bool mdigi) { - if (mdigi) { - x = std::min(x, 0.5); - x = std::max(x, -0.5); - } else { - x = std::min(x, 0.1); - x = std::max(x, -0.1); - } -} - -void set_sigma(double& x, bool mdigi) { - if (mdigi) { - x = std::min(x, 1.2); - x = std::max(x, -1.2); - } else { - x = std::min(x, 0.24); - x = std::max(x, 0.03); - } -} - class HOCalibAnalyzer : public edm::one::EDAnalyzer { public: explicit HOCalibAnalyzer(const edm::ParameterSet&); ~HOCalibAnalyzer() override; private: - void beginJob() override; + void beginJob() override {} void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; + void endJob() override {} int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } - TFile* theFile; - std::string theRootFileName; - std::string theoutputtxtFile; - std::string theoutputpsFile; - - bool m_allHOsignal; - bool m_hotime; - bool m_hbtime; - bool m_correl; - bool m_checkmap; - bool m_hbinfo; - bool m_combined; - bool m_constant; - bool m_figure; - bool m_cosmic; - bool m_histfit; - bool m_pedsuppr; - double m_sigma; + int mypow_2[31]; + static const int netamx = 30; + static const int nphimx = 72; + static const int ringmx = 5; + static const int ncut = 14; - static const int ncut = 13; - static const int mypow_2_ncut = 8192; // 2^13, should be changed to match ncut + const char* varcrit[3] = {"All", "steps", "n-1"}; // or opposite + + const double elosfact = (14.9 + 0.96 * fabs(log(8 * 2.8)) + 0.033 * 8 * (1.0 - pow(8, -0.33))); + + bool m_cosmic; + bool m_zeroField; + int m_bins; + double m_low; + double m_ahigh; + bool m_histFill; //Stored signals of individual HO towers with default selection criteria + bool m_treeFill; //Store rootuple without almost any selection criteria except a quality on muon int ipass; TTree* T1; - TH2F* ho_entry; - TH2F* ho_energy; - TH2F* ho_energy2; - TH2F* ho_rms; TH1F* ho_indenergy[netamx][nphimx]; TH1F* muonnm; @@ -257,138 +108,12 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { TH1F* sel_muonph; TH1F* sel_muonch; - TProfile* hotime[netamx][nphimx]; - TProfile* hopedtime[netamx][nphimx]; - TProfile* hbtime[netamx][nphimx]; - - TH1F* corrsglb[netamx][nphimx]; - TH1F* corrsgrb[netamx][nphimx]; - TH1F* corrsglu[netamx][nphimx]; - TH1F* corrsgru[netamx][nphimx]; - TH1F* corrsgall[netamx][nphimx]; - - TH1F* corrsgl[netamx][nphimx]; - TH1F* corrsgr[netamx][nphimx]; - - TH1F* mncorrsglb; - TH1F* mncorrsgrb; - TH1F* mncorrsglu; - TH1F* mncorrsgru; - TH1F* mncorrsgall; - - TH1F* mncorrsgl; - TH1F* mncorrsgr; - - TH1F* rmscorrsglb; - TH1F* rmscorrsgrb; - TH1F* rmscorrsglu; - TH1F* rmscorrsgru; - TH1F* rmscorrsgall; - - TH1F* rmscorrsgl; - TH1F* rmscorrsgr; - - TH1F* nevcorrsglb; - TH1F* nevcorrsgrb; - TH1F* nevcorrsglu; - TH1F* nevcorrsgru; - TH1F* nevcorrsgall; - - TH1F* nevcorrsgl; - TH1F* nevcorrsgr; - - TH1F* corrsgc[netamx][nphimx]; - TH1F* mncorrsgc; - TH1F* rmscorrsgc; - TH1F* nevcorrsgc; - - TH1F* sigrsg[netamx][nphimx + 1]; - TH1F* crossg[netamx][nphimx + 1]; - float invang[netamx][nphimx + 1]; - - TH1F* mnsigrsg; - TH1F* mncrossg; - - TH1F* rmssigrsg; - TH1F* rmscrossg; - - TH1F* nevsigrsg; - TH1F* nevcrossg; - - TH1F* ho_sig2p[9]; - TH1F* ho_sig1p[9]; - TH1F* ho_sig00[9]; - TH1F* ho_sig1m[9]; - TH1F* ho_sig2m[9]; - - TH1F* hbhe_sig[9]; - - static const int ringmx = 5; - static const int sectmx = 12; - static const int routmx = 36; - static const int rout12mx = 24; - static const int neffip = 6; - - TProfile* com_hotime[ringmx][sectmx]; - TProfile* com_hopedtime[ringmx][sectmx]; - - TProfile* com_hbtime[ringmx][sectmx]; - - TH1F* com_corrsglb[ringmx][sectmx]; - TH1F* com_corrsgrb[ringmx][sectmx]; - TH1F* com_corrsglu[ringmx][sectmx]; - TH1F* com_corrsgru[ringmx][sectmx]; - TH1F* com_corrsgall[ringmx][sectmx]; - - TH1F* com_corrsgl[ringmx][sectmx]; - TH1F* com_corrsgr[ringmx][sectmx]; - - TH1F* com_corrsgc[ringmx][sectmx]; - - TH1F* com_sigrsg[ringmx][routmx + 1]; - TH1F* com_crossg[ringmx][routmx + 1]; - float com_invang[ringmx][routmx + 1]; - - TH1F* ped_evt; - TH1F* ped_mean; - TH1F* ped_width; - TH1F* fit_chi; - TH1F* sig_evt; - TH1F* fit_sigevt; - TH1F* fit_bkgevt; - TH1F* sig_mean; - TH1F* sig_diff; - TH1F* sig_width; - TH1F* sig_sigma; - TH1F* sig_meanerr; - TH1F* sig_meanerrp; - TH1F* sig_signf; + // TProfile* sigvsevt[15][ncut]; + TH2F* sig_eta_evt[3 * netamx][ncut]; //For individual eta + TH2F* sigvsevt[3 * netamx][ncut]; + TH1F* variab[3 * netamx][ncut]; - TH1F* ped_statmean; - TH1F* sig_statmean; - TH1F* ped_rms; - TH1F* sig_rms; - - TH2F* const_eta_phi; - - TH1F* const_eta[netamx]; - TH1F* stat_eta[netamx]; - TH1F* statmn_eta[netamx]; - TH1F* peak_eta[netamx]; - - TH1F* const_hpdrm[ringmx]; - TH1F* peak_hpdrm[ringmx]; - - TH1F* mean_eta_ave; - TH1F* mean_phi_ave; - TH1F* mean_phi_hst; - - TH2F* sig_effi[neffip]; - TH2F* mean_energy; - - double fitprm[nsgpr][netamx]; - - TProfile* sigvsevt[15][ncut]; + TH2F* mu_projection[ncut + 1]; unsigned ievt, hoflag; int irun, ilumi, nprim, isect, isect2, ndof, nmuon; @@ -396,13 +121,11 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { float inslumi, trkdr, trkdz, trkvx, trkvy, trkvz, trkmm, trkth, trkph, chisq, therr, pherr, hodx, hody, hoang, htime, hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3]; float momatho, tkpt03, ecal03, hcal03; + float tmphoang; + + int nevents[10]; - int Nevents; - int nbn; - float alow; - float ahigh; - float binwid; - int irunold; + float ncount[ringmx][ncut + 10]; edm::InputTag hoCalibVariableCollectionTag; edm::EDGetTokenT tok_ho_; @@ -410,12 +133,6 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { // ----------member data --------------------------- }; -const int HOCalibAnalyzer::ringmx; -const int HOCalibAnalyzer::sectmx; -const int HOCalibAnalyzer::routmx; -const int HOCalibAnalyzer::rout12mx; -const int HOCalibAnalyzer::neffip; - // // constants, enums and typedefs // @@ -431,37 +148,30 @@ const int HOCalibAnalyzer::neffip; 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 ipass = 0; - Nevents = 0; - - theRootFileName = iConfig.getUntrackedParameter("RootFileName", "test.root"); - theoutputtxtFile = iConfig.getUntrackedParameter("txtFileName", "test.txt"); - theoutputpsFile = iConfig.getUntrackedParameter("psFileName", "test.ps"); - - m_allHOsignal = iConfig.getUntrackedParameter("allsignal", false); - m_hbinfo = iConfig.getUntrackedParameter("hbinfo", false); - m_hbtime = iConfig.getUntrackedParameter("hbtime", false); - m_hotime = iConfig.getUntrackedParameter("hotime", false); - m_correl = iConfig.getUntrackedParameter("correl", false); - m_checkmap = iConfig.getUntrackedParameter("checkmap", false); - m_combined = iConfig.getUntrackedParameter("combined", false); - m_constant = iConfig.getUntrackedParameter("get_constant", false); - m_figure = iConfig.getUntrackedParameter("get_figure", true); - m_histfit = iConfig.getUntrackedParameter("histFit", true); - m_pedsuppr = iConfig.getUntrackedParameter("pedSuppr", true); + for (int ij = 0; ij < 10; ij++) { + nevents[ij] = 0; + } + m_cosmic = iConfig.getUntrackedParameter("cosmic", true); - m_sigma = iConfig.getUntrackedParameter("sigma", 0.05); + m_zeroField = iConfig.getUntrackedParameter("zeroField", false); - edm::Service fs; + m_bins = iConfig.getUntrackedParameter("HOSignalBins", 120); + m_low = iConfig.getUntrackedParameter("lowerRange", -1.0); + m_ahigh = iConfig.getUntrackedParameter("upperRange", 29.0); - theFile = new TFile(theRootFileName.c_str(), "RECREATE"); - theFile->cd(); + m_histFill = iConfig.getUntrackedParameter("histFill", true); + m_treeFill = iConfig.getUntrackedParameter("treeFill", false); + + edm::Service fs; - T1 = fs->make("T1", "DT+CSC+HO"); + T1 = fs->make("T1", "HOSignal"); T1->Branch("irun", &irun, "irun/I"); T1->Branch("ievt", &ievt, "ievt/i"); @@ -505,38 +215,16 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { T1->Branch("hocorsig", hocorsig, "hocorsig[18]/F"); T1->Branch("caloen", caloen, "caloen[3]/F"); - if (m_hbinfo) { - T1->Branch("hbhesig", hbhesig, "hbhesig[9]/F"); - } - char name[200]; char title[200]; - if (m_allHOsignal) { - ho_entry = fs->make( - "ho_entry", "ho entry", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - - ho_energy = fs->make( - "ho_energy", "ho energy (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - - ho_energy2 = fs->make("ho_energy2", - "ho energy2 (GeV*GeV)", - netamx + 1, - -netamx / 2 - 0.5, - netamx / 2 + 0.5, - nphimx, - 0.5, - nphimx + 0.5); - - ho_rms = fs->make( - "ho_rms", "ho rms (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - + if (m_histFill) { for (int ij = 0; ij < netamx; ij++) { int ieta = getHOieta(ij); for (int jk = 0; jk < nphimx; jk++) { sprintf(name, "ho_indenergy_%i_%i", ij, jk); sprintf(title, "ho IndEnergy (GeV) i#eta=%i i#phi=%i", ieta, jk + 1); - ho_indenergy[ij][jk] = fs->make(name, title, 120, -5., 55.); + ho_indenergy[ij][jk] = fs->make(name, title, 1200, m_low, m_ahigh); } } } @@ -553,359 +241,75 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { sel_muonph = fs->make("sel_muonph", "{Phi}_{mu}(sel)", 180, -180., 180.); sel_muonch = fs->make("sel_muonch", "{chi^2}/ndf(sel)", 100, 0., 1000.); - int nbin = 50; //40;// 45; //50; //55; //60; //55; //45; //40; //50; - alow = -2.0; // -1.85; //-1.90; // -1.95; // -2.0; - ahigh = 8.0; // 8.15; // 8.10; // 8.05; // 8.0; - - float tmpwid = (ahigh - alow) / nbin; - nbn = int(-alow / tmpwid) + 1; - if (nbn < 0) - nbn = 0; - if (nbn > nbin) - nbn = nbin; - - edm::LogVerbatim("HOCalib") << "nbin " << nbin << " " << alow << " " << ahigh << " " << tmpwid << " " << nbn; - - for (int ij = 0; ij < 15; ij++) { - sprintf(title, "sigvsndof_ring%i", ij + 1); - sigvsevt[ij][0] = fs->make(title, title, 50, 0., 50., -9., 20.); - - sprintf(title, "sigvschisq_ring%i", ij + 1); - sigvsevt[ij][1] = fs->make(title, title, 50, 0., 30., -9., 20.); - - sprintf(title, "sigvsth_ring%i", ij + 1); - sigvsevt[ij][2] = fs->make(title, title, 50, .7, 2.4, -9., 20.); - - sprintf(title, "sigvsph_ring%i", ij + 1); - sigvsevt[ij][3] = fs->make(title, title, 50, -2.4, -0.7, -9., 20.); - - sprintf(title, "sigvstherr_ring%i", ij + 1); - sigvsevt[ij][4] = fs->make(title, title, 50, 0., 0.2, -9., 20.); - - sprintf(title, "sigvspherr_ring%i", ij + 1); - sigvsevt[ij][5] = fs->make(title, title, 50, 0., 0.2, -9., 20.); - - sprintf(title, "sigvsdircos_ring%i", ij + 1); - sigvsevt[ij][6] = fs->make(title, title, 50, 0.5, 1., -9., 20.); - - sprintf(title, "sigvstrkmm_ring%i", ij + 1); - sigvsevt[ij][7] = fs->make(title, title, 50, 0., 50., -9., 20.); - - sprintf(title, "sigvsnmuon_ring%i", ij + 1); - sigvsevt[ij][8] = fs->make(title, title, 5, 0.5, 5.5, -9., 20.); - - sprintf(title, "sigvserr_ring%i", ij + 1); - sigvsevt[ij][9] = fs->make(title, title, 50, 0., .3, -9., 20.); - - sprintf(title, "sigvsaccx_ring%i", ij + 1); - sigvsevt[ij][10] = fs->make(title, title, 100, -25., 25., -9., 20.); - - sprintf(title, "sigvsaccy_ring%i", ij + 1); - sigvsevt[ij][11] = fs->make(title, title, 100, -25., 25., -9., 20.); - - sprintf(title, "sigvscalo_ring%i", ij + 1); - sigvsevt[ij][12] = fs->make(title, title, 100, 0., 15., -9., 20.); - } + float pival = acos(-1.); - for (int jk = 0; jk < netamx; jk++) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - for (int ij = 0; ij < nphimx + 1; ij++) { - if (ij == nphimx) { - sprintf(title, "sig_eta%i_allphi", ieta); - } else { - sprintf(title, "sig_eta%i_phi%i", ieta, ij + 1); - } - sigrsg[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - if (ij == nphimx) { - sprintf(title, "ped_eta%i_allphi", ieta); - } else { - sprintf(title, "ped_eta%i_phi%i", ieta, ij + 1); + //if change order, change in iselect_wotime also and other efficiency numbers + const char* varnam[ncut] = {"ndof", + "chisq", + "th", + "ph", + "therr", + "pherr", + "dircos", + "trkmm", + "nmuon", + "calo", + "trkiso", + "#phi-dir", + "#eta-dir", + "time"}; + int nbinxx[ncut] = {25, 60, 60, 60, 60, 60, 60, 120, 6, 60, 60, 120, 120, 60}; + double alowxx[ncut] = {5.5, 0., 0., -pival, 0.0, 0.0, 0.0, 0., 0.5, 0.0, 0.0, -20., -32., -45.0}; + double ahghxx[ncut] = {30.5, 40., pival, pival, 0.8, 0.02, 0.5, 300., 6.5, 10.0, 24.0, 20.0, 32.0, 45.0}; + + for (int kl = 0; kl < ncut; kl++) { + for (int jk = 0; jk < 3; jk++) { + for (int ij = 0; ij < netamx; ij++) { + sprintf(name, "sigeta_%i_%i_%i", kl, jk, ij); + sprintf(title, "sigeta %s %s i#eta=%i", varnam[kl], varcrit[jk], getHOieta(ij)); + sig_eta_evt[netamx * jk + ij][kl] = + fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl], m_bins, m_low, m_ahigh); } - crossg[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } - - for (int ij = 0; ij < nphimx; ij++) { - 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 - 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 - - 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); - - sprintf(title, "corrsg_eta%i_phi%i_rightbottom", ieta, ij + 1); - corrsgrb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_leftup", ieta, ij + 1); - corrsglu[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_rightup", ieta, ij + 1); - corrsgru[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_all", ieta, ij + 1); - corrsgall[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_left", ieta, ij + 1); - corrsgl[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_right", ieta, ij + 1); - corrsgr[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //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 } } - mnsigrsg = fs->make( - "mnsigrsg", "mnsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - rmssigrsg = fs->make( - "rmssigrsg", "rmssigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - nevsigrsg = fs->make( - "nevsigrsg", "nevsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - - mncrossg = fs->make( - "mncrossg", "mncrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - rmscrossg = fs->make( - "rmscrossg", "rmscrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - nevcrossg = fs->make( - "nevcrossg", "nevcrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - - for (int ij = 0; ij < neffip; ij++) { - if (ij == 0) { - sprintf(title, "Total projected muon in tower"); - sprintf(name, "total_evt"); - } else { - sprintf(title, "Efficiency with sig >%i #sigma", ij); - sprintf(name, "Effi_with_gt%i_sig", ij); + for (int kl = 0; kl < ncut; kl++) { + for (int ij = 0; ij < ringmx * 3; ij++) { + int iring = ij % ringmx - 2; + int iset = ij / ringmx; + sprintf(name, "sigring_%i_%i", kl, ij); + sprintf(title, "Signal %s %s Ring%i", varnam[kl], varcrit[iset], iring); + sigvsevt[ij][kl] = fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl], m_bins, m_low, m_ahigh); } - sig_effi[ij] = - fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); } - sprintf(title, "Mean Energy of all towers"); - 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) { // 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); - - mncorrsgrb = fs->make("mncorrsgrb", "mncorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgrb = fs->make("rmscorrsgrb", "rmscorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgrb = fs->make("nevcorrsgrb", "nevcorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsglu = fs->make("mncorrsglu", "mncorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsglu = fs->make("rmscorrsglu", "rmscorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsglu = fs->make("nevcorrsglu", "nevcorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgru = fs->make("mncorrsgru", "mncorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgru = fs->make("rmscorrsgru", "rmscorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgru = fs->make("nevcorrsgru", "nevcorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgall = fs->make("mncorrsgall", "mncorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgall = fs->make("rmscorrsgall", "rmscorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgall = fs->make("nevcorrsgall", "nevcorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgl = fs->make("mncorrsgl", "mncorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgl = fs->make("rmscorrsgl", "rmscorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgl = fs->make("nevcorrsgl", "nevcorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - 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 - - 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 - - if (m_combined) { // COMBINED - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx + 1; ij++) { - if (jk != 2 && ij > rout12mx) - continue; - int phmn = 3 * ij - 1; - int phmx = 3 * ij + 1; - if (jk == 2) { - phmn = 2 * ij - 1; - phmx = 2 * ij; - } - if (phmn <= 0) - phmn = nphimx + phmn; - if (phmx <= 0) - phmx = nphimx + phmx; - - if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) { - sprintf(title, "sig_ring%i_allrm", jk - 2); - sprintf(name, "sig_ring%i_allrm", jk - 2); - } else { - sprintf(title, "sig_ring%i_phi%i-%i", jk - 2, phmn, phmx); - sprintf(name, "sig_ring%i_rout%i", jk - 2, ij + 1); - } - com_sigrsg[jk][ij] = fs->make(name, title, nbin, alow, ahigh); - if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) { - sprintf(title, "ped_ring%i_allrm", jk - 2); - sprintf(name, "ped_ring%i_allrm", jk - 2); - } else { - sprintf(title, "ped_ring%i_phi%i-%i", jk - 2, phmn, phmx); - sprintf(name, "ped_ring%i_rout%i", jk - 2, ij + 1); - } - com_crossg[jk][ij] = fs->make(name, title, nbin, alow, ahigh); - } - - for (int ij = 0; ij < sectmx; ij++) { - 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 - 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 - - 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); - - sprintf(title, "com_corrsg_ring%i_sect%i_rightbottom", jk - 2, ij + 1); - com_corrsgrb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_leftup", jk - 2, ij + 1); - com_corrsglu[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_rightup", jk - 2, ij + 1); - com_corrsgru[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_all", jk - 2, ij + 1); - com_corrsgall[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_left", jk - 2, ij + 1); - com_corrsgl[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - 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 - - 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 - } - } - } //m_combined - - for (int ij = -1; ij <= 1; ij++) { - for (int jk = -1; jk <= 1; jk++) { - int kl = 3 * (ij + 1) + jk + 1; - - sprintf(title, "hosct2p_eta%i_phi%i", ij, jk); - ho_sig2p[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct1p_eta%i_phi%i", ij, jk); - ho_sig1p[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct00_eta%i_phi%i", ij, jk); - ho_sig00[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct1m_eta%i_phi%i", ij, jk); - ho_sig1m[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct2m_eta%i_phi%i", ij, jk); - ho_sig2m[kl] = fs->make(title, title, nbin, alow, ahigh); - - 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 + for (int kl = 0; kl < ncut; kl++) { + for (int ij = 0; ij < ringmx * 3; ij++) { + int iring = ij % ringmx - 2; + int iset = ij / ringmx; + sprintf(name, "varring_%i_%i", kl, ij); + sprintf(title, "%s %s Ring%i", varnam[kl], varcrit[iset], iring); + variab[ij][kl] = fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl]); } } - if (m_constant) { - ped_evt = fs->make("ped_evt", "ped_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_mean = fs->make("ped_mean", "ped_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_width = fs->make("ped_width", "ped_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - fit_chi = fs->make("fit_chi", "fit_chi", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_evt = fs->make("sig_evt", "sig_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - fit_sigevt = fs->make("fit_sigevt", "fit_sigevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - fit_bkgevt = fs->make("fit_bkgevt", "fit_bkgevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_mean = fs->make("sig_mean", "sig_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_diff = fs->make("sig_diff", "sig_diff", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_width = fs->make("sig_width", "sig_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_sigma = fs->make("sig_sigma", "sig_sigma", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_meanerr = fs->make("sig_meanerr", "sig_meanerr", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_meanerrp = fs->make("sig_meanerrp", "sig_meanerrp", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_signf = fs->make("sig_signf", "sig_signf", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - ped_statmean = fs->make("ped_statmean", "ped_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_statmean = fs->make("sig_statmean", "sig_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_rms = fs->make("ped_rms", "ped_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_rms = fs->make("sig_rms", "sig_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - const_eta_phi = fs->make( - "const_eta_phi", "const_eta_phi", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2., nphimx, 0.5, nphimx + 0.5); - - for (int ij = 0; ij < netamx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - sprintf(title, "Cont_Eta_%i", ieta); - const_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - - sprintf(title, "Peak_Eta_%i", ieta); - peak_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - } - - for (int ij = 0; ij < ringmx; ij++) { - int iring = ij - 2; - int iread = (ij == 2) ? routmx : rout12mx; - sprintf(title, "Cont_hpdrm_%i", iring); - const_hpdrm[ij] = fs->make(title, title, iread, 0.5, iread + 0.5); - - sprintf(title, "Peak_hpdrm_%i", iring); - peak_hpdrm[ij] = fs->make(title, title, iread, 0.5, iread + 0.5); + for (int ij = 0; ij <= ncut; ij++) { + sprintf(name, "mu_projection_%i", ij); + if (ij == 0) { + sprintf(title, "All projected muon"); + } else { + sprintf(title, "Projected muon with selection %s", varnam[ij - 1]); } - - mean_phi_hst = fs->make("mean_phi_hst", "mean_phi_hst", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.); - mean_phi_ave = fs->make("mean_phi_ave", "mean_phi_ave", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.); - - mean_eta_ave = fs->make("mean_eta_ave", "mean_eta_ave", nphimx, 0.5, nphimx + 0.5); - - } // m_constant - - for (int ij = 0; ij < netamx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - - sprintf(title, "Stat_Eta_%i", ieta); - stat_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - - sprintf(title, "#mu(stat)_Eta_%i", ieta); - statmn_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); + mu_projection[ij] = + fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); } - for (int jk = 0; jk < netamx; jk++) { - for (int ij = 0; ij < nphimx; ij++) { - invang[jk][ij] = 0.0; - } + for (int ij = 0; ij < 31; ij++) { + mypow_2[ij] = pow(2, ij); } - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx + 1; ij++) { - com_invang[jk][ij] = 0.0; + for (int ij = 0; ij < ringmx; ij++) { + for (int jk = 0; jk < ncut + 10; jk++) { + ncount[ij][jk] = 0.0; } } } @@ -914,10 +318,9 @@ HOCalibAnalyzer::~HOCalibAnalyzer() { // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) - theFile->cd(); - theFile->Write(); - theFile->Close(); - edm::LogVerbatim("HOCalib") << " Ttoal events = " << Nevents << " Selected events # is " << ipass; + edm::LogVerbatim("HOCalib") << " Total events = " << setw(7) << nevents[0] << " " << setw(7) << nevents[1] << " " + << setw(7) << nevents[2] << " " << setw(7) << nevents[3] << " " << setw(7) << nevents[4] + << " " << setw(7) << nevents[5] << " Selected events # is " << ipass; } // @@ -926,66 +329,31 @@ HOCalibAnalyzer::~HOCalibAnalyzer() { // ------------ method called to for each event ------------ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // calcualte these once (and avoid the pow(int,int) ambiguities for c++) - int mypow_2_0 = 1; // 2^0 - int mypow_2_1 = 2; // 2^1 - int mypow_2_2 = 4; // 2^2 - - int mypow_2_3 = 8; // 2^3 - int mypow_2_4 = 16; // 2^4 - int mypow_2_5 = 32; // 2^5 - int mypow_2_6 = 64; // 2^6 - int mypow_2_7 = 128; // 2^7 - int mypow_2_8 = 256; // 2^8 - int mypow_2_9 = 512; // 2^9 - int mypow_2_10 = 1024; // 2^10 - int mypow_2_11 = 2048; // 2^11 - int mypow_2_12 = 4096; // 2^12 - - int iaxxx = 0; - int ibxxx = 0; - - Nevents++; + nevents[0]++; + + using namespace edm; float pival = acos(-1.); - irunold = irun = iEvent.id().run(); + ievt = iEvent.id().event(); ilumi = iEvent.luminosityBlock(); - if (m_allHOsignal) { - edm::Handle hoht; - iEvent.getByToken(tok_allho_, hoht); - if (hoht.isValid() && !(*hoht).empty()) { - ho_entry->Fill(-1., -1.); //Count of total number of entries - for (HORecHitCollection::const_iterator ij = (*hoht).begin(); ij != (*hoht).end(); ij++) { - HcalDetId id = (*ij).id(); - int tmpeta = id.ieta(); - int tmpphi = id.iphi(); - float signal = (*ij).energy(); - ho_entry->Fill(tmpeta, tmpphi); - ho_energy->Fill(tmpeta, tmpphi, signal); - ho_energy2->Fill(tmpeta, tmpphi, signal * signal); - - int inveta = invert_HOieta(tmpeta); - ho_indenergy[inveta][tmpphi - 1]->Fill(signal); - } - } - } - edm::Handle HOCalib; - bool isCosMu = true; - try { - iEvent.getByToken(tok_ho_, HOCalib); - } catch (cms::Exception& iEvent) { - isCosMu = false; + iEvent.getByToken(tok_ho_, HOCalib); + + if (nevents[0] % 20000 == 1) { + edm::LogVerbatim("HOCalib") << "nmuon event # " << setw(7) << nevents[0] << " " << setw(7) << nevents[1] << " " + << setw(7) << nevents[2] << " " << setw(7) << nevents[3] << " " << setw(7) << nevents[4] + << " " << setw(7) << nevents[5]; + edm::LogVerbatim("HOCalib") << " Run # " << iEvent.id().run() << " Evt # " << iEvent.id().event() << " " + << int(HOCalib.isValid()) << " " << ipass; } - if (Nevents % 5000 == 1) - edm::LogVerbatim("HOCalib") << "nmuon event # " << Nevents << " Run # " << iEvent.id().run() << " Evt # " - << iEvent.id().event() << " " << ipass; - if (isCosMu && !(*HOCalib).empty()) { + if (HOCalib.isValid()) { + nevents[1]++; nmuon = (*HOCalib).size(); + for (HOCalibVariableCollection::const_iterator hoC = (*HOCalib).begin(); hoC != (*HOCalib).end(); hoC++) { trkdr = (*hoC).trkdr; trkdz = (*hoC).trkdz; @@ -1019,27 +387,28 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i hodx = (*hoC).hodx; hody = (*hoC).hody; hoang = (*hoC).hoang; + + tmphoang = sin(trkth) - hoang; + htime = (*hoC).htime; hoflag = (*hoC).hoflag; for (int ij = 0; ij < 9; ij++) { hosig[ij] = (*hoC).hosig[ij]; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HOCalib") << "hosig " << i << " " << hosig[ij]; +#endif } for (int ij = 0; ij < 18; ij++) { hocorsig[ij] = (*hoC).hocorsig[ij]; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HOCalib") << "hocorsig " << i << " " << hocorsig[ij]; +#endif } hocro = (*hoC).hocro; for (int ij = 0; ij < 3; ij++) { caloen[ij] = (*hoC).caloen[ij]; } - if (m_hbinfo) { - for (int ij = 0; ij < 9; ij++) { - hbhesig[ij] = (*hoC).hbhesig[ij]; - } - } - - T1->Fill(); - int ipsall = 0; int ips0 = 0; int ips1 = 0; @@ -1054,15 +423,23 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i int ips10 = 0; int ips11 = 0; int ips12 = 0; + int ips13 = 0; + + nevents[2]++; + bool isZSps = (hosig[4] < -99.0) ? false : true; + + if ((!m_cosmic) && fabs(trkmm) < momatho) + continue; - if (isect < 0) - continue; //FIXGM Is it proper place ? + nevents[3]++; if (fabs(trkth - pival / 2) < 0.000001) continue; //22OCT07 + nevents[4]++; int ieta = int((abs(isect) % 10000) / 100.) - 50; //an offset to acodate -ve eta values if (abs(ieta) >= 16) continue; + nevents[5]++; int iphi = abs(isect) % 100; int tmpsect = int((iphi + 1) / 6.) + 1; @@ -1070,227 +447,475 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpsect = 1; int iring = 0; - int tmpeta = ieta + 4; //For pixel mapping - if (ieta >= -15 && ieta <= -11) { - iring = -2; - tmpeta = -11 - ieta; - } //abs(ieta)-11;} - if (ieta >= -10 && ieta <= -5) { - iring = -1; - tmpeta = -5 - ieta; - } // abs(ieta)-5;} - if (ieta >= 5 && ieta <= 10) { - iring = 1; - tmpeta = ieta - 5; - } - if (ieta >= 11 && ieta <= 15) { - iring = 2; - tmpeta = ieta - 11; - } int iring2 = iring + 2; - int tmprout = (iring == 0) ? int((iphi + 1) / 2.) + 1 : int((iphi + 1) / 3.) + 1; - int tmproutmx = (iring == 0) ? routmx : rout12mx; - if (tmprout > tmproutmx) - tmprout = 1; + double abshoang = (m_cosmic) ? fabs(hoang) : hoang; + + double elos = 1.0 / TMath::Max(0.1, abs(1.0 * hoang)); + + if (!m_zeroField) + elos *= ((14.9 + 0.96 * fabs(log(momatho * 2.8)) + 0.033 * momatho * (1.0 - pow(momatho, -0.33))) / elosfact); - // CRUZET1 if (m_cosmic) { - /* GMA temoparily change to increase event size at 3 & 9 O'clock position */ - if (abs(ndof) >= 20 && abs(ndof) < 40) { - ips0 = (int)mypow_2_0; + if (abs(ndof) >= 20 && abs(ndof) < 55) { + ips0 = mypow_2[0]; ipsall += ips0; } - if (chisq > 0 && chisq < 15) { - ips1 = (int)mypow_2_1; + if (chisq > 0 && chisq < 12) { + ips1 = mypow_2[1]; ipsall += ips1; } //18Jan2008 - if (fabs(trkth - pival / 2) < 21.5) { - ips2 = (int)mypow_2_2; + + if (trkth > 0.3 && trkth < pival - 0.3) { + ips2 = mypow_2[2]; ipsall += ips2; } //No nead for pp evt - if (fabs(trkph + pival / 2) < 21.5) { - ips3 = (int)mypow_2_3; + if (trkph > -pival + 0.1 && trkph < -0.1) { + ips3 = mypow_2[3]; ipsall += ips3; } //No nead for pp evt if (therr < 0.02) { - ips4 = (int)mypow_2_4; + ips4 = mypow_2[4]; ipsall += ips4; } if (pherr < 0.0002) { - ips5 = (int)mypow_2_5; + ips5 = mypow_2[5]; ipsall += ips5; } - if (fabs(hoang) > 0.30) { - ips6 = (int)mypow_2_6; + if (abshoang > 0.60 && abshoang < 1.0) { + ips6 = mypow_2[6]; ipsall += ips6; } - if (fabs(trkmm) > 0.100) { - ips7 = (int)mypow_2_7; + + if (m_zeroField || (fabs(momatho) > 5.0 && fabs(momatho) < 2000.0)) { + ips7 = mypow_2[7]; ipsall += ips7; } - if (nmuon >= 1 && nmuon <= 4) { - ips8 = (int)mypow_2_8; + + if (nmuon >= 1 && nmuon <= 3) { + ips8 = mypow_2[8]; ipsall += ips8; } + // if (hodx>0 && hody>0) { } + ips9 = mypow_2[9]; + ipsall += ips9; + + ips10 = mypow_2[10]; + ipsall += ips10; + if (iring2 == 2) { if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } else { if (fabs(hodx) < 100 && fabs(hodx) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } - if (caloen[0] == 0) { - ips12 = (int)mypow_2_12; - ipsall += ips12; + + if (m_zeroField) { + if (iring2 == 0) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 1) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 2) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 3) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 4) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + } else { + if (htime > -100 && htime < 100) { + ips13 = mypow_2[13]; + ipsall += ips13; + } } } else { - //csa08 - if (abs(ndof) >= 20 && abs(ndof) < 40) { - ips0 = (int)mypow_2_0; + if (abs(ndof) >= 10 && abs(ndof) < 25) { + ips0 = mypow_2[0]; ipsall += ips0; } - if (chisq > 0 && chisq < 15) { - ips1 = (int)mypow_2_1; + if (chisq > 0 && chisq < 10) { + ips1 = mypow_2[1]; ipsall += ips1; } //18Jan2008 + if (fabs(trkth - pival / 2) < 21.5) { - ips2 = (int)mypow_2_2; + ips2 = mypow_2[2]; ipsall += ips2; } //No nead for pp evt if (fabs(trkph + pival / 2) < 21.5) { - ips3 = (int)mypow_2_3; + ips3 = mypow_2[3]; ipsall += ips3; } //No nead for pp evt - if (therr < 0.02) { - ips4 = (int)mypow_2_4; + if (therr < 0.00002) { + ips4 = mypow_2[4]; ipsall += ips4; } - if (pherr < 0.0002) { - ips5 = (int)mypow_2_5; + if (pherr < 0.000002) { + ips5 = mypow_2[5]; ipsall += ips5; } - if (fabs(hoang) > 0.30) { - ips6 = (int)mypow_2_6; + // if (abshoang >0.40 && abshoang <1.0) {ips6 = mypow_2[6]; ipsall +=ips6;} + if (tmphoang < 0.065) { + ips6 = mypow_2[6]; ipsall += ips6; } - if (fabs(trkmm) > 4.0) { - ips7 = (int)mypow_2_7; - ipsall += ips7; + + if (fabs(momatho) < 250.0 && fabs(momatho) > 15.0) { + if (iring2 == 2) { + ips7 = mypow_2[7]; + ipsall += ips7; + } + if ((iring2 == 1 || iring2 == 3) && fabs(momatho) > 17.0) { + ips7 = mypow_2[7]; + ipsall += ips7; + } + if ((iring2 == 0 || iring2 == 4) && fabs(momatho) > 20.0) { + ips7 = mypow_2[7]; + ipsall += ips7; + } } - if (nmuon >= 1 && nmuon <= 2) { - ips8 = (int)mypow_2_8; + + if (nmuon >= 1 && nmuon <= 3) { + ips8 = mypow_2[8]; ipsall += ips8; } + if (ndof > 0 && caloen[0] < 15.0) { + ips9 = mypow_2[9]; + ipsall += ips9; + } //5.0 + if (tkpt03 < 5.0) { + ips10 = mypow_2[10]; + ipsall += ips10; + } //4.0 + if (iring2 == 2) { if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } else { if (fabs(hodx) < 100 && fabs(hodx) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; + } + } + + if (iring2 == 0) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; } } - if (ndof > 0 && caloen[0] < 5.0) { - ips12 = (int)mypow_2_12; - ipsall += ips12; + if (iring2 == 1) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 2) { + if (htime > -30 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 3) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 4) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } } - /* */ } + int tmpxet = invert_HOieta(ieta); + double nomHOSig = hosig[4] / elos; - if (htime > -40 && htime < 60) { - ips9 = (int)mypow_2_9; - ipsall += ips9; + if (ipsall - ips0 == mypow_2[ncut] - mypow_2[0] - 1) { + if (isZSps) { + sigvsevt[iring2][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[tmpxet][0]->Fill(abs(ndof), nomHOSig); + } + variab[iring2][0]->Fill(abs(ndof)); + } + if (ipsall - ips1 == mypow_2[ncut] - mypow_2[1] - 1) { + if (isZSps) { + sigvsevt[iring2][1]->Fill(chisq, nomHOSig); + sig_eta_evt[tmpxet][1]->Fill(chisq, nomHOSig); + } + variab[iring2][1]->Fill(chisq); + } + if (ipsall - ips2 == mypow_2[ncut] - mypow_2[2] - 1) { + if (isZSps) { + sigvsevt[iring2][2]->Fill(trkth, nomHOSig); + sig_eta_evt[tmpxet][2]->Fill(trkth, nomHOSig); + } + variab[iring2][2]->Fill(trkth); + } + if (ipsall - ips3 == mypow_2[ncut] - mypow_2[3] - 1) { + if (isZSps) { + sigvsevt[iring2][3]->Fill(trkph, nomHOSig); + sig_eta_evt[tmpxet][3]->Fill(trkph, nomHOSig); + } + variab[iring2][3]->Fill(trkph); + } + if (ipsall - ips4 == mypow_2[ncut] - mypow_2[4] - 1) { + if (isZSps) { + sigvsevt[iring2][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[tmpxet][4]->Fill(1000 * therr, nomHOSig); + } + variab[iring2][4]->Fill(1000 * therr); + } + if (ipsall - ips5 == mypow_2[ncut] - mypow_2[5] - 1) { + if (isZSps) { + sigvsevt[iring2][5]->Fill(1000 * pherr, nomHOSig); + sig_eta_evt[tmpxet][5]->Fill(1000 * pherr, nomHOSig); + } + variab[iring2][5]->Fill(1000 * pherr); + } + if (ipsall - ips6 == mypow_2[ncut] - mypow_2[6] - 1) { + if (isZSps) { + sigvsevt[iring2][6]->Fill(tmphoang, (nomHOSig)*abshoang); + sig_eta_evt[tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + variab[iring2][6]->Fill(tmphoang); + } + if (ipsall - ips7 == mypow_2[ncut] - mypow_2[7] - 1) { + if (isZSps) { + sigvsevt[iring2][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + } + variab[iring2][7]->Fill(fabs(trkmm)); + } + if (ipsall - ips8 == mypow_2[ncut] - mypow_2[8] - 1) { + if (isZSps) { + sigvsevt[iring2][8]->Fill(nmuon, nomHOSig); + sig_eta_evt[tmpxet][8]->Fill(nmuon, nomHOSig); + } + variab[iring2][8]->Fill(nmuon); } - - if (ipsall - ips0 == mypow_2_ncut - mypow_2_0 - 1) - sigvsevt[iring2][0]->Fill(abs(ndof), hosig[4]); - if (ipsall - ips1 == mypow_2_ncut - mypow_2_1 - 1) - sigvsevt[iring2][1]->Fill(chisq, hosig[4]); - if (ipsall - ips2 == mypow_2_ncut - mypow_2_2 - 1) - sigvsevt[iring2][2]->Fill(trkth, hosig[4]); - if (ipsall - ips3 == mypow_2_ncut - mypow_2_3 - 1) - sigvsevt[iring2][3]->Fill(trkph, hosig[4]); - if (ipsall - ips4 == mypow_2_ncut - mypow_2_4 - 1) - sigvsevt[iring2][4]->Fill(therr, hosig[4]); - if (ipsall - ips5 == mypow_2_ncut - mypow_2_5 - 1) - sigvsevt[iring2][5]->Fill(pherr, hosig[4]); - if (ipsall - ips6 == mypow_2_ncut - mypow_2_6 - 1) - sigvsevt[iring2][6]->Fill(hoang, hosig[4]); - if (ipsall - ips7 == mypow_2_ncut - mypow_2_7 - 1) - sigvsevt[iring2][7]->Fill(fabs(trkmm), hosig[4]); - if (ipsall - ips8 == mypow_2_ncut - mypow_2_8 - 1) - sigvsevt[iring2][8]->Fill(nmuon, hosig[4]); - if (ipsall - ips9 == mypow_2_ncut - mypow_2_9 - 1) - sigvsevt[iring2][9]->Fill(htime, hosig[4]); - if (ipsall - ips10 == mypow_2_ncut - mypow_2_10 - 1) - sigvsevt[iring2][10]->Fill(hodx, hosig[4]); - if (ipsall - ips11 == mypow_2_ncut - mypow_2_11 - 1) - sigvsevt[iring2][11]->Fill(hody, hosig[4]); if (!m_cosmic) { - if (ipsall - ips12 == mypow_2_ncut - mypow_2_12 - 1) - sigvsevt[iring2][12]->Fill(caloen[0], hosig[4]); + if (ipsall - ips9 == mypow_2[ncut] - mypow_2[9] - 1) { + if (isZSps) { + sigvsevt[iring2][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[tmpxet][9]->Fill(caloen[0], nomHOSig); + } + variab[iring2][9]->Fill(caloen[0]); + } + } + if (ipsall - ips10 == mypow_2[ncut] - mypow_2[10] - 1) { + if (isZSps) { + sigvsevt[iring2][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[tmpxet][10]->Fill(tkpt03, nomHOSig); + } + variab[iring2][10]->Fill(tkpt03); + } + if (ipsall - ips11 == mypow_2[ncut] - mypow_2[11] - 1) { + if (isZSps) { + sigvsevt[iring2][11]->Fill(hodx, nomHOSig); + sig_eta_evt[tmpxet][11]->Fill(hodx, nomHOSig); + } + variab[iring2][11]->Fill(hodx); } + if (ipsall - ips12 == mypow_2[ncut] - mypow_2[12] - 1) { + if (isZSps) { + sigvsevt[iring2][12]->Fill(hody, nomHOSig); + sig_eta_evt[tmpxet][12]->Fill(hody, nomHOSig); + } + variab[iring2][12]->Fill(hody); + } + + if (ipsall - ips13 == mypow_2[ncut] - mypow_2[13] - 1) { + if (isZSps) { + sigvsevt[iring2][13]->Fill(htime, nomHOSig); + sig_eta_evt[tmpxet][13]->Fill(htime, nomHOSig); + } + variab[iring2][13]->Fill(htime); + } + + if (isZSps) { + sigvsevt[iring2 + ringmx][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[netamx + tmpxet][0]->Fill(abs(ndof), nomHOSig); + } + variab[iring2 + 5][0]->Fill(abs(ndof)); - sigvsevt[iring2 + 5][0]->Fill(abs(ndof), hosig[4]); + ncount[iring2][0]++; + if (isZSps) { + ncount[iring2][1]++; + } if (ips0 > 0) { - sigvsevt[iring2 + 5][1]->Fill(chisq, hosig[4]); + if (isZSps) { + ncount[iring2][10]++; + sigvsevt[iring2 + ringmx][1]->Fill(chisq, nomHOSig); + sig_eta_evt[netamx + tmpxet][1]->Fill(chisq, nomHOSig); + } + variab[iring2 + ringmx][1]->Fill(chisq); + mu_projection[1]->Fill(ieta, iphi); if (ips1 > 0) { - sigvsevt[iring2 + 5][2]->Fill(trkth, hosig[4]); + if (isZSps) { + ncount[iring2][11]++; + sigvsevt[iring2 + ringmx][2]->Fill(trkth, nomHOSig); + sig_eta_evt[netamx + tmpxet][2]->Fill(trkth, nomHOSig); + } + variab[iring2 + ringmx][2]->Fill(trkth); + mu_projection[2]->Fill(ieta, iphi); if (ips2 > 0) { - sigvsevt[iring2 + 5][3]->Fill(trkph, hosig[4]); + if (isZSps) { + ncount[iring2][12]++; + sigvsevt[iring2 + ringmx][3]->Fill(trkph, nomHOSig); + sig_eta_evt[netamx + tmpxet][3]->Fill(trkph, nomHOSig); + } + variab[iring2 + ringmx][3]->Fill(trkph); + mu_projection[3]->Fill(ieta, iphi); if (ips3 > 0) { - sigvsevt[iring2 + 5][4]->Fill(therr, hosig[4]); + if (isZSps) { + ncount[iring2][13]++; + sigvsevt[iring2 + ringmx][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[netamx + tmpxet][4]->Fill(1000 * therr, nomHOSig); + } + variab[iring2 + ringmx][4]->Fill(1000 * therr); + mu_projection[4]->Fill(ieta, iphi); if (ips4 > 0) { - sigvsevt[iring2 + 5][5]->Fill(pherr, hosig[4]); + if (isZSps) { + ncount[iring2][14]++; + sigvsevt[iring2 + ringmx][5]->Fill(1000 * pherr, nomHOSig); + sig_eta_evt[netamx + tmpxet][5]->Fill(1000 * pherr, nomHOSig); + } + variab[iring2 + ringmx][5]->Fill(1000 * pherr); + mu_projection[5]->Fill(ieta, iphi); if (ips5 > 0) { - sigvsevt[iring2 + 5][6]->Fill(hoang, hosig[4]); + if (isZSps) { + ncount[iring2][15]++; + sigvsevt[iring2 + ringmx][6]->Fill(tmphoang, (nomHOSig)*abshoang); + sig_eta_evt[netamx + tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + variab[iring2 + ringmx][6]->Fill(tmphoang); + mu_projection[6]->Fill(ieta, iphi); if (ips6 > 0) { - sigvsevt[iring2 + 5][7]->Fill(fabs(trkmm), hosig[4]); + if (isZSps) { + ncount[iring2][16]++; + sigvsevt[iring2 + ringmx][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[netamx + tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + } + variab[iring2 + ringmx][7]->Fill(fabs(trkmm)); + mu_projection[7]->Fill(ieta, iphi); if (ips7 > 0) { - sigvsevt[iring2 + 5][8]->Fill(nmuon, hosig[4]); + ncount[iring2][4]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][17]++; + sigvsevt[iring2 + ringmx][8]->Fill(nmuon, nomHOSig); + sig_eta_evt[netamx + tmpxet][8]->Fill(nmuon, nomHOSig); + } + variab[iring2 + ringmx][8]->Fill(nmuon); + mu_projection[8]->Fill(ieta, iphi); if (ips8 > 0) { - sigvsevt[iring2 + 5][9]->Fill(htime, hosig[4]); + if (!m_cosmic) { + if (isZSps) { + ncount[iring2][18]++; + sigvsevt[iring2 + ringmx][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[netamx + tmpxet][9]->Fill(caloen[0], nomHOSig); + } + variab[iring2 + ringmx][9]->Fill(caloen[0]); + mu_projection[9]->Fill(ieta, iphi); + } if (ips9 > 0) { - sigvsevt[iring2 + 5][10]->Fill(hodx, hosig[4]); + if (isZSps) { + ncount[iring2][19]++; + sigvsevt[iring2 + ringmx][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[netamx + tmpxet][10]->Fill(tkpt03, nomHOSig); + } + variab[iring2 + ringmx][10]->Fill(tkpt03); + mu_projection[10]->Fill(ieta, iphi); if (ips10 > 0) { - sigvsevt[iring2 + 5][11]->Fill(hody, hosig[4]); + ncount[iring2][3]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][20]++; + sigvsevt[iring2 + ringmx][11]->Fill(hodx, nomHOSig); + sig_eta_evt[netamx + tmpxet][11]->Fill(hodx, nomHOSig); + } + variab[iring2 + ringmx][11]->Fill(hodx); + mu_projection[11]->Fill(ieta, iphi); + if (ips11 > 0) { - if (!m_cosmic) - sigvsevt[iring2 + 5][12]->Fill(caloen[0], hosig[4]); + if (isZSps) { + ncount[iring2][21]++; + sigvsevt[iring2 + ringmx][12]->Fill(hody, nomHOSig); + sig_eta_evt[netamx + tmpxet][12]->Fill(hody, nomHOSig); + } + variab[iring2 + ringmx][12]->Fill(hody); + mu_projection[12]->Fill(ieta, iphi); + + if (ips12 > 0) { + ncount[iring2][2]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][22]++; + sigvsevt[iring2 + ringmx][13]->Fill(htime, nomHOSig); + sig_eta_evt[tmpxet + ringmx][13]->Fill(htime, nomHOSig); + } + variab[iring2 + ringmx][13]->Fill(htime); + mu_projection[13]->Fill(ieta, iphi); + + if (ips13 > 0) { + if (isZSps) { + ncount[iring2][23]++; + mu_projection[14]->Fill(ieta, iphi); + } + } + } } } } @@ -1303,26 +928,59 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i } } } - - sigvsevt[iring2 + 10][0]->Fill(abs(ndof), hosig[4]); - sigvsevt[iring2 + 10][1]->Fill(chisq, hosig[4]); - sigvsevt[iring2 + 10][2]->Fill(trkth, hosig[4]); - sigvsevt[iring2 + 10][3]->Fill(trkph, hosig[4]); - sigvsevt[iring2 + 10][4]->Fill(therr, hosig[4]); - sigvsevt[iring2 + 10][5]->Fill(pherr, hosig[4]); - sigvsevt[iring2 + 10][6]->Fill(hoang, hosig[4]); - sigvsevt[iring2 + 10][7]->Fill(fabs(trkmm), hosig[4]); - sigvsevt[iring2 + 10][8]->Fill(nmuon, hosig[4]); - sigvsevt[iring2 + 10][9]->Fill(htime, hosig[4]); - sigvsevt[iring2 + 10][10]->Fill(hodx, hosig[4]); - sigvsevt[iring2 + 10][11]->Fill(hody, hosig[4]); + if (isZSps) { + sigvsevt[iring2 + 2 * ringmx][0]->Fill(abs(ndof), nomHOSig); + sigvsevt[iring2 + 2 * ringmx][1]->Fill(chisq, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][2]->Fill(trkth, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][3]->Fill(trkph, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][4]->Fill(1000 * therr, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][5]->Fill(1000 * pherr, nomHOSig); + if (abshoang > 0.01) { + sigvsevt[iring2 + 2 * ringmx][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + sigvsevt[iring2 + 2 * ringmx][7]->Fill(fabs(trkmm), nomHOSig); + sigvsevt[iring2 + 2 * ringmx][8]->Fill(nmuon, nomHOSig); + if (!m_cosmic) + sigvsevt[iring2 + 2 * ringmx][9]->Fill(caloen[0], nomHOSig); + sigvsevt[iring2 + 2 * ringmx][10]->Fill(tkpt03, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][11]->Fill(hodx, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][12]->Fill(hody, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][13]->Fill(htime, nomHOSig); + + sig_eta_evt[2 * netamx + tmpxet][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][1]->Fill(chisq, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][2]->Fill(trkth, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][3]->Fill(trkph, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][5]->Fill(1000 * pherr, nomHOSig); + if (abshoang > 0.01) { + sig_eta_evt[2 * netamx + tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + sig_eta_evt[2 * netamx + tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][8]->Fill(nmuon, nomHOSig); + if (!m_cosmic) + sig_eta_evt[2 * netamx + tmpxet][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][11]->Fill(hodx, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][12]->Fill(hody, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][13]->Fill(htime, nomHOSig); + } + + variab[iring2 + 2 * ringmx][0]->Fill(abs(ndof)); + variab[iring2 + 2 * ringmx][1]->Fill(chisq); + variab[iring2 + 2 * ringmx][2]->Fill(trkth); + variab[iring2 + 2 * ringmx][3]->Fill(trkph); + variab[iring2 + 2 * ringmx][4]->Fill(1000 * therr); + variab[iring2 + 2 * ringmx][5]->Fill(1000 * pherr); + variab[iring2 + 2 * ringmx][6]->Fill(tmphoang); + variab[iring2 + 2 * ringmx][7]->Fill(fabs(trkmm)); + variab[iring2 + 2 * ringmx][8]->Fill(nmuon); if (!m_cosmic) - sigvsevt[iring2 + 10][12]->Fill(caloen[0], hosig[4]); - - int iselect = (ipsall == mypow_2_ncut - 1) ? 1 : 0; - - if (hocro != -100.0 && hocro < -50.0) - hocro += 100.; + variab[iring2 + 2 * ringmx][9]->Fill(caloen[0]); + variab[iring2 + 2 * ringmx][10]->Fill(tkpt03); + variab[iring2 + 2 * ringmx][11]->Fill(hodx); + variab[iring2 + 2 * ringmx][12]->Fill(hody); + variab[iring2 + 2 * ringmx][13]->Fill(htime); muonnm->Fill(nmuon); muonmm->Fill(trkmm); @@ -1330,6 +988,8 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i muonph->Fill(trkph * 180 / pival); muonch->Fill(chisq); + int iselect = (ipsall == mypow_2[ncut] - 1) ? 1 : 0; + if (iselect == 1) { ipass++; sel_muonnm->Fill(nmuon); @@ -1337,1622 +997,15 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i sel_muonth->Fill(trkth * 180 / pival); sel_muonph->Fill(trkph * 180 / pival); sel_muonch->Fill(chisq); - } - - int tmpphi = (iphi + 1) % 3; //pixel mapping - int npixel = 0; - int itag = -1; - int iflip = 0; - int fact = 2; - - if (iring == 0) { - tmpphi = (iphi + 1) % 2; - if (tmpsect == 2 || tmpsect == 3 || tmpsect == 6 || tmpsect == 7 || tmpsect == 10 || tmpsect == 11) { - npixel = mapx0p[tmpeta][tmpphi]; - itag = 2; - } else { - npixel = mapx0m[tmpeta][tmpphi]; - itag = 3; - } - } else { - fact = 3; - if (tmpsect % 2 == 1) - iflip = 1; - if (abs(iring) == 1) { - npixel = mapx1[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)]; - itag = 1; - } else { - npixel = mapx2[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)]; - itag = 0; + if (m_histFill && tmpxet >= 0 && tmpxet < netamx && iphi >= 0 && iphi < nphimx) { + ho_indenergy[tmpxet][iphi - 1]->Fill(nomHOSig); } - } - - int tmpeta1 = (ieta > 0) ? ieta - 1 : -ieta + 14; - - int iselect2 = 0; - if (hosig[4] != -100) { - if (m_cosmic) { - if (caloen[2] <= 0.0) - iselect2 = 1; - } else { - if (caloen[2] <= 3.0) - iselect2 = 1; + if (m_treeFill) { + T1->Fill(); } } - - if (iselect2 == 1) { - int tmpphi2 = (iphi + 6 <= nphimx) ? iphi + 5 : iphi + 5 - nphimx; - - int tmprout2 = (iring == 0) ? int((tmpphi2 + 2) / 2.) + 1 : int((tmpphi2 + 2) / 3.) + 1; - if (tmprout2 > tmproutmx) - tmprout2 = 1; - - if (cro_ssg[tmpeta1][tmpphi2].size() < 4000) { - if (hocro > alow && hocro < ahigh) { - if (!m_histfit) - cro_ssg[tmpeta1][tmpphi2].push_back(hocro); - crossg[tmpeta1][tmpphi2]->Fill(hocro); - } - } - - if (tmpphi2 >= 0 && tmpphi2 < nphimx) { - crossg[tmpeta1][nphimx]->Fill(hocro); - } - if (m_combined) { - com_crossg[iring2][tmprout2 - 1]->Fill(hocro); - com_crossg[iring2][tmproutmx]->Fill(hocro); - } - } - - if (iselect == 1) { - for (int ij = 0; ij < neffip; ij++) { - if (ij == 0) { - sig_effi[ij]->Fill(ieta, iphi, 1.); - } else { - if (hosig[4] > ij * m_sigma) { - sig_effi[ij]->Fill(ieta, iphi, 1.); - } - } - } - - //Histogram filling for noise study: phi shift according to DTChamberAnalysis - int tmpphi1 = iphi - 1; - - if (sig_reg[tmpeta1][tmpphi1].size() < 4000) { - if (hosig[4] > -50 && hosig[4] < 15) { - sigrsg[tmpeta1][tmpphi1]->Fill(hosig[4]); - if (!m_histfit && hosig[4] <= ahigh / 2.) - sig_reg[tmpeta1][tmpphi1].push_back(hosig[4]); - invang[tmpeta1][tmpphi1] += 1. / fabs(hoang); - } - } - - if (tmpphi1 >= 0 && tmpphi1 < nphimx) { //GREN - sigrsg[tmpeta1][nphimx]->Fill(hosig[4]); - invang[tmpeta1][nphimx] += 1. / fabs(hoang); - } - - if (m_combined) { // COMBINED - com_sigrsg[iring2][tmprout - 1]->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 - - if (m_checkmap || m_correl) { // CHECKMAP - tmpeta = etamap[itag][npixel]; - tmpphi = phimap[itag][npixel]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - if (int((hocorsig[fact * tmpeta + tmpphi] - hosig[4]) * 10000) / 10000. != 0) { - iaxxx++; - 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::LogVerbatim("HOCalib") << " " << ij << " " << hocorsig[ij]; - } - edm::LogVerbatim("HOCalib") << " ix " << iaxxx << " " << ibxxx; - } else { - ibxxx++; - } - - corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - if (m_combined) { // COMBINED - com_corrsgc[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - } //m_checkmap - - if (m_correl) { // CORREL - float allcorsig = 0.0; - - tmpeta = etamap[itag][npixleft[npixel]]; - tmpphi = phimap[itag][npixleft[npixel]]; - - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgl[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixrigh[npixel]]; - tmpphi = phimap[itag][npixrigh[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgr[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // #ifdef COMBINED - com_corrsgr[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif - } - - tmpeta = etamap[itag][npixlebt[npixel]]; - tmpphi = phimap[itag][npixlebt[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsglb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixribt[npixel]]; - tmpphi = phimap[itag][npixribt[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgrb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixleup[npixel]]; - tmpphi = phimap[itag][npixleup[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsglu[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixriup[npixel]]; - tmpphi = phimap[itag][npixriup[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgru[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig); - if (m_combined) { // COMBINED - com_corrsgall[iring2][tmpsect - 1]->Fill(allcorsig); - } //m_combined - - } //m_correl - for (int k = 0; k < 9; k++) { - switch (iring) { - case 2: - ho_sig2p[k]->Fill(hosig[k]); - break; - case 1: - ho_sig1p[k]->Fill(hosig[k]); - break; - case 0: - ho_sig00[k]->Fill(hosig[k]); - break; - case -1: - ho_sig1m[k]->Fill(hosig[k]); - break; - case -2: - ho_sig2m[k]->Fill(hosig[k]); - break; - } - if (m_hbinfo) { // HBINFO - hbhe_sig[k]->Fill(hbhesig[k]); - } //m_hbinfo - } - } //if (iselect==1) - } //for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin(); hoC!=(*HOCalib).end(); hoC++){ - - } //if (isCosMu) -} - -// ------------ method called once each job just before starting event loop ------------ -void HOCalibAnalyzer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HOCalibAnalyzer::endJob() { - theFile->cd(); - - if (m_allHOsignal) { - for (int jk = 0; jk < ho_energy->GetNbinsX(); jk++) { - for (int kl = 0; kl < ho_energy->GetNbinsY(); kl++) { - double entry = ho_entry->GetBinContent(jk + 1, kl + 1); - if (entry < 1.) - entry = 1.; - - double energy = ho_energy->GetBinContent(jk + 1, kl + 1) / entry; - double energy2 = ho_energy2->GetBinContent(jk + 1, kl + 1) / entry; - double rms = sqrt(energy2 - energy * energy); - - double xval = ho_energy->GetXaxis()->GetBinCenter(jk + 1); - double yval = ho_energy->GetYaxis()->GetBinCenter(kl + 1); - - ho_rms->Fill(xval, yval, rms); - } - } - } - - for (int ij = 0; ij < nphimx; ij++) { - for (int jk = 0; jk < netamx; jk++) { - nevsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetEntries()); - mnsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetMean()); - rmssigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetRMS()); - - nevcrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetEntries()); - mncrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetMean()); - rmscrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetRMS()); - - if (m_correl) { // CORREL - - nevcorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetEntries()); - mncorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetMean()); - rmscorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetRMS()); - - nevcorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetEntries()); - mncorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetMean()); - rmscorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetRMS()); - - nevcorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetEntries()); - mncorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetMean()); - rmscorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetRMS()); - - nevcorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetEntries()); - mncorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetMean()); - rmscorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetRMS()); - - nevcorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetEntries()); - mncorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetMean()); - rmscorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetRMS()); - - nevcorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetEntries()); - mncorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetMean()); - rmscorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetRMS()); - - 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 - 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 - } - } - - if (m_combined) { // COMBINED - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx; ij++) { - if (jk != 2 && ij >= rout12mx) - continue; - nevsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetEntries()); - mnsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetMean()); - rmssigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetRMS()); - - nevcrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetEntries()); - mncrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetMean()); - rmscrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetRMS()); - } - } - - for (int ij = 0; ij < sectmx; ij++) { - for (int jk = 0; jk < ringmx; jk++) { - 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()); - - nevcorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetEntries()); - mncorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetMean()); - rmscorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetRMS()); - - nevcorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetEntries()); - mncorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetMean()); - rmscorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetRMS()); - - nevcorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetEntries()); - mncorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetMean()); - rmscorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetRMS()); - - nevcorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetEntries()); - mncorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetMean()); - rmscorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetRMS()); - - nevcorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetEntries()); - mncorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetMean()); - rmscorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetRMS()); - - 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 - 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 - } - } - } //m_combined - - for (int ij = 1; ij < neffip; ij++) { - sig_effi[ij]->Divide(sig_effi[0]); - } - for (int ij = 0; ij < netamx; ij++) { - for (int jk = 0; jk < nphimx; jk++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - int iphi = jk + 1; - double signal = sigrsg[ij][jk]->GetMean(); - mean_energy->Fill(ieta, iphi, signal); - } - } - - int irunold = irun; - - gStyle->SetOptLogy(0); - gStyle->SetTitleFillColor(10); - gStyle->SetStatColor(10); - - gStyle->SetCanvasColor(10); - gStyle->SetOptStat(0); //1110); - gStyle->SetOptTitle(1); - - gStyle->SetTitleColor(10); - gStyle->SetTitleFontSize(0.09); - gStyle->SetTitleOffset(-0.05); - gStyle->SetTitleBorderSize(1); - - gStyle->SetPadColor(10); - gStyle->SetPadBorderMode(0); - gStyle->SetStatColor(10); - gStyle->SetPadBorderMode(0); - gStyle->SetStatBorderSize(1); - gStyle->SetStatFontSize(.07); - - gStyle->SetStatStyle(1001); - gStyle->SetOptFit(101); - gStyle->SetCanvasColor(10); - gStyle->SetCanvasBorderMode(0); - - gStyle->SetStatX(.99); - gStyle->SetStatY(.99); - gStyle->SetStatW(.45); - gStyle->SetStatH(.16); - gStyle->SetLabelSize(0.075, "XY"); - gStyle->SetLabelOffset(0.21, "XYZ"); - gStyle->SetTitleSize(0.065, "XY"); - gStyle->SetTitleOffset(0.06, "XYZ"); - gStyle->SetPadTopMargin(.09); - gStyle->SetPadBottomMargin(0.11); - gStyle->SetPadLeftMargin(0.12); - gStyle->SetPadRightMargin(0.15); - gStyle->SetPadGridX(true); - gStyle->SetPadGridY(true); - gStyle->SetGridStyle(2); - gStyle->SetNdivisions(303, "XY"); - - gStyle->SetMarkerSize(0.60); - gStyle->SetMarkerColor(2); - gStyle->SetMarkerStyle(20); - gStyle->SetTitleFontSize(0.07); - - char out_file[200]; - int xsiz = 700; - int ysiz = 500; - - gStyle->SetPadBottomMargin(0.14); - gStyle->SetPadLeftMargin(0.17); - gStyle->SetPadRightMargin(0.03); - - gStyle->SetOptStat(1110); - - const int nsample = 8; - TF1* gx0[nsample] = {nullptr}; - TF1* ped0fun[nsample] = {nullptr}; - TF1* signal[nsample] = {nullptr}; - TF1* pedfun[nsample] = {nullptr}; - TF1* sigfun[nsample] = {nullptr}; - TF1* signalx[nsample] = {nullptr}; - - TH1F* signall[nsample] = {nullptr}; - TH1F* pedstll[nsample] = {nullptr}; - - if (m_constant) { - gStyle->SetOptFit(101); - gStyle->SetCanvasBorderMode(0); - gStyle->SetPadBorderMode(0); - gStyle->SetStatBorderSize(1); - gStyle->SetStatStyle(1001); - gStyle->SetTitleColor(10); - gStyle->SetTitleFontSize(0.09); - gStyle->SetTitleOffset(-0.05); - gStyle->SetTitleBorderSize(1); - - gStyle->SetCanvasColor(10); - gStyle->SetPadColor(10); - gStyle->SetStatColor(10); - gStyle->SetStatFontSize(.07); - gStyle->SetStatX(0.99); - gStyle->SetStatY(0.99); - gStyle->SetStatW(0.30); - gStyle->SetStatH(0.10); - gStyle->SetTitleSize(0.065, "XYZ"); - gStyle->SetLabelSize(0.075, "XYZ"); - gStyle->SetLabelOffset(0.012, "XYZ"); - gStyle->SetPadGridX(true); - gStyle->SetPadGridY(true); - gStyle->SetGridStyle(3); - gStyle->SetNdivisions(101, "XY"); - gStyle->SetOptLogy(0); - int iiter = 0; - - std::ofstream file_out(theoutputtxtFile.c_str()); - // TPostScript* ps=0; - int ips = 111; - TPostScript ps(theoutputpsFile.c_str(), ips); - ps.Range(20, 28); - - xsiz = 900; //900; - ysiz = 1200; //600; - TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz); - - // Fix is done for eta-phi - - float mean_eta[netamx]; - float mean_phi[nphimx]; - float rms_eta[netamx]; - float rms_phi[nphimx]; - - for (int ij = 0; ij < nphimx; ++ij) { - mean_phi[ij] = 0; - rms_phi[ij] = 0; - } - for (int ij = 0; ij < netamx; ++ij) { - mean_eta[ij] = 0; - rms_eta[ij] = 0; - } - - int mxeta = 0; - int mxphi = 0; - int mneta = 0; - int mnphi = 0; - - //iijj = 0 : Merging all ring - // = 1 : Individual HPD - //iijj = 2 : merging all phi - // = 3 : Individual tower - - for (int iijj = 0; iijj < 4; iijj++) { - // if ((!mx_combined) && iijj==1) continue; //Use this only for combined data - if (iijj == 0) { - mxeta = ringmx; - mxphi = 1; - mneta = 0; - mnphi = 0; - } else if (iijj == 1) { - mxeta = ringmx; - mxphi = routmx; - mneta = 0; - mnphi = 0; - } else if (iijj == 2) { - mxeta = netamx; - mxphi = 1; - mneta = 0; - mnphi = 0; - } else if (iijj == 3) { - mxeta = netamx; - mxphi = nphimx; - mneta = 0; - mnphi = 0; - } - - for (int jk = mneta; jk < mxeta; jk++) { - for (int ij = mnphi; ij < mxphi; ij++) { - if (iijj == 1) - continue; - if ((iijj == 0 || iijj == 1) && jk != 2 && ij >= rout12mx) - continue; - int izone = iiter % nsample; - - if (iijj == 0) { - int iread = (jk == 2) ? routmx : rout12mx; - signall[izone] = (TH1F*)com_sigrsg[jk][iread]->Clone("hnew"); - pedstll[izone] = (TH1F*)com_crossg[jk][iread]->Clone("hnew"); - } else if (iijj == 1) { - signall[izone] = (TH1F*)com_sigrsg[jk][ij]->Clone("hnew"); - pedstll[izone] = (TH1F*)com_crossg[jk][ij]->Clone("hnew"); - } else if (iijj == 2) { - signall[izone] = (TH1F*)sigrsg[jk][nphimx]->Clone("hnew"); - pedstll[izone] = (TH1F*)crossg[jk][nphimx]->Clone("hnew"); - } else if (iijj == 3) { - signall[izone] = (TH1F*)sigrsg[jk][ij]->Clone("hnew"); - pedstll[izone] = (TH1F*)crossg[jk][ij]->Clone("hnew"); - } - - pedstll[izone]->SetLineWidth(2); - signall[izone]->SetLineWidth(2); - pedstll[izone]->SetLineColor(2); - signall[izone]->SetLineColor(4); - pedstll[izone]->SetNdivisions(506, "XY"); - signall[izone]->SetNdivisions(506, "XY"); - - signall[izone]->GetXaxis()->SetLabelSize(.065); - signall[izone]->GetYaxis()->SetLabelSize(.06); - signall[izone]->GetXaxis()->SetTitle("Signal (GeV)"); - - signall[izone]->GetXaxis()->SetTitleSize(.065); - signall[izone]->GetXaxis()->CenterTitle(); - - if (izone == 0) { //iiter%8 ==0) { - ps.NewPage(); - c0->Divide(4, 4); //c0->Divide(2,4); // c0->Divide(1,2); - } - c0->cd(2 * izone + 1); // (iiter%8)+1); //c0->cd(iiter%8+1); - - float mean = pedstll[izone]->GetMean(); - float rms = pedstll[izone]->GetRMS(); - - if (rms < 0.10) - rms = 0.10; - if (rms > 0.15) - rms = 0.15; - if (mean > 0.20) - mean = 0.20; - if (mean < -0.20) - mean = -0.20; - - float xmn = mean - 6. * rms; - float xmx = mean + 6. * rms; - - binwid = pedstll[izone]->GetBinWidth(1); - if (xmx > pedstll[izone]->GetXaxis()->GetXmax()) - xmx = pedstll[izone]->GetXaxis()->GetXmax() - 0.5 * binwid; - if (xmn < pedstll[izone]->GetXaxis()->GetXmin()) - xmn = pedstll[izone]->GetXaxis()->GetXmin() + 0.5 * binwid; - - float height = pedstll[izone]->GetEntries(); - - double par[nbgpr] = {height, mean, 0.75 * rms}; - - double gaupr[nbgpr]; - double parer[nbgpr]; - - ietafit = jk; - iphifit = ij; - pedstll[izone]->GetXaxis()->SetLabelSize(.065); - pedstll[izone]->GetYaxis()->SetLabelSize(.06); - - pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx); - - if (iijj == 0) { - pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)"); - } else { - pedstll[izone]->GetXaxis()->SetTitle("Pedestal (GeV)"); - } - pedstll[izone]->GetXaxis()->SetTitleSize(.065); - pedstll[izone]->GetXaxis()->CenterTitle(); - - pedstll[izone]->Draw(); - if (m_pedsuppr) { - gaupr[0] = 0; - gaupr[1] = 0.0; // pedmean[ietafit][iphifit]; - gaupr[2] = 0.15; //GMA need from database - parer[0] = parer[1] = parer[2] = 0; - } else { - if (pedstll[izone]->GetEntries() > 5) { - if ((iijj != 3) || m_histfit) { - char temp[20]; - sprintf(temp, "gx0_%i", izone); - gx0[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - gx0[izone]->SetParameters(par); - gx0[izone]->SetLineWidth(1); - pedstll[izone]->Fit(gx0[izone], "R+"); - - for (int k = 0; k < nbgpr; k++) { - parer[k] = gx0[izone]->GetParError(k); - gaupr[k] = gx0[izone]->GetParameter(k); - } - } else { - double strt[nbgpr] = {height, mean, 0.75 * rms}; - double step[nbgpr] = {1.0, 0.001, 0.001}; - double alowmn[nbgpr] = {0.5 * height, mean - rms, 0.3 * rms}; - double ahighmn[nbgpr] = {1.5 * height, mean + rms, 1.5 * rms}; - - TMinuit* gMinuit = new TMinuit(nbgpr); - gMinuit->SetFCN(fcnbg); - - double arglist[10]; - int ierflg = 0; - arglist[0] = 0.5; - gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); - char name[100]; - for (int k = 0; k < nbgpr; k++) { - sprintf(name, "pedpar%i", k); - gMinuit->mnparm(k, name, strt[k], step[k], alowmn[k], ahighmn[k], ierflg); - } - - arglist[0] = 0; - gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg); - - arglist[0] = 0; - gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); - - TString chnam; - double parv, err, xlo, xup, plerr, mierr, eparab, gcc; - int iuit; - - for (int k = 0; k < nbgpr; k++) { - if (step[k] > -10) { - gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit); - gMinuit->mnerrs(k, plerr, mierr, eparab, gcc); - if (k == 0) { - gaupr[k] = parv * binwid; - parer[k] = err * binwid; - } else { - gaupr[k] = parv; - parer[k] = err; - } - } - } - - char temp[20]; - sprintf(temp, "ped0fun_%i", izone); - ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - ped0fun[izone]->SetParameters(gaupr); - ped0fun[izone]->SetLineColor(3); - ped0fun[izone]->SetLineWidth(1); - ped0fun[izone]->Draw("same"); - - delete gMinuit; - } - } else { - for (int k = 0; k < nbgpr; k++) { - gaupr[k] = par[k]; - } - gaupr[2] = 0.15; - } - } - - c0->cd(2 * izone + 2); - if (signall[izone]->GetEntries() > 5) { - Double_t parall[nsgpr]; - double parserr[nsgpr]; - double fitres[nsgpr]; - double pedht = 0; - - char temp[20]; - sprintf(temp, "signal_%i", izone); - xmn = signall[izone]->GetXaxis()->GetXmin(); - xmx = 0.5 * signall[izone]->GetXaxis()->GetXmax(); - signal[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); - xmx *= 2.0; - if ((iijj != 3) || m_histfit) { - pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) + - signall[izone]->GetBinContent(nbn + 1)) / - 3.; - - if (m_pedsuppr) { - parall[1] = 0.0; // pedmean[ietafit][iphifit]; - parall[2] = 0.15; - } else { - for (int lm = 0; lm < nbgpr; lm++) { - parall[lm] = gaupr[lm]; - } - } - - set_mean(parall[1], false); - set_sigma(parall[2], false); - - parall[0] = 0.9 * pedht; //GM for Z-mumu, there is almost no pedestal - parall[3] = 0.14; - double area = binwid * signall[izone]->GetEntries(); - parall[5] = area; - - if (iijj == 3) { - parall[4] = fitprm[4][jk]; - parall[6] = fitprm[6][jk]; - } else { - parall[4] = signall[izone]->GetMean(); - parall[6] = parall[2]; - } - - signal[izone]->SetParameters(parall); - signal[izone]->FixParameter(1, parall[1]); - signal[izone]->FixParameter(2, parall[2]); - signal[izone]->SetParLimits(0, 0.00, 2.0 * pedht + 0.1); - signal[izone]->FixParameter(3, 0.14); - - signal[izone]->SetParLimits(5, 0.40 * area, 1.15 * area); - 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]); - } else { - signal[izone]->SetParLimits(4, 0.1, 1.0); - signal[izone]->SetParLimits(6, 0.035, 0.3); - } - signal[izone]->SetParNames("const", "mean", "sigma", "Width", "MP", "Area", "GSigma"); - signall[izone]->Fit(signal[izone], "0R+"); - - signall[izone]->GetXaxis()->SetRangeUser(xmn, xmx); - for (int k = 0; k < nsgpr; k++) { - fitres[k] = fitprm[k][jk] = signal[izone]->GetParameter(k); - parserr[k] = signal[izone]->GetParError(k); - } - - } else { - double pedhtx = 0; - for (unsigned i = 0; i < sig_reg[ietafit][iphifit].size(); i++) { - if (sig_reg[ietafit][iphifit][ij] > gaupr[1] - 3 * gaupr[2] && - sig_reg[ietafit][iphifit][ij] < gaupr[1] + gaupr[2]) - pedhtx++; - } - - set_mean(gaupr[1], false); - set_sigma(gaupr[2], false); - - TString name[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma"}; - double strt[nsgpr] = {0.9 * pedhtx, - gaupr[1], - gaupr[2], - fitprm[3][jk], - fitprm[4][jk], - signall[izone]->GetEntries(), - fitprm[6][jk]}; - double alowmn[nsgpr] = { - 0.1 * pedhtx - 0.1, gaupr[1] - 0.1, gaupr[2] - 0.1, 0.07, 0.2 * strt[4], 0.1 * strt[5], 0.2 * strt[6]}; - double ahighmn[nsgpr] = { - 1.2 * pedhtx + 0.1, gaupr[1] + 0.1, gaupr[2] + 0.1, 0.20, 2.5 * strt[4], 1.5 * strt[5], 2.2 * strt[6]}; - double step[nsgpr] = {1.0, 0.0, 0.0, 0.0, 0.001, 1.0, 0.002}; - - TMinuit* gMinuit = new TMinuit(nsgpr); - gMinuit->SetFCN(fcnsg); - - double arglist[10]; - int ierflg = 0; - arglist[0] = 0.5; - gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); - - for (int k = 0; k < nsgpr; k++) { - gMinuit->mnparm(k, name[k], strt[k], step[k], alowmn[k], ahighmn[k], ierflg); - } - - arglist[0] = 0; - gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg); - - arglist[0] = 0; - gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); - - TString chnam; - double parv, err, xlo, xup, plerr, mierr, eparab, gcc; - int iuit; - - for (int k = 0; k < nsgpr; k++) { - if (step[k] > -10) { - gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit); - gMinuit->mnerrs(k, plerr, mierr, eparab, gcc); - if (k == 0 || k == 5) { - fitres[k] = parv * binwid; - parserr[k] = err * binwid; - } else { - fitres[k] = parv; - parserr[k] = err; - } - } - } - - delete gMinuit; - } - - signall[izone]->Draw(); - - sprintf(temp, "pedfun_%i", izone); - pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - pedfun[izone]->SetParameters(fitres); - pedfun[izone]->SetLineColor(3); - pedfun[izone]->SetLineWidth(1); - pedfun[izone]->Draw("same"); - - sprintf(temp, "signalfun_%i", izone); - sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr); - sigfun[izone]->SetParameters(&fitres[3]); - sigfun[izone]->SetLineWidth(1); - sigfun[izone]->SetLineColor(4); - sigfun[izone]->Draw("same"); - - sprintf(temp, "total_%i", izone); - signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); - signalx[izone]->SetParameters(fitres); - signalx[izone]->SetLineWidth(1); - signalx[izone]->Draw("same"); - - int kl = (jk < 15) ? jk + 1 : 14 - jk; - - 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() - << " " << 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() << std::endl; - - file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << fitres[0] << " " << fitres[1] << " " - << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] << " " << fitres[6] - << std::endl; - file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " " - << parserr[2] << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6] - << std::endl; - - int ieta = (jk < 15) ? (15 + jk) : (29 - jk); - int ifl = nphimx * ieta + ij; - - if (iijj == 3) { - ped_evt->Fill(ifl, pedstll[izone]->GetEntries()); - ped_mean->Fill(ifl, gaupr[1]); - ped_width->Fill(ifl, gaupr[2]); - fit_chi->Fill(ifl, signal[izone]->GetChisquare()); - sig_evt->Fill(ifl, signall[izone]->GetEntries()); - fit_sigevt->Fill(ifl, fitres[5]); - fit_bkgevt->Fill(ifl, fitres[0] * sqrt(2 * acos(-1.)) * gaupr[2]); - sig_mean->Fill(ifl, fitres[4]); - sig_diff->Fill(ifl, fitres[4] - fitres[1]); - sig_width->Fill(ifl, fitres[3]); - sig_sigma->Fill(ifl, fitres[6]); - sig_meanerr->Fill(ifl, parserr[4]); - if (fitres[4] - fitres[1] != 0) - sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1])); - if (gaupr[2] != 0) - sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / gaupr[2]); - - ped_statmean->Fill(ifl, pedstll[izone]->GetMean()); - sig_statmean->Fill(ifl, signall[izone]->GetMean()); - ped_rms->Fill(ifl, pedstll[izone]->GetRMS()); - sig_rms->Fill(ifl, signall[izone]->GetRMS()); - } - - if ((iijj == 2) || (iijj == 3) || (iijj == 1)) { - if (signall[izone]->GetEntries() > 5 && fitres[4] > 0.1) { - //GMA need to put this==1 in future - float fact = 0.812; - if (abs(kl) <= 4) - fact = 0.895; - fact *= 0.19; //conversion factor for GeV/fC - - float fact2 = 0; - if (iijj == 2) - fact2 = invang[jk][nphimx]; - if (iijj == 3) - fact2 = invang[jk][ij]; - if (iijj == 1) - fact2 = com_invang[jk][ij]; - - float calibc = fact * fact2 / (fitres[4] * signall[izone]->GetEntries()); - float caliberr = TMath::Abs(calibc * parserr[4] / std::max(0.001, fitres[4])); - - if (iijj == 2) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - mean_phi_hst->Fill(ieta, calibc); - mean_phi_hst->SetBinError(mean_phi_hst->FindBin(ieta), caliberr); - file_out << "intieta " << jk << " " << ij << " " << ieta << " " << mean_phi_hst->FindBin(double(ieta)) - << " " << calibc << " " << caliberr << std::endl; - } else if (iijj == 3) { - const_eta[jk]->Fill(ij + 1, calibc); - const_eta[jk]->SetBinError(const_eta[jk]->FindBin(ij + 1), caliberr); - - peak_eta[jk]->Fill(ij + 1, fitres[4]); - peak_eta[jk]->SetBinError(peak_eta[jk]->FindBin(ij + 1), parserr[4]); - - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - const_eta_phi->Fill(ieta, ij + 1, calibc); - file_out << "intietax " << jk << " " << ij << " " << ieta << " " - << const_eta_phi->FindBin(ieta, ij + 1) << std::endl; - if (caliberr > 0) { - const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), caliberr); - - mean_eta[ij] += calibc / (caliberr * caliberr); - mean_phi[jk] += calibc / (caliberr * caliberr); - - rms_eta[ij] += 1. / (caliberr * caliberr); - rms_phi[jk] += 1. / (caliberr * caliberr); - - } else { - const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), 0.0); - } - } else if (iijj == 1) { - const_hpdrm[jk]->Fill(ij + 1, calibc); - const_hpdrm[jk]->SetBinError(const_hpdrm[jk]->FindBin(ij + 1), caliberr); - - peak_hpdrm[jk]->Fill(ij + 1, fitres[4]); - peak_hpdrm[jk]->SetBinError(peak_hpdrm[jk]->FindBin(ij + 1), parserr[4]); - } - - file_out << "HO 4 " << iijj << " " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " " - << std::setw(7) << calibc << " " << std::setw(7) << caliberr << std::endl; - } - } - - } else { //if (signall[izone]->GetEntries() >10) { - signall[izone]->Draw(); - float varx = 0.000; - int kl = (jk < 15) ? jk + 1 : 14 - jk; - file_out << "histinfo" << iijj << " nof " << 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) << varx << " " << std::setw(3) - << varx << std::endl; - - file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx - << " " << varx << " " << varx << " " << varx << " " << varx << std::endl; - file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx - << " " << varx << " " << varx << " " << varx << " " << varx << std::endl; - } - iiter++; - if (iiter % nsample == 0) { - c0->Update(); - - for (int kl = 0; kl < nsample; kl++) { - if (gx0[kl]) { - delete gx0[kl]; - gx0[kl] = nullptr; - } - if (ped0fun[kl]) { - delete ped0fun[kl]; - ped0fun[kl] = nullptr; - } - if (signal[kl]) { - delete signal[kl]; - signal[kl] = nullptr; - } - if (pedfun[kl]) { - delete pedfun[kl]; - pedfun[kl] = nullptr; - } - if (sigfun[kl]) { - delete sigfun[kl]; - sigfun[kl] = nullptr; - } - if (signalx[kl]) { - delete signalx[kl]; - signalx[kl] = nullptr; - } - if (signall[kl]) { - delete signall[kl]; - signall[kl] = nullptr; - } - if (pedstll[kl]) { - delete pedstll[kl]; - pedstll[kl] = nullptr; - } - } - } - } //for (int jk=0; jkUpdate(); - for (int kl = 0; kl < nsample; kl++) { - if (gx0[kl]) { - delete gx0[kl]; - gx0[kl] = nullptr; - } - if (ped0fun[kl]) { - delete ped0fun[kl]; - ped0fun[kl] = nullptr; - } - if (signal[kl]) { - delete signal[kl]; - signal[kl] = nullptr; - } - if (pedfun[kl]) { - delete pedfun[kl]; - pedfun[kl] = nullptr; - } - if (sigfun[kl]) { - delete sigfun[kl]; - sigfun[kl] = nullptr; - } - if (signalx[kl]) { - delete signalx[kl]; - signalx[kl] = nullptr; - } - if (signall[kl]) { - delete signall[kl]; - signall[kl] = nullptr; - } - if (pedstll[kl]) { - delete pedstll[kl]; - pedstll[kl] = nullptr; - } - } - } - - delete c0; - - xsiz = 600; //int xsiz = 600; - ysiz = 800; //int ysiz = 800; - - gStyle->SetTitleFontSize(0.05); - gStyle->SetTitleSize(0.025, "XYZ"); - gStyle->SetLabelSize(0.025, "XYZ"); - gStyle->SetStatFontSize(.045); - - gStyle->SetOptStat(0); - ps.NewPage(); - TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz); - ped_evt->Draw(); - c1->Update(); - - ps.NewPage(); - ped_statmean->Draw(); - c1->Update(); - - ps.NewPage(); - ped_rms->Draw(); - c1->Update(); - - ps.NewPage(); - ped_mean->Draw(); - c1->Update(); - - ps.NewPage(); - ped_width->Draw(); - c1->Update(); - - ps.NewPage(); - sig_evt->Draw(); - c1->Update(); - - ps.NewPage(); - sig_statmean->Draw(); - c1->Update(); - - ps.NewPage(); - sig_rms->Draw(); - c1->Update(); - - ps.NewPage(); - fit_chi->Draw(); - c1->Update(); - - ps.NewPage(); - fit_sigevt->Draw(); - c1->Update(); - - ps.NewPage(); - fit_bkgevt->Draw(); - c1->Update(); - - ps.NewPage(); - sig_mean->Draw(); - c1->Update(); - - ps.NewPage(); - sig_width->Draw(); - c1->Update(); - - ps.NewPage(); - sig_sigma->Draw(); - c1->Update(); - - ps.NewPage(); - sig_meanerr->Draw(); - c1->Update(); - - ps.NewPage(); - sig_meanerrp->Draw(); - c1->Update(); - - ps.NewPage(); - sig_signf->Draw(); - c1->Update(); - - ps.Close(); - delete c1; - - file_out.close(); - - if (m_figure) { - xsiz = 700; - ysiz = 450; - - gStyle->SetTitleFontSize(0.09); - gStyle->SetPadBottomMargin(0.17); - gStyle->SetPadLeftMargin(0.18); - gStyle->SetPadRightMargin(0.01); - gStyle->SetOptLogy(0); - gStyle->SetOptStat(0); - - TCanvas* c2 = new TCanvas("c2", "runfile", xsiz, ysiz); - c2->Divide(5, 3); - - for (int side = 0; side < 2; side++) { - gStyle->SetNdivisions(303, "XY"); - gStyle->SetPadRightMargin(0.01); - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - - int nzone = 0; - - for (int ij = nmn; ij < nmx; ij++) { - c2->cd(nzone + 1); - const_eta[ij]->GetXaxis()->SetTitle("#phi index"); - const_eta[ij]->GetXaxis()->SetTitleSize(.08); - const_eta[ij]->GetXaxis()->CenterTitle(); - const_eta[ij]->GetXaxis()->SetTitleOffset(0.9); - const_eta[ij]->GetXaxis()->SetLabelSize(.085); - const_eta[ij]->GetXaxis()->SetLabelOffset(.01); - - const_eta[ij]->GetYaxis()->SetLabelSize(.08); - const_eta[ij]->GetYaxis()->SetLabelOffset(.01); - const_eta[ij]->GetYaxis()->SetTitle("GeV/MIP-GeV!!"); - - const_eta[ij]->GetYaxis()->SetTitleSize(.085); - const_eta[ij]->GetYaxis()->CenterTitle(); - const_eta[ij]->GetYaxis()->SetTitleOffset(1.3); - const_eta[ij]->SetMarkerSize(0.60); - const_eta[ij]->SetMarkerColor(2); - const_eta[ij]->SetMarkerStyle(20); - - const_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "calibho_%i_side%i.eps", irunold, side); - c2->SaveAs(out_file); - - sprintf(out_file, "calibho_%i_side%i.jpg", irunold, side); - c2->SaveAs(out_file); - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2->cd(nzone + 1); - peak_eta[ij]->GetXaxis()->SetTitle("#phi index"); - peak_eta[ij]->GetXaxis()->SetTitleSize(.08); - peak_eta[ij]->GetXaxis()->CenterTitle(); - peak_eta[ij]->GetXaxis()->SetTitleOffset(0.90); - peak_eta[ij]->GetXaxis()->SetLabelSize(.08); - peak_eta[ij]->GetXaxis()->SetLabelOffset(.01); - - peak_eta[ij]->GetYaxis()->SetLabelSize(.08); - peak_eta[ij]->GetYaxis()->SetLabelOffset(.01); - peak_eta[ij]->GetYaxis()->SetTitle("GeV"); - - peak_eta[ij]->GetYaxis()->SetTitleSize(.085); - peak_eta[ij]->GetYaxis()->CenterTitle(); - peak_eta[ij]->GetYaxis()->SetTitleOffset(1.3); - - peak_eta[ij]->SetMarkerSize(0.60); - peak_eta[ij]->SetMarkerColor(2); - peak_eta[ij]->SetMarkerStyle(20); - - peak_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "peakho_%i_side%i.eps", irunold, side); - c2->SaveAs(out_file); - - sprintf(out_file, "peakho_%i_side%i.jpg", irunold, side); - c2->SaveAs(out_file); - } - delete c2; - - // if (m_combined) { - gStyle->SetTitleFontSize(0.045); - gStyle->SetPadRightMargin(0.13); - gStyle->SetPadBottomMargin(0.15); - gStyle->SetPadLeftMargin(0.1); - gStyle->SetOptStat(0); - xsiz = 700; - ysiz = 600; - TCanvas* c1 = new TCanvas("c1", "Fitted const in each tower", xsiz, ysiz); - const_eta_phi->GetXaxis()->SetTitle("#eta"); - const_eta_phi->GetXaxis()->SetTitleSize(0.065); - const_eta_phi->GetXaxis()->SetTitleOffset(0.85); //6); - const_eta_phi->GetXaxis()->CenterTitle(); - const_eta_phi->GetXaxis()->SetLabelSize(0.045); - const_eta_phi->GetXaxis()->SetLabelOffset(0.01); - - const_eta_phi->GetYaxis()->SetTitle("#phi"); - const_eta_phi->GetYaxis()->SetTitleSize(0.075); - const_eta_phi->GetYaxis()->SetTitleOffset(0.5); - const_eta_phi->GetYaxis()->CenterTitle(); - const_eta_phi->GetYaxis()->SetLabelSize(0.045); - const_eta_phi->GetYaxis()->SetLabelOffset(0.01); - - const_eta_phi->Draw("colz"); - sprintf(out_file, "high_hoconst_eta_phi_%i.jpg", irunold); - c1->SaveAs(out_file); - - delete c1; - - for (int jk = 0; jk < netamx; jk++) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - if (rms_phi[jk] > 0) { - mean_phi_ave->Fill(ieta, mean_phi[jk] / rms_phi[jk]); - mean_phi_ave->SetBinError(mean_phi_ave->FindBin(ieta), pow(double(rms_phi[jk]), -0.5)); - } - } - - for (int ij = 0; ij < nphimx; ij++) { - if (rms_eta[ij] > 0) { - mean_eta_ave->Fill(ij + 1, mean_eta[ij] / rms_eta[ij]); - mean_eta_ave->SetBinError(mean_eta_ave->FindBin(ij + 1), pow(double(rms_eta[ij]), -0.5)); - } - } - - ysiz = 450; - gStyle->SetPadLeftMargin(0.13); - gStyle->SetPadRightMargin(0.03); - - TCanvas* c2y = new TCanvas("c2", "Avearge signal in eta and phi", xsiz, ysiz); - c2y->Divide(2, 1); - mean_eta_ave->GetXaxis()->SetTitle("#phi"); - mean_eta_ave->GetXaxis()->SetTitleSize(0.085); - mean_eta_ave->GetXaxis()->SetTitleOffset(0.65); - mean_eta_ave->GetXaxis()->CenterTitle(); - mean_eta_ave->GetXaxis()->SetLabelSize(0.05); - mean_eta_ave->GetXaxis()->SetLabelOffset(0.001); - - mean_eta_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP"); - mean_eta_ave->GetYaxis()->SetTitleSize(0.055); - mean_eta_ave->GetYaxis()->SetTitleOffset(1.3); - mean_eta_ave->GetYaxis()->CenterTitle(); - mean_eta_ave->GetYaxis()->SetLabelSize(0.045); - mean_eta_ave->GetYaxis()->SetLabelOffset(0.01); - mean_eta_ave->SetMarkerSize(0.60); - mean_eta_ave->SetMarkerColor(2); - mean_eta_ave->SetMarkerStyle(20); - - c2y->cd(1); - mean_eta_ave->Draw(); - - mean_phi_ave->GetXaxis()->SetTitle("#eta"); - mean_phi_ave->GetXaxis()->SetTitleSize(0.085); - mean_phi_ave->GetXaxis()->SetTitleOffset(0.65); //55); - mean_phi_ave->GetXaxis()->CenterTitle(); - mean_phi_ave->GetXaxis()->SetLabelSize(0.05); - mean_phi_ave->GetXaxis()->SetLabelOffset(0.001); - - mean_phi_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP"); - mean_phi_ave->GetYaxis()->SetTitleSize(0.055); - mean_phi_ave->GetYaxis()->SetTitleOffset(1.3); - mean_phi_ave->GetYaxis()->CenterTitle(); - mean_phi_ave->GetYaxis()->SetLabelSize(0.045); - mean_phi_ave->GetYaxis()->SetLabelOffset(0.01); - mean_phi_ave->SetMarkerSize(0.60); - mean_phi_ave->SetMarkerColor(2); - mean_phi_ave->SetMarkerStyle(20); - - c2y->cd(2); - mean_phi_ave->Draw(); - - sprintf(out_file, "high_hoaverage_eta_phi_%i.jpg", irunold); - c2y->SaveAs(out_file); - - delete c2y; - // } else { //m_combined - - xsiz = 800; - ysiz = 450; - TCanvas* c3 = new TCanvas("c3", "Avearge signal in eta and phi", xsiz, ysiz); - c3->Divide(2, 1); - mean_phi_hst->GetXaxis()->SetTitle("#eta"); - mean_phi_hst->GetXaxis()->SetTitleSize(0.065); - mean_phi_hst->GetXaxis()->SetTitleOffset(0.9); - mean_phi_hst->GetXaxis()->CenterTitle(); - mean_phi_hst->GetXaxis()->SetLabelSize(0.065); - mean_phi_hst->GetXaxis()->SetLabelOffset(0.001); - - mean_phi_hst->GetYaxis()->SetTitle("GeV/MIP"); - mean_phi_hst->GetYaxis()->SetTitleSize(0.055); - mean_phi_hst->GetYaxis()->SetTitleOffset(0.9); - mean_phi_hst->GetYaxis()->CenterTitle(); - mean_phi_hst->GetYaxis()->SetLabelSize(0.065); - mean_phi_hst->GetYaxis()->SetLabelOffset(0.01); - - mean_phi_hst->SetMarkerColor(4); - mean_phi_hst->SetMarkerSize(0.8); - mean_phi_hst->SetMarkerStyle(20); - mean_phi_hst->Draw(); - - sprintf(out_file, "low_mean_phi_hst_%i.jpg", irunold); - c3->SaveAs(out_file); - - delete c3; - - // } //m_combined - - gStyle->SetOptLogy(1); - gStyle->SetPadTopMargin(.1); - gStyle->SetPadLeftMargin(.15); - xsiz = 800; - ysiz = 500; - TCanvas* c0x = new TCanvas("c0x", "Signal in each ring", xsiz, ysiz); - - c0x->Divide(3, 2); - for (int ij = 0; ij < ringmx; ij++) { - int iread = (ij == 2) ? routmx : rout12mx; - com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (GeV)"); - - com_sigrsg[ij][iread]->GetXaxis()->SetTitleSize(0.060); - com_sigrsg[ij][iread]->GetXaxis()->SetTitleOffset(1.05); - com_sigrsg[ij][iread]->GetXaxis()->CenterTitle(); - com_sigrsg[ij][iread]->GetXaxis()->SetLabelSize(0.065); - com_sigrsg[ij][iread]->GetXaxis()->SetLabelOffset(0.01); - - com_sigrsg[ij][iread]->GetYaxis()->SetLabelSize(0.065); - com_sigrsg[ij][iread]->GetYaxis()->SetLabelOffset(0.01); - - com_sigrsg[ij][iread]->SetLineWidth(3); - com_sigrsg[ij][iread]->SetLineColor(4); - - c0x->cd(ij + 1); - com_sigrsg[ij][iread]->Draw(); - - com_crossg[ij][iread]->SetLineWidth(2); - com_crossg[ij][iread]->SetLineColor(2); - com_crossg[ij][iread]->Draw("same"); - } - sprintf(out_file, "hosig_ring_%i.jpg", irunold); - c0x->SaveAs(out_file); - delete c0x; - - gStyle->SetTitleFontSize(0.06); - gStyle->SetOptStat(0); - gStyle->SetOptLogy(0); - - TCanvas* c0 = new TCanvas("c0", "Signal in each ring", xsiz, ysiz); - - c0->Divide(3, 2); - for (int jk = 0; jk < ringmx; jk++) { - peak_hpdrm[jk]->GetXaxis()->SetTitle("RM #"); - peak_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070); - peak_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.0); - peak_hpdrm[jk]->GetXaxis()->CenterTitle(); - peak_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065); - peak_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01); - - peak_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)/MIP"); - - peak_hpdrm[jk]->GetYaxis()->SetTitleSize(0.07); - peak_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.3); - peak_hpdrm[jk]->GetYaxis()->CenterTitle(); - peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); - peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - peak_hpdrm[jk]->SetMarkerSize(0.60); - peak_hpdrm[jk]->SetMarkerColor(2); - peak_hpdrm[jk]->SetMarkerStyle(20); - - c0->cd(jk + 1); - peak_hpdrm[jk]->Draw(); - } - sprintf(out_file, "comb_peak_hpdrm_%i.jpg", irunold); - c0->SaveAs(out_file); - - delete c0; - - TCanvas* c1y = new TCanvas("c1y", "Signal in each ring", xsiz, ysiz); - - c1y->Divide(3, 2); - for (int jk = 0; jk < ringmx; jk++) { - const_hpdrm[jk]->GetXaxis()->SetTitle("RM #"); - const_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070); - const_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.3); - const_hpdrm[jk]->GetXaxis()->CenterTitle(); - const_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065); - const_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01); - - const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)"); - const_hpdrm[jk]->GetYaxis()->SetTitleSize(0.065); - const_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.0); - const_hpdrm[jk]->GetYaxis()->CenterTitle(); - const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); - const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - const_hpdrm[jk]->SetMarkerSize(0.60); - const_hpdrm[jk]->SetMarkerColor(2); - const_hpdrm[jk]->SetMarkerStyle(20); - - c1y->cd(jk + 1); - const_hpdrm[jk]->Draw(); - } - - sprintf(out_file, "comb_const_hpdrm_%i.jpg", irunold); - c1y->SaveAs(out_file); - - delete c1y; - } - - } // if (m_constant){ - - if (m_figure) { - for (int ij = 0; ij < nphimx; ij++) { - for (int jk = 0; jk < netamx; jk++) { - stat_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetEntries()); - statmn_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetMean()); - } - } - - xsiz = 700; - ysiz = 450; - gStyle->SetTitleFontSize(0.09); - gStyle->SetPadBottomMargin(0.14); - gStyle->SetPadLeftMargin(0.17); - gStyle->SetPadRightMargin(0.01); - gStyle->SetNdivisions(303, "XY"); - gStyle->SetOptLogy(1); - - TCanvas* c2x = new TCanvas("c2x", "runfile", xsiz, ysiz); - c2x->Divide(5, 3); - for (int side = 0; side < 2; side++) { - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - int nzone = 0; - char name[200]; - - for (int ij = nmn; ij < nmx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - c2x->cd(nzone + 1); - sprintf(name, "GeV(#eta=%i)", ieta); - sigrsg[ij][nphimx]->GetXaxis()->SetTitle(name); - sigrsg[ij][nphimx]->GetXaxis()->SetTitleSize(.08); - sigrsg[ij][nphimx]->GetXaxis()->CenterTitle(); - sigrsg[ij][nphimx]->GetXaxis()->SetTitleOffset(0.90); - sigrsg[ij][nphimx]->GetXaxis()->SetLabelSize(.08); - sigrsg[ij][nphimx]->GetXaxis()->SetLabelOffset(.01); - - sigrsg[ij][nphimx]->GetYaxis()->SetLabelSize(.08); - sigrsg[ij][nphimx]->GetYaxis()->SetLabelOffset(.01); - sigrsg[ij][nphimx]->SetLineWidth(2); - sigrsg[ij][nphimx]->SetLineColor(4); - sigrsg[ij][nphimx]->Draw(); - crossg[ij][nphimx]->SetLineWidth(2); - crossg[ij][nphimx]->SetLineColor(2); - crossg[ij][nphimx]->Draw("same"); - nzone++; - } - - sprintf(out_file, "sig_ho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "sig_ho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - } - - gStyle->SetOptLogy(0); - c2x = new TCanvas("c2x", "runfile", xsiz, ysiz); - c2x->Divide(5, 3); - for (int side = 0; side < 2; side++) { - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - int nzone = 0; - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2x->cd(nzone + 1); - statmn_eta[ij]->SetLineWidth(2); - statmn_eta[ij]->SetLineColor(4); - statmn_eta[ij]->GetXaxis()->SetTitle("#phi index"); - statmn_eta[ij]->GetXaxis()->SetTitleSize(.08); - statmn_eta[ij]->GetXaxis()->CenterTitle(); - statmn_eta[ij]->GetXaxis()->SetTitleOffset(0.9); - statmn_eta[ij]->GetYaxis()->SetLabelSize(.08); - statmn_eta[ij]->GetYaxis()->SetLabelOffset(.01); - statmn_eta[ij]->GetXaxis()->SetLabelSize(.08); - statmn_eta[ij]->GetXaxis()->SetLabelOffset(.01); - statmn_eta[ij]->GetYaxis()->SetTitle("GeV"); - statmn_eta[ij]->GetYaxis()->SetTitleSize(.075); - statmn_eta[ij]->GetYaxis()->CenterTitle(); - statmn_eta[ij]->GetYaxis()->SetTitleOffset(1.30); - - statmn_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "statmnho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "statmnho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - - gStyle->SetOptLogy(1); - gStyle->SetNdivisions(203, "XY"); - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2x->cd(nzone + 1); - stat_eta[ij]->SetLineWidth(2); - stat_eta[ij]->SetLineColor(4); - stat_eta[ij]->GetXaxis()->SetTitle("#phi index"); - stat_eta[ij]->GetXaxis()->SetTitleSize(.08); - stat_eta[ij]->GetXaxis()->CenterTitle(); - stat_eta[ij]->GetXaxis()->SetTitleOffset(0.80); - stat_eta[ij]->GetXaxis()->SetLabelSize(.08); - stat_eta[ij]->GetXaxis()->SetLabelOffset(.01); - stat_eta[ij]->GetYaxis()->SetLabelSize(.08); - stat_eta[ij]->GetYaxis()->SetLabelOffset(.01); - - stat_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "statho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "statho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - } - delete c2x; - - } //if (m_figure) { - - if (!m_constant) { //m_constant - for (int jk = 0; jk < netamx; jk++) { - for (int ij = 0; ij < nphimx; ij++) { - if (crossg[jk][ij]) { - delete crossg[jk][ij]; - } - if (sigrsg[jk][ij]) { - delete sigrsg[jk][ij]; - } - } - } - } + } //if (isCosMu) } //define this as a plug-in From d81789158de35d67d9594196cdef9340f3f3d755 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 11:11:50 -0500 Subject: [PATCH 557/923] Added esConsumes directly in MuonCkfTrajectoryBuilder --- RecoMuon/L3TrackFinder/interface/MuonCkfTrajectoryBuilder.h | 2 ++ RecoMuon/L3TrackFinder/src/MuonCkfTrajectoryBuilder.cc | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RecoMuon/L3TrackFinder/interface/MuonCkfTrajectoryBuilder.h b/RecoMuon/L3TrackFinder/interface/MuonCkfTrajectoryBuilder.h index 7b53f3d30cc67..f4b205a6803c2 100644 --- a/RecoMuon/L3TrackFinder/interface/MuonCkfTrajectoryBuilder.h +++ b/RecoMuon/L3TrackFinder/interface/MuonCkfTrajectoryBuilder.h @@ -4,6 +4,7 @@ #include "RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h" #include "FWCore/Framework/interface/ESWatcher.h" +class TrackingComponentsRecord; class MuonCkfTrajectoryBuilder : public CkfTrajectoryBuilder { public: MuonCkfTrajectoryBuilder(const edm::ParameterSet& conf, edm::ConsumesCollector& iC); @@ -30,6 +31,7 @@ class MuonCkfTrajectoryBuilder : public CkfTrajectoryBuilder { const double theDeltaPhi; const std::string theProximityPropagatorName; const Propagator* theProximityPropagator; + const edm::ESGetToken thePropagatorToken; edm::ESWatcher theEstimatorWatcher; std::unique_ptr theEtaPhiEstimator; }; diff --git a/RecoMuon/L3TrackFinder/src/MuonCkfTrajectoryBuilder.cc b/RecoMuon/L3TrackFinder/src/MuonCkfTrajectoryBuilder.cc index b8934b097e571..74d68df5ac7d5 100644 --- a/RecoMuon/L3TrackFinder/src/MuonCkfTrajectoryBuilder.cc +++ b/RecoMuon/L3TrackFinder/src/MuonCkfTrajectoryBuilder.cc @@ -21,6 +21,7 @@ MuonCkfTrajectoryBuilder::MuonCkfTrajectoryBuilder(const edm::ParameterSet& conf theDeltaPhi(conf.getParameter("deltaPhi")), theProximityPropagatorName(conf.getParameter("propagatorProximity")), theProximityPropagator(nullptr), + thePropagatorToken(iC.esConsumes(edm::ESInputTag("", theProximityPropagatorName))), theEtaPhiEstimator(nullptr) { //and something specific to me ? theUseSeedLayer = conf.getParameter("useSeedLayer"); @@ -32,9 +33,7 @@ MuonCkfTrajectoryBuilder::~MuonCkfTrajectoryBuilder() {} void MuonCkfTrajectoryBuilder::setEvent_(const edm::Event& iEvent, const edm::EventSetup& iSetup) { CkfTrajectoryBuilder::setEvent_(iEvent, iSetup); - edm::ESHandle propagatorProximityHandle; - iSetup.get().get(theProximityPropagatorName, propagatorProximityHandle); - theProximityPropagator = propagatorProximityHandle.product(); + theProximityPropagator = &iSetup.getData(thePropagatorToken); // theEstimator is set for this event in the base class if (theEstimatorWatcher.check(iSetup) && theDeltaEta > 0 && theDeltaPhi > 0) From bec9a31ff24b5a0c18afb17fec9c28c8f804d15a Mon Sep 17 00:00:00 2001 From: yuanchao Date: Tue, 14 Sep 2021 00:23:35 +0800 Subject: [PATCH 558/923] add back duplicated file removal in #35105 --- .../DTRawToDigi/interface/DTROS25Data.h | 61 +++++++ .../ESRawToDigi/interface/ESCrcKchipFast.h | 50 +++++ .../interface/ECALUnpackerException.h | 32 ++++ .../EcalRawToDigi/interface/MyWatcher.h | 43 +++++ .../RPCRawToDigi/interface/RPCRawSynchro.h | 1 + EventFilter/Utilities/interface/ModuleWeb.h | 51 ++++++ EventFilter/Utilities/interface/config_json.h | 43 +++++ .../interface/BPHMuonChargeSelect.h | 54 ++++++ .../interface/BPHParticleChargeSelect.h | 73 ++++++++ IOPool/Common/interface/CustomStreamer.h | 58 ++++++ .../interface/BoxNDScanner.h | 172 ++++++++++++++++++ .../interface/MultivariateFunctorScanner.h | 77 ++++++++ .../interface/rescanArray.h | 122 +++++++++++++ .../interface/CorrectedMETProducerT.h | 110 +++++++++++ 14 files changed, 947 insertions(+) create mode 100644 EventFilter/DTRawToDigi/interface/DTROS25Data.h create mode 100644 EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h create mode 100644 EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h create mode 100644 EventFilter/EcalRawToDigi/interface/MyWatcher.h create mode 100644 EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h create mode 100644 EventFilter/Utilities/interface/ModuleWeb.h create mode 100644 EventFilter/Utilities/interface/config_json.h create mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h create mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h create mode 100644 IOPool/Common/interface/CustomStreamer.h create mode 100644 JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h create mode 100644 JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h create mode 100644 JetMETCorrections/InterpolationTables/interface/rescanArray.h create mode 100644 JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h diff --git a/EventFilter/DTRawToDigi/interface/DTROS25Data.h b/EventFilter/DTRawToDigi/interface/DTROS25Data.h new file mode 100644 index 0000000000000..57ea5ecaa1df0 --- /dev/null +++ b/EventFilter/DTRawToDigi/interface/DTROS25Data.h @@ -0,0 +1,61 @@ +#ifndef DTRawToDigi_DTROS25Data_h +#define DTRawToDigi_DTROS25Data_h + +/** \class DTROS25Data + * The collection containing DT ROS25 status data. + * + * \author M. Zanetti - INFN Padova + */ + +#include + +#include + + +typedef std::pair DTTDCData; + +class DTROS25Data { + +public: + + /// Constructors + DTROS25Data(int ROSId = 0): theROSId(ROSId) {} + + + /// Destructor + virtual ~DTROS25Data() {} + + /// Setters + inline void setROSId(const int & ID) { theROSId = ID; } + + inline void addROSTrailer( const DTROSTrailerWord & word) { theROSTrailers.push_back(word); } + inline void addROSError( const DTROSErrorWord & word) { theROSErrors.push_back(word); } + inline void addROSDebug( const DTROSDebugWord & word) { theROSDebugs.push_back(word); } + inline void addROBTrailer( const DTROBTrailerWord & word) { theROBTrailers.push_back(word); } + inline void addTDCMeasurement( const DTTDCMeasurementWord & word) { theTDCMeasurements.push_back(word); } + inline void addTDCData( const DTTDCData & tdcData) { theTDCData.push_back(tdcData); } + + /// Getters + inline int getROSID() const { return theROSId; } + + inline const std::vector& getROSTrailers() const {return theROSTrailers;} + inline const std::vector& getROSErrors() const {return theROSErrors;} + inline const std::vector& getROSDebugs() const {return theROSDebugs;} + inline const std::vector& getROBTrailers() const {return theROBTrailers;} + inline const std::vector& getTDCMeasurements() const {return theTDCMeasurements;} + inline const std::vector& getTDCData() const {return theTDCData;} + +private: + + int theROSId; + + std::vector theROSTrailers; + std::vector theROSErrors; + std::vector theROSDebugs; + std::vector theROBTrailers; + std::vector theTDCMeasurements; + std::vector theTDCData; + +}; + +#endif diff --git a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h b/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h new file mode 100644 index 0000000000000..206cbc5c734dc --- /dev/null +++ b/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h @@ -0,0 +1,50 @@ +#ifndef ESCrcKchipFast_H +#define ESCrcKchipFast_H + +#include + +class ESCrcKchipFast { + + private : + + uint32_t crc; + + public: + + ESCrcKchipFast() { + init(); + reset() ; + }; + + void init() { + crc = 0x0ffff ; + } + + void reset() { + crc = 0x0ffff ; + } ; + + void add(unsigned int data) { + for (int i=0;i<16;i++) + { + if ((crc&0x0001) == (data&0x0001)) + crc=crc>>1; + else + crc=(crc>>1)^0x8408; // flipped 0x1021; + data=(data>>1); + } + }; + + uint32_t get_crc() { + return crc ; + }; + + bool isCrcOk(unsigned int crcin=0x0000) { + return ((get_crc()==crcin) ? true : false ); + }; + + ~ESCrcKchipFast() { } ; + +}; + +#endif diff --git a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h b/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h new file mode 100644 index 0000000000000..a9f1e57d0cdb2 --- /dev/null +++ b/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h @@ -0,0 +1,32 @@ +// Date : 30/05/2005 +// Author : N.Almeida (LIP) + +#ifndef ECALUNPACKEREXCEPTION_H +#define ECALUNPACKEREXCEPTION_H + +#include +#include +#include + + +class ECALUnpackerException { + public : + + /** + * Constructor + */ + ECALUnpackerException(std::ostringstream a){ info_=a.str(); } + + ECALUnpackerException(std::string a){info_=a;} + /** + * Exception's discription + */ + std::string what() const throw() { return info_;} + + protected : + + std::string info_; + +}; + +#endif diff --git a/EventFilter/EcalRawToDigi/interface/MyWatcher.h b/EventFilter/EcalRawToDigi/interface/MyWatcher.h new file mode 100644 index 0000000000000..5d26a0df24808 --- /dev/null +++ b/EventFilter/EcalRawToDigi/interface/MyWatcher.h @@ -0,0 +1,43 @@ +#ifndef MyWATCHER_H +#define MyWATCHER_H + +#include "TStopwatch.h" +#include +#include + +#ifdef EDM_ML_DEBUG +class MyWatcher : public TStopwatch { + public: + MyWatcher(const std::string n=""):name(n),total(0) {} + ~MyWatcher(){} + + std::string start(bool r=true){Start(r); return " [Start]";} + std::string continu(){Continue(); return " [Continue]";} + std::string reset(){Reset(); return " [Reset]";} + std::string stop() {Stop(); return " [Stop]";} + std::string lap() { + std::stringstream o; + double r=RealTime(); + total+=r; + o<<"\n "< +#include +#include + + + + namespace evf + { + + + namespace moduleweb { + class ForkParams { + public: + ForkParams():slotId(-1),restart(0),isMaster(-1){} + int slotId; + bool restart; + int isMaster; + }; + class ForkInfoObj { + public: + ForkInfoObj() + { + control_sem_ = new sem_t; + sem_init(control_sem_,0,0); + stopCondition=0; + receivedStop_=false; + } + ~ForkInfoObj() + { + sem_destroy(control_sem_); + delete control_sem_; + } + void lock() {if (mst_lock_) pthread_mutex_lock(mst_lock_);} + void unlock() {if (mst_lock_) pthread_mutex_unlock(mst_lock_);} + void (*forkHandler) (void *); + ForkParams forkParams; + unsigned int stopCondition; + bool receivedStop_; + sem_t *control_sem_; + pthread_mutex_t * mst_lock_; + void * fuAddr; + }; + } + +} +#endif diff --git a/EventFilter/Utilities/interface/config_json.h b/EventFilter/Utilities/interface/config_json.h new file mode 100644 index 0000000000000..5d334cbc5e6b9 --- /dev/null +++ b/EventFilter/Utilities/interface/config_json.h @@ -0,0 +1,43 @@ +#ifndef JSON_CONFIG_H_INCLUDED +# define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 +/// If defined, indicates that Json specific container should be used +/// (hash table & simple deque container with customizable allocator). +/// THIS FEATURE IS STILL EXPERIMENTAL! +//# define JSON_VALUE_USE_INTERNAL_MAP 1 +/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. +/// The memory pools allocator used optimization (initializing Value and ValueInternalLink +/// as if it was a POD) that may cause some validation tool to report errors. +/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. +//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 + +/// If defined, indicates that Json use exception to report invalid type manipulation +/// instead of C assert macro. +# define JSON_USE_EXCEPTION 1 + +# ifdef JSON_IN_CPPTL +# include +# ifndef JSON_USE_CPPTL +# define JSON_USE_CPPTL 1 +# endif +# endif + +# ifdef JSON_IN_CPPTL +# define JSON_API CPPTL_API +# elif defined(JSON_DLL_BUILD) +# define JSON_API __declspec(dllexport) +# elif defined(JSON_DLL) +# define JSON_API __declspec(dllimport) +# else +# define JSON_API +# endif + +#endif // JSON_CONFIG_H_INCLUDED diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h new file mode 100644 index 0000000000000..3f7d574ed79fc --- /dev/null +++ b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h @@ -0,0 +1,54 @@ +#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h +#define HeavyFlavorAnalysis_SpecificDecay_BPHMuonChargeSelect_h +/** \class BPHMuonChargeSelect + * + * Description: + * Class for muon selection by charge + * + * \author Paolo Ronchese INFN Padova + * + */ + +//---------------------- +// Base Class Headers -- +//---------------------- +#include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h" + +//------------------------------------ +// Collaborating Class Declarations -- +//------------------------------------ +#include "DataFormats/PatCandidates/interface/Muon.h" + +//--------------- +// C++ Headers -- +//--------------- + +// --------------------- +// -- Class Interface -- +// --------------------- + +class BPHMuonChargeSelect : public BPHParticleChargeSelect { +public: + /** Constructor + */ + BPHMuonChargeSelect(int c) : BPHParticleChargeSelect(c) {} + + // deleted copy constructor and assignment operator + BPHMuonChargeSelect(const BPHMuonChargeSelect& x) = delete; + BPHMuonChargeSelect& operator=(const BPHMuonChargeSelect& x) = delete; + + /** Destructor + */ + ~BPHMuonChargeSelect() override {} + + /** Operations + */ + /// select muon + bool accept(const reco::Candidate& cand) const override { + if (dynamic_cast(&cand) == nullptr) + return false; + return BPHParticleChargeSelect::accept(cand); + }; +}; + +#endif diff --git a/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h new file mode 100644 index 0000000000000..e85f05677bad2 --- /dev/null +++ b/HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h @@ -0,0 +1,73 @@ +#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h +#define HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h +/** \class BPHParticleChargeSelect + * + * Description: + * Class for particle selection by charge + * + * \author Paolo Ronchese INFN Padova + * + */ + +//---------------------- +// Base Class Headers -- +//---------------------- +#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoSelect.h" + +//------------------------------------ +// Collaborating Class Declarations -- +//------------------------------------ +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" + +//--------------- +// C++ Headers -- +//--------------- + +// --------------------- +// -- Class Interface -- +// --------------------- + +class BPHParticleChargeSelect : public BPHRecoSelect { +public: + /** Constructor + */ + BPHParticleChargeSelect(int c) : charge(c ? (c > 0 ? 1 : -1) : 0) {} + + // deleted copy constructor and assignment operator + BPHParticleChargeSelect(const BPHParticleChargeSelect& x) = delete; + BPHParticleChargeSelect& operator=(const BPHParticleChargeSelect& x) = delete; + + /** Destructor + */ + ~BPHParticleChargeSelect() override {} + + /** Operations + */ + /// select particle + bool accept(const reco::Candidate& cand) const override { + switch (charge) { + default: + case 0: + return (cand.charge() != 0); + case 1: + return (cand.charge() > 0); + case -1: + return (cand.charge() < 0); + } + return true; + }; + + /// set selection charge + void setCharge(int c) { + charge = (c ? (c > 0 ? 1 : -1) : 0); + return; + } + + /// get selection charge + double getCharge() const { return charge; } + +private: + int charge; +}; + +#endif diff --git a/IOPool/Common/interface/CustomStreamer.h b/IOPool/Common/interface/CustomStreamer.h new file mode 100644 index 0000000000000..5f07f3e7fd904 --- /dev/null +++ b/IOPool/Common/interface/CustomStreamer.h @@ -0,0 +1,58 @@ +#ifndef IOPool_Common_CustomStreamer_h +#define IOPool_Common_CustomStreamer_h + +#include +#include "TClass.h" +#include "TClassStreamer.h" +#include "TClassRef.h" +#include "FWCore/Utilities/interface/TypeID.h" +#include "TBuffer.h" + +namespace edm { + template + class CustomStreamer : public TClassStreamer { + public: + typedef T element_type; + CustomStreamer(); + void operator() (TBuffer &R__b, void *objp); + private: + std::string className_; + TClassRef cl_; + }; + + template + CustomStreamer::CustomStreamer() : + className_(TypeID(typeid(T)).className()), + cl_(className_.c_str()) + {} + + template + void + CustomStreamer::operator()(TBuffer &R__b, void *objp) { + if (R__b.IsReading()) { + cl_->ReadBuffer(R__b, objp); + } else { + cl_->WriteBuffer(R__b, objp); + } + } + + template + void + SetCustomStreamer() { + TClass *cl = TClass::GetClass(typeid(T)); + if (cl->GetStreamer() == 0) { + cl->AdoptStreamer(new CustomStreamer()); + } + } + + template + void + SetCustomStreamer(T const&) { + TClass *cl = TClass::GetClass(typeid(T)); + if (cl->GetStreamer() == 0) { + cl->AdoptStreamer(new CustomStreamer()); + } + } +} + +#endif diff --git a/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h b/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h new file mode 100644 index 0000000000000..44d32c6b037da --- /dev/null +++ b/JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h @@ -0,0 +1,172 @@ +#ifndef NPSTAT_BOXNDSCANNER_HH_ +#define NPSTAT_BOXNDSCANNER_HH_ + +/*! +// \file BoxNDScanner.h +// +// \brief Iteration over uniformly spaced coordinates inside +// a multidimensional box +// +// Author: I. Volobouev +// +// March 2010 +*/ + +#include "JetMETCorrections/InterpolationTables/interface/BoxND.h" + +namespace npstat { + /** + * A class for iterating over all coordinates in a multidimensional box + * (but not a full-fledeged iterator). The expected usage pattern is as + * follows: + * + * @code + * double* coords = ... (the buffer size should be at least box.dim()) + * for (BoxNDScanner scan(box,shape); scan.isValid(); ++scan) + * { + * scan.getCoords(coords, coordsBufferSize); + * .... Do what is necessary with coordinates .... + * .... Extract linear bin number: .............. + * scan.state(); + * } + * @endcode + * + * The coordinates will be in the middle of the bins (imagine + * a multivariate histogram with boundaries defined by the given box). + */ + template + class BoxNDScanner + { + public: + //@{ + /** + // Constructor from a bounding box and a multidimensional + // array shape + */ + inline BoxNDScanner(const BoxND& box, + const std::vector& shape) + : box_(box), state_(0UL) + {initialize(shape.empty() ? static_cast(0) : + &shape[0], shape.size());} + + inline BoxNDScanner(const BoxND& box, + const unsigned* shape, const unsigned lenShape) + : box_(box), state_(0UL) {initialize(shape, lenShape);} + //@} + + /** Dimensionality of the scan */ + inline unsigned dim() const {return box_.dim();} + + /** Retrieve current state (i.e., linear index of the scan) */ + inline unsigned long state() const {return state_;} + + /** Maximum possible state (i.e., linear index of the scan) */ + inline unsigned long maxState() const {return maxState_;} + + /** Returns false when iteration is complete */ + inline bool isValid() const {return state_ < maxState_;} + + /** Retrieve current coordinates inside the box */ + void getCoords(Numeric* x, unsigned nx) const; + + /** Retrieve current multidimensional index */ + void getIndex(unsigned* index, unsigned indexBufferLen) const; + + /** Reset the state (as if the object has just been constructed) */ + inline void reset() {state_ = 0UL;} + + /** Prefix increment */ + inline BoxNDScanner& operator++() + {if (state_ < maxState_) ++state_; return *this;} + + /** Postfix increment (distinguished by the dummy "int" parameter) */ + inline void operator++(int) {if (state_ < maxState_) ++state_;} + + /** Set the state directly */ + inline void setState(const unsigned long state) + {state_ = state <= maxState_ ? state : maxState_;} + + private: + BoxNDScanner(); + + void initialize(const unsigned* shape, unsigned lenShape); + + BoxND box_; + std::vector strides_; + std::vector bw_; + unsigned long state_; + unsigned long maxState_; + }; +} + +#include +#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" + +namespace npstat { + template + void BoxNDScanner::initialize(const unsigned* shape, + const unsigned dim) + { + if (!(dim && box_.dim() == dim)) throw npstat::NpstatInvalidArgument( + "In npstat::BoxNDScanner::initialize: incompatible scan shape"); + assert(shape); + for (unsigned j=0; j0; --j) + strides_[j - 1] = strides_[j]*shape[j]; + maxState_ = strides_[0]*shape[0]; + + bw_.reserve(dim); + for (unsigned j=0; j + void BoxNDScanner::getCoords(Numeric* x, const unsigned nx) const + { + const unsigned dim = strides_.size(); + if (nx < dim) throw npstat::NpstatInvalidArgument( + "In npstat::BoxNDScanner::getCoords: " + "insufficient length of the output buffer"); + if (state_ >= maxState_) throw npstat::NpstatRuntimeError( + "In npstat::BoxNDScanner::getCoords: invalid scanner state"); + assert(x); + + unsigned long l = state_; + for (unsigned i=0; i + void BoxNDScanner::getIndex(unsigned* ix, const unsigned nx) const + { + const unsigned dim = strides_.size(); + if (nx < dim) throw npstat::NpstatInvalidArgument( + "In npstat::BoxNDScanner::getIndex: " + "insufficient length of the output buffer"); + if (state_ >= maxState_) throw npstat::NpstatRuntimeError( + "In npstat::BoxNDScanner::getIndex: invalid scanner state"); + assert(ix); + + unsigned long l = state_; + for (unsigned i=0; i(idx); + l -= (idx * strides_[i]); + } + } +} + + +#endif // NPSTAT_BOXNDSCANNER_HH_ + diff --git a/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h b/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h new file mode 100644 index 0000000000000..c34494d45b63e --- /dev/null +++ b/JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h @@ -0,0 +1,77 @@ +#ifndef NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ +#define NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ + +/*! +// \file MultivariateFunctorScanner.h +// +// \brief Adapts any AbsMultivariateFunctor for use with ArrayND method +// "functorFill" +// +// Author: I. Volobouev +// +// July 2012 +*/ + +#include +#include +#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" + +#include "JetMETCorrections/InterpolationTables/interface/AbsMultivariateFunctor.h" + +namespace npstat { + /** + // This class adapts an object derived from AbsMultivariateFunctor + // so that it can be used with ArrayND method "functorFill" and such + */ + template + class MultivariateFunctorScanner + { + public: + /** + // A mapper for each coordinate in the "maps" argument will + // convert the array index into a proper argument for the scanned + // density. + // + // This functor will NOT make copies of either "fcn" or "maps" + // parameters. These parameters will be used by reference only + // (aliased). It is up to the user of this class to ensure proper + // lifetime of these objects. + */ + inline MultivariateFunctorScanner(const AbsMultivariateFunctor& fcn, + const std::vector& maps) + : fcn_(fcn), mapping_(maps), buf_(fcn.minDim()), dim_(fcn.minDim()) + { + if (!(dim_ && dim_ == maps.size())) throw npstat::NpstatInvalidArgument( + "In npstat::MultivariateFunctorScanner constructor: " + "incompatible arguments"); + if (dim_ != fcn.maxDim()) throw npstat::NpstatInvalidArgument( + "In npstat::MultivariateFunctorScanner constructor: " + "functors of variable dimensionality are not supported"); + } + + /** Calculate the functor value for the given array indices */ + inline double operator()(const unsigned* index, + const unsigned indexLen) const + { + if (dim_ != indexLen) throw npstat::NpstatInvalidArgument( + "In npstat::MultivariateFunctorScanner::operator(): " + "incompatible input point dimensionality"); + assert(index); + double* x = &buf_[0]; + for (unsigned i=0; i& mapping_; + mutable std::vector buf_; + unsigned dim_; + }; +} + +#endif // NPSTAT_MULTIVARIATEFUNCTORSCANNER_HH_ + diff --git a/JetMETCorrections/InterpolationTables/interface/rescanArray.h b/JetMETCorrections/InterpolationTables/interface/rescanArray.h new file mode 100644 index 0000000000000..08742b7113908 --- /dev/null +++ b/JetMETCorrections/InterpolationTables/interface/rescanArray.h @@ -0,0 +1,122 @@ +#ifndef NPSTAT_RESCANARRAY_HH_ +#define NPSTAT_RESCANARRAY_HH_ + +/*! +// \file rescanArray.h +// +// \brief Fill a multidimensional array using values from another array +// with a different shape +// +// Author: I. Volobouev +// +// October 2010 +*/ + +#include "JetMETCorrections/InterpolationTables/interface/ArrayND.h" + +namespace npstat { + /** + // A utility for filling one array using values of another. The + // array shapes do not have to be the same but the ranks have to be. + // Roughly, the arrays are treated as values of histogram bins inside + // the unit box. The array "to" is filled either with the closest bin + // value of the array "from" or with an interpolated value (if + // "interpolationDegree" parameter is not 0). + // + // interpolationDegree parameter must be one of 0, 1, or 3. + */ + template + void rescanArray(const ArrayND& from, + ArrayND* to, + unsigned interpolationDegree=0); +} + +#include +#include "JetMETCorrections/InterpolationTables/interface/NpstatException.h" + +#include "JetMETCorrections/InterpolationTables/interface/LinearMapper1d.h" + +namespace npstat { + namespace Private { + template + class ArrayMapper + { + public: + ArrayMapper(const ArrayND& from, + const ArrayND& to, + const unsigned interpolationDegree) + : mapped_(from.rank()), + from_(from), + dim_(from.rank()), + ideg_(interpolationDegree) + { + assert(dim_ == to.rank()); + if (dim_) + { + mappers_.reserve(dim_); + for (unsigned i=0; i mappers_; + mutable std::vector mapped_; + const ArrayND& from_; + unsigned dim_; + unsigned ideg_; + }; + } + + template + void rescanArray(const ArrayND& from, + ArrayND* to, + const unsigned interpolationDegree) + { + assert(to); + if (from.rank() != to->rank()) throw npstat::NpstatInvalidArgument( + "In npstat::rescanArray: incompatible dimensionalities " + "of input and output arrays"); + if (!(interpolationDegree == 0U || + interpolationDegree == 1U || + interpolationDegree == 3U)) throw npstat::NpstatInvalidArgument( + "In npstat::rescanArray: unsupported interpolation degree"); + to->functorFill(Private::ArrayMapper( + from, *to, interpolationDegree)); + } +} + + +#endif // NPSTAT_RESCANARRAY_HH_ + diff --git a/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h b/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h new file mode 100644 index 0000000000000..298d28b228224 --- /dev/null +++ b/JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h @@ -0,0 +1,110 @@ +#ifndef JetMETCorrections_Type1MET_CorrectedMETProducer_h +#define JetMETCorrections_Type1MET_CorrectedMETProducer_h + +/** \class CorrectedMETProducerT + * + * Produce MET collections with Type 1 / Type 1 + 2 corrections applied + * + * NOTE: This file defines the generic template. + * Concrete instances for CaloMET and PFMET are defined in + * JetMETCorrections/Type1MET/plugins/CorrectedCaloMETProducer.cc + * JetMETCorrections/Type1MET/plugins/CorrectedPFMETProducer.cc + * + * \authors Michael Schmitt, Richard Cavanaugh, The University of Florida + * Florent Lacroix, University of Illinois at Chicago + * Christian Veelken, LLR + * + * + * + */ + +#include "FWCore/Framework/interface/stream/EDProducer.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 "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "JetMETCorrections/Type1MET/interface/METCorrectionAlgorithm.h" +#include "DataFormats/METReco/interface/CorrMETData.h" +#include "DataFormats/Candidate/interface/Candidate.h" + +#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" + +#include + +namespace CorrectedMETProducer_namespace { + template + reco::Candidate::LorentzVector correctedP4(const T& rawMEt, const CorrMETData& correction) { + double correctedMEtPx = rawMEt.px() + correction.mex; + double correctedMEtPy = rawMEt.py() + correction.mey; + double correctedMEtPt = sqrt(correctedMEtPx * correctedMEtPx + correctedMEtPy * correctedMEtPy); + return reco::Candidate::LorentzVector(correctedMEtPx, correctedMEtPy, 0., correctedMEtPt); + } + + template + double correctedSumEt(const T& rawMEt, const CorrMETData& correction) { + return rawMEt.sumEt() + correction.sumet; + } + + template + class CorrectedMETFactoryT { + public: + T operator()(const T&, const CorrMETData&) const { + assert(0); // "place-holder" for template instantiations for concrete T types only, **not** to be called + } + }; +} // namespace CorrectedMETProducer_namespace + +template +class CorrectedMETProducerT : public edm::stream::EDProducer<> { + typedef std::vector METCollection; + +public: + explicit CorrectedMETProducerT(const edm::ParameterSet& cfg) + : moduleLabel_(cfg.getParameter("@module_label")), algorithm_(0) { + token_ = consumes(cfg.getParameter("src")); + + algorithm_ = new METCorrectionAlgorithm(cfg, consumesCollector()); + + produces(""); + } + ~CorrectedMETProducerT() { delete algorithm_; } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("src", edm::InputTag("corrPfMetType1", "type1")); + descriptions.add(defaultModuleLabel >(), desc); + } + +private: + void produce(edm::Event& evt, const edm::EventSetup& es) { + std::unique_ptr correctedMEtCollection(new METCollection); + + edm::Handle rawMEtCollection; + evt.getByToken(token_, rawMEtCollection); + + for (typename METCollection::const_iterator rawMEt = rawMEtCollection->begin(); rawMEt != rawMEtCollection->end(); + ++rawMEt) { + CorrMETData correction = algorithm_->compMETCorrection(evt); + + static const CorrectedMETProducer_namespace::CorrectedMETFactoryT correctedMET_factory{}; + T correctedMEt = correctedMET_factory(*rawMEt, correction); + + correctedMEtCollection->push_back(correctedMEt); + } + + //--- add collection of MET objects with Type 1 / Type 1 + 2 corrections applied to the event + evt.put(std::move(correctedMEtCollection)); + } + + std::string moduleLabel_; + + edm::EDGetTokenT token_; + + METCorrectionAlgorithm* algorithm_; // algorithm for computing Type 1 / Type 1 + 2 MET corrections +}; + +#endif From db116a2a0d2c45d18d3503f7d5dbc6a33f393211 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Mon, 13 Sep 2021 11:40:03 -0500 Subject: [PATCH 559/923] skip TT channels for TP channel params in hardcoded conditions --- .../src/HcalHardcodeCalibrations.cc | 4 ++ .../plugins/HcalTrigPrimDigiProducer.cc | 60 +++++++++---------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc index 7ec9989e7f8d4..43941d9d13cc4 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc +++ b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc @@ -834,6 +834,10 @@ std::unique_ptr HcalHardcodeCalibrations::produceTPChan auto result = std::make_unique(&topo); const std::vector& cells = allCells(topo, dbHardcode.killHE()); for (auto cell : cells) { + // Thinking about Phase2 and the new FIR filter, + // for now, don't put TT in TPChannelParams + if (cell.subdetId() == HcalTriggerTower) + continue; HcalTPChannelParameter item = dbHardcode.makeHardcodeTPChannelParameter(cell); result->addValues(item); } diff --git a/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc index 4cf68eb184585..4abb171cfecd3 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/plugins/HcalTrigPrimDigiProducer.cc @@ -174,40 +174,38 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet int aieta = abs(hcalTTDetId.ieta()); + // Filter weight represented in fixed point 8 bit + int fixedPointWeight = -1.0; + + // The absence of TT channels in the HcalTPChannelParameters + // is intepreted as to not use the new filter + auto tpParam = db->getHcalTPChannelParameter(hcalTTDetId, false); + if (tpParam) + fixedPointWeight = tpParam->getauxi1(); + // Do not let ieta 29 in the map // If the aieta already has a weight in the map, then move on - if (aieta < lastHERing) { - // Filter weight represented in fixed point 8 bit - int fixedPointWeight = -1.0; - - // The absence of TT channels in the HcalTPChannelParameters - // is intepreted as to not use the new filter - auto tpParam = db->getHcalTPChannelParameter(hcalTTDetId, false); - if (tpParam) - fixedPointWeight = tpParam->getauxi1(); - - if (aieta <= lastHBRing) { - // Fix number of filter presamples to one if we are using DB weights - // Size of filter is already known when using DB weights - // Weight from DB represented as 8-bit integer - if (!overrideDBweightsAndFilterHB_) { - if (fixedPointWeight != -1.0) { - theAlgo_.setNumFilterPresamplesHBQIE11(1); - theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); - } else { - theAlgo_.setNumFilterPresamplesHBQIE11(0); - theAlgo_.setWeightQIE11(aieta, 1.0); - } + if (aieta <= lastHBRing) { + // Fix number of filter presamples to one if we are using DB weights + // Size of filter is already known when using DB weights + // Weight from DB represented as 8-bit integer + if (!overrideDBweightsAndFilterHB_) { + if (fixedPointWeight != -1.0) { + theAlgo_.setNumFilterPresamplesHBQIE11(1); + theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); + } else { + theAlgo_.setNumFilterPresamplesHBQIE11(0); + theAlgo_.setWeightQIE11(aieta, 1.0); } - } else if (aieta > lastHBRing) { - if (!overrideDBweightsAndFilterHE_) { - if (fixedPointWeight != -1.0) { - theAlgo_.setNumFilterPresamplesHEQIE11(1); - theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); - } else { - theAlgo_.setNumFilterPresamplesHEQIE11(0); - theAlgo_.setWeightQIE11(aieta, 1.0); - } + } + } else if (aieta < lastHERing) { + if (!overrideDBweightsAndFilterHE_) { + if (fixedPointWeight != -1.0) { + theAlgo_.setNumFilterPresamplesHEQIE11(1); + theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); + } else { + theAlgo_.setNumFilterPresamplesHEQIE11(0); + theAlgo_.setWeightQIE11(aieta, 1.0); } } } From 8a3228460bee47d4fcb52f589d7e7630f4d8b61f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 12:17:30 -0500 Subject: [PATCH 560/923] Remove EventSetup dependency from CosmicLayerPairs --- .../src/SeedGeneratorForCRack.cc | 8 +++++-- .../src/SeedGeneratorForCosmics.cc | 8 +++++-- .../TkHitPairs/interface/CosmicLayerPairs.h | 22 +++++++++++------- .../TkHitPairs/src/CosmicLayerPairs.cc | 23 +++++-------------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc index 5ea1475c38907..cef505a5e1d5a 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc @@ -2,6 +2,7 @@ #include "RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" void SeedGeneratorForCRack::init(const SiStripRecHit2DCollection& collstereo, const SiStripRecHit2DCollection& collrphi, const SiStripMatchedRecHit2DCollection& collmatched, @@ -18,8 +19,11 @@ void SeedGeneratorForCRack::init(const SiStripRecHit2DCollection& collstereo, iSetup.get().get(builderName, theBuilder); TTTRHBuilder = theBuilder.product(); - CosmicLayerPairs cosmiclayers(geometry); - cosmiclayers.init(collstereo, collrphi, collmatched, iSetup); + edm::ESHandle track; + iSetup.get().get(track); + edm::ESHandle httopo; + iSetup.get().get(httopo); + CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, *track, *httopo); thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, iSetup); HitPairs.clear(); thePairGenerator->hitPairs(region, HitPairs, iSetup); diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc index fde24fb999b24..794bc7cde81a3 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc @@ -24,9 +24,13 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, TTTRHBuilder = theBuilder.product(); LogDebug("CosmicSeedFinder") << " Hits built with " << hitsforseeds << " hits"; - CosmicLayerPairs cosmiclayers(geometry); + edm::ESHandle track; + iSetup.get().get(track); + edm::ESHandle httopo; + iSetup.get().get(httopo); + + CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, *track, *httopo); - cosmiclayers.init(collstereo, collrphi, collmatched, iSetup); thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, iSetup); HitPairs.clear(); if ((hitsforseeds == "pairs") || (hitsforseeds == "pairsandtriplets")) { diff --git a/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h b/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h index 5434320d62b93..325f127300438 100644 --- a/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h +++ b/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h @@ -15,22 +15,28 @@ #include class TrackerTopology; +class GeometricSearchTracker; class CosmicLayerPairs : public SeedLayerPairs { public: - CosmicLayerPairs(std::string geometry) : _geometry(geometry){}; //:isFirstCall(true){}; + CosmicLayerPairs(std::string geometry, + const SiStripRecHit2DCollection &collrphi, + const SiStripMatchedRecHit2DCollection &collmatched, + const GeometricSearchTracker &track, + const TrackerTopology &ttopo) + : _geometry(geometry) { + init(collrphi, collmatched, track, ttopo); + }; //:isFirstCall(true){}; ~CosmicLayerPairs() override; - // explicit PixelSeedLayerPairs(const edm::EventSetup& iSetup); - // virtual vector operator()() const; std::vector operator()() override; - void init(const SiStripRecHit2DCollection &collstereo, - const SiStripRecHit2DCollection &collrphi, - const SiStripMatchedRecHit2DCollection &collmatched, - //std::string geometry, - const edm::EventSetup &iSetup); private: + void init(const SiStripRecHit2DCollection &collrphi, + const SiStripMatchedRecHit2DCollection &collmatched, + const GeometricSearchTracker &, + const TrackerTopology &); + //bool isFirstCall; std::string _geometry; diff --git a/RecoTracker/TkHitPairs/src/CosmicLayerPairs.cc b/RecoTracker/TkHitPairs/src/CosmicLayerPairs.cc index 10c0084343c29..466bf179f6e69 100644 --- a/RecoTracker/TkHitPairs/src/CosmicLayerPairs.cc +++ b/RecoTracker/TkHitPairs/src/CosmicLayerPairs.cc @@ -11,7 +11,6 @@ #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" - std::vector CosmicLayerPairs::operator()() { std::vector result; @@ -236,30 +235,20 @@ std::vector CosmicLayerPairs::operator()() { } CosmicLayerPairs::~CosmicLayerPairs() {} -void CosmicLayerPairs::init(const SiStripRecHit2DCollection &collstereo, - const SiStripRecHit2DCollection &collrphi, +void CosmicLayerPairs::init(const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, - //std::string geometry, - const edm::EventSetup &iSetup) { + const GeometricSearchTracker &track, + const TrackerTopology &ttopo) { ////std::cout << "initializing geometry " << geometry << std::endl; - //_geometry=geometry; - //if(isFirstCall){ - //std::cout << "in isFirtsCall" << std::endl; - edm::ESHandle track; - iSetup.get().get(track); //std::cout << "about to take barrel" << std::endl; - bl = track->barrelLayers(); + bl = track.barrelLayers(); //std::cout << "barrel taken" << std::endl; - fpos = track->posTecLayers(); + fpos = track.posTecLayers(); //std::cout << "pos forw taken" << std::endl; - fneg = track->negTecLayers(); + fneg = track.negTecLayers(); //std::cout << "neg forw taken" << std::endl; //isFirstCall=false; - edm::ESHandle httopo; - iSetup.get().get(httopo); - const TrackerTopology &ttopo = *httopo; - if (_geometry == "MTCC") { //we have to distinguish the MTCC and CRACK case because they have special geometries with different neumbering of layers MTCCLayerWithHits.push_back(new LayerWithHits(bl[0], selectTIBHit(collrphi, ttopo, 1))); From e9f86b54b4e6863af1c83b85088c1bd59843cfe9 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 13:47:11 -0500 Subject: [PATCH 561/923] Remove EventSetup use in CosmicHitPairGeneratorFromLayerPair Now pass in the necessary ES data product. --- .../src/SeedGeneratorForCRack.cc | 4 +- .../src/SeedGeneratorForCosmics.cc | 6 +-- .../interface/CosmicHitPairGenerator.h | 6 +-- .../CosmicHitPairGeneratorFromLayerPair.h | 30 +----------- .../TkHitPairs/src/CosmicHitPairGenerator.cc | 14 +++--- .../CosmicHitPairGeneratorFromLayerPair.cc | 46 +++++++++++++------ 6 files changed, 49 insertions(+), 57 deletions(-) diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc index cef505a5e1d5a..4b76244f4abdc 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCRack.cc @@ -24,9 +24,9 @@ void SeedGeneratorForCRack::init(const SiStripRecHit2DCollection& collstereo, edm::ESHandle httopo; iSetup.get().get(httopo); CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, *track, *httopo); - thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, iSetup); + thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, *tracker); HitPairs.clear(); - thePairGenerator->hitPairs(region, HitPairs, iSetup); + thePairGenerator->hitPairs(region, HitPairs); LogDebug("CosmicSeedFinder") << "Initialized with " << HitPairs.size() << " hit pairs" << std::endl; } diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc index 794bc7cde81a3..c01d9d55908fd 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc @@ -28,13 +28,13 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, iSetup.get().get(track); edm::ESHandle httopo; iSetup.get().get(httopo); - + CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, *track, *httopo); - thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, iSetup); + thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, *tracker); HitPairs.clear(); if ((hitsforseeds == "pairs") || (hitsforseeds == "pairsandtriplets")) { - thePairGenerator->hitPairs(region, HitPairs, iSetup); + thePairGenerator->hitPairs(region, HitPairs); } CosmicLayerTriplets cosmiclayers2; diff --git a/RecoTracker/TkHitPairs/interface/CosmicHitPairGenerator.h b/RecoTracker/TkHitPairs/interface/CosmicHitPairGenerator.h index d715723cc824c..c35a5f4a45210 100644 --- a/RecoTracker/TkHitPairs/interface/CosmicHitPairGenerator.h +++ b/RecoTracker/TkHitPairs/interface/CosmicHitPairGenerator.h @@ -18,16 +18,16 @@ class CosmicHitPairGenerator { typedef std::vector > Container; public: - CosmicHitPairGenerator(SeedLayerPairs& layers, const edm::EventSetup& iSetup); + CosmicHitPairGenerator(SeedLayerPairs& layers, const TrackerGeometry&); CosmicHitPairGenerator(SeedLayerPairs& layers); ~CosmicHitPairGenerator(); /// add generators based on layers // void add(const DetLayer* inner, const DetLayer* outer); - void add(const LayerWithHits* inner, const LayerWithHits* outer, const edm::EventSetup& iSetup); + void add(const LayerWithHits* inner, const LayerWithHits* outer, const TrackerGeometry& trackGeom); /// form base class - void hitPairs(const TrackingRegion& reg, OrderedHitPairs& prs, const edm::EventSetup& iSetup); + void hitPairs(const TrackingRegion& reg, OrderedHitPairs& pr); private: Container theGenerators; diff --git a/RecoTracker/TkHitPairs/interface/CosmicHitPairGeneratorFromLayerPair.h b/RecoTracker/TkHitPairs/interface/CosmicHitPairGeneratorFromLayerPair.h index 58e9e921c0904..b7d9eb16d861d 100644 --- a/RecoTracker/TkHitPairs/interface/CosmicHitPairGeneratorFromLayerPair.h +++ b/RecoTracker/TkHitPairs/interface/CosmicHitPairGeneratorFromLayerPair.h @@ -11,47 +11,21 @@ class DetLayer; class TrackingRegion; class LayerWithHits; -class CompareHitPairsY { -public: - CompareHitPairsY(const edm::EventSetup& iSetup) { iSetup.get().get(tracker); }; - bool operator()(const OrderedHitPair& h1, const OrderedHitPair& h2) { - const TrackingRecHit* trh1i = h1.inner()->hit(); - const TrackingRecHit* trh2i = h2.inner()->hit(); - const TrackingRecHit* trh1o = h1.outer()->hit(); - const TrackingRecHit* trh2o = h2.outer()->hit(); - GlobalPoint in1p = tracker->idToDet(trh1i->geographicalId())->surface().toGlobal(trh1i->localPosition()); - GlobalPoint in2p = tracker->idToDet(trh2i->geographicalId())->surface().toGlobal(trh2i->localPosition()); - GlobalPoint ou1p = tracker->idToDet(trh1o->geographicalId())->surface().toGlobal(trh1o->localPosition()); - GlobalPoint ou2p = tracker->idToDet(trh2o->geographicalId())->surface().toGlobal(trh2o->localPosition()); - if (ou1p.y() * ou2p.y() < 0) - return ou1p.y() > ou2p.y(); - else { - float dist1 = 100 * std::abs(ou1p.z() - in1p.z()) - std::abs(ou1p.y()) - 0.1 * std::abs(in1p.y()); - float dist2 = 100 * std::abs(ou2p.z() - in2p.z()) - std::abs(ou2p.y()) - 0.1 * std::abs(in2p.y()); - return dist1 < dist2; - } - } -private: - edm::ESHandle tracker; -}; class CosmicHitPairGeneratorFromLayerPair { public: - CosmicHitPairGeneratorFromLayerPair(const LayerWithHits* inner, - const LayerWithHits* outer, - const edm::EventSetup& iSetup); + CosmicHitPairGeneratorFromLayerPair(const LayerWithHits* inner, const LayerWithHits* outer, const TrackerGeometry&); ~CosmicHitPairGeneratorFromLayerPair(); // virtual OrderedHitPairs hitPairs( const TrackingRegion& region,const edm::EventSetup& iSetup ) { // return HitPairGenerator::hitPairs(region, iSetup); // } - void hitPairs(const TrackingRegion& ar, OrderedHitPairs& ap, const edm::EventSetup& iSetup); + void hitPairs(const TrackingRegion& ar, OrderedHitPairs& ap); const LayerWithHits* innerLayer() const { return theInnerLayer; } const LayerWithHits* outerLayer() const { return theOuterLayer; } private: - const TransientTrackingRecHitBuilder* TTRHbuilder; const TrackerGeometry* trackerGeometry; const LayerWithHits* theOuterLayer; const LayerWithHits* theInnerLayer; diff --git a/RecoTracker/TkHitPairs/src/CosmicHitPairGenerator.cc b/RecoTracker/TkHitPairs/src/CosmicHitPairGenerator.cc index 84beb496a331f..186b9b277a3d4 100644 --- a/RecoTracker/TkHitPairs/src/CosmicHitPairGenerator.cc +++ b/RecoTracker/TkHitPairs/src/CosmicHitPairGenerator.cc @@ -6,11 +6,11 @@ using namespace std; -CosmicHitPairGenerator::CosmicHitPairGenerator(SeedLayerPairs& layers, const edm::EventSetup& iSetup) { +CosmicHitPairGenerator::CosmicHitPairGenerator(SeedLayerPairs& layers, const TrackerGeometry& trackGeom) { vector layerPairs = layers(); vector::const_iterator it; for (it = layerPairs.begin(); it != layerPairs.end(); it++) { - add((*it).first, (*it).second, iSetup); + add((*it).first, (*it).second, trackGeom); } } @@ -18,15 +18,13 @@ CosmicHitPairGenerator::~CosmicHitPairGenerator() {} void CosmicHitPairGenerator::add(const LayerWithHits* inner, const LayerWithHits* outer, - const edm::EventSetup& iSetup) { - theGenerators.push_back(std::make_unique(inner, outer, iSetup)); + const TrackerGeometry& trackGeom) { + theGenerators.push_back(std::make_unique(inner, outer, trackGeom)); } -void CosmicHitPairGenerator::hitPairs(const TrackingRegion& region, - OrderedHitPairs& pairs, - const edm::EventSetup& iSetup) { +void CosmicHitPairGenerator::hitPairs(const TrackingRegion& region, OrderedHitPairs& pairs) { Container::const_iterator i; for (i = theGenerators.begin(); i != theGenerators.end(); i++) { - (**i).hitPairs(region, pairs, iSetup); + (**i).hitPairs(region, pairs); } } diff --git a/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc b/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc index d928ae7f48a76..56c6cbe504b1f 100644 --- a/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc +++ b/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc @@ -16,20 +16,18 @@ CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair( const LayerWithHits* inner, const LayerWithHits* outer, // LayerCacheType* layerCache, - const edm::EventSetup& iSetup) - : TTRHbuilder(nullptr), - trackerGeometry(nullptr), + const TrackerGeometry& geom) + : trackerGeometry(&geom), //theLayerCache(*layerCache), theOuterLayer(outer), theInnerLayer(inner) { - edm::ESHandle tracker; - iSetup.get().get(tracker); - trackerGeometry = tracker.product(); + //edm::ESHandle tracker; + //iSetup.get().get(tracker); + //trackerGeometry = tracker.product(); } CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair() {} -void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, - OrderedHitPairs& result, - const edm::EventSetup& iSetup) { + +void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, OrderedHitPairs& result) { // static int NSee = 0; static int Ntry = 0; static int Nacc = 0; typedef OrderedHitPair::InnerRecHit InnerHit; @@ -65,9 +63,6 @@ void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, } vector allthepairs; - std::string builderName = "WithTrackAngle"; - edm::ESHandle builder; - iSetup.get().get(builderName, builder); for (auto ohh = theOuterLayer->recHits().begin(); ohh != theOuterLayer->recHits().end(); ohh++) { for (auto ihh = theInnerLayer->recHits().begin(); ihh != theInnerLayer->recHits().end(); ihh++) { @@ -107,7 +102,32 @@ void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, } } - // stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(iSetup)); + /* + class CompareHitPairsY { + public: + CompareHitPairsY(const TrackerGeometry& t): tracker{&t} {} + bool operator()(const OrderedHitPair& h1, const OrderedHitPair& h2) { + const TrackingRecHit* trh1i = h1.inner()->hit(); + const TrackingRecHit* trh2i = h2.inner()->hit(); + const TrackingRecHit* trh1o = h1.outer()->hit(); + const TrackingRecHit* trh2o = h2.outer()->hit(); + GlobalPoint in1p = tracker->idToDet(trh1i->geographicalId())->surface().toGlobal(trh1i->localPosition()); + GlobalPoint in2p = tracker->idToDet(trh2i->geographicalId())->surface().toGlobal(trh2i->localPosition()); + GlobalPoint ou1p = tracker->idToDet(trh1o->geographicalId())->surface().toGlobal(trh1o->localPosition()); + GlobalPoint ou2p = tracker->idToDet(trh2o->geographicalId())->surface().toGlobal(trh2o->localPosition()); + if (ou1p.y() * ou2p.y() < 0) + return ou1p.y() > ou2p.y(); + else { + float dist1 = 100 * std::abs(ou1p.z() - in1p.z()) - std::abs(ou1p.y()) - 0.1 * std::abs(in1p.y()); + float dist2 = 100 * std::abs(ou2p.z() - in2p.z()) - std::abs(ou2p.y()) - 0.1 * std::abs(in2p.y()); + return dist1 < dist2; + } + } + + private: + const TrackerGeometry* tracker; + }; */ + // stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(*trackerGeometry)); // //Seed from overlaps are saved only if // //no others have been saved From aa435c0aa6eeab35d012aa82167f9036a3ba38d8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 14:41:04 -0500 Subject: [PATCH 562/923] Removed EventSetup use in CosmicLayerTriplets Now pass in the needed EventSetup data products. --- .../interface/CosmicLayerTriplets.h | 22 +++++++++---------- .../PixelTriplets/src/CosmicLayerTriplets.cc | 19 +++++----------- .../src/SeedGeneratorForCosmics.cc | 4 ++-- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/CosmicLayerTriplets.h b/RecoPixelVertexing/PixelTriplets/interface/CosmicLayerTriplets.h index 23e64e50fd206..62c072dd09a0c 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CosmicLayerTriplets.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CosmicLayerTriplets.h @@ -6,8 +6,6 @@ */ #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" #include "DataFormats/Common/interface/RangeMap.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESWatcher.h" #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h" #include "RecoTracker/TkHitPairs/interface/LayerWithHits.h" @@ -18,12 +16,18 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" -#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" +class GeometricSearchTracker; +class TrackerTopology; #include class CosmicLayerTriplets { public: - CosmicLayerTriplets(){}; + CosmicLayerTriplets(std::string geometry, + const SiStripRecHit2DCollection &collrphi, + const GeometricSearchTracker &track, + const TrackerTopology &ttopo) { + init(collrphi, std::move(geometry), track, ttopo); + }; ~CosmicLayerTriplets(); // explicit PixelSeedLayerPairs(const edm::EventSetup& iSetup); typedef std::pair > LayerPairAndLayers; @@ -40,18 +44,14 @@ class CosmicLayerTriplets { LayerWithHits *lh3; LayerWithHits *lh4; - edm::ESWatcher watchTrackerGeometry_; - std::vector bl; //MP std::vector allLayersWithHits; -public: - void init(const SiStripRecHit2DCollection &collstereo, - const SiStripRecHit2DCollection &collrphi, - const SiStripMatchedRecHit2DCollection &collmatched, + void init(const SiStripRecHit2DCollection &collrphi, std::string geometry, - const edm::EventSetup &iSetup); + const GeometricSearchTracker &track, + const TrackerTopology &ttopo); private: std::string _geometry; diff --git a/RecoPixelVertexing/PixelTriplets/src/CosmicLayerTriplets.cc b/RecoPixelVertexing/PixelTriplets/src/CosmicLayerTriplets.cc index 0efa73ded159c..2799a9fb26d2f 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CosmicLayerTriplets.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CosmicLayerTriplets.cc @@ -53,21 +53,12 @@ CosmicLayerTriplets::~CosmicLayerTriplets() { } } -void CosmicLayerTriplets::init(const SiStripRecHit2DCollection& collstereo, - const SiStripRecHit2DCollection& collrphi, - const SiStripMatchedRecHit2DCollection& collmatched, +void CosmicLayerTriplets::init(const SiStripRecHit2DCollection& collrphi, std::string geometry, - const edm::EventSetup& iSetup) { - _geometry = geometry; - if (watchTrackerGeometry_.check(iSetup)) { - edm::ESHandle track; - iSetup.get().get(track); - bl = track->barrelLayers(); - } - edm::ESHandle httopo; - iSetup.get().get(httopo); - const TrackerTopology& ttopo = *httopo; - + const GeometricSearchTracker& track, + const TrackerTopology& ttopo) { + _geometry = std::move(geometry); + bl = track.barrelLayers(); for (vector::const_iterator it = allLayersWithHits.begin(); it != allLayersWithHits.end(); it++) { delete *it; } diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc index c01d9d55908fd..619c6039629f9 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc @@ -5,6 +5,7 @@ #include "FWCore/Utilities/interface/isFinite.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h" +#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h" void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, const SiStripRecHit2DCollection& collrphi, const SiStripMatchedRecHit2DCollection& collmatched, @@ -37,8 +38,7 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, thePairGenerator->hitPairs(region, HitPairs); } - CosmicLayerTriplets cosmiclayers2; - cosmiclayers2.init(collstereo, collrphi, collmatched, geometry, iSetup); + CosmicLayerTriplets cosmiclayers2(geometry, collrphi, *track, *httopo); theTripletGenerator = new CosmicHitTripletGenerator(cosmiclayers2, iSetup); HitTriplets.clear(); if ((hitsforseeds == "triplets") || (hitsforseeds == "pairsandtriplets")) { From bd474320a761d72a275ca115baf1439334156ae9 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 14:58:55 -0500 Subject: [PATCH 563/923] Removed Eventsetup dependency from CosmicHitTripletGenerator --- .../interface/CosmicHitTripletGenerator.h | 7 +++--- ...osmicHitTripletGeneratorFromLayerTriplet.h | 5 ++-- .../src/CosmicHitTripletGenerator.cc | 14 +++++------ ...smicHitTripletGeneratorFromLayerTriplet.cc | 23 ++++--------------- .../src/SeedGeneratorForCosmics.cc | 4 ++-- 5 files changed, 17 insertions(+), 36 deletions(-) diff --git a/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGenerator.h b/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGenerator.h index 327e0f30e9e59..53271501fed23 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGenerator.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGenerator.h @@ -5,7 +5,6 @@ #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" #include "RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGeneratorFromLayerTriplet.h" #include "DataFormats/Common/interface/RangeMap.h" -#include "FWCore/Framework/interface/EventSetup.h" class LayerWithHits; class DetLayer; @@ -20,7 +19,7 @@ class CosmicHitTripletGenerator { typedef std::vector > Container; public: - CosmicHitTripletGenerator(CosmicLayerTriplets& layers, const edm::EventSetup& iSetup); + CosmicHitTripletGenerator(CosmicLayerTriplets& layers, const TrackerGeometry& trackGeom); CosmicHitTripletGenerator(CosmicLayerTriplets& layers); ~CosmicHitTripletGenerator(); @@ -30,9 +29,9 @@ class CosmicHitTripletGenerator { void add(const LayerWithHits* inner, const LayerWithHits* middle, const LayerWithHits* outer, - const edm::EventSetup& iSetup); + const TrackerGeometry& trackGeom); - void hitTriplets(const TrackingRegion& reg, OrderedHitTriplets& prs, const edm::EventSetup& iSetup); + void hitTriplets(const TrackingRegion& reg, OrderedHitTriplets& prs); private: Container theGenerators; diff --git a/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGeneratorFromLayerTriplet.h b/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGeneratorFromLayerTriplet.h index ec0af890622b1..264589063be11 100644 --- a/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGeneratorFromLayerTriplet.h +++ b/RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGeneratorFromLayerTriplet.h @@ -18,17 +18,16 @@ class CosmicHitTripletGeneratorFromLayerTriplet { CosmicHitTripletGeneratorFromLayerTriplet(const LayerWithHits* inner, const LayerWithHits* middle, const LayerWithHits* outer, - const edm::EventSetup& iSetup); + const TrackerGeometry& trackGeom); ~CosmicHitTripletGeneratorFromLayerTriplet() {} - void hitTriplets(const TrackingRegion& ar, OrderedHitTriplets& ap, const edm::EventSetup& iSetup); + void hitTriplets(const TrackingRegion& ar, OrderedHitTriplets& ap); const LayerWithHits* innerLayer() const { return theInnerLayer; } const LayerWithHits* middleLayer() const { return theMiddleLayer; } const LayerWithHits* outerLayer() const { return theOuterLayer; } private: - const TransientTrackingRecHitBuilder* TTRHbuilder; const TrackerGeometry* trackerGeometry; const LayerWithHits* theOuterLayer; const LayerWithHits* theMiddleLayer; diff --git a/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGenerator.cc b/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGenerator.cc index 1eca20a664826..b9689d04956e2 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGenerator.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGenerator.cc @@ -6,7 +6,7 @@ using namespace std; -CosmicHitTripletGenerator::CosmicHitTripletGenerator(CosmicLayerTriplets& layers, const edm::EventSetup& iSetup) { +CosmicHitTripletGenerator::CosmicHitTripletGenerator(CosmicLayerTriplets& layers, const TrackerGeometry& trackGeom) { // vector layerTriplets = layers(); vector layerTriplets = layers.layers(); vector::const_iterator it; @@ -17,7 +17,7 @@ CosmicHitTripletGenerator::CosmicHitTripletGenerator(CosmicLayerTriplets& layers // const LayerWithHits* second=(*it).first.second; // const LayerWithHits* third=(*ilwh); // add( (*it).first.first, (*it).first.second, (*it).second,iSetup); - add((*it).first.first, (*it).first.second, (*ilwh), iSetup); + add((*it).first.first, (*it).first.second, (*ilwh), trackGeom); } } } @@ -27,15 +27,13 @@ CosmicHitTripletGenerator::~CosmicHitTripletGenerator() {} void CosmicHitTripletGenerator::add(const LayerWithHits* inner, const LayerWithHits* middle, const LayerWithHits* outer, - const edm::EventSetup& iSetup) { - theGenerators.push_back(std::make_unique(inner, middle, outer, iSetup)); + const TrackerGeometry& trackGeom) { + theGenerators.push_back(std::make_unique(inner, middle, outer, trackGeom)); } -void CosmicHitTripletGenerator::hitTriplets(const TrackingRegion& region, - OrderedHitTriplets& pairs, - const edm::EventSetup& iSetup) { +void CosmicHitTripletGenerator::hitTriplets(const TrackingRegion& region, OrderedHitTriplets& pairs) { Container::const_iterator i; for (i = theGenerators.begin(); i != theGenerators.end(); i++) { - (**i).hitTriplets(region, pairs, iSetup); + (**i).hitTriplets(region, pairs); } } diff --git a/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGeneratorFromLayerTriplet.cc b/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGeneratorFromLayerTriplet.cc index 8cafa3803701f..e6de0ecfb7dc4 100644 --- a/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGeneratorFromLayerTriplet.cc +++ b/RecoPixelVertexing/PixelTriplets/src/CosmicHitTripletGeneratorFromLayerTriplet.cc @@ -2,12 +2,8 @@ #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" #include "TrackingTools/DetLayers/interface/DetLayer.h" #include "RecoPixelVertexing/PixelTriplets/interface/OrderedHitTriplets.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include @@ -16,20 +12,13 @@ typedef TransientTrackingRecHit::ConstRecHitPointer TkHitPairsCachedHit; CosmicHitTripletGeneratorFromLayerTriplet::CosmicHitTripletGeneratorFromLayerTriplet(const LayerWithHits *inner, const LayerWithHits *middle, const LayerWithHits *outer, - const edm::EventSetup &iSetup) - : TTRHbuilder(nullptr), - trackerGeometry(nullptr), + const TrackerGeometry &trackGeom) + : trackerGeometry(&trackGeom), //theLayerCache(*layerCache), theOuterLayer(outer), theMiddleLayer(middle), - theInnerLayer(inner) { - edm::ESHandle tracker; - iSetup.get().get(tracker); - trackerGeometry = tracker.product(); -} -void CosmicHitTripletGeneratorFromLayerTriplet::hitTriplets(const TrackingRegion ®ion, - OrderedHitTriplets &result, - const edm::EventSetup &iSetup) { + theInnerLayer(inner) {} +void CosmicHitTripletGeneratorFromLayerTriplet::hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &result) { if (theInnerLayer->recHits().empty()) return; if (theMiddleLayer->recHits().empty()) @@ -44,10 +33,6 @@ void CosmicHitTripletGeneratorFromLayerTriplet::hitTriplets(const TrackingRegion std::vector::const_iterator mhh; std::vector::const_iterator ihh; - std::string builderName = "WithTrackAngle"; - edm::ESHandle builder; - iSetup.get().get(builderName, builder); - if (!seedfromoverlaps) { for (ohh = theOuterLayer->recHits().begin(); ohh != theOuterLayer->recHits().end(); ohh++) { auto oh = (BaseTrackerRecHit const *)(&*ohh); diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc index 619c6039629f9..9b0c2e3a3f48e 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc @@ -39,10 +39,10 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, } CosmicLayerTriplets cosmiclayers2(geometry, collrphi, *track, *httopo); - theTripletGenerator = new CosmicHitTripletGenerator(cosmiclayers2, iSetup); + theTripletGenerator = new CosmicHitTripletGenerator(cosmiclayers2, *tracker); HitTriplets.clear(); if ((hitsforseeds == "triplets") || (hitsforseeds == "pairsandtriplets")) { - theTripletGenerator->hitTriplets(region, HitTriplets, iSetup); + theTripletGenerator->hitTriplets(region, HitTriplets); } } From f13a105993e12714ef5d873dc3b665e642b70b81 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Mon, 13 Sep 2021 15:39:53 -0500 Subject: [PATCH 564/923] Added esConsumes calls to SeedGeneratorForCosmics --- .../interface/SeedGeneratorForCosmics.h | 25 +++++++--- .../src/CosmicSeedGenerator.cc | 6 +-- .../src/SeedGeneratorForCosmics.cc | 46 ++++++++----------- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/RecoTracker/SpecialSeedGenerators/interface/SeedGeneratorForCosmics.h b/RecoTracker/SpecialSeedGenerators/interface/SeedGeneratorForCosmics.h index 98a64d1fc9303..b9d5ddcd994bc 100644 --- a/RecoTracker/SpecialSeedGenerators/interface/SeedGeneratorForCosmics.h +++ b/RecoTracker/SpecialSeedGenerators/interface/SeedGeneratorForCosmics.h @@ -9,6 +9,7 @@ #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h" //#include "RecoTracker/SpecialSeedGenerators/interface/SeedGeneratorFromLayerPairs.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" @@ -22,21 +23,28 @@ #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" #include "RecoPixelVertexing/PixelTriplets/interface/CosmicHitTripletGenerator.h" class PixelSeedLayerPairs; +class GeometricSearchTracker; +class TrackerRecoGeometryRecord; class SeedGeneratorForCosmics { public: typedef TrajectoryStateOnSurface TSOS; - SeedGeneratorForCosmics(const edm::ParameterSet &conf); - virtual ~SeedGeneratorForCosmics(){}; + SeedGeneratorForCosmics(const edm::ParameterSet &conf, edm::ConsumesCollector); + + void run(const SiStripRecHit2DCollection &collstereo, + const SiStripRecHit2DCollection &collrphi, + const SiStripMatchedRecHit2DCollection &collmatched, + const edm::EventSetup &c, + TrajectorySeedCollection &); + +private: void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c); - void run(TrajectorySeedCollection &, const edm::EventSetup &c); - bool seeds(TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion ®ion); + bool seeds(TrajectorySeedCollection &output, const TrackingRegion ®ion); -private: int32_t maxSeeds_; GlobalTrackingRegion region; CosmicHitPairGenerator *thePairGenerator; @@ -44,11 +52,14 @@ class SeedGeneratorForCosmics { edm::ESHandle magfield; edm::ESHandle tracker; + const edm::ESGetToken theMagfieldToken; + const edm::ESGetToken theTrackerToken; + const edm::ESGetToken theSearchTrackerToken; + const edm::ESGetToken theTTopoToken; + KFUpdator *theUpdator; PropagatorWithMaterial *thePropagatorAl; PropagatorWithMaterial *thePropagatorOp; - const TransientTrackingRecHitBuilder *TTTRHBuilder; - std::string builderName; std::string geometry; std::string hitsforseeds; float seedpt; diff --git a/RecoTracker/SpecialSeedGenerators/src/CosmicSeedGenerator.cc b/RecoTracker/SpecialSeedGenerators/src/CosmicSeedGenerator.cc index ed557a17f8989..c84b74fcfec16 100644 --- a/RecoTracker/SpecialSeedGenerators/src/CosmicSeedGenerator.cc +++ b/RecoTracker/SpecialSeedGenerators/src/CosmicSeedGenerator.cc @@ -15,7 +15,7 @@ using namespace std; CosmicSeedGenerator::CosmicSeedGenerator(edm::ParameterSet const& conf) - : cosmic_seed(conf), + : cosmic_seed(conf, consumesCollector()), check(conf, consumesCollector()) { @@ -45,10 +45,8 @@ void CosmicSeedGenerator::produce(edm::Event& ev, const edm::EventSetup& es) { //check on the number of clusters size_t clustsOrZero = check.tooManyClusters(ev); if (!clustsOrZero) { - cosmic_seed.init(*stereorecHits, *rphirecHits, *matchedrecHits, es); - // invoke the seed finding algorithm - cosmic_seed.run(*output, es); + cosmic_seed.run(*stereorecHits, *rphirecHits, *matchedrecHits, es, *output); } else edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n"; diff --git a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc index 9b0c2e3a3f48e..f22625e1cef7b 100644 --- a/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc +++ b/RecoTracker/SpecialSeedGenerators/src/SeedGeneratorForCosmics.cc @@ -10,27 +10,18 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, const SiStripRecHit2DCollection& collrphi, const SiStripMatchedRecHit2DCollection& collmatched, const edm::EventSetup& iSetup) { - iSetup.get().get(magfield); - iSetup.get().get(tracker); + magfield = iSetup.getHandle(theMagfieldToken); + tracker = iSetup.getHandle(theTrackerToken); thePropagatorAl = new PropagatorWithMaterial(alongMomentum, 0.1057, &(*magfield)); thePropagatorOp = new PropagatorWithMaterial(oppositeToMomentum, 0.1057, &(*magfield)); theUpdator = new KFUpdator(); - // get the transient builder - // - - edm::ESHandle theBuilder; - - iSetup.get().get(builderName, theBuilder); - TTTRHBuilder = theBuilder.product(); LogDebug("CosmicSeedFinder") << " Hits built with " << hitsforseeds << " hits"; - edm::ESHandle track; - iSetup.get().get(track); - edm::ESHandle httopo; - iSetup.get().get(httopo); + GeometricSearchTracker const& track = iSetup.getData(theSearchTrackerToken); + TrackerTopology const& ttopo = iSetup.getData(theTTopoToken); - CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, *track, *httopo); + CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, track, ttopo); thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, *tracker); HitPairs.clear(); @@ -38,7 +29,7 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, thePairGenerator->hitPairs(region, HitPairs); } - CosmicLayerTriplets cosmiclayers2(geometry, collrphi, *track, *httopo); + CosmicLayerTriplets cosmiclayers2(geometry, collrphi, track, ttopo); theTripletGenerator = new CosmicHitTripletGenerator(cosmiclayers2, *tracker); HitTriplets.clear(); if ((hitsforseeds == "triplets") || (hitsforseeds == "pairsandtriplets")) { @@ -46,15 +37,18 @@ void SeedGeneratorForCosmics::init(const SiStripRecHit2DCollection& collstereo, } } -SeedGeneratorForCosmics::SeedGeneratorForCosmics(edm::ParameterSet const& conf) - : maxSeeds_(conf.getParameter("maxSeeds")) { +SeedGeneratorForCosmics::SeedGeneratorForCosmics(edm::ParameterSet const& conf, edm::ConsumesCollector iCC) + : maxSeeds_(conf.getParameter("maxSeeds")), + theMagfieldToken(iCC.esConsumes()), + theTrackerToken(iCC.esConsumes()), + theSearchTrackerToken(iCC.esConsumes()), + theTTopoToken(iCC.esConsumes()) { float ptmin = conf.getParameter("ptMin"); float originradius = conf.getParameter("originRadius"); float halflength = conf.getParameter("originHalfLength"); float originz = conf.getParameter("originZPosition"); seedpt = conf.getParameter("SeedPt"); - builderName = conf.getParameter("TTRHBuilder"); geometry = conf.getUntrackedParameter("GeometricStructure", "STANDARD"); region = GlobalTrackingRegion(ptmin, originradius, halflength, originz); hitsforseeds = conf.getUntrackedParameter("HitsForSeeds", "pairs"); @@ -68,17 +62,20 @@ SeedGeneratorForCosmics::SeedGeneratorForCosmics(edm::ParameterSet const& conf) //*** } -void SeedGeneratorForCosmics::run(TrajectorySeedCollection& output, const edm::EventSetup& iSetup) { - seeds(output, iSetup, region); +void SeedGeneratorForCosmics::run(const SiStripRecHit2DCollection& collstereo, + const SiStripRecHit2DCollection& collrphi, + const SiStripMatchedRecHit2DCollection& collmatched, + const edm::EventSetup& c, + TrajectorySeedCollection& output) { + init(collstereo, collrphi, collmatched, c); + seeds(output, region); delete thePairGenerator; delete theTripletGenerator; delete thePropagatorAl; delete thePropagatorOp; delete theUpdator; } -bool SeedGeneratorForCosmics::seeds(TrajectorySeedCollection& output, - const edm::EventSetup& iSetup, - const TrackingRegion& region) { +bool SeedGeneratorForCosmics::seeds(TrajectorySeedCollection& output, const TrackingRegion& region) { LogDebug("CosmicSeedFinder") << "Number of triplets " << HitTriplets.size(); LogDebug("CosmicSeedFinder") << "Number of pairs " << HitPairs.size(); @@ -104,8 +101,6 @@ bool SeedGeneratorForCosmics::seeds(TrajectorySeedCollection& output, ->surface() .toGlobal((*(HitTriplets[it].outer())).localPosition()); - // SeedingHitSet::ConstRecHitPointer outrhit=TTTRHBuilder->build(HitPairs[is].outer()) - SeedingHitSet::ConstRecHitPointer outrhit = HitTriplets[it].outer(); //***top-bottom SeedingHitSet::ConstRecHitPointer innrhit = HitTriplets[it].inner(); @@ -187,7 +182,6 @@ bool SeedGeneratorForCosmics::seeds(TrajectorySeedCollection& output, .toGlobal((*(HitPairs[is].outer())).localPosition()); LogDebug("CosmicSeedFinder") << "inner point of the seed " << inner << " outer point of the seed " << outer; - //RC const TransientTrackingRecHit* outrhit=TTTRHBuilder->build(HitPairs[is].outer().RecHit()); SeedingHitSet::ConstRecHitPointer outrhit = HitPairs[is].outer(); //***top-bottom SeedingHitSet::ConstRecHitPointer innrhit = HitPairs[is].inner(); From 479661d0c128b1c68811212239ec66bc8b64578d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 14 Sep 2021 03:08:13 +0200 Subject: [PATCH 565/923] Take care of Qiang's comment --- Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc index 4a31eb7b57993..c444f1fae63de 100644 --- a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc @@ -55,6 +55,7 @@ April 2015 using namespace std; using namespace edm; +//#define EDM_ML_DEBUG // // class decleration // @@ -395,13 +396,13 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i for (int ij = 0; ij < 9; ij++) { hosig[ij] = (*hoC).hosig[ij]; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HOCalib") << "hosig " << i << " " << hosig[ij]; + edm::LogVerbatim("HOCalib") << "hosig " << ij << " " << hosig[ij]; #endif } for (int ij = 0; ij < 18; ij++) { hocorsig[ij] = (*hoC).hocorsig[ij]; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HOCalib") << "hocorsig " << i << " " << hocorsig[ij]; + edm::LogVerbatim("HOCalib") << "hocorsig " << ij << " " << hocorsig[ij]; #endif } hocro = (*hoC).hocro; From 6dff24d4f78a4bc987bec52deacdcdfe11ee9642 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 23 Aug 2021 14:47:38 +0200 Subject: [PATCH 566/923] Plugins and test config for NanoAOD-based calibtree from SiStripCalCosmics ALCARECO --- CalibTracker/SiStripCommon/BuildFile.xml | 3 + .../SiStripOnTrackClusterTableProducerBase.h | 56 ++++++ .../SiStripCommon/plugins/BuildFile.xml | 1 + .../SiStripCommon/plugins/SealModules.cc | 4 + ...SiStripLorentzAngleRunInfoTableProducer.cc | 107 +++++++++++ ...SiStripPositionCorrectionsTableProducer.cc | 75 ++++++++ .../SiStripOnTrackClusterTableProducerBase.cc | 68 +++++++ .../produceCalibrationTree_CosmicsLABP_cfg.py | 173 ++++++++++++++++++ 8 files changed, 487 insertions(+) create mode 100644 CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h create mode 100644 CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc create mode 100644 CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc create mode 100644 CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc create mode 100644 CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py diff --git a/CalibTracker/SiStripCommon/BuildFile.xml b/CalibTracker/SiStripCommon/BuildFile.xml index 17b87a3ad87ae..dba91db4041f4 100644 --- a/CalibTracker/SiStripCommon/BuildFile.xml +++ b/CalibTracker/SiStripCommon/BuildFile.xml @@ -2,8 +2,11 @@ + + + diff --git a/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h b/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h new file mode 100644 index 0000000000000..4dec2d9591a6c --- /dev/null +++ b/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h @@ -0,0 +1,56 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/NanoAOD/interface/FlatTable.h" +#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" + +class SiStripOnTrackClusterTableProducerBase : public edm::stream::EDProducer<> { +public: + explicit SiStripOnTrackClusterTableProducerBase(const edm::ParameterSet& params) + : m_name(params.getParameter("name")), + m_doc(params.existsAs("doc") ? params.getParameter("doc") : ""), + m_extension(params.existsAs("extension") ? params.getParameter("extension") : true), + m_tracks_token(consumes>(params.getParameter("Tracks"))), + m_association_token(consumes(params.getParameter("Tracks"))) { + produces(); + } + ~SiStripOnTrackClusterTableProducerBase() override; + + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final; + + struct OnTrackCluster { + uint32_t det; + const SiStripCluster* cluster; + const Trajectory* traj; + const reco::Track* track; + const TrajectoryMeasurement& measurement; + OnTrackCluster(uint32_t detId, + const SiStripCluster* stripCluster, + const Trajectory* trajectory, + const reco::Track* track_, + const TrajectoryMeasurement& measurement_) + : det{detId}, cluster{stripCluster}, traj{trajectory}, track{track_}, measurement{measurement_} {} + }; + + virtual void fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) = 0; + + template + static void addColumn(nanoaod::FlatTable* table, const std::string& name, VALUES&& values, const std::string& doc) { + using value_type = typename std::remove_reference::type::value_type; + table->template addColumn(name, values, doc); + } + +private: + const std::string m_name; + const std::string m_doc; + bool m_extension; + + const edm::EDGetTokenT> m_tracks_token; + const edm::EDGetTokenT m_association_token; +}; diff --git a/CalibTracker/SiStripCommon/plugins/BuildFile.xml b/CalibTracker/SiStripCommon/plugins/BuildFile.xml index 039a07453e59c..64a3dcae11884 100644 --- a/CalibTracker/SiStripCommon/plugins/BuildFile.xml +++ b/CalibTracker/SiStripCommon/plugins/BuildFile.xml @@ -9,6 +9,7 @@ + diff --git a/CalibTracker/SiStripCommon/plugins/SealModules.cc b/CalibTracker/SiStripCommon/plugins/SealModules.cc index 6613d45b91294..e700bb6a6472c 100644 --- a/CalibTracker/SiStripCommon/plugins/SealModules.cc +++ b/CalibTracker/SiStripCommon/plugins/SealModules.cc @@ -24,3 +24,7 @@ DEFINE_FWK_MODULE(ShallowSimhitClustersProducer); DEFINE_FWK_MODULE(ShallowTracksProducer); DEFINE_FWK_MODULE(ShallowSimTracksProducer); DEFINE_FWK_MODULE(ShallowGainCalibration); + +#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" +typedef SimpleFlatTableProducer SimpleTrackFlatTableProducer; +DEFINE_FWK_MODULE(SimpleTrackFlatTableProducer); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc b/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc new file mode 100644 index 0000000000000..7e09ef4f58a7a --- /dev/null +++ b/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc @@ -0,0 +1,107 @@ +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "DataFormats/NanoAOD/interface/FlatTable.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h" +#include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +#include "CalibTracker/SiStripCommon/interface/ShallowTools.h" + +class SiStripLorentzAngleRunInfoTableProducer : public edm::global::EDProducer { +public: + explicit SiStripLorentzAngleRunInfoTableProducer(const edm::ParameterSet& params) + : m_name{params.getParameter("name")}, + m_magFieldName{params.getParameter("magFieldName")}, + m_doc{params.existsAs("doc") ? params.getParameter("doc") : ""}, + m_tkGeomToken{esConsumes()}, + m_magFieldToken{esConsumes()}, + m_lorentzAngleToken{esConsumes()} { + produces(); + produces("magField"); + } + + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("name", "Det"); + desc.add("magFieldName", "magField"); + desc.add("doc", "Run info for the Lorentz angle measurement"); + descriptions.add("siStripLorentzAngleRunInfoTable", desc); + } + + void globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const& iSetup) const override; + +private: + const std::string m_name, m_magFieldName; + const std::string m_doc; + edm::ESGetToken m_tkGeomToken; + edm::ESGetToken m_magFieldToken; + edm::ESGetToken m_lorentzAngleToken; +}; + +namespace { + template + void addColumn(nanoaod::FlatTable* table, const std::string& name, VALUES&& values, const std::string& doc) { + using value_type = typename std::remove_reference::type::value_type; + table->template addColumn(name, values, doc); + } +} // namespace + +void SiStripLorentzAngleRunInfoTableProducer::globalBeginRunProduce(edm::Run& iRun, + edm::EventSetup const& iSetup) const { + const auto& tkGeom = iSetup.getData(m_tkGeomToken); + const auto& magField = iSetup.getData(m_magFieldToken); + const auto& lorentzAngle = iSetup.getData(m_lorentzAngleToken); + std::vector c_rawid; + std::vector c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle; + + auto dets = tkGeom.detsTIB(); + dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end()); + dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end()); + dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end()); + for (auto det : dets) { + auto detid = det->geographicalId().rawId(); + const StripGeomDetUnit* stripDet = dynamic_cast(tkGeom.idToDet(det->geographicalId())); + if (stripDet) { + c_rawid.push_back(detid); + c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z()); + const auto locB = magField.inTesla(stripDet->surface().position()); + c_localB.push_back(locB.mag()); + c_BdotY.push_back(stripDet->surface().toLocal(locB).y()); + const auto drift = shallow::drift(stripDet, magField, lorentzAngle); + c_driftx.push_back(drift.x()); + c_drifty.push_back(drift.y()); + c_driftz.push_back(drift.z()); + c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid)); + } + } + auto out = std::make_unique(c_rawid.size(), m_name, false, false); + addColumn(out.get(), "rawid", c_rawid, "DetId"); + addColumn(out.get(), "globalZofunitlocalY", c_globalZofunitlocalY, "z component of a local unit vector along y"); + addColumn(out.get(), "localB", c_localB, "Local magnitude of the magnetic field"); + addColumn(out.get(), "BdotY", c_BdotY, "Magnetic field projection on the local y axis"); + addColumn(out.get(), "driftx", c_driftx, "x component of the drift vector"); + addColumn(out.get(), "drifty", c_drifty, "y component of the drift vector"); + addColumn(out.get(), "driftz", c_driftz, "z component of the drift vector"); + addColumn(out.get(), "lorentzAngle", c_lorentzAngle, "Lorentz angle from database"); + iRun.put(std::move(out)); + + auto out2 = std::make_unique(1, m_magFieldName, true, false); + out2->addColumnValue( + "origin", magField.inTesla(GlobalPoint(0, 0, 0)).z(), "z-component of the magnetic field at (0,0,0) in Tesla"); + iRun.put(std::move(out2), "magField"); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SiStripLorentzAngleRunInfoTableProducer); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc b/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc new file mode 100644 index 0000000000000..1f7d93008807f --- /dev/null +++ b/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc @@ -0,0 +1,75 @@ +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +#include "RecoLocalTracker/SiStripClusterizer/interface/SiStripClusterInfo.h" + +#include "CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h" + +class SiStripPositionCorrectionsTableProducer : public SiStripOnTrackClusterTableProducerBase { +public: + explicit SiStripPositionCorrectionsTableProducer(const edm::ParameterSet& params) + : SiStripOnTrackClusterTableProducerBase(params), + m_clusterInfo(consumesCollector()), + m_tkGeomToken{esConsumes<>()} {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("name", "cluster"); + desc.add("doc", "On-track cluster properties for Lorentz angle and backplane correction measurement"); + desc.add("extension", false); + desc.add("Tracks", edm::InputTag{"generalTracks"}); + descriptions.add("siStripPositionCorrectionsTable", desc); + } + + void fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) final; + +private: + SiStripClusterInfo m_clusterInfo; + edm::ESGetToken m_tkGeomToken; +}; + +void SiStripPositionCorrectionsTableProducer::fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) { + const auto& tkGeom = iSetup.getData(m_tkGeomToken); + std::vector c_nstrips; + std::vector c_barycenter, c_variance, c_localdirx, c_localdiry, c_localdirz, c_localx, c_rhlocalx, + c_rhlocalxerr; + for (const auto clus : clusters) { + c_nstrips.push_back(clus.cluster->amplitudes().size()); + m_clusterInfo.setCluster(*clus.cluster, clus.det); + c_variance.push_back(m_clusterInfo.variance()); + const auto& trajState = clus.measurement.updatedState(); + const auto trackDir = trajState.localDirection(); + c_localdirx.push_back(trackDir.x()); + c_localdiry.push_back(trackDir.y()); + c_localdirz.push_back(trackDir.z()); + const auto hit = clus.measurement.recHit()->hit(); + const auto stripDet = dynamic_cast(tkGeom.idToDet(hit->geographicalId())); + c_barycenter.push_back(stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x()); + c_localx.push_back(stripDet->toLocal(trajState.globalPosition()).x()); + c_rhlocalx.push_back(hit->localPosition().x()); + c_rhlocalxerr.push_back(hit->localPositionError().xx()); + } + addColumn(table, "nstrips", c_nstrips, "cluster width"); + addColumn(table, "variance", c_variance, "Cluster variance"); + addColumn(table, "localdirx", c_localdirx, "x component of the local track direction"); + addColumn(table, "localdiry", c_localdiry, "y component of the local track direction"); + addColumn(table, "localdirz", c_localdirz, "z component of the local track direction"); + addColumn(table, "barycenter", c_barycenter, "Cluster barycenter (local x without corrections)"); + addColumn(table, "localx", c_localx, "Track local x"); + addColumn(table, "rhlocalx", c_rhlocalx, "RecHit local x"); + addColumn(table, "rhlocalxerr", c_rhlocalxerr, "RecHit local x uncertainty"); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SiStripPositionCorrectionsTableProducer); diff --git a/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc b/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc new file mode 100644 index 0000000000000..36e8804a3e88e --- /dev/null +++ b/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc @@ -0,0 +1,68 @@ +#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" + +#include "CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h" + +SiStripOnTrackClusterTableProducerBase::~SiStripOnTrackClusterTableProducerBase() {} + +namespace { + int findTrackIndex(const edm::View& tracks, const reco::Track* track) { + for (auto iTr = tracks.begin(); iTr != tracks.end(); ++iTr) { + if (&(*iTr) == track) { + return iTr - tracks.begin(); + } + } + return -2; + } +} // namespace + +void SiStripOnTrackClusterTableProducerBase::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle> tracks; + iEvent.getByToken(m_tracks_token, tracks); + edm::Handle trajTrackAssociations; + iEvent.getByToken(m_association_token, trajTrackAssociations); + + std::vector clusters{}; + + for (const auto& assoc : *trajTrackAssociations) { + const auto traj = assoc.key.get(); + const auto track = assoc.val.get(); + + for (const auto& meas : traj->measurements()) { + const auto& trajState = meas.updatedState(); + if (!trajState.isValid()) + continue; + + // there can be 2 (stereo module), 1 (no stereo module), or 0 (no strip hit) clusters per measurement + const auto trechit = meas.recHit()->hit(); + const auto simple1d = dynamic_cast(trechit); + const auto simple = dynamic_cast(trechit); + const auto matched = dynamic_cast(trechit); + if (matched) { + clusters.emplace_back(matched->monoId(), &matched->monoCluster(), traj, track, meas); + clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), traj, track, meas); + } else if (simple) { + clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), traj, track, meas); + } else if (simple1d) { + clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), traj, track, meas); + } + } + } + + auto out = std::make_unique(clusters.size(), m_name, false, m_extension); + if (!m_extension) { + std::vector c_trackindex; + c_trackindex.reserve(clusters.size()); + std::vector c_rawid; + c_rawid.reserve(clusters.size()); + for (const auto clus : clusters) { + c_trackindex.push_back(findTrackIndex(*tracks, clus.track)); + c_rawid.push_back(clus.det); + } + addColumn(out.get(), "trackindex", c_trackindex, "Track index"); + addColumn(out.get(), "rawid", c_rawid, "DetId"); + } + fillTable(clusters, *tracks, out.get(), iSetup); + iEvent.put(std::move(out)); +} diff --git a/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py new file mode 100644 index 0000000000000..6341d7b945525 --- /dev/null +++ b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py @@ -0,0 +1,173 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing + +################################################################### +# Setup 'standard' options +################################################################### +options = VarParsing() + +options.register('conditionGT', + "auto:run2_data", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "condition global tag for the job (\"auto:run2_data\" is default)") + +options.register('conditionOverwrite', + "", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "configuration to overwrite the condition into the GT (\"\" is default)") + +options.register('inputCollection', + "ALCARECOSiStripCalMinBias", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "collections to be used for input (\"ALCARECOSiStripCalMinBias\" is default, use 'generalTracks' for prompt reco and 'ctfWithMaterialTracksP5' for cosmic reco)") + +options.register('outputFile', + "calibTreeTest.root", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "name for the output root file (\"calibTreeTest.root\" is default)") + +options.register('inputFiles', + '/store/data/Run2018D/Cosmics/ALCARECO/SiStripCalCosmics-UL18-v1/40000/0346DCE4-0C70-1344-A7EB-D488B627208C.root', + VarParsing.multiplicity.list, + VarParsing.varType.string, + "file to process") + +options.register('maxEvents', + -1, + VarParsing.multiplicity.singleton, + VarParsing.varType.int, + "number of events to process (\"-1\" for all)") + +options.register('runNumber', + -1, + VarParsing.multiplicity.singleton, + VarParsing.varType.int, + "run number to process (\"-1\" for all)") + +options.register('cosmicTriggers', '', + VarParsing.multiplicity.list, + VarParsing.varType.string, + 'cosmic triggers') + +options.parseArguments() +################################################################### +# To use the prompt reco dataset please use 'generalTracks' as inputCollection +# To use the cosmic reco dataset please use 'ctfWithMaterialTracksP5' as inputCollection + + +process = cms.Process('CALIB') +process.load('Configuration/StandardSequences/MagneticField_cff') +process.load('Configuration.Geometry.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.conditionGT, options.conditionOverwrite) + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.StandardSequences.Services_cff') + +process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(options.maxEvents)) + +process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(options.inputFiles)) +if options.runNumber != -1: + if 'Cosmics' not in options.inputCollection: # FIXME: this should be improved + print("Restricting to the following events :") + print('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + process.source.eventsToProcess = cms.untracked.VEventRange('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + else: + print("Restricting to the following lumis for Cosmic runs only:") + print('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) + ) +process.MessageLogger.cerr.FwkReport.reportEvery = 10000 + +inTracks = cms.InputTag(options.inputCollection) + +process.load('CalibTracker.SiStripCommon.prescaleEvent_cfi') +process.load('CalibTracker.Configuration.Filter_Refit_cff') +## use CalibrationTracks (for clusters) and CalibrationTracksRefit (for tracks) +process.CalibrationTracks.src = inTracks +tracksForCalib = cms.InputTag("CalibrationTracksRefit") + +process.prescaleEvent.prescale = 1 +process.load("CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi") + +from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter + +process.IsolatedMuonFilter = triggerResultsFilter.clone( + triggerConditions = cms.vstring("HLT_IsoMu20_*"), + hltResults = cms.InputTag("TriggerResults", "", "HLT"), + l1tResults = cms.InputTag(""), + throw = cms.bool(False) + ) +if len(options.cosmicTriggers) > 0: + print("Cosmic triggers: {0}".format(", ".join(options.cosmicTriggers))) + process.IsolatedMuonFilter.triggerConditions = cms.vstring(options.cosmicTriggers) +else: + print("Cosmic triggers: {0} (default)".format(", ".join(process.IsolatedMuonFilter.triggerConditions))) + print("Argument passed: {0}".format(options.cosmicTriggers)) + +process.TkCalSeq = cms.Sequence( + process.prescaleEvent* + process.IsolatedMuonFilter* + process.siStripBFieldOnFilter* + process.CalibrationTracks, + cms.Task(process.MeasurementTrackerEvent), + cms.Task(process.offlineBeamSpot), + cms.Task(process.CalibrationTracksRefit) + ) + +process.load("PhysicsTools.NanoAOD.nano_cff") +process.load("PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff") + +## as a test: it should be possible to add tracks fully at configuration level (+ declaring the plugin) +from PhysicsTools.NanoAOD.common_cff import * +## this is equivalent to ShallowTrackProducer as configured for the gain calibration +process.tracksTable = cms.EDProducer("SimpleTrackFlatTableProducer", + src=tracksForCalib, + cut=cms.string(""), + name=cms.string("track"), + doc=cms.string("SiStripCalMinBias ALCARECO tracks"), + singleton=cms.bool(False), + extension=cms.bool(False), + variables=cms.PSet( + chi2ndof=Var("chi2()/ndof", float), + pt=Var("pt()", float), + hitsvalid=Var("numberOfValidHits()", int), ## unsigned? + phi=Var("phi()", float), + eta=Var("eta()", float), + ) + ) +process.load("CalibTracker.SiStripCommon.siStripPositionCorrectionsTable_cfi") +process.siStripPositionCorrectionsTable.Tracks = tracksForCalib +process.load("CalibTracker.SiStripCommon.siStripLorentzAngleRunInfoTable_cfi") + +siStripCalCosmicsNanoTables = cms.Task( + process.nanoMetadata, + process.tracksTable, + process.siStripPositionCorrectionsTable, + process.siStripLorentzAngleRunInfoTable + ) + +process.nanoCTPath = cms.Path(process.TkCalSeq, siStripCalCosmicsNanoTables) + +process.out = cms.OutputModule("NanoAODOutputModule", + fileName=cms.untracked.string(options.outputFile), + outputCommands=process.NANOAODEventContent.outputCommands+[ + "drop edmTriggerResults_*_*_*" + ], + SelectEvents=cms.untracked.PSet( + SelectEvents=cms.vstring("nanoCTPath") + ) + ) +process.end = cms.EndPath(process.out) + +process.schedule = cms.Schedule(process.nanoCTPath, process.end) From 64d46b10ebb89fdb95dba82c6dac2a9540960ef5 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 23 Aug 2021 14:49:24 +0200 Subject: [PATCH 567/923] Use NanoAODOutputModule for ALCARECO stream if dataTier equals NANOAOD --- .../Applications/python/ConfigBuilder.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index f87fe67ec4ce7..a45932b9f99e7 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -1151,9 +1151,9 @@ def inGeometryKeys(opt): self.REDIGIDefaultSeq=self.DIGIDefaultSeq # for alca, skims, etc - def addExtraStream(self,name,stream,workflow='full'): + def addExtraStream(self, name, stream, workflow='full', cppType="PoolOutputModule"): # define output module and go from there - output = cms.OutputModule("PoolOutputModule") + output = cms.OutputModule(cppType) if stream.selectEvents.parameters_().__len__()!=0: output.SelectEvents = stream.selectEvents else: @@ -1187,8 +1187,9 @@ def doNotInlineEventContent(instance,label = "process."+stream.content+".outputC if self._options.filtername: output.dataset.filterName= cms.untracked.string(self._options.filtername+"_"+stream.name) - #add an automatic flushing to limit memory consumption - output.eventAutoFlushCompressedSize=cms.untracked.int32(5*1024*1024) + if cppType == "PoolOutputModule": + #add an automatic flushing to limit memory consumption + output.eventAutoFlushCompressedSize=cms.untracked.int32(5*1024*1024) if workflow in ("producers,full"): if isinstance(stream.paths,tuple): @@ -1287,10 +1288,12 @@ def prepare_ALCA(self, sequence = None, workflow = 'full'): print("Setting numberOfConcurrentLuminosityBlocks=1 because of AlCa sequence {}".format(shortName)) self._options.nConcurrentLumis = "1" self._options.nConcurrentIOVs = "1" - output = self.addExtraStream(name,alcastream, workflow = workflow) + isNano = (alcastream.dataTier == "NANOAOD") + output = self.addExtraStream(name, alcastream, workflow=workflow, + cppType=("NanoAODOutputModule" if isNano else "PoolOutputModule")) self.executeAndRemember('process.ALCARECOEventContent.outputCommands.extend(process.OutALCARECO'+shortName+'_noDrop.outputCommands)') self.AlCaPaths.append(shortName) - if 'DQM' in alcaList: + if 'DQM' in alcaList and not isNano: if not self._options.inlineEventContent and hasattr(self.process,name): self.executeAndRemember('process.' + name + '.outputCommands.append("keep *_MEtoEDMConverter_*_*")') else: From 79496e5bc432d4aae59011bd241ea02c72155d1a Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 23 Aug 2021 14:48:24 +0200 Subject: [PATCH 568/923] Add SiStripCalCosmicsNano definition --- ...LCARECOSiStripCalCosmicsNano_Output_cff.py | 17 +++++ .../ALCARECOSiStripCalCosmicsNano_cff.py | 65 +++++++++++++++++++ .../EventContent/python/AlCaRecoOutput_cff.py | 1 + .../python/AlCaRecoStreams_cff.py | 11 ++++ 4 files changed, 94 insertions(+) create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py new file mode 100644 index 0000000000000..fb9691c6feb08 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +# AlCaNano for track based calibration using Cosmics events +from PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff import NANOAODEventContent +OutALCARECOSiStripCalCosmicsNano_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOSiStripCalCosmicsNano') + ), + outputCommands=cms.untracked.vstring( + 'keep nanoaodFlatTable_*Table_*_*', + 'keep nanoaodMergeableCounterTable_*Table_*_*', + 'keep nanoaodUniqueString_nanoMetadata_*_*', + ) + ) +import copy +OutALCARECOSiStripCalCosmicsNano = copy.deepcopy(OutALCARECOSiStripCalCosmicsNano_noDrop) +OutALCARECOSiStripCalCosmicsNano.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py new file mode 100644 index 0000000000000..ee97ed06c8430 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py @@ -0,0 +1,65 @@ +import FWCore.ParameterSet.Config as cms + +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import ALCARECOSiStripCalCosmics +from CalibTracker.SiStripCommon.prescaleEvent_cfi import prescaleEvent +from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter +from CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi import siStripBFieldOnFilter + +ALCARECOSiStripCalCosmicsNanoPrescale = prescaleEvent.clone(prescale=1) + +ALCARECOSiStripCalCosmicsNanoHLT = triggerResultsFilter.clone( + triggerConditions=cms.vstring("HLT_L1SingleMuCosmics_v*"), + hltResults=cms.InputTag("TriggerResults", "", "HLT"), + l1tResults=cms.InputTag(""), + throw=cms.bool(False) + ) + +from CalibTracker.Configuration.Filter_Refit_cff import CalibrationTracks, CalibrationTracksRefit, MeasurementTrackerEvent, offlineBeamSpot + +ALCARECOSiStripCalCosmicsNanoCalibTracks = CalibrationTracks.clone(src=cms.InputTag("ALCARECOSiStripCalCosmics")) +ALCARECOSiStripCalCosmicsNanoCalibTracksRefit = CalibrationTracksRefit.clone( + src=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracks") + ) + +ALCARECOSiStripCalCosmicsNanoTkCalSeq = cms.Sequence( + ALCARECOSiStripCalCosmicsNanoPrescale* + ALCARECOSiStripCalCosmicsNanoHLT* + siStripBFieldOnFilter* + ALCARECOSiStripCalCosmicsNanoCalibTracks, + cms.Task(MeasurementTrackerEvent), + cms.Task(offlineBeamSpot), + cms.Task(ALCARECOSiStripCalCosmicsNanoCalibTracksRefit) + ) + +from PhysicsTools.NanoAOD.common_cff import * +from PhysicsTools.NanoAOD.nano_cff import nanoMetadata +from CalibTracker.SiStripCommon.siStripPositionCorrectionsTable_cfi import siStripPositionCorrectionsTable +from CalibTracker.SiStripCommon.siStripLorentzAngleRunInfoTable_cfi import siStripLorentzAngleRunInfoTable + +ALCARECOSiStripCalCosmicsNanoTracksTable = cms.EDProducer("SimpleTrackFlatTableProducer", + src=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracksRefit"), + cut=cms.string(""), + name=cms.string("track"), + doc=cms.string("SiStripCalCosmics ALCARECO tracks"), + singleton=cms.bool(False), + extension=cms.bool(False), + variables=cms.PSet( + chi2ndof=Var("chi2()/ndof", float), + pt=Var("pt()", float), + hitsvalid=Var("numberOfValidHits()", int), ## unsigned? + phi=Var("phi()", float), + eta=Var("eta()", float), + ) + ) + +ALCARECOSiStripCalCosmicsNanoMeasTable = siStripPositionCorrectionsTable.clone( + Tracks=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracksRefit")) + +ALCARECOSiStripCalCosmicsNanoTables = cms.Task( + nanoMetadata, + ALCARECOSiStripCalCosmicsNanoTracksTable, + ALCARECOSiStripCalCosmicsNanoMeasTable, + siStripLorentzAngleRunInfoTable + ) + +seqALCARECOSiStripCalCosmicsNano = cms.Sequence(ALCARECOSiStripCalCosmicsNanoTkCalSeq, ALCARECOSiStripCalCosmicsNanoTables) diff --git a/Configuration/EventContent/python/AlCaRecoOutput_cff.py b/Configuration/EventContent/python/AlCaRecoOutput_cff.py index a8ddcb707fd92..ce7e83798e11e 100644 --- a/Configuration/EventContent/python/AlCaRecoOutput_cff.py +++ b/Configuration/EventContent/python/AlCaRecoOutput_cff.py @@ -53,6 +53,7 @@ from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_Output_cff import * # AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_Output_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmicsNano_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalCosmics_Output_cff import * # AlCaReco for tracker based alignment using beam halo diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index a5487c282e9ed..84ebf7ff9a000 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -51,6 +51,7 @@ from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_cff import * # AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmicsNano_cff import * ############################################################### # LUMI Calibration @@ -184,6 +185,7 @@ pathALCARECOSiPixelCalCosmics = cms.Path(seqALCARECOSiPixelCalCosmics) pathALCARECOSiStripCalMinBias = cms.Path(seqALCARECOSiStripCalMinBias*ALCARECOSiStripCalMinBiasDQM) pathALCARECOSiStripCalCosmics = cms.Path(seqALCARECOSiStripCalCosmics) +pathALCARECOSiStripCalCosmicsNano = cms.Path(seqALCARECOSiStripCalCosmics*seqALCARECOSiStripCalCosmicsNano) pathALCARECOSiStripCalMinBiasAAG = cms.Path(seqALCARECOSiStripCalMinBiasAAG*ALCARECOSiStripCalMinBiasAAGDQM) pathALCARECOSiStripCalSmallBiasScan = cms.Path(seqALCARECOSiStripCalSmallBiasScan) pathALCARECOSiStripCalZeroBias = cms.Path(seqALCARECOSiStripCalZeroBias*ALCARECOSiStripCalZeroBiasDQM) @@ -443,6 +445,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamSiStripCalCosmicsNano = cms.FilteredStream( + responsible = "Pieter David", + name = "SiStripCalCosmicsNano", + paths = (pathALCARECOSiStripCalCosmicsNano), + content = OutALCARECOSiStripCalCosmicsNano.outputCommands, + selectEvents = OutALCARECOSiStripCalCosmicsNano.SelectEvents, + dataTier = cms.untracked.string("NANOAOD") + ) + ALCARECOStreamSiStripCalZeroBias = cms.FilteredStream( responsible = 'Gordon Kaussen', name = 'SiStripCalZeroBias', From 05134f007901fa707a8582148b2073ffb6134926 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 23 Aug 2021 15:06:24 +0200 Subject: [PATCH 569/923] Add SiStripCalCosmicsNano to relval steps --- .../PyReleaseValidation/python/relval_steps.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 2d47b7e5df5ff..f4e71afd8fc11 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2597,11 +2597,11 @@ def gen2021HiMix(fragment,howMuch): '-s':'ALCA:TkAlCosmics0T+MuAlGlobalCosmics+HcalCalHOCosmics+DQM' } -steps['ALCACOSDRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) -steps['ALCACOSDRUN3']=merge([{'--conditions':'auto:run3_data','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) -steps['ALCACOSDPROMPTRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) -steps['ALCACOSDEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDRUN3']=merge([{'--conditions':'auto:run3_data','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDPROMPTRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) steps['ALCAPROMPT']={'-s':'ALCA:PromptCalibProd', '--filein':'file:TkAlMinBias.root', @@ -2658,10 +2658,10 @@ def gen2021HiMix(fragment,howMuch): steps['ALCAHAL']=merge([{'-s':'ALCA:TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo'},step4Up2015Defaults]) steps['ALCACOS_UP15']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo'},step4Up2015Defaults]) -steps['ALCACOS_UP16']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2016'},step4Up2015Defaults]) -steps['ALCACOS_UP17']=merge([{'--conditions':'auto:phase1_2017_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2017'},step4Up2015Defaults]) -steps['ALCACOS_UP18']=merge([{'--conditions':'auto:phase1_2018_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2018'},step4Up2015Defaults]) -steps['ALCACOS_UP21']=merge([{'--conditions':'auto:phase1_2021_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run3'},step4Up2015Defaults]) +steps['ALCACOS_UP16']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2016'},step4Up2015Defaults]) +steps['ALCACOS_UP17']=merge([{'--conditions':'auto:phase1_2017_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2017'},step4Up2015Defaults]) +steps['ALCACOS_UP18']=merge([{'--conditions':'auto:phase1_2018_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2018'},step4Up2015Defaults]) +steps['ALCACOS_UP21']=merge([{'--conditions':'auto:phase1_2021_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run3'},step4Up2015Defaults]) steps['ALCACOS_UP21_0T']=merge([{'--magField':'0T','--conditions':'auto:phase1_2021_cosmics_0T'},steps['ALCACOS_UP21']]) steps['ALCAHARVD']={'-s':'ALCAHARVEST:BeamSpotByRun+BeamSpotByLumi+SiStripQuality', '--conditions':'auto:run1_data', From e81a5d7a521c86a8805602ef027527e492c1a4fc Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 23 Aug 2021 17:19:55 +0200 Subject: [PATCH 570/923] Remove B-field filter --- .../python/ALCARECOSiStripCalCosmicsNano_cff.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py index ee97ed06c8430..59cb4c8ac3789 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py @@ -3,7 +3,6 @@ from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import ALCARECOSiStripCalCosmics from CalibTracker.SiStripCommon.prescaleEvent_cfi import prescaleEvent from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter -from CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi import siStripBFieldOnFilter ALCARECOSiStripCalCosmicsNanoPrescale = prescaleEvent.clone(prescale=1) @@ -24,7 +23,6 @@ ALCARECOSiStripCalCosmicsNanoTkCalSeq = cms.Sequence( ALCARECOSiStripCalCosmicsNanoPrescale* ALCARECOSiStripCalCosmicsNanoHLT* - siStripBFieldOnFilter* ALCARECOSiStripCalCosmicsNanoCalibTracks, cms.Task(MeasurementTrackerEvent), cms.Task(offlineBeamSpot), From 0f0c650fff698edb0367e7a1bfb4a6e2f2e167a7 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Wed, 25 Aug 2021 11:15:26 +0200 Subject: [PATCH 571/923] Add SiStripCalCosmicsNano tests for Configuration/DataProcessing --- Configuration/DataProcessing/test/run_CfgTest.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Configuration/DataProcessing/test/run_CfgTest.sh b/Configuration/DataProcessing/test/run_CfgTest.sh index ad04c1d7c2db6..9d09dbb9e99a3 100755 --- a/Configuration/DataProcessing/test/run_CfgTest.sh +++ b/Configuration/DataProcessing/test/run_CfgTest.sh @@ -21,6 +21,12 @@ do runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" done +declare -a arr=("cosmicsEra_Run2_2018" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3") +for scenario in "${arr[@]}" +do + runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco SiStripCalCosmicsNano " +done + declare -a arr=("HeavyIonsEra_Run2_2018") for scenario in "${arr[@]}" do From bc66b49f7f90b283da46b29c072e520bb7d86024 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Wed, 1 Sep 2021 10:06:19 +0200 Subject: [PATCH 572/923] Remove a comment --- .../produceCalibrationTree_CosmicsLABP_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py index 6341d7b945525..bc5062a7a833b 100644 --- a/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py +++ b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py @@ -75,7 +75,7 @@ process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(options.inputFiles)) if options.runNumber != -1: - if 'Cosmics' not in options.inputCollection: # FIXME: this should be improved + if 'Cosmics' not in options.inputCollection: print("Restricting to the following events :") print('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) process.source.eventsToProcess = cms.untracked.VEventRange('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) From c52defb96dd625233f218921184017b1fed4e195 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Wed, 1 Sep 2021 10:31:53 +0200 Subject: [PATCH 573/923] update inspectNanoFile script for Runs and LuminosityBlocks trees They are only added to the outputs if they contain non-standard products (i.e. more branches than the run and lumiblock number) --- PhysicsTools/NanoAOD/test/inspectNanoFile.py | 337 +++++++++++-------- 1 file changed, 199 insertions(+), 138 deletions(-) diff --git a/PhysicsTools/NanoAOD/test/inspectNanoFile.py b/PhysicsTools/NanoAOD/test/inspectNanoFile.py index 731d1f4254ddd..d05154a5aab72 100755 --- a/PhysicsTools/NanoAOD/test/inspectNanoFile.py +++ b/PhysicsTools/NanoAOD/test/inspectNanoFile.py @@ -15,6 +15,10 @@ def __init__(self,data): setattr(self,k,v) self.Events = self.trees["Events"] self.nevents = self.Events["entries"] + self.Runs = self.trees["Runs"] + self.nruns = self.Runs["entries"] + self.LuminosityBlocks = self.trees["LuminosityBlocks"] + self.nluminosityblocks = self.LuminosityBlocks["entries"] class Branch: def __init__(self, tree, branch): @@ -87,13 +91,13 @@ def inspectRootFile(infile): filesize = os.path.getsize(infile)/1024.0 tfile = ROOT.TFile.Open(infile) trees = {} - for treeName in "Events", "Runs", "Lumis": + for treeName in "Events", "Runs", "LuminosityBlocks": toplevelDoc={} tree = tfile.Get(treeName) entries = tree.GetEntries() trees[treeName] = tree branchList = tree.GetListOfBranches() - allbranches = [ Branch(tree,branchList.At(i)) for i in range(branchList.GetSize()) ] + allbranches = [ Branch(tree, br) for br in branchList ] branchmap = dict((b.name,b) for b in allbranches) branchgroups = {} # make list of counters and countees @@ -149,7 +153,6 @@ def inspectRootFile(infile): branchgroups = dict(bg.toJSON() for bg in branchgroups.values()), ) c1.Close() - break # only Event tree for now tfile.Close() return dict(filename = os.path.basename(infile), filesize = filesize, trees = trees) @@ -175,11 +178,13 @@ def makeSurvey(treeName, treeData): runningtotal += s['tot'] return (survey, "\n,\t".join(scriptdata)) -def writeSizeReport(fileData, stream): +def writeSizeReport(fileData, trees, stream): filename = fileData.filename filesize = fileData.filesize events = fileData.nevents - survey, scriptdata = makeSurvey("Events", filedata.Events) + surveys = {} + for treename, treeData in trees.items(): + surveys[treename] = makeSurvey(treename, treeData) title = "%s (%.3f Mb, %d events, %.2f kb/event)" % (filename, filesize/1024.0, events, filesize/events) stream.write(""" @@ -194,87 +199,115 @@ def writeSizeReport(fileData, stream):

    {title}

    - [No canvas support] - -

    Event data

    - - """); + """.format( + "\n".join(""" + values = []; + labels = []; + keys = []; + tips = []; + for (var i = 0; i < data_{treename}.length; i++) {{ + values.push( data_{treename}[i].size ); + labels.push( data_{treename}[i].label ); + keys.push( data_{treename}[i].label ); + tips.push( data_{treename}[i].tip ); + }} + var chart_{treename} = new RGraph.Pie("{treename}Canvas", values) + .Set('exploded', 7) + .Set('tooltips', tips) + .Set('tooltips.event', 'onmousemove') + .Set('key', labels) + .Set('key.position.graph.boxed', false) + .Draw(); + """.format(treename=treename, scriptdata=scriptdata) + for treename, (_, scriptdata) in surveys.items()))) + + if len(trees) > 1: + stream.write("

    Collections summary

    \n") + stream.write("
    \n") stream.write("\n"); - grandtotal = filedata.Events['allsize']; runningtotal = 0 - for s in survey: - stream.write("" % (s['doc'],s['name'],s['name'],s['kind'].lower(),len(s['subs']))) - stream.write("" % (s['entries']/events, s['tot']/events, s['tot']/s['entries']*1024 if s['entries'] else 0)) - stream.write("" % (s['tot']/grandtotal*200,10)) - stream.write("" % ( s['tot']/grandtotal * 100.0)) - stream.write("" % ( (runningtotal+s['tot'])/grandtotal * 100.0)) - stream.write("" % ( (grandtotal-runningtotal)/grandtotal * 100.0)) + runningtotal = 0 + for treename, (survey, _) in surveys.items(): + treetotal = trees[treename]['allsize'] + treerunningtotal = 0 + for s in survey: + stream.write("" % (s['doc'],s['name'],s['name'],s['kind'].lower(),len(s['subs']))) + stream.write("" % (s['entries']/events, s['tot']/events, s['tot']/s['entries']*1024 if s['entries'] else 0)) + stream.write("" % (s['tot']/treetotal*200,10)) + stream.write("" % ( s['tot']/treetotal * 100.0)) + stream.write("" % ( (runningtotal+s['tot'])/treetotal * 100.0)) + stream.write("" % ( (treetotal-runningtotal)/treetotal * 100.0)) + stream.write("\n") + treerunningtotal += s['tot'] + runningtotal += treerunningtotal + + # all known data + stream.write("" % treename) + stream.write("" % (treetotal/events)) + stream.write("" % (treetotal/filesize*100.0)) stream.write("\n") - runningtotal += s['tot']; - # all known data - stream.write("") - stream.write("" % (grandtotal/events)) - stream.write("" % (grandtotal/filesize*100.0)) - stream.write("\n") + if treename == "Events": + # non-event + stream.write("") + stream.write("" % ( (filesize-treetotal)/events)) + stream.write("" % ( (filesize-treetotal)/filesize * 100, 10 )) + stream.write("" % ( (filesize-treetotal)/filesize * 100.0 )) + stream.write("\n") - # other, unknown overhead - stream.write("") - stream.write("" % ( (filesize-grandtotal)/events)) - stream.write("" % ( (filesize-grandtotal)/filesize * 100, 10 )) - stream.write("" % ( (filesize-grandtotal)/filesize * 100.0 )) - stream.write("\n") + if len(surveys) > 1: + # other, unknown overhead + stream.write("") + stream.write("" % ( (filesize-runningtotal)/events)) + stream.write("" % ( (filesize-runningtotal)/filesize * 100, 10 )) + stream.write("" % ( (filesize-runningtotal)/filesize * 100.0 )) + stream.write("\n") # all file - stream.write("") + stream.write("") stream.write("" % (filesize/events)) stream.write("\n") stream.write("""
    " + "".join([ "collection", "kind", "vars", "items/evt", "kb/evt", "b/item", "plot", "%" ]) + "cumulative %
    %s%s%d%.2f%.3f%.1f%.1f%%%.1f%%%.1f%%
    %s%s%d%.2f%.3f%.1f%.1f%%%.1f%%%.1f%%
    All %s data   %.2f " % ( treetotal/filesize*100.0)) + stream.write("%.1f%%a
    All Event data   %.2f " % ( grandtotal/filesize*100.0)) - stream.write("%.1f%%a
    Non per-event data or overhead   %.2f %.1f%%a
    Non per-event data or overhead   %.2f %.1f%%a
    Overhead   %.2f %.1f%%a
    File size
    File size   %.2f   
    - Note: size percentages of individual event products are relative to the total size of Event data only.
    + Note: size percentages of individual event products are relative to the total size of Event data only (or equivalent for non-Events trees).
    Percentages with a are instead relative to the full file size. -

    Events detail

    """) - for s in sorted(survey, key = lambda s : s['name']): - stream.write("

    %s (%.1f items/evt, %.3f kb/evt) [back to top]

    " % (s['name'], s['name'], s['name'], s['entries']/events, s['tot']/events)) - stream.write("\n") - stream.write("\n") - subs = [ fileData.Events['branches'][b] for b in s['subs'] ] - for b in sorted(subs, key = lambda s : - s['tot']): - stream.write("" % (b['doc'],b['name'], b['kind'], b['tot']/events*1024, b['tot']/s['entries']*1024 if s['entries'] else 0)) - stream.write("" % ( b['tot']/s['tot']*200, 10 )) - stream.write("" % (b['tot']/s['tot'] * 100.0)) - stream.write("\n") - stream.write("
    " + "".join( [ "branch", "kind", "b/event", "b/item", "plot", "%" ]) + "
    %s%s%.1f%.1f%.1f%%
    \n") + for treename, treeData in trees.items(): + stream.write(""" +

    %s detail

    + """ % treename) + for s in sorted(surveys[treename][0], key = lambda s : s['name']): + stream.write("

    %s (%.1f items/evt, %.3f kb/evt) [back to top]

    " % (s['name'], s['name'], s['name'], s['entries']/events, s['tot']/events)) + stream.write("\n") + stream.write("\n") + subs = [ treeData['branches'][b] for b in s['subs'] ] + for b in sorted(subs, key = lambda s : - s['tot']): + stream.write("" % (b['doc'],b['name'], b['kind'], b['tot']/events*1024, b['tot']/s['entries']*1024 if s['entries'] else 0)) + stream.write("" % ( b['tot']/s['tot']*200, 10 )) + stream.write("" % (b['tot']/s['tot'] * 100.0)) + stream.write("\n") + stream.write("
    " + "".join( [ "branch", "kind", "b/event", "b/item", "plot", "%" ]) + "
    %s%s%.1f%.1f%.1f%%
    \n") stream.write(""" """) -def writeDocReport(fileData, stream): +def writeDocReport(fileName, trees, stream): stream.write( """ @@ -282,95 +315,115 @@ def writeDocReport(fileData, stream): -

    Content

    - - """.format(filename=fileData.filename)) - stream.write( "\n" ) - groups = list(fileData.Events['branchgroups'].values()) - groups.sort(key = lambda s : s['name']) - for s in groups: - stream.write( "\n" % (s['name'],s['name'],s['doc']) ) - stream.write( "
    CollectionDescription
    %s%s
    \n\n

    Events detail

    \n" ) - for s in groups: - stream.write( "

    %s [back to top]

    \n" % (s['name'], s['name'], s['name']) ) - stream.write( "\n" ) - stream.write( "\n" ) - subs = [ fileData.Events['branches'][b] for b in s['subs'] ] - for b in sorted(subs, key = lambda s : s['name']): - stream.write( "" % (b['name'], b['kind'], b['doc']) ) - stream.write( "\n" ) - stream.write( "
    Object propertyTypeDescription
    %s%s%s
    \n" ) + """.format(filename=fileName)) + for treename, treeData in trees.items(): + stream.write(""" +

    {treename} Content

    + + """.format(treename=treename)) + stream.write( "\n" ) + groups = list(treeData['branchgroups'].values()) + groups.sort(key = lambda s : s['name']) + for s in groups: + stream.write( "\n" % (s['name'],s['name'],s['doc']) ) + stream.write("
    CollectionDescription
    %s%s
    \n\n

    {treename} detail

    \n".format(treename=treename)) + for s in groups: + stream.write( "

    %s [back to top]

    \n" % (s['name'], s['name'], s['name']) ) + stream.write( "\n" ) + stream.write( "\n" ) + subs = [ treeData['branches'][b] for b in s['subs'] ] + for b in sorted(subs, key = lambda s : s['name']): + stream.write( "" % (b['name'], b['kind'], b['doc']) ) + stream.write( "\n" ) + stream.write( "
    Object propertyTypeDescription
    %s%s%s
    \n" ) stream.write( """ """ ) -def writeMarkdownSizeReport(fileData, stream): +def writeMarkdownSizeReport(fileData, trees, stream): filename = fileData.filename filesize = fileData.filesize events = fileData.nevents - survey, _ = makeSurvey("Events", filedata.Events) + surveys = {} + for treename, treeData in trees.items(): + surveys[treename] = makeSurvey(treename, treeData)[0] stream.write("**%s (%.3f Mb, %d events, %.2f kb/event)**\n" % (filename, filesize/1024.0, events, filesize/events)) - stream.write("\n# Event data\n") + stream.write("\n# Event data\n" if len(trees) == 1 else "\n# Collection data\n") stream.write("| collection | kind | vars | items/evt | kb/evt | b/item | plot | % | ascending cumulative % | descending cumulative % |\n") stream.write("| - | - | - | - | - | - | - | - | - | - |\n") - grandtotal = filedata.Events['allsize']; runningtotal = 0 - for s in survey: - stream.write("| [**%s**](#%s '%s') | %s | %d" % (s['name'], s['name'].lower(), s['doc'].replace('|', '\|').replace('\'', '\"'), s['kind'].lower(), len(s['subs']))) - stream.write("| %.2f|%.3f|%.1f" % (s['entries']/events, s['tot']/events, s['tot'] / s['entries'] * 1024 if s['entries'] else 0)) - stream.write("| " % (s['tot'] / grandtotal * 200, 10)) - stream.write("| %.1f%%" % (s['tot'] / grandtotal * 100.0)) - stream.write("| %.1f%%" % ((runningtotal+s['tot'])/grandtotal * 100.0)) - stream.write("| %.1f%% |\n" % ((grandtotal-runningtotal)/grandtotal * 100.0)) - runningtotal += s['tot'] + runningtotal = 0 + for treename, survey in surveys.items(): + treetotal = trees[treename]['allsize'] + treerunningtotal = 0 + for s in survey: + stream.write("| [**%s**](#%s '%s') | %s | %d" % (s['name'], s['name'].lower(), s['doc'].replace('|', '\|').replace('\'', '\"'), s['kind'].lower(), len(s['subs']))) + stream.write("| %.2f|%.3f|%.1f" % (s['entries']/events, s['tot']/events, s['tot'] / s['entries'] * 1024 if s['entries'] else 0)) + stream.write("| " % (s['tot'] / treetotal * 200, 10)) + stream.write("| %.1f%%" % (s['tot'] / treetotal * 100.0)) + stream.write("| %.1f%%" % ((runningtotal+s['tot'])/treetotal * 100.0)) + stream.write("| %.1f%% |\n" % ((treetotal-runningtotal)/treetotal * 100.0)) + runningtotal += s['tot'] - # all known data - stream.write("**All Event data**") - stream.write("| | | | **%.2f**" % (grandtotal/events)) - stream.write("| | " % (grandtotal / filesize * 100.0, 10)) - stream.write("| %.1f%%a | | |\n" % (grandtotal/filesize * 100.0)) + # all known data + stream.write("**All %s data**" % treename) + stream.write("| | | | **%.2f**" % (treetotal/events)) + stream.write("| | " % (treetotal / filesize * 100.0, 10)) + stream.write("| %.1f%%a | | |\n" % (treetotal/filesize * 100.0)) - # other, unknown overhead - stream.write("**Non per-event data or overhead**") - stream.write("| | | | %.2f" % ((filesize-grandtotal)/events)) - stream.write("| | " % ((filesize - grandtotal) / filesize * 100, 10)) - stream.write("| %.1f%%a | | |\n" % ((filesize-grandtotal)/filesize * 100.0)) + if treename == "Events": + # non-event + stream.write("**Non per-event data or overhead**") + stream.write("| | | | %.2f" % ((filesize-treetotal)/events)) + stream.write("| | " % ((filesize - treetotal) / filesize * 100, 10)) + stream.write("| %.1f%%a | | |\n" % ((filesize-treetotal)/filesize * 100.0)) + + if len(surveys) > 1: + # other, unknown overhead + stream.write("**Overhead**") + stream.write("| | | | %.2f" % ((filesize-runningtotal)/events)) + stream.write("| | " % ((filesize - runningtotal) / filesize * 100, 10)) + stream.write("| %.1f%%a | | |\n" % ((filesize-runningtotal)/filesize * 100.0)) # all file stream.write("**File size**") stream.write("| | | | **%.2f**" % (filesize/events)) stream.write("| | | | | |\n\n") - stream.write("Note: size percentages of individual event products are relative to the total size of Event data only.\\\n") + stream.write("Note: size percentages of individual event products are relative to the total size of Event data only (or equivalent for non-Events trees).\\\n") stream.write("Percentages with a are instead relative to the full file size.\n\n") - stream.write("# Events detail\n") - for s in sorted(survey, key=lambda s: s['name']): - stream.write("## %s (%.1f items/evt, %.3f kb/evt) [[back to top]](#event-data)\n" % (s['name'].lower(), s['name'], s['entries'] / events, s['tot'] / events)) - stream.write("| branch | kind | b/event | b/item | plot | % |\n") - stream.write("| - | - | - | - | - | - |\n") - subs = [fileData.Events['branches'][b] for b in s['subs']] - for b in sorted(subs, key = lambda s: - s['tot']): - stream.write("| %s | %s | %.1f | %.1f" % (b['doc'].replace('|', '\|').replace('\'', '\"'), b['name'], b['kind'], b['tot'] / events * 1024, b['tot'] / s['entries'] * 1024 if s['entries'] else 0)) - stream.write("| " % (b['tot'] / s['tot'] * 200, 10)) - stream.write("| %.1f%% |\n" % (b['tot'] / s['tot'] * 100.0)) + for treename, survey in surveys.items(): + stream.write("# %s detail\n" % treename) + for s in sorted(survey, key=lambda s: s['name']): + stream.write("## %s (%.1f items/evt, %.3f kb/evt) [[back to top]](#event-data)\n" % (s['name'].lower(), s['name'], s['entries'] / events, s['tot'] / events)) + stream.write("| branch | kind | b/event | b/item | plot | % |\n") + stream.write("| - | - | - | - | - | - |\n") + subs = [trees[treename]['branches'][b] for b in s['subs']] + for b in sorted(subs, key = lambda s: - s['tot']): + stream.write("| %s | %s | %.1f | %.1f" % (b['doc'].replace('|', '\|').replace('\'', '\"'), b['name'], b['kind'], b['tot'] / events * 1024, b['tot'] / s['entries'] * 1024 if s['entries'] else 0)) + stream.write("| " % (b['tot'] / s['tot'] * 200, 10)) + stream.write("| %.1f%% |\n" % (b['tot'] / s['tot'] * 100.0)) + stream.write("\n") -def writeMarkdownDocReport(fileData, stream): - stream.write("# Content\n") - stream.write("\n| Collection | Description |\n") - stream.write("| - | - |\n") - groups = fileData.Events['branchgroups'].values() - groups.sort(key = lambda s : s['name']) - for s in groups: - stream.write("| [**%s**](#%s) | %s |\n" % (s['name'], s['name'].lower(), s['doc'])) - stream.write("\n# Events detail\n") - for s in groups: - stream.write("\n## %s [[back to top]](#content)\n" % (s['name'].lower(), s['name'])) - stream.write("| Object property | Type | Description |\n") - stream.write("| - | - | - |\n") - subs = [fileData.Events['branches'][b] for b in s['subs']] - for b in sorted(subs, key = lambda s : s['name']): - stream.write("| **%s** | %s| %s |\n" % (b['name'], b['kind'], b['doc'])) +def writeMarkdownDocReport(trees, stream): + for treename, treeData in trees.items(): + stream.write("# %s Content\n" % treename) + stream.write("\n| Collection | Description |\n") + stream.write("| - | - |\n") + groups = list(treeData['branchgroups'].values()) + groups.sort(key = lambda s : s['name']) + for s in groups: + stream.write("| [**%s**](#%s) | %s |\n" % (s['name'], s['name'].lower(), s['doc'])) + stream.write("\n# %s detail\n" % treename) + for s in groups: + stream.write("\n## %s [[back to top]](#content)\n" % (s['name'].lower(), s['name'])) + stream.write("| Object property | Type | Description |\n") + stream.write("| - | - | - |\n") + subs = [treeData['branches'][b] for b in s['subs']] + for b in sorted(subs, key = lambda s : s['name']): + stream.write("| **%s** | %s| %s |\n" % (b['name'], b['kind'], b['doc'])) + stream.write("\n") def _maybeOpen(filename): return open(filename, 'w') if filename != "-" else sys.stdout @@ -395,15 +448,23 @@ def _maybeOpen(filename): if options.json: json.dump(filedata._json, _maybeOpen(options.json), indent=4) sys.stderr.write("JSON output saved to %s\n" % options.json) + + treedata = {} # trees for (HTML or markdown) doc report + if len(filedata.Runs["branches"]) > 1: # default: run number + treedata["Runs"] = filedata.Runs + if len(filedata.LuminosityBlocks["branches"]) > 2: # default: run number, lumiblock + treedata["LuminosityBlocks"] = filedata.LuminosityBlocks + treedata["Events"] = filedata.Events + if options.doc: - writeDocReport(filedata, _maybeOpen(options.doc)) + writeDocReport(filedata.filename, treedata, _maybeOpen(options.doc)) sys.stderr.write("HTML documentation saved to %s\n" % options.doc) if options.size: - writeSizeReport(filedata, _maybeOpen(options.size)) + writeSizeReport(filedata, treedata, _maybeOpen(options.size)) sys.stderr.write("HTML size report saved to %s\n" % options.size) if options.docmd: - writeMarkdownDocReport(filedata, _maybeOpen(options.docmd)) + writeMarkdownDocReport(treedata, _maybeOpen(options.docmd)) sys.stderr.write("Markdown documentation saved to %s\n" % options.docmd) if options.sizemd: - writeMarkdownSizeReport(filedata, _maybeOpen(options.sizemd)) + writeMarkdownSizeReport(filedata, treedata, _maybeOpen(options.sizemd)) sys.stderr.write("Markdown size report saved to %s\n" % options.sizemd) From faa2da48c0dc8e820872d65bdc5463f9f32fec45 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Wed, 8 Sep 2021 16:47:18 +0200 Subject: [PATCH 574/923] DQM SPLASH resolve # 1 --- .../beamfake_dqm_sourceclient-live_cfg.py | 5 +++++ .../beamhltfake_dqm_sourceclient-live_cfg.py | 5 +++++ .../clients/castor_dqm_sourceclient-live_cfg.py | 3 +++ .../clients/csc_dqm_sourceclient-live_cfg.py | 2 ++ .../clients/ctpps_dqm_sourceclient-live_cfg.py | 1 + .../clients/dt4ml_dqm_sourceclient-live_cfg.py | 1 + .../clients/dt_dqm_sourceclient-live_cfg.py | 1 + .../clients/ecal_dqm_sourceclient-live_cfg.py | 1 + .../ecalcalib_dqm_sourceclient-live_cfg.py | 1 + .../clients/es_dqm_sourceclient-live_cfg.py | 1 + .../clients/fed_dqm_sourceclient-live_cfg.py | 1 + .../clients/gem_dqm_sourceclient-live_cfg.py | 1 + .../clients/hcal_dqm_sourceclient-live_cfg.py | 6 ++++-- .../hcalcalib_dqm_sourceclient-live_cfg.py | 6 +++++- .../hcalreco_dqm_sourceclient-live_cfg.py | 8 ++++++-- .../python/clients/hlt_dqm_clientPB-live_cfg.py | 2 +- .../clients/hlt_dqm_sourceclient-live_cfg.py | 3 ++- .../clients/info_dqm_sourceclient-live_cfg.py | 1 + .../l1tstage2_dqm_sourceclient-live_cfg.py | 2 +- ...tstage2emulator_dqm_sourceclient-live_cfg.py | 1 + .../mutracking_dqm_sourceclient-live_cfg.py | 2 +- ...linebeammonitor_dqm_sourceclient-live_cfg.py | 2 +- .../clients/pixel_dqm_sourceclient-live_cfg.py | 1 + .../pixellumi_dqm_sourceclient-live_cfg.py | 1 + .../clients/rpc_dqm_sourceclient-live_cfg.py | 3 +++ .../clients/scal_dqm_sourceclient-live_cfg.py | 1 + .../sistrip_dqm_sourceclient-live_cfg.py | 1 + .../visualization-live-secondInstance_cfg.py | 8 +++++++- .../python/clients/visualization-live_cfg.py | 8 +++++++- .../python/config/inputsource_cfi.py | 17 ++++++++++++++++- DQM/Integration/python/config/pbsource_cfi.py | 8 ++++++++ 31 files changed, 91 insertions(+), 13 deletions(-) diff --git a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py index 44e6495d057ba..04a7e29e5b94f 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -198,6 +198,11 @@ #--------- # Final path +print("Final Source settings:", process.source) + process.p = cms.Path(process.dqmcommon * process.monitor ) + + + diff --git a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py index 4edc1310160c1..c93032d5031ce 100644 --- a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py @@ -167,5 +167,10 @@ ) print("Configured frontierKey", options.runUniqueKey) +#--------- +# Final path +print("Final Source settings:", process.source) + process.p = cms.Path(process.dqmcommon * process.monitor ) + diff --git a/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py index 21c7ba5d03802..3c9ba334c2c96 100644 --- a/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py @@ -143,4 +143,7 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) + + diff --git a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py index 03a0947379fcb..0a2915a1be984 100644 --- a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py @@ -222,4 +222,6 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) + diff --git a/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py index ca590a35ef5ab..8d490dcc7b3b1 100644 --- a/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py @@ -104,4 +104,5 @@ # Process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py index a775a8debe554..f68e01817f44d 100644 --- a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py @@ -123,4 +123,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py index 33708fd2b40f7..0001acf61064b 100644 --- a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py @@ -104,4 +104,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 8409881dd6e62..350732160fbb1 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -171,4 +171,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py index 4b8508fb3023b..27588bd4156f1 100644 --- a/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py @@ -213,4 +213,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py index 50821b2842190..868f9119170f6 100644 --- a/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py @@ -96,4 +96,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index 7cb5cb5900b7c..4264ac93ab9d5 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -156,4 +156,5 @@ # Finaly: DQM process customizations from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py index 087c80024c1d7..8729da504bc58 100644 --- a/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py @@ -58,4 +58,5 @@ process.dqmProvInfo.runType = process.runType.getRunTypeName() from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index 346786f8f9476..32430ba4f6eff 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -59,8 +59,9 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) process.DQMStore.verbose = 0 -if not useFileInput and not unitTest: - process.source.minEventsPerLumi = 100 +if not unitTest and not useFileInput : + if not process.BeamSplashRun : + process.source.minEventsPerLumi = 100 #------------------------------------- # CMSSW/Hcal non-DQM Related Module import @@ -256,4 +257,5 @@ # tracer #process.Tracer = cms.Service("Tracer") +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py index 0910e080f8185..c69d2a5c46e83 100644 --- a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py @@ -52,7 +52,10 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) if not useFileInput: - process.source.minEventsPerLumi=100 + if hasattr(process, "BeamSplashRun") : + if not process.BeamSplashRun : + process.source.minEventsPerLumi=100 + else : process.source.minEventsPerLumi=100 #------------------------------------- @@ -236,6 +239,7 @@ #------------------------------------- # Scheduling #------------------------------------- +print("Final Source settings:", process.source) process.options = cms.untracked.PSet( Rethrow = cms.untracked.vstring( # "ProductNotFound", diff --git a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py index 8e37ecc6756b4..0db8b902299b7 100644 --- a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py @@ -68,8 +68,9 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) process.DQMStore.verbose = 0 -if not useFileInput and not unitTest: - process.source.minEventsPerLumi = 5 +if not unitTest and not useFileInput: + if not process.BeamSplashRun : + process.source.minEventsPerLumi = 5 # Note, runType is obtained after importing DQM-related modules # => DQM-dependent @@ -196,4 +197,7 @@ "TooFewProducts" ) ) + process.options.wantSummary = True +print("Final Source settings:", process.source) + diff --git a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py index 047c9b1924722..d76880246ec3b 100644 --- a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py @@ -85,5 +85,5 @@ process.load('DQM.HLTEvF.psMonitorClient_cfi') process.psChecker = process.psMonitorClient.clone() - +print("Final Source settings:", process.source) process.p = cms.EndPath( process.fastTimerServiceClient + process.throughputServiceClient + process.psColumnVsLumi + process.psChecker + process.dqmEnv + process.dqmSaver + process.dqmSaverPB ) diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index c2203f1eeb50b..08b5608d72481 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -1,4 +1,4 @@ -import FWCore.ParameterSet.Config as cms +sourceimport FWCore.ParameterSet.Config as cms import sys from Configuration.ProcessModifiers.run2_HECollapse_2018_cff import run2_HECollapse_2018 @@ -136,3 +136,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py index 6f1666f2313cd..bab64c29a006e 100644 --- a/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py @@ -79,3 +79,4 @@ # Process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 8f95e2b1b8fa4..cc0aae145ff1e 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -184,4 +184,4 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index 6c660e08e7249..f1b7a69c79d23 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -180,3 +180,4 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py index fc7262569776e..4742e4da7fb42 100644 --- a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py @@ -188,5 +188,5 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - +process.options.wantSummary = cms.untracked.bool(True) diff --git a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py index c2082f42ccfaf..46e579f65fd74 100644 --- a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py @@ -171,4 +171,4 @@ process.p = cms.Path( process.dqmcommon * process.monitor ) - +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py index ed4e66d3a889e..1662356049622 100644 --- a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py @@ -252,3 +252,4 @@ #-------------------------------------------------- print("Running with run type = ", process.runType.getRunType()) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py index f7e4ee9fdf91e..d7efdcfe9544d 100644 --- a/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py @@ -142,3 +142,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py index b0c99a3130971..0c84f0ca17f36 100644 --- a/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py @@ -190,3 +190,6 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) + + diff --git a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py index 96d0368af11a4..3aca30e0fa20d 100644 --- a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py @@ -107,3 +107,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) 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 f6c0a82d59682..afac4d725764c 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -659,3 +659,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index 38273da9aaf35..110855ae77bfb 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -27,6 +27,9 @@ scenarioName = scenarios[runType.getRunTypeName()] +if not unitTest and process.BeamSplashRun : + scenarioName = 'ppEra_Run3' + print("Using scenario:",scenarioName) try: @@ -68,6 +71,8 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQMEventDisplay' + if process.BeamSplashRun : + set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) runno = str(m.group(1)) @@ -118,3 +123,4 @@ psetFile.close() cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py" print("Now do:\n%s" % cmsRun) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 621c3b595cf98..bfa60e0df8888 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -27,6 +27,9 @@ scenarioName = scenarios[runType.getRunTypeName()] +if not unitTest and process.BeamSplashRun : + scenarioName = 'ppEra_Run3' + print("Using scenario:",scenarioName) try: @@ -66,6 +69,8 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQM' + if process.BeamSplashRun : + set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) runno = str(m.group(1)) @@ -113,3 +118,4 @@ psetFile.close() cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py" print("Now do:\n%s" % cmsRun) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/config/inputsource_cfi.py b/DQM/Integration/python/config/inputsource_cfi.py index ebc4a3036d526..d7afb71ff23da 100644 --- a/DQM/Integration/python/config/inputsource_cfi.py +++ b/DQM/Integration/python/config/inputsource_cfi.py @@ -110,4 +110,19 @@ # secondaryFileNames = cms.untracked.vstring() #) -print("Source:", source) +# https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017 +def set_BeamSplashRun_settings( source ): + source.minEventsPerLumi = 1000000 + source.nextLumiTimeoutMillis = 15000 + +BeamSplashRun = False +if BeamSplashRun : set_BeamSplashRun_settings( source ) + + +print("Initial Source settings:", source) + + + + + + diff --git a/DQM/Integration/python/config/pbsource_cfi.py b/DQM/Integration/python/config/pbsource_cfi.py index b3ba96c4aafa4..ed0b022d2b9da 100644 --- a/DQM/Integration/python/config/pbsource_cfi.py +++ b/DQM/Integration/python/config/pbsource_cfi.py @@ -83,4 +83,12 @@ endOfRunKills = cms.untracked.bool(endOfRunKills), ) +# https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017 +def set_BeamSplashRun_settings( source ): + source.minEventsPerLumi = 1000000 + source.nextLumiTimeoutMillis = 15000 + +BeamSplashRun = False +if BeamSplashRun : set_BeamSplashRun_settings( source ) + print("Source:", source) From a86f31563921229b4a9f0fa0a321f4547e5467a7 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Wed, 8 Sep 2021 16:49:22 +0200 Subject: [PATCH 575/923] printout fix --- DQM/Integration/python/config/pbsource_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/config/pbsource_cfi.py b/DQM/Integration/python/config/pbsource_cfi.py index ed0b022d2b9da..7430aa588e084 100644 --- a/DQM/Integration/python/config/pbsource_cfi.py +++ b/DQM/Integration/python/config/pbsource_cfi.py @@ -91,4 +91,4 @@ def set_BeamSplashRun_settings( source ): BeamSplashRun = False if BeamSplashRun : set_BeamSplashRun_settings( source ) -print("Source:", source) +print("Initial Source settings:", source) From a6ec5414eaae4cc207af2c59a76c319affc85216 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Wed, 8 Sep 2021 18:06:46 +0200 Subject: [PATCH 576/923] typos fix --- .../python/clients/hcal_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/hcalcalib_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/hcalreco_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/hlt_dqm_sourceclient-live_cfg.py | 2 +- .../clients/visualization-live-secondInstance_cfg.py | 7 ++++--- DQM/Integration/python/clients/visualization-live_cfg.py | 7 ++++--- DQM/Integration/python/config/pbsource_cfi.py | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index 32430ba4f6eff..d1fdc1801e9de 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -46,7 +46,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options + from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -60,7 +60,7 @@ process = customise(process) process.DQMStore.verbose = 0 if not unitTest and not useFileInput : - if not process.BeamSplashRun : + if not BeamSplashRun : process.source.minEventsPerLumi = 100 #------------------------------------- diff --git a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py index c69d2a5c46e83..b9ce238bed22e 100644 --- a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py @@ -55,7 +55,7 @@ if hasattr(process, "BeamSplashRun") : if not process.BeamSplashRun : process.source.minEventsPerLumi=100 - else : process.source.minEventsPerLumi=100 + else : process.source.minEventsPerLumi=100 #------------------------------------- diff --git a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py index 0db8b902299b7..4a6aa5d94f58a 100644 --- a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py @@ -55,7 +55,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options + from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -69,7 +69,7 @@ process = customise(process) process.DQMStore.verbose = 0 if not unitTest and not useFileInput: - if not process.BeamSplashRun : + if not BeamSplashRun : process.source.minEventsPerLumi = 5 # Note, runType is obtained after importing DQM-related modules diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index 08b5608d72481..19d4a18a757bb 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -1,4 +1,4 @@ -sourceimport FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.Config as cms import sys from Configuration.ProcessModifiers.run2_HECollapse_2018_cff import run2_HECollapse_2018 diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index 110855ae77bfb..1255dbe05128b 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings + from DQM.Integration.config.inputsource_cfi import options, runType, source, BeamSplashRun, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -27,8 +27,9 @@ scenarioName = scenarios[runType.getRunTypeName()] -if not unitTest and process.BeamSplashRun : - scenarioName = 'ppEra_Run3' +if not unitTest : + if BeamSplashRun : + scenarioName = 'ppEra_Run3' print("Using scenario:",scenarioName) diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index bfa60e0df8888..75f7cd78e929c 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings + from DQM.Integration.config.inputsource_cfi import options, runType, source, BeamSplashRun, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -27,8 +27,9 @@ scenarioName = scenarios[runType.getRunTypeName()] -if not unitTest and process.BeamSplashRun : - scenarioName = 'ppEra_Run3' +if not unitTest : + if BeamSplashRun : + scenarioName = 'ppEra_Run3' print("Using scenario:",scenarioName) diff --git a/DQM/Integration/python/config/pbsource_cfi.py b/DQM/Integration/python/config/pbsource_cfi.py index 7430aa588e084..72071ae25c58e 100644 --- a/DQM/Integration/python/config/pbsource_cfi.py +++ b/DQM/Integration/python/config/pbsource_cfi.py @@ -85,7 +85,7 @@ # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017 def set_BeamSplashRun_settings( source ): - source.minEventsPerLumi = 1000000 + # source.minEventsPerLumi = 1000000 source.nextLumiTimeoutMillis = 15000 BeamSplashRun = False From 201777ed74e95c7c4254665d6fd67ed031967783 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Thu, 9 Sep 2021 14:20:37 +0200 Subject: [PATCH 577/923] DQM SPLASH resolve # 2 --- .../python/clients/hcalcalib_dqm_sourceclient-live_cfg.py | 8 +++----- .../clients/visualization-live-secondInstance_cfg.py | 5 +++-- DQM/Integration/python/clients/visualization-live_cfg.py | 5 +++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py index b9ce238bed22e..afea0dd38856b 100644 --- a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py @@ -37,7 +37,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options + from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -52,10 +52,8 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) if not useFileInput: - if hasattr(process, "BeamSplashRun") : - if not process.BeamSplashRun : - process.source.minEventsPerLumi=100 - else : process.source.minEventsPerLumi=100 + if not BeamSplashRun : + process.source.minEventsPerLumi=100 #------------------------------------- diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index 1255dbe05128b..769cf38bd2c6d 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -29,7 +29,8 @@ if not unitTest : if BeamSplashRun : - scenarioName = 'ppEra_Run3' + # scenarioName = 'ppEra_Run3' FIXME + pass print("Using scenario:",scenarioName) @@ -72,7 +73,7 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQMEventDisplay' - if process.BeamSplashRun : + if BeamSplashRun : set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 75f7cd78e929c..2a692f286f2b7 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -29,7 +29,8 @@ if not unitTest : if BeamSplashRun : - scenarioName = 'ppEra_Run3' + # scenarioName = 'ppEra_Run3' #FIXME + pass print("Using scenario:",scenarioName) @@ -70,7 +71,7 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQM' - if process.BeamSplashRun : + if BeamSplashRun : set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) From 4123a98a27ac3add9e9a28d59e6d57e03ce646a0 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Fri, 10 Sep 2021 15:39:36 +0200 Subject: [PATCH 578/923] add mutracking printout --- .../python/clients/mutracking_dqm_sourceclient-live_cfg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py index 4742e4da7fb42..def262433037a 100644 --- a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py @@ -189,4 +189,5 @@ process = customise(process) process.options.wantSummary = cms.untracked.bool(True) +print("Final Source settings:", process.source) From c93a72f657bddb47e14a37228a20ebcc0eeeb59c Mon Sep 17 00:00:00 2001 From: pmandrik Date: Fri, 10 Sep 2021 15:56:26 +0200 Subject: [PATCH 579/923] fix spacing --- .../python/clients/hcal_dqm_sourceclient-live_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index d1fdc1801e9de..f3acbeb49aadf 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -61,7 +61,7 @@ process.DQMStore.verbose = 0 if not unitTest and not useFileInput : if not BeamSplashRun : - process.source.minEventsPerLumi = 100 + process.source.minEventsPerLumi = 100 #------------------------------------- # CMSSW/Hcal non-DQM Related Module import From 9a1b10e435f6ffbc51d676e55eb690ee7ed98563 Mon Sep 17 00:00:00 2001 From: pmandrik Date: Tue, 14 Sep 2021 10:16:14 +0200 Subject: [PATCH 580/923] DQM SPLASH resolve # 3 --- .../python/clients/hcal_dqm_sourceclient-live_cfg.py | 4 ++-- .../clients/hcalcalib_dqm_sourceclient-live_cfg.py | 4 ++-- .../clients/hcalreco_dqm_sourceclient-live_cfg.py | 4 ++-- .../clients/visualization-live-secondInstance_cfg.py | 6 +++--- .../python/clients/visualization-live_cfg.py | 6 +++--- DQM/Integration/python/config/inputsource_cfi.py | 10 +++++++--- DQM/Integration/python/config/pbsource_cfi.py | 11 +++++++++-- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index f3acbeb49aadf..95a51c5c2ccf2 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -46,7 +46,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun + from DQM.Integration.config.inputsource_cfi import options process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -60,7 +60,7 @@ process = customise(process) process.DQMStore.verbose = 0 if not unitTest and not useFileInput : - if not BeamSplashRun : + if not options.BeamSplashRun : process.source.minEventsPerLumi = 100 #------------------------------------- diff --git a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py index afea0dd38856b..11ca9f357b3bf 100644 --- a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py @@ -37,7 +37,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun + from DQM.Integration.config.inputsource_cfi import options process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -52,7 +52,7 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) if not useFileInput: - if not BeamSplashRun : + if not options.BeamSplashRun : process.source.minEventsPerLumi=100 diff --git a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py index 4a6aa5d94f58a..a0367c856fc72 100644 --- a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py @@ -55,7 +55,7 @@ from DQM.Integration.config.fileinputsource_cfi import options else: process.load('DQM.Integration.config.inputsource_cfi') - from DQM.Integration.config.inputsource_cfi import options, BeamSplashRun + from DQM.Integration.config.inputsource_cfi import options process.load('DQM.Integration.config.environment_cfi') #------------------------------------- @@ -69,7 +69,7 @@ process = customise(process) process.DQMStore.verbose = 0 if not unitTest and not useFileInput: - if not BeamSplashRun : + if not options.BeamSplashRun : process.source.minEventsPerLumi = 5 # Note, runType is obtained after importing DQM-related modules diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index 769cf38bd2c6d..be6aff821d2e9 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source, BeamSplashRun, set_BeamSplashRun_settings + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -28,7 +28,7 @@ scenarioName = scenarios[runType.getRunTypeName()] if not unitTest : - if BeamSplashRun : + if options.BeamSplashRun : # scenarioName = 'ppEra_Run3' FIXME pass @@ -73,7 +73,7 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQMEventDisplay' - if BeamSplashRun : + if options.BeamSplashRun : set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 2a692f286f2b7..698ae619b5aa6 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -14,7 +14,7 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source, BeamSplashRun, set_BeamSplashRun_settings + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} @@ -28,7 +28,7 @@ scenarioName = scenarios[runType.getRunTypeName()] if not unitTest : - if BeamSplashRun : + if options.BeamSplashRun : # scenarioName = 'ppEra_Run3' #FIXME pass @@ -71,7 +71,7 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQM' - if BeamSplashRun : + if options.BeamSplashRun : set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) diff --git a/DQM/Integration/python/config/inputsource_cfi.py b/DQM/Integration/python/config/inputsource_cfi.py index d7afb71ff23da..8fbbdc218e491 100644 --- a/DQM/Integration/python/config/inputsource_cfi.py +++ b/DQM/Integration/python/config/inputsource_cfi.py @@ -45,6 +45,12 @@ VarParsing.VarParsing.varType.bool, "Don't upload the BeamSpot conditions to the DB") +options.register('BeamSplashRun', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Set client source settings for beam SPLASH run") + # Parameters for runType options.register ('runkey', @@ -115,9 +121,7 @@ def set_BeamSplashRun_settings( source ): source.minEventsPerLumi = 1000000 source.nextLumiTimeoutMillis = 15000 -BeamSplashRun = False -if BeamSplashRun : set_BeamSplashRun_settings( source ) - +if options.BeamSplashRun : set_BeamSplashRun_settings( source ) print("Initial Source settings:", source) diff --git a/DQM/Integration/python/config/pbsource_cfi.py b/DQM/Integration/python/config/pbsource_cfi.py index 72071ae25c58e..127df864e5ed8 100644 --- a/DQM/Integration/python/config/pbsource_cfi.py +++ b/DQM/Integration/python/config/pbsource_cfi.py @@ -32,6 +32,12 @@ VarParsing.VarParsing.varType.bool, "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ") +options.register('BeamSplashRun', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Set client source settings for beam SPLASH run") + # Parameters for runType options.register ('runkey', @@ -88,7 +94,8 @@ def set_BeamSplashRun_settings( source ): # source.minEventsPerLumi = 1000000 source.nextLumiTimeoutMillis = 15000 -BeamSplashRun = False -if BeamSplashRun : set_BeamSplashRun_settings( source ) +if options.BeamSplashRun : set_BeamSplashRun_settings( source ) print("Initial Source settings:", source) + + From d95ef7278e955c96fc8f451f5a9a3880b4eae433 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 14 Sep 2021 12:03:31 +0200 Subject: [PATCH 581/923] modernize AnalysisAlgos/TrackInfoProducer --- .../interface/TrackInfoProducer.h | 41 ------------- .../TrackInfoProducer/src/SealModules.cc | 5 -- .../src/TrackInfoProducer.cc | 58 +++++++++++++++---- 3 files changed, 48 insertions(+), 56 deletions(-) delete mode 100644 AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h delete mode 100644 AnalysisAlgos/TrackInfoProducer/src/SealModules.cc diff --git a/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h b/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h deleted file mode 100644 index 428c7e380976e..0000000000000 --- a/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef TrackInfoProducer_h -#define TrackInfoProducer_h - -// -// Package: RecoTracker/TrackInfoProducer -// Class: TrackInfoProducer -// -// -// Description: Produce TrackInfo from Trajectory -// -// -// Original Author: Chiara Genta -// Created: -// - -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h" -#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 "DataFormats/TrackReco/interface/TrackFwd.h" -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" - -class TrackInfoProducer : public edm::EDProducer { -public: - // TrackInfoProducer(){} - explicit TrackInfoProducer(const edm::ParameterSet& iConfig); - - ~TrackInfoProducer() override{}; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - TrackInfoProducerAlgorithm theAlgo_; - edm::EDGetTokenT > TrajectoryToken_; - edm::EDGetTokenT trackCollectionToken_; - edm::EDGetTokenT assoMapToken_; - std::string forwardPredictedStateTag_, backwardPredictedStateTag_, updatedStateTag_, combinedStateTag_; -}; -#endif diff --git a/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc b/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc deleted file mode 100644 index a1b7ae25133a4..0000000000000 --- a/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h" - -DEFINE_FWK_MODULE(TrackInfoProducer); diff --git a/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc b/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc index 8f6830c779f8a..fe9a1917484f1 100644 --- a/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc +++ b/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc @@ -1,15 +1,54 @@ -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h" +// +// Package: RecoTracker/TrackInfoProducer +// Class: TrackInfoProducer +// +// +// Description: Produce TrackInfo from Trajectory +// +// +// Original Author: Chiara Genta +// Created: +// + // system include files #include + // user include files -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h" #include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" #include "AnalysisDataFormats/TrackInfo/interface/TrackInfoTrackAssociation.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "TrackingTools/PatternTools/interface/Trajectory.h" + +class TrackInfoProducer : public edm::stream::EDProducer<> { +public: + explicit TrackInfoProducer(const edm::ParameterSet& iConfig); + + ~TrackInfoProducer() override{}; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + edm::ESGetToken tkGeomToken_; + TrackInfoProducerAlgorithm theAlgo_; + edm::EDGetTokenT > TrajectoryToken_; + edm::EDGetTokenT trackCollectionToken_; + edm::EDGetTokenT assoMapToken_; + std::string forwardPredictedStateTag_, backwardPredictedStateTag_, updatedStateTag_, combinedStateTag_; +}; + TrackInfoProducer::TrackInfoProducer(const edm::ParameterSet& iConfig) - : theAlgo_(iConfig), + : tkGeomToken_(esConsumes()), + theAlgo_(iConfig), TrajectoryToken_(consumes >(iConfig.getParameter("cosmicTracks"))), trackCollectionToken_(consumes(iConfig.getParameter("cosmicTracks"))), assoMapToken_(consumes(iConfig.getParameter("cosmicTracks"))) { @@ -21,17 +60,14 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set // // create empty output collections // - std::unique_ptr outputColl(new reco::TrackInfoCollection); + const TrackerGeometry* tracker = &setup.getData(tkGeomToken_); + edm::Handle > TrajectoryCollection; edm::Handle trackCollection; edm::Handle assoMap; - edm::ESHandle tkgeom; - setup.get().get(tkgeom); - const TrackerGeometry* tracker = &(*tkgeom); - theEvent.getByToken(TrajectoryToken_, TrajectoryCollection); theEvent.getByToken(trackCollectionToken_, trackCollection); theEvent.getByToken(assoMapToken_, assoMap); @@ -72,3 +108,5 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set theEvent.put(std::move(TIassociationColl)); } + +DEFINE_FWK_MODULE(TrackInfoProducer); From cc07c6256505fa7575f2cdf8910ba6855fadc31f Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 14 Sep 2021 12:38:13 +0200 Subject: [PATCH 582/923] add GPU to runTheMatrix --- .../python/MatrixInjector.py | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index 6d8a1223ef32e..a759a43f32537 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -65,6 +65,25 @@ def __init__(self,opt,mode='init',options=''): if(opt.batchName): self.batchName = '__'+opt.batchName+'-'+self.batchTime + #################################### + # Checking and setting up GPU attributes + #################################### + # Mendatory + self.RequiresGPU = opt.RequiresGPU + if self.RequiresGPU not in ('forbidden','optional','required'): + print('RequiresGPU must be forbidden, optional, required. Now, set to forbidden.') + self.RequiresGPU = 'forbidden' + if self.RequiresGPU == 'optional': + print('Optional GPU is turned off for RelVals. Now, changing it to forbidden') + self.RequiresGPU = 'forbidden' + self.GPUMemoryMB = opt.GPUMemoryMB + self.CUDACapabilities = opt.CUDACapabilities.split(',') + self.CUDARuntime = opt.CUDARuntime + # optional + self.GPUName = opt.GPUName + self.CUDADriverVersion = opt.CUDADriverVersion + self.CUDARuntimeVersion = opt.CUDARuntimeVersion + # WMagent url if not self.wmagent: # Overwrite with env variable @@ -180,7 +199,17 @@ def __init__(self,opt,mode='init',options=''): "nowmIO": {}, "Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified "EventStreams": self.numberOfStreams, - "KeepOutput" : False + "KeepOutput" : False, + "RequiresGPU" : None, + "GPUParams": None + } + self.defaultGPUParams={ + "GPUMemoryMB": self.GPUMemoryMB, + "CUDACapabilities": self.CUDACapabilities, + "CUDARuntime": self.CUDARuntime, + "GPUName": self.GPUName, + "CUDADriverVersion": self.CUDADriverVersion, + "CUDARuntimeVersion": self.CUDARuntimeVersion } self.chainDicts={} @@ -408,6 +437,9 @@ def prepare(self, mReader, directories, mode='init'): if setPrimaryDs: chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs nextHasDSInput=None + if 'GPU' in step and self.RequiresGPU == 'required': + chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU + chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) else: #not first step and no inputDS chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultTask)) @@ -420,6 +452,9 @@ def prepare(self, mReader, directories, mode='init'): chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf if step in wmsplit: chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step] + if 'GPU' in step and self.RequiresGPU == 'required': + chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU + chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) # change LumisPerJob for Hadronizer steps. if 'Hadronizer' in step: From 7d8f0624d20154594bae6b5d6445514197498adc Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 14 Sep 2021 12:39:18 +0200 Subject: [PATCH 583/923] add GPU to runTheMatrix --- .../scripts/runTheMatrix.py | 80 +++++++++++++++++-- 1 file changed, 72 insertions(+), 8 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 263b5f8106724..985fcb31f4051 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -120,26 +120,31 @@ def runSelected(opt): dest='memoryOffset', default=3000 ) + parser.add_option('--addMemPerCore', help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', dest='memPerCore', default=1500 ) + parser.add_option('-j','--nproc', help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', dest='nProcs', default=4 ) + parser.add_option('-t','--nThreads', help='number of threads per process to use in cmsRun.', dest='nThreads', default=1 ) + parser.add_option('--nStreams', help='number of streams to use in cmsRun.', dest='nStreams', default=0 ) + parser.add_option('--numberEventsInLuminosityBlock', help='number of events in a luminosity block', dest='numberEventsInLuminosityBlock', @@ -152,119 +157,142 @@ def runSelected(opt): default=False, action='store_true' ) + parser.add_option('-e','--extended', help='Show details of workflows, used with --show', dest='extended', default=False, action='store_true' ) + parser.add_option('-s','--selected', help='Run a pre-defined selected matrix of wf. Deprecated, please use -l limited', dest='restricted', default=False, action='store_true' ) + parser.add_option('-l','--list', - help='Coma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', + help='Comma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', dest='testList', default=None ) + parser.add_option('-r','--raw', help='Temporary dump the .txt needed for prodAgent interface. To be discontinued soon. Argument must be the name of the set (standard, pileup,...)', dest='raw' ) + parser.add_option('-i','--useInput', - help='Use recyling where available. Either all, or a coma separated list of wf number.', + help='Use recyling where available. Either all, or a comma separated list of wf number.', dest='useInput', default=None ) + parser.add_option('-w','--what', help='Specify the set to be used. Argument must be the name of a set (standard, pileup,...) or multiple sets separated by commas (--what standard,pileup )', dest='what', default='all' ) + parser.add_option('--step1', help='Used with --raw. Limit the production to step1', dest='step1Only', default=False ) + parser.add_option('--maxSteps', help='Only run maximum on maxSteps. Used when we are only interested in first n steps.', dest='maxSteps', default=9999, type="int" ) + parser.add_option('--fromScratch', - help='Coma separated list of wf to be run without recycling. all is not supported as default.', + help='Comma separated list of wf to be run without recycling. all is not supported as default.', dest='fromScratch', default=None ) + parser.add_option('--refRelease', help='Allow to modify the recycling dataset version', dest='refRel', default=None ) + parser.add_option('--wmcontrol', help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', choices=['init','test','submit','force'], dest='wmcontrol', default=None, ) + parser.add_option('--revertDqmio', help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', choices=['yes','no'], dest='revertDqmio', default='no', ) + parser.add_option('--optionswm', help='Specify a few things for wm injection', default='', dest='wmoptions') + parser.add_option('--keep', - help='allow to specify for which coma separated steps the output is needed', + help='allow to specify for which comma separated steps the output is needed', default=None) + parser.add_option('--label', help='allow to give a special label to the output dataset name', default='') + parser.add_option('--command', help='provide a way to add additional command to all of the cmsDriver commands in the matrix', dest='command', action='append', default=None ) + parser.add_option('--apply', - help='allow to use the --command only for 1 coma separeated', + help='allow to use the --command only for 1 comma separeated', dest='apply', default=None) + parser.add_option('--workflow', help='define a workflow to be created or altered from the matrix', action='append', dest='workflow', default=None ) + parser.add_option('--dryRun', help='do not run the wf at all', action='store_true', dest='dryRun', default=False ) + parser.add_option('--testbed', help='workflow injection to cmswebtest (you need dedicated rqmgr account)', dest='testbed', default=False, action='store_true' ) + parser.add_option('--noCafVeto', help='Run from any source, ignoring the CAF label', dest='cafVeto', default=True, action='store_false' ) + parser.add_option('--overWrite', help='Change the content of a step for another. List of pairs.', dest='overWrite', default=None ) + parser.add_option('--noRun', help='Remove all run list selection from wfs', dest='noRun', @@ -294,6 +322,7 @@ def runSelected(opt): dest='dasSites', default='T2_CH_CERN', action='store') + parser.add_option('--interactive', help="Open the Matrix interactive shell", action='store_true', @@ -305,6 +334,41 @@ def runSelected(opt): default=None, action='store') + parser.add_option('--RequiresGPU', + help='if GPU is reuired or not: forbidden (default, CPU-only), optional, required. For relvals, the GPU option will be turned off for optional.', + dest='RequiresGPU', + default='forbidden') + + parser.add_option('--GPUMemoryMB', + help='to specify GPU memory. Default = 8000 MB (for RequiresGPU = required).', + dest='GPUMemoryMB', + default='8000') + + parser.add_option('--CUDACapabilities', + help='to specify CUDA capabilities. Default = 7.5 (for RequiresGPU = required). Use comma to identify various CUDACapabilities', + dest='CUDACapabilities', + default='6.0,6.1,6.2,7.0,7.2,7.5') + + parser.add_option('--CUDARuntime', + help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (for RequiresGPU = required). FIX ME TO MATCH WITH CMSSW.', + dest='CUDARuntime', + default='11.2') + + parser.add_option('--GPUName', + help='to specify GPU class. This is an optional parameter.', + dest='GPUName', + default='') + + parser.add_option('--CUDADriverVersion', + help='to specify CUDA driver version. This is an optional parameter.', + dest='CUDADriverVersion', + default='') + + parser.add_option('--CUDARuntimeVersion', + help='to specify CUDA runtime version. This is an optional parameter.', + dest='CUDARuntimeVersion', + default='') + opt,args = parser.parse_args() if opt.command: opt.command = ' '.join(opt.command) os.environ["CMSSW_DAS_QUERY_SITES"]=opt.dasSites @@ -372,9 +436,9 @@ def stepOrIndex(s): if opt.nProcs: opt.nProcs=int(opt.nProcs) if opt.nThreads: opt.nThreads=int(opt.nThreads) if opt.nStreams: opt.nStreams=int(opt.nStreams) - if (opt.numberEventsInLuminosityBlock): opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock) - if (opt.memoryOffset): opt.memoryOffset=int(opt.memoryOffset) - if (opt.memPerCore): opt.memPerCore=int(opt.memPerCore) + if opt.numberEventsInLuminosityBlock: opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock) + if opt.memoryOffset: opt.memoryOffset=int(opt.memoryOffset) + if opt.memPerCore: opt.memPerCore=int(opt.memPerCore) if opt.wmcontrol: performInjectionOptionTest(opt) From b972f580cc35fcd3be35110255032d5972259d1b Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 14 Sep 2021 12:39:40 +0200 Subject: [PATCH 584/923] Fixed HepMC interface for Run-1 --- PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc index 00338ca2ef8a5..eab7c38dba5cd 100644 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc @@ -147,7 +147,7 @@ static const double mmToCm = 0.1; static const double mmToNs = 1.0 / 299792458e-6; GenParticleProducer::GenParticleProducer(const ParameterSet& cfg) - : abortOnUnknownPDGCode_(cfg.getUntrackedParameter("abortOnUnknownPDGCode", true)), + : abortOnUnknownPDGCode_(false), saveBarCodes_(cfg.getUntrackedParameter("saveBarCodes", false)), doSubEvent_(cfg.getUntrackedParameter("doSubEvent", false)), useCF_(cfg.getUntrackedParameter("useCrossingFrame", false)) { From 710a04f6e0f48bb2cb9c68875ad72474bb338e64 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Tue, 14 Sep 2021 13:01:13 +0200 Subject: [PATCH 585/923] Revert "Deleted obsolete files and lines of code." This reverts commit 772b3e45b8734af9838f345bcd8d3affcd61ef5e. --- .../plugins/PPSAlignmentConfigESSource.cc | 690 ++++++++++++++++++ CondCore/Utilities/plugins/Module_2XML.cc | 1 + CondCore/Utilities/src/CondDBFetch.cc | 1 + CondCore/Utilities/src/CondDBImport.cc | 1 + CondCore/Utilities/src/CondFormats.h | 1 + CondFormats/PPSObjects/test/BuildFile.xml | 4 + .../testSerializationPPSAlignmentConfig.cc | 17 + .../plugins/RetrievePPSAlignmentConfig.cc | 42 ++ .../CTPPS/plugins/WritePPSAlignmentConfig.cc | 51 ++ .../test/retrieve_PPSAlignmentConfig_cfg.py | 52 ++ .../test/write_PPSAlignmentConfig_cfg.py | 88 +++ 11 files changed, 948 insertions(+) create mode 100644 CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc create mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfig.cc create mode 100644 CondTools/CTPPS/plugins/RetrievePPSAlignmentConfig.cc create mode 100644 CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc create mode 100644 CondTools/CTPPS/test/retrieve_PPSAlignmentConfig_cfg.py create mode 100644 CondTools/CTPPS/test/write_PPSAlignmentConfig_cfg.py diff --git a/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc new file mode 100644 index 0000000000000..5a23314fe8e8b --- /dev/null +++ b/CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc @@ -0,0 +1,690 @@ +/**************************************************************************** + * + * CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc + * + * Description: Constructs PPSAlignmentConfig instance + * + * Authors: + * - Jan KaÅ¡par + * - Mateusz Kocot + * + ****************************************************************************/ + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/SourceFactory.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESProducts.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/ESInputTag.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" + +#include +#include +#include +#include +#include + +#include "TF1.h" +#include "TProfile.h" +#include "TFile.h" +#include "TKey.h" +#include "TSystemFile.h" + +//--------------------------------------------------------------------------------------------- + +class PPSAlignmentConfigESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + PPSAlignmentConfigESSource(const edm::ParameterSet &iConfig); + + std::unique_ptr produce(const PPSAlignmentConfigRcd &); + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + int fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc); + TDirectory *findDirectoryWithName(TDirectory *dir, std::string searchName); + std::vector buildVectorFromDirectory(TDirectory *dir, const RPConfig &rpd); + + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, + const edm::IOVSyncValue &iosv, + edm::ValidityInterval &oValidity) override; + + bool debug; + + std::vector sequence; + std::string resultsDir; + + SectorConfig sectorConfig45, sectorConfig56; + + double x_ali_sh_step; + + double y_mode_sys_unc; + double chiSqThreshold; + double y_mode_unc_max_valid; + double y_mode_max_valid; + + unsigned int maxRPTracksSize; + double n_si; + + std::map> matchingReferencePoints; + std::map matchingShiftRanges; + + std::map alignment_x_meth_o_ranges; + unsigned int fitProfileMinBinEntries; + unsigned int fitProfileMinNReasonable; + unsigned int methOGraphMinN; + double methOUncFitRange; + + std::map alignment_x_relative_ranges; + unsigned int nearFarMinEntries; + + std::map alignment_y_ranges; + unsigned int modeGraphMinN; + unsigned int multSelProjYMinEntries; + + Binning binning; + + std::string label; +}; + +//--------------------------------------------------------------------------------------------- + +PPSAlignmentConfigESSource::PPSAlignmentConfigESSource(const edm::ParameterSet &iConfig) { + label = iConfig.getParameter("label"); + + debug = iConfig.getParameter("debug"); + TFile *debugFile = nullptr; + if (debug) { + debugFile = new TFile(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate"); + } + + sequence = iConfig.getParameter>("sequence"); + resultsDir = iConfig.getParameter("results_dir"); + + sectorConfig45.name_ = "sector 45"; + + sectorConfig45.rp_N_.position_ = "N"; + sectorConfig45.rp_F_.position_ = "F"; + + sectorConfig56.name_ = "sector 56"; + + sectorConfig56.rp_N_.position_ = "N"; + sectorConfig56.rp_F_.position_ = "F"; + + for (std::string sectorName : {"sector_45", "sector_56"}) { + const auto &sps = iConfig.getParameter(sectorName); + SectorConfig *sc; + if (sectorName == "sector_45") + sc = §orConfig45; + else + sc = §orConfig56; + + for (std::string rpName : {"rp_N", "rp_F"}) { + const auto &rpps = sps.getParameter(rpName); + RPConfig *rc; + if (rpName == "rp_N") + rc = &sc->rp_N_; + else + rc = &sc->rp_F_; + + rc->name_ = rpps.getParameter("name"); + rc->id_ = rpps.getParameter("id"); + + rc->slope_ = rpps.getParameter("slope"); + rc->sh_x_ = rpps.getParameter("sh_x"); + + rc->x_min_fit_mode_ = rpps.getParameter("x_min_fit_mode"); + rc->x_max_fit_mode_ = rpps.getParameter("x_max_fit_mode"); + rc->y_max_fit_mode_ = rpps.getParameter("y_max_fit_mode"); + rc->y_cen_add_ = rpps.getParameter("y_cen_add"); + rc->y_width_mult_ = rpps.getParameter("y_width_mult"); + + rc->x_slice_min_ = rpps.getParameter("x_slice_min"); + rc->x_slice_w_ = rpps.getParameter("x_slice_w"); + rc->x_slice_n_ = std::ceil((rpps.getParameter("x_slice_max") - rc->x_slice_min_) / rc->x_slice_w_); + } + + sc->slope_ = sps.getParameter("slope"); + + sc->cut_h_apply_ = sps.getParameter("cut_h_apply"); + sc->cut_h_a_ = sps.getParameter("cut_h_a"); + sc->cut_h_c_ = sps.getParameter("cut_h_c"); + sc->cut_h_si_ = sps.getParameter("cut_h_si"); + + sc->cut_v_apply_ = sps.getParameter("cut_v_apply"); + sc->cut_v_a_ = sps.getParameter("cut_v_a"); + sc->cut_v_c_ = sps.getParameter("cut_v_c"); + sc->cut_v_si_ = sps.getParameter("cut_v_si"); + } + + std::map rpTags = {{sectorConfig45.rp_F_.id_, "rp_L_F"}, + {sectorConfig45.rp_N_.id_, "rp_L_N"}, + {sectorConfig56.rp_N_.id_, "rp_R_N"}, + {sectorConfig56.rp_F_.id_, "rp_R_F"}}; + + std::map sectorNames = {{sectorConfig45.rp_F_.id_, sectorConfig45.name_}, + {sectorConfig45.rp_N_.id_, sectorConfig45.name_}, + {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, + {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; + + std::map rpConfigs = {{sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, + {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, + {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, + {sectorConfig56.rp_F_.id_, §orConfig56.rp_F_}}; + + x_ali_sh_step = iConfig.getParameter("x_ali_sh_step"); + + y_mode_sys_unc = iConfig.getParameter("y_mode_sys_unc"); + chiSqThreshold = iConfig.getParameter("chiSqThreshold"); + y_mode_unc_max_valid = iConfig.getParameter("y_mode_unc_max_valid"); + y_mode_max_valid = iConfig.getParameter("y_mode_max_valid"); + + maxRPTracksSize = iConfig.getParameter("max_RP_tracks_size"); + n_si = iConfig.getParameter("n_si"); + + const auto &c_axo = iConfig.getParameter("x_alignment_meth_o"); + for (const auto &p : rpTags) { + const auto &ps = c_axo.getParameter(p.second); + alignment_x_meth_o_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + fitProfileMinBinEntries = c_axo.getParameter("fit_profile_min_bin_entries"); + fitProfileMinNReasonable = c_axo.getParameter("fit_profile_min_N_reasonable"); + methOGraphMinN = c_axo.getParameter("meth_o_graph_min_N"); + methOUncFitRange = c_axo.getParameter("meth_o_unc_fit_range"); + + const auto &c_m = iConfig.getParameter("matching"); + const auto &referenceDataset = c_m.getParameter("reference_dataset"); + + // constructing vectors with reference data + if (!referenceDataset.empty()) { + TFile *f_ref = TFile::Open(referenceDataset.c_str()); + if (!f_ref->IsOpen()) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset; + } else { + TDirectory *ad_ref = findDirectoryWithName((TDirectory *)f_ref, sectorConfig45.name_); + if (ad_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset; + } else { + edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath(); + + for (const auto &p : rpTags) { + if (debug) + gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref"); + + auto *d_ref = (TDirectory *)ad_ref->Get( + (sectorNames[p.first] + "/near_far/x slices, " + rpConfigs[p.first]->position_).c_str()); + if (d_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not load d_ref"; + } else { + matchingReferencePoints[p.first] = buildVectorFromDirectory(d_ref, *rpConfigs[p.first]); + } + } + } + } + delete f_ref; + } + + for (const auto &p : rpTags) { + const auto &ps = c_m.getParameter(p.second); + matchingShiftRanges[p.first] = {ps.getParameter("sh_min"), ps.getParameter("sh_max")}; + } + + const auto &c_axr = iConfig.getParameter("x_alignment_relative"); + for (const auto &p : rpTags) { + const auto &ps = c_axr.getParameter(p.second); + alignment_x_relative_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + nearFarMinEntries = c_axr.getParameter("near_far_min_entries"); + + const auto &c_ay = iConfig.getParameter("y_alignment"); + for (const auto &p : rpTags) { + const auto &ps = c_ay.getParameter(p.second); + alignment_y_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + modeGraphMinN = c_ay.getParameter("mode_graph_min_N"); + multSelProjYMinEntries = c_ay.getParameter("mult_sel_proj_y_min_entries"); + + const auto &bps = iConfig.getParameter("binning"); + binning.bin_size_x_ = bps.getParameter("bin_size_x"); + binning.n_bins_x_ = bps.getParameter("n_bins_x"); + binning.pixel_x_offset_ = bps.getParameter("pixel_x_offset"); + binning.n_bins_y_ = bps.getParameter("n_bins_y"); + binning.y_min_ = bps.getParameter("y_min"); + binning.y_max_ = bps.getParameter("y_max"); + + setWhatProduced(this, label); + findingRecord(); + + if (debug) + delete debugFile; +} + +//--------------------------------------------------------------------------------------------- + +std::unique_ptr PPSAlignmentConfigESSource::produce(const PPSAlignmentConfigRcd &) { + auto p = std::make_unique(); + + p->setSequence(sequence); + p->setResultsDir(resultsDir); + + p->setSectorConfig45(sectorConfig45); + p->setSectorConfig56(sectorConfig56); + + p->setX_ali_sh_step(x_ali_sh_step); + + p->setY_mode_sys_unc(y_mode_sys_unc); + p->setChiSqThreshold(chiSqThreshold); + p->setY_mode_unc_max_valid(y_mode_unc_max_valid); + p->setY_mode_max_valid(y_mode_max_valid); + + p->setMaxRPTracksSize(maxRPTracksSize); + p->setN_si(n_si); + + p->setMatchingReferencePoints(matchingReferencePoints); + p->setMatchingShiftRanges(matchingShiftRanges); + + p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges); + p->setFitProfileMinBinEntries(fitProfileMinBinEntries); + p->setFitProfileMinNReasonable(fitProfileMinNReasonable); + p->setMethOGraphMinN(methOGraphMinN); + p->setMethOUncFitRange(methOUncFitRange); + + p->setAlignment_x_relative_ranges(alignment_x_relative_ranges); + p->setNearFarMinEntries(nearFarMinEntries); + + p->setAlignment_y_ranges(alignment_y_ranges); + p->setModeGraphMinN(modeGraphMinN); + p->setMultSelProjYMinEntries(multSelProjYMinEntries); + + p->setBinning(binning); + + edm::LogInfo("PPS") << "\n" + << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n" + << (*p); + + return p; +} + +//--------------------------------------------------------------------------------------------- + +// most default values come from 2018 period +void PPSAlignmentConfigESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + + desc.add("debug", false); + + desc.add("label", ""); + + desc.add>("sequence", {}); + desc.add("results_dir", "./alignment_results.txt"); + + // sector_45 + { + edm::ParameterSetDescription sector45; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "L_1_F"); + rp_N.add("id", 3); + + rp_N.add("slope", 0.19); + rp_N.add("sh_x", -3.6); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.0); + rp_N.add("y_max_fit_mode", 7.0); + rp_N.add("y_cen_add", -0.3); + rp_N.add("y_width_mult", 1.1); + + rp_N.add("x_slice_min", 7.); + rp_N.add("x_slice_max", 19.); + rp_N.add("x_slice_w", 0.2); + sector45.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "L_2_F"); + rp_F.add("id", 23); + + rp_F.add("slope", 0.19); + rp_F.add("sh_x", -42.); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 7.5); + rp_F.add("y_max_fit_mode", 7.5); + rp_F.add("y_cen_add", -0.3); + rp_F.add("y_width_mult", 1.1); + + rp_F.add("x_slice_min", 46.); + rp_F.add("x_slice_max", 58.); + rp_F.add("x_slice_w", 0.2); + sector45.add("rp_F", rp_F); + + sector45.add("slope", 0.006); + sector45.add("cut_h_apply", true); + sector45.add("cut_h_a", -1.); + sector45.add("cut_h_c", -38.55); + sector45.add("cut_h_si", 0.2); + sector45.add("cut_v_apply", true); + sector45.add("cut_v_a", -1.07); + sector45.add("cut_v_c", 1.63); + sector45.add("cut_v_si", 0.15); + + desc.add("sector_45", sector45); + } + + // sector_56 + { + edm::ParameterSetDescription sector56; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "R_1_F"); + rp_N.add("id", 103); + + rp_N.add("slope", 0.40); + rp_N.add("sh_x", -2.8); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.4); + rp_N.add("y_max_fit_mode", 7.4); + rp_N.add("y_cen_add", -0.8); + rp_N.add("y_width_mult", 1.0); + + rp_N.add("x_slice_min", 6.); + rp_N.add("x_slice_max", 17.); + rp_N.add("x_slice_w", 0.2); + sector56.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "R_2_F"); + rp_F.add("id", 123); + + rp_F.add("slope", 0.39); + rp_F.add("sh_x", -41.9); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 8.0); + rp_F.add("y_max_fit_mode", 8.0); + rp_F.add("y_cen_add", -0.8); + rp_F.add("y_width_mult", 1.0); + + rp_F.add("x_slice_min", 45.); + rp_F.add("x_slice_max", 57.); + rp_F.add("x_slice_w", 0.2); + sector56.add("rp_F", rp_F); + + sector56.add("slope", -0.015); + sector56.add("cut_h_apply", true); + sector56.add("cut_h_a", -1.); + sector56.add("cut_h_c", -39.26); + sector56.add("cut_h_si", 0.2); + sector56.add("cut_v_apply", true); + sector56.add("cut_v_a", -1.07); + sector56.add("cut_v_c", 1.49); + sector56.add("cut_v_si", 0.15); + + desc.add("sector_56", sector56); + } + + desc.add("x_ali_sh_step", 0.01); + + desc.add("y_mode_sys_unc", 0.03); + desc.add("chiSqThreshold", 50.); + desc.add("y_mode_unc_max_valid", 5.); + desc.add("y_mode_max_valid", 20.); + + desc.add("max_RP_tracks_size", 2); + desc.add("n_si", 4.); + + // matching + { + edm::ParameterSetDescription matching; + matching.add("reference_dataset", ""); + + edm::ParameterSetDescription rpLF; + rpLF.add("sh_min", -43.); + rpLF.add("sh_max", -41.); + matching.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("sh_min", -4.2); + rpLN.add("sh_max", -2.4); + matching.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("sh_min", -3.6); + rpRN.add("sh_max", -1.8); + matching.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("sh_min", -43.2); + rpRF.add("sh_max", -41.2); + matching.add("rp_R_F", rpRF); + + desc.add("matching", matching); + } + + // x alignment meth o + { + edm::ParameterSetDescription x_alignment_meth_o; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 47.); + rpLF.add("x_max", 56.5); + x_alignment_meth_o.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 9.); + rpLN.add("x_max", 18.5); + x_alignment_meth_o.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 7.); + rpRN.add("x_max", 15.); + x_alignment_meth_o.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 46.); + rpRF.add("x_max", 54.); + x_alignment_meth_o.add("rp_R_F", rpRF); + + x_alignment_meth_o.add("fit_profile_min_bin_entries", 5); + x_alignment_meth_o.add("fit_profile_min_N_reasonable", 10); + x_alignment_meth_o.add("meth_o_graph_min_N", 5); + x_alignment_meth_o.add("meth_o_unc_fit_range", 0.5); + + desc.add("x_alignment_meth_o", x_alignment_meth_o); + } + + // x alignment relative + { + edm::ParameterSetDescription x_alignment_relative; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 0.); + rpLF.add("x_max", 0.); + x_alignment_relative.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 7.5); + rpLN.add("x_max", 12.); + x_alignment_relative.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 6.); + rpRN.add("x_max", 10.); + x_alignment_relative.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 0.); + rpRF.add("x_max", 0.); + x_alignment_relative.add("rp_R_F", rpRF); + + x_alignment_relative.add("near_far_min_entries", 100); + + desc.add("x_alignment_relative", x_alignment_relative); + } + + // y alignment + { + edm::ParameterSetDescription y_alignment; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 44.5); + rpLF.add("x_max", 49.); + y_alignment.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 6.7); + rpLN.add("x_max", 11.); + y_alignment.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 5.9); + rpRN.add("x_max", 10.); + y_alignment.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 44.5); + rpRF.add("x_max", 49.); + y_alignment.add("rp_R_F", rpRF); + + y_alignment.add("mode_graph_min_N", 5); + y_alignment.add("mult_sel_proj_y_min_entries", 300); + + desc.add("y_alignment", y_alignment); + } + + // binning + { + edm::ParameterSetDescription binning; + + binning.add("bin_size_x", 142.3314E-3); + binning.add("n_bins_x", 210); + binning.add("pixel_x_offset", 40.); + binning.add("n_bins_y", 400); + binning.add("y_min", -20.); + binning.add("y_max", 20.); + + desc.add("binning", binning); + } + + descriptions.add("ppsAlignmentConfigESSource", desc); +} + +//--------------------------------------------------------------------------------------------- + +// Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). +int PPSAlignmentConfigESSource::fitProfile(TProfile *p, double x_mean, double x_rms, double &sl, double &sl_unc) { + unsigned int n_reasonable = 0; + for (int bi = 1; bi <= p->GetNbinsX(); bi++) { + if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { + p->SetBinContent(bi, 0.); + p->SetBinError(bi, 0.); + } else { + n_reasonable++; + } + } + + if (n_reasonable < fitProfileMinNReasonable) + return 1; + + double xMin = x_mean - x_rms, xMax = x_mean + x_rms; + + TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); + + ff_pol1->SetParameter(0., 0.); + p->Fit(ff_pol1, "Q", "", xMin, xMax); + + sl = ff_pol1->GetParameter(1); + sl_unc = ff_pol1->GetParError(1); + + return 0; +} + +//--------------------------------------------------------------------------------------------- + +// Performs a breadth first search on dir. If found, returns the directory with object +// named searchName inside. Otherwise, returns nullptr. +TDirectory *PPSAlignmentConfigESSource::findDirectoryWithName(TDirectory *dir, std::string searchName) { + TIter next(dir->GetListOfKeys()); + std::queue dirQueue; + TObject *o; + while ((o = next())) { + TKey *k = (TKey *)o; + + std::string name = k->GetName(); + if (name == searchName) + return dir; + + if (((TSystemFile *)k)->IsDirectory()) + dirQueue.push((TDirectory *)k->ReadObj()); + } + + while (!dirQueue.empty()) { + TDirectory *resultDir = findDirectoryWithName(dirQueue.front(), searchName); + dirQueue.pop(); + if (resultDir != nullptr) + return resultDir; + } + + return nullptr; +} + +//--------------------------------------------------------------------------------------------- + +// Builds vector of PointErrors instances from slice plots in dir. +std::vector PPSAlignmentConfigESSource::buildVectorFromDirectory(TDirectory *dir, const RPConfig &rpd) { + std::vector pv; + + TIter next(dir->GetListOfKeys()); + TObject *o; + while ((o = next())) { + TKey *k = (TKey *)o; + + std::string name = k->GetName(); + size_t d = name.find('-'); + const double x_min = std::stod(name.substr(0, d)); + const double x_max = std::stod(name.substr(d + 1)); + + TDirectory *d_slice = (TDirectory *)k->ReadObj(); + + TH1D *h_y = (TH1D *)d_slice->Get("h_y"); + TProfile *p_y_diffFN_vs_y = (TProfile *)d_slice->Get("p_y_diffFN_vs_y"); + + double y_cen = h_y->GetMean(); + double y_width = h_y->GetRMS(); + + y_cen += rpd.y_cen_add_; + y_width *= rpd.y_width_mult_; + + double sl = 0., sl_unc = 0.; + int fr = fitProfile(p_y_diffFN_vs_y, y_cen, y_width, sl, sl_unc); + if (fr != 0) + continue; + + if (debug) + p_y_diffFN_vs_y->Write(name.c_str()); + + pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc}); + } + + return pv; +} + +//--------------------------------------------------------------------------------------------- + +void PPSAlignmentConfigESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, + const edm::IOVSyncValue &iosv, + edm::ValidityInterval &oValidity) { + edm::LogInfo("PPS") << ">> PPSAlignmentConfigESSource::setIntervalFor(" << key.name() << ")\n" + << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); + + edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); + oValidity = infinity; +} + +DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigESSource); \ No newline at end of file diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 5bc423fd9de50..639ffe22fe632 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(PPSAlignmentConfiguration) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index b251891ac817f..d7ff2191b49ee 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(PPSAlignmentConfiguration) FETCH_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) FETCH_PAYLOAD_CASE(CastorChannelQuality) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 85fc2f8604576..3d68b71a3e9de 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(PPSAlignmentConfiguration) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index c9832ed9f24eb..8fb8a6358cd47 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -35,6 +35,7 @@ #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.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/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index df6c93de895a5..ad9fcb974a153 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -10,6 +10,10 @@ + + + + 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/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..bef365aec7d57 --- /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 From de467d497506dd355c66e6abdad64db0c0030ed2 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 14 Sep 2021 13:03:22 +0200 Subject: [PATCH 586/923] improvements from CRUZET'21 data analysis --- .../OfflineValidation/plugins/BuildFile.xml | 1 + .../OfflineValidation/plugins/DMRChecker.cc | 20 +++--- .../plugins/GeneralPurposeTrackAnalyzer.cc | 61 ++++++++++++++++--- .../interface/Phase1PixelMaps.h | 2 +- DQM/TrackerRemapper/src/Phase1PixelMaps.cc | 8 ++- DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc | 4 ++ .../src/Phase1PixelSummaryMap.cc | 3 +- 7 files changed, 75 insertions(+), 24 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/BuildFile.xml b/Alignment/OfflineValidation/plugins/BuildFile.xml index 9a516c4315241..5f837ecee49c1 100644 --- a/Alignment/OfflineValidation/plugins/BuildFile.xml +++ b/Alignment/OfflineValidation/plugins/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/Alignment/OfflineValidation/plugins/DMRChecker.cc b/Alignment/OfflineValidation/plugins/DMRChecker.cc index cd68af995f2e3..2d4bc4b3fe7d2 100644 --- a/Alignment/OfflineValidation/plugins/DMRChecker.cc +++ b/Alignment/OfflineValidation/plugins/DMRChecker.cc @@ -149,11 +149,11 @@ namespace running { class DMRChecker : public edm::one::EDAnalyzer { public: DMRChecker(const edm::ParameterSet &pset) - : geomToken_(esConsumes()), - runInfoToken_(esConsumes()), - magFieldToken_(esConsumes()), - topoToken_(esConsumes()), - latencyToken_(esConsumes()), + : geomToken_(esConsumes()), + runInfoToken_(esConsumes()), + magFieldToken_(esConsumes()), + topoToken_(esConsumes()), + latencyToken_(esConsumes()), isCosmics_(pset.getParameter("isCosmics")) { usesResource(TFileService::kSharedResource); @@ -195,7 +195,7 @@ class DMRChecker : public edm::one::EDAnalyzer { static void fillDescriptions(edm::ConfigurationDescriptions &); - ~DMRChecker() override {} + ~DMRChecker() override = default; /*_______________________________________________________ // @@ -620,7 +620,7 @@ class DMRChecker : public edm::one::EDAnalyzer { resDetailsTIB_[detid_db].rOrZDirection = resDetailsTIB_[detid_db].rDirection; // barrel (split in r) } - hTIBResXPrime->Fill(uOrientation * resX * 10000); + hTIBResXPrime->Fill(uOrientation * resX * cmToUm); hTIBResXPull->Fill(pullX); // update residuals @@ -630,7 +630,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.z() - gPModule.z() >= 0 ? +1.F : -1.F; // not used for Strips - hTOBResXPrime->Fill(uOrientation * resX * 10000); + hTOBResXPrime->Fill(uOrientation * resX * cmToUm); hTOBResXPull->Fill(pullX); // if the detid has never occcurred yet, set the local orientations @@ -647,7 +647,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.perp() - gPModule.perp() >= 0. ? +1.F : -1.F; // not used for Strips - hTIDResXPrime->Fill(uOrientation * resX * 10000); + hTIDResXPrime->Fill(uOrientation * resX * cmToUm); hTIDResXPull->Fill(pullX); // update residuals @@ -657,7 +657,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.perp() - gPModule.perp() >= 0. ? +1.F : -1.F; // not used for Strips - hTECResXPrime->Fill(uOrientation * resX * 10000); + hTECResXPrime->Fill(uOrientation * resX * cmToUm); hTECResXPull->Fill(pullX); // update residuals diff --git a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc index 1574d3f914846..eb080b217c6fa 100644 --- a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc +++ b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc @@ -32,13 +32,16 @@ #include // user include files - #include "CommonTools/TrackerMap/interface/TrackerMap.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" #include "CondFormats/SiStripObjects/interface/SiStripLatency.h" +#include "DQM/SiPixelPhase1Common/interface/SiPixelCoordinates.h" #include "DQM/TrackerRemapper/interface/Phase1PixelMaps.h" +#include "DQM/TrackerRemapper/interface/Phase1PixelROCMaps.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/DetId/interface/DetId.h" @@ -60,11 +63,11 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "FWCore/Common/interface/TriggerNames.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/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -85,9 +88,12 @@ const int kFPIX = PixelSubdetector::PixelEndcap; class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer { public: GeneralPurposeTrackAnalyzer(const edm::ParameterSet &pset) - : geomToken_(esConsumes()), - magFieldToken_(esConsumes()), - latencyToken_(esConsumes()) { + : geomToken_(esConsumes()), + magFieldToken_(esConsumes()), + latencyToken_(esConsumes()), + geomTokenBR_(esConsumes()), + trackerTopologyTokenBR_(esConsumes()), + siPixelFedCablingMapTokenBR_(esConsumes()) { usesResource(TFileService::kSharedResource); TkTag_ = pset.getParameter("TkTag"); @@ -116,9 +122,11 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer("COLZ0 L"); pixelmap->bookBarrelHistograms("entriesBarrel", "# hits", "# pixel hits"); pixelmap->bookForwardHistograms("entriesForward", "# hits", "# pixel hits"); + + pixelrocsmap_ = std::make_unique(""); } - ~GeneralPurposeTrackAnalyzer() override {} + ~GeneralPurposeTrackAnalyzer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions &); @@ -140,14 +148,21 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer magFieldToken_; const edm::ESGetToken latencyToken_; + const edm::ESGetToken geomTokenBR_; + const edm::ESGetToken trackerTopologyTokenBR_; + const edm::ESGetToken siPixelFedCablingMapTokenBR_; + edm::ESHandle magneticField_; + SiPixelCoordinates coord_; + edm::Service fs; std::unique_ptr tmap; std::unique_ptr pmap; std::unique_ptr pixelmap; + std::unique_ptr pixelrocsmap_; TH1D *hchi2ndof; TH1D *hNtrk; @@ -343,11 +358,13 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer rocsToMask; for (auto iHit = track->recHitsBegin(); iHit != track->recHitsEnd(); ++iHit) { if (this->isHit2D(**iHit)) { ++nHit2D; } - + // rest the ROCs for the map + rocsToMask.reset(); const DetId &detId = (*iHit)->geographicalId(); const GeomDet *geomDet(theGeometry->idToDet(detId)); @@ -358,6 +375,18 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzercluster(); + + if (clustp.isNull()) + continue; + auto const &cluster = *clustp; + int row = cluster.x() - 0.5, col = cluster.y() - 0.5; + int rocId = coord_.roc(detId, std::make_pair(row, col)); + + rocsToMask.set(rocId); + pixelrocsmap_->fillSelectedRocs(detid_db, rocsToMask, 1); + if (!isPhase1_) { pmap->fill(detid_db, 1); } else { @@ -695,6 +724,14 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzerGetXaxis()->SetBinLabel((the_r - theRuns_.front()) + 1, std::to_string(the_r).c_str()); } - pmap->save(true, 0, 0, "PixelHitMap.pdf", 600, 800); - pmap->save(true, 0, 0, "PixelHitMap.png", 500, 750); + if (!isPhase1_) { + pmap->save(true, 0, 0, "PixelHitMap.pdf", 600, 800); + pmap->save(true, 0, 0, "PixelHitMap.png", 500, 750); + } tmap->save(true, 0, 0, "StripHitMap.pdf"); tmap->save(true, 0, 0, "StripHitMap.png"); @@ -1139,6 +1178,10 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzerdrawForwardMaps("entriesForward", cF); cF.SaveAs("pixelForwardEntries.png"); + + TCanvas cRocs = TCanvas("cRocs", "cRocs", 1200, 1600); + pixelrocsmap_->drawMaps(cRocs, "Pixel on-track clusters occupancy"); + cRocs.SaveAs("Phase1PixelROCMaps_fullROCs.png"); } //************************************************************* diff --git a/DQM/TrackerRemapper/interface/Phase1PixelMaps.h b/DQM/TrackerRemapper/interface/Phase1PixelMaps.h index 9a22292fb7840..06f46b63ab1fc 100644 --- a/DQM/TrackerRemapper/interface/Phase1PixelMaps.h +++ b/DQM/TrackerRemapper/interface/Phase1PixelMaps.h @@ -80,7 +80,7 @@ class Phase1PixelMaps { // drawing methos void drawBarrelMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); void drawForwardMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); - void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas); + void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); private: Option_t* m_option; diff --git a/DQM/TrackerRemapper/src/Phase1PixelMaps.cc b/DQM/TrackerRemapper/src/Phase1PixelMaps.cc index 8be086c0d678a..96c7a6aa86c9e 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelMaps.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelMaps.cc @@ -393,7 +393,7 @@ void Phase1PixelMaps::drawForwardMaps(const std::string& currentHistoName, TCanv } //============================================================================ -void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas) { +void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption) { auto found = (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) != m_knownNames.end()); if (!m_isBooked.second || !m_isBooked.first || !found) { @@ -411,7 +411,8 @@ void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanv pxbTh2PolyBarrelSummary[currentHistoName]->SetMarkerSize(0.5); } pxbTh2PolyBarrelSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4); - pxbTh2PolyBarrelSummary[currentHistoName]->Draw(); + pxbTh2PolyBarrelSummary[currentHistoName]->Draw("AL"); + pxbTh2PolyBarrelSummary[currentHistoName]->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str()); canvas.cd(2); adjustCanvasMargins(canvas.cd(2), 0.07, 0.02, 0.01, isText ? 0.05 : 0.15); @@ -420,7 +421,8 @@ void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanv pxfTh2PolyForwardSummary[currentHistoName]->SetMarkerSize(0.5); } pxfTh2PolyForwardSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4); - pxfTh2PolyForwardSummary[currentHistoName]->Draw(); + pxfTh2PolyForwardSummary[currentHistoName]->Draw("AL"); + pxfTh2PolyForwardSummary[currentHistoName]->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str()); } //============================================================================ diff --git a/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc b/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc index 105b0d6dbdad6..f803b4f4c6ce3 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc @@ -645,6 +645,7 @@ void Phase1PixelROCMaps::drawBarrelMaps(TCanvas& canvas, const std::string& text bottomPad->cd(); bottomPad->Divide(2, 2); for (unsigned int lay = 1; lay <= n_layers; lay++) { + h_bpix_maps[lay - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_bpix_maps[lay - 1].get(), lay, 0, 1, found == std::string::npos); } } @@ -676,6 +677,7 @@ void Phase1PixelROCMaps::drawForwardMaps(TCanvas& canvas, const std::string& tex bottomPad->cd(); bottomPad->Divide(2, 1); for (unsigned int ring = 1; ring <= n_rings; ring++) { + h_fpix_maps[ring - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_fpix_maps[ring - 1].get(), 0, ring, 1, found == std::string::npos); } } @@ -709,6 +711,7 @@ void Phase1PixelROCMaps::drawMaps(TCanvas& canvas, const std::string& text) // dress the plots for (unsigned int lay = 1; lay <= n_layers; lay++) { + h_bpix_maps[lay - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_bpix_maps[lay - 1].get(), lay, 0, 1, found == std::string::npos); } @@ -717,6 +720,7 @@ void Phase1PixelROCMaps::drawMaps(TCanvas& canvas, const std::string& text) bottomPad->cd(); for (unsigned int ring = 1; ring <= n_rings; ring++) { + h_fpix_maps[ring - 1]->SetStats(false); PixelROCMapHelper::dress_plot( bottomPad, h_fpix_maps[ring - 1].get(), 0, n_layers + ring, 1, found == std::string::npos); } diff --git a/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc b/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc index fc3a2f48f3588..d1b2a0846dedd 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc @@ -88,7 +88,8 @@ void Phase1PixelSummaryMap::printTrackerMap(TCanvas& canvas) { canvas.SetBottomMargin(0.02); canvas.SetLeftMargin(0.02); canvas.SetRightMargin(0.14); - m_BaseTrackerMap->Draw("AC COLZ L"); + m_BaseTrackerMap->Draw("AL"); + m_BaseTrackerMap->Draw("AC COLZ0 L SAME"); //### z arrow arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02, "|>"); From 8a347c55ae4efd2b226468490633b2bafea0eff2 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Tue, 14 Sep 2021 13:37:38 +0200 Subject: [PATCH 587/923] Revert code format modifications in WritePPSAlignmentConfig. --- CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc index bef365aec7d57..84437bd4e3728 100644 --- a/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfig.cc @@ -22,21 +22,21 @@ class WritePPSAlignmentConfig : public edm::one::EDAnalyzer<> { public: - explicit WritePPSAlignmentConfig(const edm::ParameterSet&); + explicit WritePPSAlignmentConfig(const edm::ParameterSet &); private: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event &, const edm::EventSetup &) override; edm::ESGetToken esToken_; }; -WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet& iConfig) +WritePPSAlignmentConfig::WritePPSAlignmentConfig(const edm::ParameterSet &iConfig) : esToken_(esConsumes( edm::ESInputTag("", iConfig.getParameter("label")))) {} -void WritePPSAlignmentConfig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +void WritePPSAlignmentConfig::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // get the data - const auto& ppsAlignmentConfig = iSetup.getData(esToken_); + const auto &ppsAlignmentConfig = iSetup.getData(esToken_); // store the data in a DB object edm::Service poolDbService; From 07a59f7fa8ceedbf9de716b4f966b5240a703da6 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 14 Sep 2021 14:56:10 +0200 Subject: [PATCH 588/923] modernize SiStripDetInfoFileWriter --- .../SiStripCommon/plugins/SealModules.cc | 4 -- .../plugins/SiStripDetInfoFileWriter.cc | 54 +++++++++++++++---- .../plugins/SiStripDetInfoFileWriter.h | 44 --------------- 3 files changed, 44 insertions(+), 58 deletions(-) delete mode 100644 CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h diff --git a/CalibTracker/SiStripCommon/plugins/SealModules.cc b/CalibTracker/SiStripCommon/plugins/SealModules.cc index 6613d45b91294..275fd4b1ba83c 100644 --- a/CalibTracker/SiStripCommon/plugins/SealModules.cc +++ b/CalibTracker/SiStripCommon/plugins/SealModules.cc @@ -1,10 +1,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h" - -DEFINE_FWK_MODULE(SiStripDetInfoFileWriter); - #include "ShallowTree.h" #include "ShallowEventDataProducer.h" #include "ShallowDigisProducer.h" diff --git a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc index 9aa18d1401659..e85d85cf9a99c 100644 --- a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc +++ b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc @@ -1,16 +1,52 @@ // -*- C++ -*- -// Package: SiStripCommon +// +// Package: SiStripDetInfoFileWriter // Class: SiStripDetInfoFileWriter -// Original Author: G. Bruno -// Created: Mon May 20 10:04:31 CET 2007 +// +/**\class SiStripDetInfoFileWriter SiStripDetInfoFileWriter.cc CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc + + Description: -#include "CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h" + Implementation: + +*/ +// +// Original Author: G. Bruno +// Created: Mon Nov 20 10:04:31 CET 2006 +// +// + +// C++ includes +#include +#include +#include + +// User includes +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +class SiStripDetInfoFileWriter : public edm::one::EDAnalyzer { +public: + explicit SiStripDetInfoFileWriter(const edm::ParameterSet&); + ~SiStripDetInfoFileWriter() override; + +private: + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override; + void analyze(const edm::Event&, const edm::EventSetup&) override{}; + void endRun(const edm::Run&, const edm::EventSetup& iSetup) override{}; + +private: + std::ofstream outputFile_; + std::string filePath_; + edm::ESGetToken tkGeomToken_; +}; using namespace cms; using namespace std; @@ -55,13 +91,11 @@ void SiStripDetInfoFileWriter::beginRun(const edm::Run&, const edm::EventSetup& outputFile_ << detid << " " << numberOfAPVs << " " << stripLength << " " << thickness << "\n"; } } - outputFile_.close(); - - } - - else { + } else { edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file") << endl; return; } } + +DEFINE_FWK_MODULE(SiStripDetInfoFileWriter); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h deleted file mode 100644 index fd3d1353abc43..0000000000000 --- a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CalibTracker_SiStripChannelGain_SiStripDetInfoFileWriter_h -#define CalibTracker_SiStripChannelGain_SiStripDetInfoFileWriter_h -// -*- C++ -*- -// -// Package: SiStripDetInfoFileWriter -// Class: SiStripDetInfoFileWriter -// -/**\class SiStripDetInfoFileWriter SiStripDetInfoFileWriter.cc CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc - - Description: - - Implementation: - -*/ -// -// Original Author: G. Bruno -// Created: Mon Nov 20 10:04:31 CET 2006 -// -// - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include -#include -#include - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" - -class SiStripDetInfoFileWriter : public edm::EDAnalyzer { -public: - explicit SiStripDetInfoFileWriter(const edm::ParameterSet&); - ~SiStripDetInfoFileWriter() override; - -private: - void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override; - - void analyze(const edm::Event&, const edm::EventSetup&) override{}; - -private: - std::ofstream outputFile_; - std::string filePath_; - edm::ESGetToken tkGeomToken_; -}; -#endif From 422723ee0e6bbb7cc94c1d8e328e092c4b5294f6 Mon Sep 17 00:00:00 2001 From: Andres Date: Tue, 14 Sep 2021 15:58:27 +0200 Subject: [PATCH 589/923] Update CondDBFW to Python3 --- .../Utilities/python/CondDBFW/command_line.py | 6 +- .../Utilities/python/CondDBFW/data_formats.py | 17 +- .../Utilities/python/CondDBFW/data_sources.py | 28 +- CondCore/Utilities/python/CondDBFW/models.py | 119 ++- .../Utilities/python/CondDBFW/querying.py | 827 +++++++++--------- CondCore/Utilities/python/CondDBFW/shell.py | 2 - .../python/CondDBFW/uploadConditions.py | 484 ++++++---- CondCore/Utilities/python/CondDBFW/uploads.py | 155 ++-- .../Utilities/python/CondDBFW/url_query.py | 37 +- CondCore/Utilities/python/CondDBFW/utils.py | 4 +- 10 files changed, 916 insertions(+), 763 deletions(-) diff --git a/CondCore/Utilities/python/CondDBFW/command_line.py b/CondCore/Utilities/python/CondDBFW/command_line.py index 73074e65e6fd8..4462fbb7285b0 100755 --- a/CondCore/Utilities/python/CondDBFW/command_line.py +++ b/CondCore/Utilities/python/CondDBFW/command_line.py @@ -5,8 +5,6 @@ Works by taking the main keyword (first command given to the script), passing that to the function that will deal with that action, along with the following arguments as parameters for that function. """ -from __future__ import print_function -from __future__ import absolute_import from . import querying import argparse @@ -112,7 +110,7 @@ def copy_tag(arguments): # set end_of_validity to -1 because sqlite doesn't support long ints source_tag.end_of_validity = -1 source_tag.name = arguments.dest_tag - source_tag.modification_time = datetime.datetime.now() + source_tag.modification_time = datetime.datetime.utcnow() # create new iovs new_iovs = [] @@ -154,7 +152,7 @@ def copy_global_tag(arguments): tags = source_connection.tag(name=tags) # copy global tag first - global_tag.insertion_time = datetime.datetime.now() + global_tag.insertion_time = datetime.datetime.utcnow() global_tag.validity = -1 dest_connection.write_and_commit(global_tag) diff --git a/CondCore/Utilities/python/CondDBFW/data_formats.py b/CondCore/Utilities/python/CondDBFW/data_formats.py index e21a369c00911..4e5daadb36144 100644 --- a/CondCore/Utilities/python/CondDBFW/data_formats.py +++ b/CondCore/Utilities/python/CondDBFW/data_formats.py @@ -6,7 +6,6 @@ Note: may also contain a decorator that can wrap a class around a function that contains a script (future development). """ -from __future__ import absolute_import from .data_sources import json_data_node, json_list, json_dict, json_basic @@ -30,7 +29,7 @@ def to_datatables(script): def new_script(self, connection): try: data = script(self, connection) - if(isinstance(data, list)): + if(type(data) == list): data = _json_data_node.make(data) return to_datatables(data) except (KeyError, TypeError) as e: @@ -64,19 +63,19 @@ def _to_array_of_dicts(data): headers = data.get("headers").data() data_list = data.get("data").data() def unicode_to_str(string): - return str(string) if isinstance(string, unicode) else string - headers = map(unicode_to_str, headers) + return str(string) if type(string) == str else string + headers = list(map(unicode_to_str, headers)) def row_to_dict(row): - row = map(unicode_to_str, row) - return dict(zip(headers, row)) - array_of_dicts = map(row_to_dict, data_list) + row = list(map(unicode_to_str, row)) + return dict(list(zip(headers, row))) + array_of_dicts = list(map(row_to_dict, data_list)) return json_data_node.make(array_of_dicts) def _to_datatables(data): - headers = map(str, data.get(0).data().keys()) + headers = list(map(str, list(data.get(0).data().keys()))) new_data = [] for n in range(0, len(data.data())): - new_data.append(map(lambda entry : str(entry) if isinstance(entry, unicode) else entry, data.get(n).data().values())) + new_data.append([str(entry) if type(entry) == str else entry for entry in list(data.get(n).data().values())]) return json_data_node.make({ "headers" : headers, "data" : new_data diff --git a/CondCore/Utilities/python/CondDBFW/data_sources.py b/CondCore/Utilities/python/CondDBFW/data_sources.py index 2737308574dcc..1ad43a4d00255 100644 --- a/CondCore/Utilities/python/CondDBFW/data_sources.py +++ b/CondCore/Utilities/python/CondDBFW/data_sources.py @@ -3,8 +3,6 @@ This file contains the base DataSource class, and all sub classes that implement their own methods for parsing data. """ -from __future__ import print_function -from __future__ import absolute_import import json @@ -107,7 +105,7 @@ def __init__(self, sqlite_file_name): sql_query = "select %s from %s" % (column_string, table) results = cursor.execute(sql_query).fetchall() for n in range(0, len(results)): - results[n] = dict(zip(table_to_columns[table], map(str, results[n]))) + results[n] = dict(list(zip(table_to_columns[table], list(map(str, results[n]))))) table_to_data[str(table)] = results self._data = json_data_node.make(table_to_data) else: @@ -129,9 +127,9 @@ def __init__(self, data=None): # be created in code that shouldn't be doing it. @staticmethod def make(data): - if isinstance(data, list): + if type(data) == list: return json_list(data) - elif isinstance(data, dict): + elif type(data) == dict: return json_dict(data) else: return json_basic(data) @@ -159,12 +157,12 @@ def find(self, type_name): # traverse json_data_node structure, and find all lists # if this node in the structure is a list, return all sub lists lists = [] - if isinstance(self._data, type_name): + if type(self._data) == type_name: lists.append(self._data) - if isinstance(self._data, list): + if type(self._data) == list: for item in self._data: lists += json_data_node.make(item).find(type_name) - elif isinstance(self._data, dict): + elif type(self._data) == dict: for key in self._data: lists += json_data_node.make(self._data[key]).find(type_name) return lists @@ -198,7 +196,7 @@ def add_child(self, data): def __iter__(self): return self - def next(self): + def __next__(self): if self.iterator_index > len(self._data)-1: self.reset() raise StopIteration @@ -227,13 +225,13 @@ def indices(self, *indices): def get_members(self, member_name): # assume self.data() is a list - if not(type(member_name) in [str, unicode]): + if not(type(member_name) in [str, str]): raise TypeError("Value given for member name must be a string.") type_of_first_item = self.data()[0].__class__ for item in self.data(): if item.__class__ != type_of_first_item: return None - return json_data_node.make(map(lambda item : getattr(item, member_name), self.data())) + return json_data_node.make([getattr(item, member_name) for item in self.data()]) # format methods @@ -245,7 +243,7 @@ def as_dicts(self, convert_timestamps=False): if self.get(0).data().__class__.__name__ in ["GlobalTag", "GlobalTagMap", "Tag", "IOV", "Payload"]: # copy data - new_data = map(lambda item : item.as_dicts(convert_timestamps=convert_timestamps), [item for item in self.data()]) + new_data = [item.as_dicts(convert_timestamps=convert_timestamps) for item in [item for item in self.data()]] return new_data else: print("Data in json_list was not the correct type.") @@ -281,7 +279,7 @@ def as_table(self, fit=["all"], columns=None, hide=None, col_width=None, row_num table_name = None data = self.data() # gets headers stored in first dictionary - headers = data[0].keys() + headers = list(data[0].keys()) if columns != None: headers = columns @@ -298,7 +296,7 @@ def as_table(self, fit=["all"], columns=None, hide=None, col_width=None, row_num if col_width == None: import subprocess - table_width = int(0.95*int(subprocess.check_output(["stty", "size"]).split(" ")[1])) + table_width = int(0.95*int(subprocess.check_output([b'stty', b'size']).split(b' ')[1])) col_width = int(table_width/len(headers)) if hide != None: @@ -335,7 +333,7 @@ def cell(content, header, col_width, fit): for column in fit: if not(column in headers): - print("'%s' is not a valid column." % column) + print(("'%s' is not a valid column." % column)) return column_to_width[column] = max_width_of_column(column, data) diff --git a/CondCore/Utilities/python/CondDBFW/models.py b/CondCore/Utilities/python/CondDBFW/models.py index ca8f783445122..ee9c2773da8fb 100644 --- a/CondCore/Utilities/python/CondDBFW/models.py +++ b/CondCore/Utilities/python/CondDBFW/models.py @@ -8,8 +8,6 @@ so these will not work in a normal context outside the framework. """ -from __future__ import print_function -from __future__ import absolute_import import json import datetime @@ -24,7 +22,7 @@ exit() from . import data_sources, data_formats -import urllib, urllib2, base64 +import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse, base64 from copy import deepcopy # get utility functions @@ -50,8 +48,8 @@ def session_independent_object(object, schema=None): return new_object def session_independent(objects): - if isinstance(objects, list): - return map(session_independent_object, objects) + if type(objects) == list: + return list(map(session_independent_object, objects)) else: # assume objects is a single object (not a list) return session_independent_object(objects) @@ -153,9 +151,9 @@ def apply(self): def apply_filter(orm_query, orm_class, attribute, value): filter_attribute = getattr(orm_class, attribute) - if isinstance(value, list): + if type(value) == list: orm_query = orm_query.filter(filter_attribute.in_(value)) - elif isinstance(value, data_sources.json_list): + elif type(value) == data_sources.json_list: orm_query = orm_query.filter(filter_attribute.in_(value.data())) elif type(value) in [Range, Radius]: @@ -163,7 +161,7 @@ def apply_filter(orm_query, orm_class, attribute, value): plus = value.get_end() orm_query = orm_query.filter(and_(filter_attribute >= minus, filter_attribute <= plus)) - elif isinstance(value, RegExp): + elif type(value) == RegExp: # Relies on being a SingletonThreadPool @@ -181,7 +179,7 @@ def apply_filter(orm_query, orm_class, attribute, value): return orm_query def apply_filters(orm_query, orm_class, **filters): - for (key, value) in filters.items(): + for (key, value) in list(filters.items()): if not(key in ["amount"]): orm_query = apply_filter(orm_query, orm_class, key, value) return orm_query @@ -189,8 +187,11 @@ def apply_filters(orm_query, orm_class, **filters): def generate(map_blobs=False, class_name=None): Base = declarative_base() + schema = {"schema" : "CMS_CONDITIONS"} + fk_schema_prefix = ("%s." % schema["schema"]) if schema else "" class GlobalTag(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG' headers = ["name", "validity", "description", "release", "insertion_time", "snapshot_time", "scenario", "workflow", "type"] @@ -246,7 +247,7 @@ def all(self, **kwargs): """ query = self.session.query(GlobalTag) query = apply_filters(query, self.__class__, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(GlobalTag.name).limit(amount).all() gts = data_sources.json_data_node.make(query_result) return gts @@ -258,10 +259,10 @@ def tags(self, **kwargs): kwargs["global_tag_name"] = self.name all_tags = self.session.query(GlobalTagMap.global_tag_name, GlobalTagMap.record, GlobalTagMap.label, GlobalTagMap.tag_name) all_tags = apply_filters(all_tags, GlobalTagMap, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None all_tags = all_tags.order_by(GlobalTagMap.tag_name).limit(amount).all() column_names = ["global_tag_name", "record", "label", "tag_name"] - all_tags = map(lambda row : dict(zip(column_names, map(to_timestamp, row))), all_tags) + all_tags = [dict(list(zip(column_names, list(map(to_timestamp, row))))) for row in all_tags] all_tags = data_formats._dicts_to_orm_objects(GlobalTagMap, all_tags) return data_sources.json_data_node.make(all_tags) @@ -281,7 +282,7 @@ def iovs(self, **kwargs): tag_names = self.tags().get_members("tag_name").data() iovs_all_tags = self.session.query(IOV).filter(IOV.tag_name.in_(tag_names)) iovs_all_tags = apply_filters(iovs_all_tags, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None iovs_all_tags = iovs_all_tags.limit(amount).subquery() # now, join Global Tag Map table onto IOVs @@ -293,7 +294,7 @@ def iovs(self, **kwargs): iovs_gt_tags = iovs_gt_tags.order_by(iovs_all_tags.c.since).all() column_names = ["tag_name", "since", "payload_hash", "insertion_time"] - all_iovs = map(lambda row : dict(zip(column_names, row)), iovs_gt_tags) + all_iovs = [dict(list(zip(column_names, row))) for row in iovs_gt_tags] all_iovs = data_formats._dicts_to_orm_objects(IOV, all_iovs) return data_sources.json_data_node.make(all_iovs) @@ -335,14 +336,15 @@ def diff(self, gt): return data_sources.json_data_node.make(table) class GlobalTagMap(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG_MAP' headers = ["global_tag_name", "record", "label", "tag_name"] - global_tag_name = Column(String(100), ForeignKey('GLOBAL_TAG.name'), primary_key=True, nullable=False) - record = Column(String(100), ForeignKey('RECORDS.record'), primary_key=True, nullable=False) + global_tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'GLOBAL_TAG.name'), primary_key=True, nullable=False) + record = Column(String(100), ForeignKey(fk_schema_prefix + 'RECORDS.record'), primary_key=True, nullable=False) label = Column(String(100), primary_key=True, nullable=False) - tag_name = Column(String(100), ForeignKey('TAG.name'), nullable=False) + tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), nullable=False) def __init__(self, dictionary={}, convert_timestamps=True): # assign each entry in a kwargs @@ -372,11 +374,12 @@ def as_dicts(self, convert_timestamps=False): class GlobalTagMapRequest(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG_MAP_REQUEST' queue = Column(String(100), primary_key=True, nullable=False) - tag = Column(String(100), ForeignKey('TAG.name'), primary_key=True, nullable=False) - record = Column(String(100), ForeignKey('RECORDS.record'), primary_key=True, nullable=False) + tag = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) + record = Column(String(100), ForeignKey(fk_schema_prefix + 'RECORDS.record'), primary_key=True, nullable=False) label = Column(String(100), primary_key=True, nullable=False) status = Column(String(1), nullable=False) description = Column(String(4000), nullable=False) @@ -420,13 +423,14 @@ def to_array(self): return [self.queue, self.tag, self.record, self.label, status_full_name(self.status), to_timestamp(self.time_submitted), to_timestamp(self.last_edited)] class IOV(Base): + __table_args__ = schema __tablename__ = 'IOV' headers = ["tag_name", "since", "payload_hash", "insertion_time"] - tag_name = Column(String(4000), ForeignKey('TAG.name'), primary_key=True, nullable=False) + tag_name = Column(String(4000), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) since = Column(Integer, primary_key=True, nullable=False) - payload_hash = Column(String(40), ForeignKey('PAYLOAD.hash'), nullable=False) + payload_hash = Column(String(40), ForeignKey(fk_schema_prefix + 'PAYLOAD.hash'), nullable=False) insertion_time = Column(DateTime, primary_key=True, nullable=False) def __init__(self, dictionary={}, convert_timestamps=True): @@ -463,12 +467,13 @@ def all(self, **kwargs): """ query = self.session.query(IOV) query = apply_filters(query, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(IOV.tag_name).order_by(IOV.since).limit(amount).all() return data_sources.json_data_node.make(query_result) class Payload(Base): + __table_args__ = schema __tablename__ = 'PAYLOAD' headers = ["hash", "object_type", "version", "insertion_time"] @@ -536,8 +541,8 @@ def parent_tags(self, **kwargs): query = self.session.query(IOV.tag_name) query = apply_filters(query, IOV, **kwargs) query_result = query.all() - tag_names = map(lambda entry : entry[0], query_result) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + tag_names = [entry[0] for entry in query_result] + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None tags = self.session.query(Tag).filter(Tag.name.in_(tag_names)).order_by(Tag.name).limit(amount).all() return data_sources.json_data_node.make(tags) @@ -547,12 +552,13 @@ def all(self, **kwargs): """ query = self.session.query(Payload) query = apply_filters(query, Payload, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Payload.hash).limit(amount).all() return data_sources.json_data_node.make(query_result) class Record(Base): + __table_args__ = schema __tablename__ = 'RECORDS' headers = ["record", "object", "type"] @@ -583,16 +589,17 @@ def all(self, **kwargs): """ query = self.session.query(Record) query = apply_filters(query, Record, kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Record.record).limit(amount).all() return data_sources.json_data_node.make(query_result) class Tag(Base): + __table_args__ = schema __tablename__ = 'TAG' headers = ["name", "time_type", "object_type", "synchronization", "end_of_validity",\ - "description", "last_validated_time", "insertion_time", "modification_time"] + "description", "last_validated_time", "insertion_time", "modification_time", "protection_code"] name = Column(String(4000), primary_key=True, nullable=False) time_type = Column(String(4000), nullable=False) @@ -603,6 +610,7 @@ class Tag(Base): last_validated_time = Column(BigInteger, nullable=False) insertion_time = Column(DateTime, nullable=False) modification_time = Column(DateTime, nullable=False) + protection_code = Column(Integer, nullable=False) record = None label = None @@ -656,8 +664,8 @@ def parent_global_tags(self, **kwargs): query = apply_filters(query, GlobalTagMap, **kwargs) query_result = query.all() if len(query_result) != 0: - global_tag_names = map(lambda entry : entry[0], query_result) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + global_tag_names = [entry[0] for entry in query_result] + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None global_tags = self.session.query(GlobalTag).filter(GlobalTag.name.in_(global_tag_names)).order_by(GlobalTag.name).limit(amount).all() else: global_tags = None @@ -669,7 +677,7 @@ def all(self, **kwargs): """ query = self.session.query(Tag) query = apply_filters(query, Tag, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Tag.name).limit(amount).all() return data_sources.json_data_node.make(query_result) @@ -680,7 +688,7 @@ def iovs(self, **kwargs): # filter_params contains a list of columns to filter the iovs by iovs_query = self.session.query(IOV).filter(IOV.tag_name == self.name) iovs_query = apply_filters(iovs_query, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None iovs = iovs_query.order_by(IOV.since).limit(amount).all() return data_sources.json_data_node.make(iovs) @@ -738,8 +746,8 @@ def diff(self, tag, short=False): raise TypeError("Tag given must be a CondDBFW Tag object.") # get lists of iovs - iovs1 = dict(map(lambda iov : (iov.since, iov.payload_hash), self.iovs().data())) - iovs2 = dict(map(lambda iov : (iov.since, iov.payload_hash), tag.iovs().data())) + iovs1 = dict([(iov.since, iov.payload_hash) for iov in self.iovs().data()]) + iovs2 = dict([(iov.since, iov.payload_hash) for iov in tag.iovs().data()]) iovs = [(x, iovs1.get(x), iovs2.get(x)) for x in sorted(set(iovs1) | set(iovs2))] iovs.append(("Infinity", 1, 2)) @@ -851,7 +859,7 @@ def merge_into(self, tag, range_object): else: # otherwise, iterate down from n to find the last sqlite iov, # and assign that hash - for i in reversed(range(0,n)): + for i in reversed(list(range(0,n))): if new_iovs_list[i].source == "sqlite": print("change %s to %s at since %d" % (iov.payload_hash, new_iovs_list[i].payload_hash, iov.since)) iov.payload_hash = new_iovs_list[i].payload_hash @@ -867,7 +875,7 @@ def merge_into(self, tag, range_object): new_iov_list_copied = sorted(new_iov_list_copied, key=lambda iov : iov.since) - now = datetime.datetime.now() + now = datetime.datetime.utcnow() new_iovs = [] for iov in new_iov_list_copied: @@ -881,8 +889,47 @@ def merge_into(self, tag, range_object): return new_tag #sqlite.write_and_commit(new_iovs) + + class TagAuthorization(Base): + __table_args__ = schema + __tablename__ = 'TAG_AUTHORIZATION' + + headers = ["tag_name", "access_type", "credential", "credential_type"] + + tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) + access_type = Column(Integer, nullable=False) + credential = Column(String(100), primary_key=True, nullable=False) + credential_type = Column(Integer, nullable=False) + + def as_dicts(self): + """ + Returns dictionary form of this Tag Authorization. + """ + return { + "tag_name" : self.tag_name, + "access_type" : self.access_type, + "credential" : self.credential, + "credential_type" : self.credential_type + } + + def __repr__(self): + return '' % (self.tag_name, self.access_type, self.credential, self.credential_type) + + def to_array(self): + return [self.tag_name, self.access_type, self.credential, self.credential_type] + + def all(self, **kwargs): + """ + Returns `amount` Records ordered by Record record. + """ + query = self.session.query(TagAuthorization) + query = apply_filters(query, TagAuthorization, kwargs) + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None + query_result = query.order_by(TagAuthorization.tag).limit(amount).all() + return data_sources.json_data_node.make(query_result) + classes = {"globaltag" : GlobalTag, "iov" : IOV, "globaltagmap" : GlobalTagMap,\ - "payload" : Payload, "tag" : Tag, "Base" : Base} + "payload" : Payload, "tag" : Tag, "TagAuthorization": TagAuthorization, "Base" : Base} if class_name == None: return classes diff --git a/CondCore/Utilities/python/CondDBFW/querying.py b/CondCore/Utilities/python/CondDBFW/querying.py index d7d3528a8e7db..1de2aa3eaddd1 100644 --- a/CondCore/Utilities/python/CondDBFW/querying.py +++ b/CondCore/Utilities/python/CondDBFW/querying.py @@ -6,8 +6,6 @@ connection class can also take a pre-constructed engine - useful for web services. """ -from __future__ import print_function -from __future__ import absolute_import import sqlalchemy from sqlalchemy import create_engine, text, or_ @@ -23,436 +21,439 @@ import sys class connection(object): - engine = None - connection = None - session = None - connection_data = None - netrc_authenticators = None - secrets = None - """ + engine = None + connection = None + session = None + connection_data = None + netrc_authenticators = None + secrets = None + """ Given a connection string, parses the connection string and connects. """ - def __init__(self, connection_data, mode=None, map_blobs=False, secrets=None, pooling=False): - - self._pooling = pooling - - # add querying utility properties - # these must belong to the connection since the way in which their values are handled - # depends on the database being connected to. - self.range = models.Range - self.radius = models.Radius - self.regexp = models.RegExp - self.regexp.connection_object = self - - if type(connection_data) in [str, unicode]: - # if we've been given a connection string, process it - self.connection_data = new_connection_dictionary(connection_data, secrets=secrets, mode=mode) - self.schema = self.connection_data.get("schema") if self.connection_data.get("schema") != None else "" - - self.range.database_type = self.connection_data["host"] - self.radius.database_type = self.connection_data["host"] - self.regexp.database_type = self.connection_data["host"] - else: - self.connection_data = connection_data - # assume we have an engine - # we need to take the string representation so we know which type of db we're aiming at - engine_string = str(connection_data) - db_type = None - if "oracle" in engine_string: - db_type = "oracle" - elif "frontier" in engine_string: - db_type = "frontier" - elif "sqlite" in engine_string: - db_type = "sqlite" - - self.range.database_type = db_type - self.radius.database_type = db_type - self.regexp.database_type = db_type - - from . import models as ms - self.models = ms.generate(map_blobs) - #self.base = self.models["Base"] - - def setup(self): - """ - Setup engine with given credentials from netrc file, and make a session maker. - """ - - if isinstance(self.connection_data, dict): - self.engine = engine_from_dictionary(self.connection_data, pooling=self._pooling) - else: - # we've been given an engine by the user - # use it as the engine - self.engine = self.connection_data - - self.sessionmaker = sessionmaker(bind=self.engine) - self.session = self.sessionmaker() - self.factory = factory(self) - - # assign correct schema for database name to each model - tmp_models_dict = {} - for key in self.models: - if self.models[key].__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta\ - and str(self.models[key].__name__) != "Base": - - if isinstance(self.connection_data, dict): - # we can only extract the secrets and schema individuall - # if we were given a dictionary... if we were given an engine - # we can't do this without parsing the connection string from the engine - # - a wide range of which it will be difficult to support! - self.models[key].__table__.schema = self.connection_data["schema"] - self.models[key].secrets = self.connection_data["secrets"] - - self.models[key].session = self.session - # isn't used anywhere - comment it out for now - #self.models[key].authentication = self.netrc_authenticators - self.models[key].connection = self - tmp_models_dict[key.lower()] = self.models[key] - tmp_models_dict[key.lower()].empty = False - - self.models = tmp_models_dict - - return self - - @staticmethod - def _get_CMS_frontier_connection_string(database): - try: - import subprocess - return subprocess.Popen(['cmsGetFnConnect', 'frontier://%s' % database], stdout = subprocess.PIPE).communicate()[0].strip() - except: - raise Exception("Frontier connections can only be constructed when inside a CMSSW environment.") - - @staticmethod - def _cms_frontier_string(database, schema="cms_conditions"): - """ - Get database string for frontier. - """ - import urllib - return 'oracle+frontier://@%s/%s' % (urllib.quote_plus(connection._get_CMS_frontier_connection_string(database)), schema) - - @staticmethod - def _cms_oracle_string(user, pwd, db_name): - """ - Get database string for oracle. - """ - return 'oracle://%s:%s@%s' % (user, pwd, db_name) - - @staticmethod - def build_oracle_url(user, pwd, db_name): - """ - Build the connection url, and get credentials from self.secrets dictionary. - """ - - database_url = connection._cms_oracle_string(user, pwd, db_name) - - try: - url = sqlalchemy.engine.url.make_url(database_url) - if url.password is None: - url.password = pwd - except sqlalchemy.exc.ArgumentError: - url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) - return url - - @staticmethod - def build_frontier_url(db_name, schema): - database_url = connection._cms_frontier_string(db_name, schema) - - try: - url = sqlalchemy.engine.url.make_url(database_url) - except sqlalchemy.exc.ArgumentError: - """ - Is this needed for a use case? - """ - url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) - return url - - # currently just commits and closes the current session (ends transaction, closes connection) - # may do other things later - def tear_down(self): - try: - self.session.commit() - self.close_session() - except: - return "Couldn't tear down connection on engine %s." % str(self.engine) - - def close_session(self): - self.session.close() - return True - - def hard_close(self): - self.engine.dispose() - return True - - # get model based on given model name - def model(self, model_name): - if model_name.__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta: - model_name = model_name.__name__ - model_name = model_name.replace("_", "") - return self.models[model_name] - - # model should be the class the developer wants to be instantiated - # pk_to_value maps primary keys to values - def object(self, model, pk_to_value): - if self.session == None: - return None - model_data = self.session.query(model) - for pk in pk_to_value: - model_data = model_data.filter(model.__dict__[pk] == pk_to_value[pk]) - return model_data.first() - - def global_tag(self, **pkargs): - return self.factory.object("globaltag", **pkargs) - - def global_tag_map(self, **pkargs): - return self.factory.object("globaltagmap", **pkargs) - - """def global_tag_map_request(self, **pkargs): + def __init__(self, connection_data, mode=None, map_blobs=False, secrets=None, pooling=False): + + self._pooling = pooling + + # add querying utility properties + # these must belong to the connection since the way in which their values are handled + # depends on the database being connected to. + self.range = models.Range + self.radius = models.Radius + self.regexp = models.RegExp + self.regexp.connection_object = self + + if type(connection_data) in [str, str]: + # if we've been given a connection string, process it + self.connection_data = new_connection_dictionary(connection_data, secrets=secrets, mode=mode) + self.schema = self.connection_data.get("schema") if self.connection_data.get("schema") != None else "" + + self.range.database_type = self.connection_data["host"] + self.radius.database_type = self.connection_data["host"] + self.regexp.database_type = self.connection_data["host"] + else: + self.connection_data = connection_data + # assume we have an engine + # we need to take the string representation so we know which type of db we're aiming at + engine_string = str(connection_data) + db_type = None + if "oracle" in engine_string: + db_type = "oracle" + elif "frontier" in engine_string: + db_type = "frontier" + elif "sqlite" in engine_string: + db_type = "sqlite" + + self.range.database_type = db_type + self.radius.database_type = db_type + self.regexp.database_type = db_type + + from . import models as ms + self.models = ms.generate(map_blobs) + #self.base = self.models["Base"] + + def setup(self): + """ + Setup engine with given credentials from netrc file, and make a session maker. + """ + + if type(self.connection_data) == dict: + self.engine = engine_from_dictionary(self.connection_data, pooling=self._pooling) + else: + # we've been given an engine by the user + # use it as the engine + self.engine = self.connection_data + + self.sessionmaker = sessionmaker(bind=self.engine) + self.session = self.sessionmaker() + self.factory = factory(self) + + # assign correct schema for database name to each model + tmp_models_dict = {} + for key in self.models: + if self.models[key].__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta\ + and str(self.models[key].__name__) != "Base": + + if type(self.connection_data) == dict: + # we can only extract the secrets and schema individuall + # if we were given a dictionary... if we were given an engine + # we can't do this without parsing the connection string from the engine + # - a wide range of which it will be difficult to support! + self.models[key].__table__.schema = self.connection_data["schema"] + self.models[key].secrets = self.connection_data["secrets"] + + self.models[key].session = self.session + # isn't used anywhere - comment it out for now + #self.models[key].authentication = self.netrc_authenticators + self.models[key].connection = self + tmp_models_dict[key.lower()] = self.models[key] + tmp_models_dict[key.lower()].empty = False + + self.models = tmp_models_dict + + return self + + @staticmethod + def _get_CMS_frontier_connection_string(database): + try: + import subprocess + return subprocess.Popen(['cmsGetFnConnect', 'frontier://%s' % database], stdout = subprocess.PIPE).communicate()[0].strip() + except: + raise Exception("Frontier connections can only be constructed when inside a CMSSW environment.") + + @staticmethod + def _cms_frontier_string(database, schema="cms_conditions"): + """ + Get database string for frontier. + """ + import urllib.request, urllib.parse, urllib.error + return 'oracle+frontier://@%s/%s' % (urllib.parse.quote_plus(connection._get_CMS_frontier_connection_string(database)), schema) + + @staticmethod + def _cms_oracle_string(user, pwd, db_name): + """ + Get database string for oracle. + """ + return 'oracle://%s:%s@%s' % (user, pwd, db_name) + + @staticmethod + def build_oracle_url(user, pwd, db_name): + """ + Build the connection url, and get credentials from self.secrets dictionary. + """ + + database_url = connection._cms_oracle_string(user, pwd, db_name) + + try: + url = sqlalchemy.engine.url.make_url(database_url) + if url.password is None: + url.password = pwd + except sqlalchemy.exc.ArgumentError: + url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) + return url + + @staticmethod + def build_frontier_url(db_name, schema): + database_url = connection._cms_frontier_string(db_name, schema) + + try: + url = sqlalchemy.engine.url.make_url(database_url) + except sqlalchemy.exc.ArgumentError: + """ + Is this needed for a use case? + """ + url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) + return url + + # currently just commits and closes the current session (ends transaction, closes connection) + # may do other things later + def tear_down(self): + try: + self.session.commit() + self.close_session() + except: + return "Couldn't tear down connection on engine %s." % str(self.engine) + + def close_session(self): + self.session.close() + return True + + def hard_close(self): + self.engine.dispose() + return True + + # get model based on given model name + def model(self, model_name): + if model_name.__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta: + model_name = model_name.__name__ + model_name = model_name.replace("_", "") + return self.models[model_name] + + # model should be the class the developer wants to be instantiated + # pk_to_value maps primary keys to values + def object(self, model, pk_to_value): + if self.session == None: + return None + model_data = self.session.query(model) + for pk in pk_to_value: + model_data = model_data.filter(model.__dict__[pk] == pk_to_value[pk]) + return model_data.first() + + def global_tag(self, **pkargs): + return self.factory.object("globaltag", **pkargs) + + def global_tag_map(self, **pkargs): + return self.factory.object("globaltagmap", **pkargs) + + """def global_tag_map_request(self, **pkargs): return self.factory.object("globaltagmaprequest", **pkargs)""" - def tag(self, **pkargs): - return self.factory.object("tag", **pkargs) + def tag(self, **pkargs): + return self.factory.object("tag", **pkargs) + + def tag_authorization(self, **pkargs): + return self.factory.object("tagauthorization", **pkargs) - def iov(self, **pkargs): - return self.factory.object("iov", **pkargs) + def iov(self, **pkargs): + return self.factory.object("iov", **pkargs) - def payload(self, **pkargs): - return self.factory.object("payload", **pkargs) + def payload(self, **pkargs): + return self.factory.object("payload", **pkargs) - """def record(self, **pkargs): + """def record(self, **pkargs): return self.factory.object("record", **pkargs)""" - # adds %% at the beginning and end so LIKE in SQL searches all of the string - def _oracle_match_format(self, string): - return "%%%s%%" % string - - # returns dictionary mapping object type to a list of all objects found in the search - def search_everything(self, string, amount=10): - string = self._oracle_match_format(string) - - gt = self.model("globaltag") - global_tags = self.session.query(gt).filter(or_( - gt.name.ilike(string), - gt.description.ilike(string), - gt.release.ilike(string) - )).limit(amount) - tag = self.model("tag") - tags = self.session.query(tag).filter(or_( - tag.name.ilike(string), - tag.object_type.ilike(string), - tag.description.ilike(string)) - ).limit(amount) - iov = self.model("iov") - iovs = self.session.query(iov).filter(or_( - iov.tag_name.ilike(string), - iov.since.ilike(string), - iov.payload_hash.ilike(string), - iov.insertion_time.ilike(string) - )).limit(amount) - payload = self.model("payload") - payloads = self.session.query(payload).filter(or_( - payload.hash.ilike(string), - payload.object_type.ilike(string), - payload.insertion_time.ilike(string) - )).limit(amount) - - return json_data_node.make({ - "global_tags" : global_tags.all(), - "tags" : tags.all(), - "iovs" : iovs.all(), - "payloads" : payloads.all() - }) - - def write(self, object): - new_object = models.session_independent_object(object, schema=self.schema) - self.session.add(new_object) - return new_object - - def commit(self): - try: - self.session.commit() - except: - traceback.print_exc() - self.session.rollback() - - def write_and_commit(self, object): - if isinstance(object, list): - for item in object: - self.write_and_commit(item) - else: - # should be changed to deal with errors - add them to exception handling if they appear - self.write(object) - self.commit() - - def rollback(self): - try: - self.session.rollback() - except: - traceback.print_exc() - print("Session couldn't be rolled back.") + # adds %% at the beginning and end so LIKE in SQL searches all of the string + def _oracle_match_format(self, string): + return "%%%s%%" % string + + # returns dictionary mapping object type to a list of all objects found in the search + def search_everything(self, string, amount=10): + string = self._oracle_match_format(string) + + gt = self.model("globaltag") + global_tags = self.session.query(gt).filter(or_( + gt.name.ilike(string), + gt.description.ilike(string), + gt.release.ilike(string) + )).limit(amount) + tag = self.model("tag") + tags = self.session.query(tag).filter(or_( + tag.name.ilike(string), + tag.object_type.ilike(string), + tag.description.ilike(string)) + ).limit(amount) + iov = self.model("iov") + iovs = self.session.query(iov).filter(or_( + iov.tag_name.ilike(string), + iov.since.ilike(string), + iov.payload_hash.ilike(string), + iov.insertion_time.ilike(string) + )).limit(amount) + payload = self.model("payload") + payloads = self.session.query(payload).filter(or_( + payload.hash.ilike(string), + payload.object_type.ilike(string), + payload.insertion_time.ilike(string) + )).limit(amount) + + return json_data_node.make({ + "global_tags" : global_tags.all(), + "tags" : tags.all(), + "iovs" : iovs.all(), + "payloads" : payloads.all() + }) + + def write(self, object): + new_object = models.session_independent_object(object, schema=self.schema) + self.session.add(new_object) + return new_object + + def commit(self): + try: + self.session.commit() + except: + traceback.print_exc() + self.session.rollback() + + def write_and_commit(self, object): + if type(object) == list: + for item in object: + self.write_and_commit(item) + else: + # should be changed to deal with errors - add them to exception handling if they appear + self.write(object) + self.commit() + + def rollback(self): + try: + self.session.rollback() + except: + traceback.print_exc() + print("Session couldn't be rolled back.") class factory(): - """ - Contains methods for creating objects. - """ - def __init__(self, connection): - self.connection = connection - - # class_name is the class name of the model to be used - # pkargs is a dictionary of keyword arguments used as primary key values - # this dictionary will be used to populate the object of type name class_name - def object(self, class_name, **pkargs): - from .data_sources import json_list - from .models import apply_filters - # get the class that self.connection holds from the class name - model = self.connection.model(class_name) - - if self.connection.session == None: - return None - - # query for the ORM object, and return the appropriate object (None, CondDBFW object, or json_list) - model_data = self.connection.session.query(model) - if len(pkargs.items()) != 0: - # apply the filters defined in **kwargs - model_data = apply_filters(model_data, model, **pkargs) - amount = pkargs["amount"] if "amount" in pkargs.keys() else None - model_data = model_data.limit(amount) - if model_data.count() > 1: - # if we have multiple objects, return a json_list - return json_list(model_data.all()) - elif model_data.count() == 1: - # if we have a single object, return that object - return model_data.first() - else: - # if we have no objects returned, return None - return None - else: - # no column arguments were given, so return an empty object - new_object = model() - new_object.empty = True - return new_object + """ + Contains methods for creating objects. + """ + def __init__(self, connection): + self.connection = connection + + # class_name is the class name of the model to be used + # pkargs is a dictionary of keyword arguments used as primary key values + # this dictionary will be used to populate the object of type name class_name + def object(self, class_name, **pkargs): + from .data_sources import json_list + from .models import apply_filters + # get the class that self.connection holds from the class name + model = self.connection.model(class_name) + + if self.connection.session == None: + return None + + # query for the ORM object, and return the appropriate object (None, CondDBFW object, or json_list) + model_data = self.connection.session.query(model) + if len(list(pkargs.items())) != 0: + # apply the filters defined in **kwargs + model_data = apply_filters(model_data, model, **pkargs) + amount = pkargs["amount"] if "amount" in list(pkargs.keys()) else None + model_data = model_data.limit(amount) + if model_data.count() > 1: + # if we have multiple objects, return a json_list + return json_list(model_data.all()) + elif model_data.count() == 1: + # if we have a single object, return that object + return model_data.first() + else: + # if we have no objects returned, return None + return None + else: + # no column arguments were given, so return an empty object + new_object = model() + new_object.empty = True + return new_object def _get_netrc_data(netrc_file, key): - """ - Returns a dictionary {login : ..., account : ..., password : ...} - """ - try: - headers = ["login", "account", "password"] - authenticator_tuple = netrc.netrc(netrc_file).authenticators(key) - if authenticator_tuple == None: - raise Exception("netrc file must contain key '%s'." % key) - except: - raise Exception("Couldn't get credentials from netrc file.") - return dict(zip(headers, authenticator_tuple)) + """ + Returns a dictionary {login : ..., account : ..., password : ...} + """ + try: + headers = ["login", "account", "password"] + authenticator_tuple = netrc.netrc(netrc_file).authenticators(key) + if authenticator_tuple == None: + raise Exception("netrc file must contain key '%s'." % key) + except: + raise Exception("Couldn't get credentials from netrc file.") + return dict(list(zip(headers, authenticator_tuple))) def new_connection_dictionary(connection_data, secrets=None, mode="r"): - """ - Function used to construct connection data dictionaries - internal to framework. - """ - frontier_str_length = len("frontier://") - sqlite_str_length = len("sqlite://") - #sqlite_file_str_length = len("sqlite_file://") - oracle_str_length = len("oracle://") - - if type(connection_data) in [str, unicode] and connection_data[0:frontier_str_length] == "frontier://": - """ - frontier://database_name/schema - """ - db_name = connection_data[frontier_str_length:].split("/")[0] - schema = connection_data[frontier_str_length:].split("/")[1] - connection_data = {} - connection_data["database_name"] = db_name - connection_data["schema"] = schema - connection_data["host"] = "frontier" - connection_data["secrets"] = None - elif type(connection_data) in [str, unicode] and connection_data[0:sqlite_str_length] == "sqlite://": - """ - sqlite://database_file_name - """ - # for now, just support "sqlite://" format for sqlite connection strings - db_name = connection_data[sqlite_str_length:] - schema = "" - connection_data = {} - connection_data["database_name"] = os.path.abspath(db_name) - connection_data["schema"] = schema - connection_data["host"] = "sqlite" - connection_data["secrets"] = None - elif type(connection_data) in [str, unicode] and connection_data[0:oracle_str_length] == "oracle://": - """ - oracle://account:password@database_name - or - oracle://database_name/schema (requires a separate method of authentication - either dictionary or netrc) - """ - new_connection_string = connection_data[oracle_str_length:] - - if ":" in new_connection_string: - # the user has given a password - usually in the case of the db upload service - database_name = new_connection_string[new_connection_string.index("@")+1:] - schema_name = new_connection_string[0:new_connection_string.index(":")] - # set username based on connection string - username = new_connection_string[0:new_connection_string.index(":")] - password = new_connection_string[new_connection_string.index(":")+1:new_connection_string.index("@")] - else: - mode_to_netrc_key_suffix = {"r" : "read", "w" : "write"} - database_name = new_connection_string[0:new_connection_string.index("/")] - schema_name = new_connection_string[new_connection_string.index("/")+1:] - if secrets == None: - username = str(raw_input("Enter the username you want to connect to the schema '%s' with: " % (schema_name))) - password = str(raw_input("Enter the password for the user '%s' in database '%s': " % (username, database_name))) - else: - if isinstance(secrets, str): - netrc_key = "%s/%s/%s" % (database_name, schema_name, mode_to_netrc_key_suffix[mode]) - netrc_data = _get_netrc_data(secrets, key=netrc_key) - # take the username from the netrc entry corresponding to the mode the database is opened in - # eg, if the user has given mode="read", the database_name/schema_name/read entry will be taken - username = netrc_data["login"] - password = netrc_data["password"] - elif isinstance(secrets, dict): - username = secrets["user"] - password = secrets["password"] - else: - raise Exception("Invalid type given for secrets. Either an str or a dict must be given.") - - #print("Connected to database %s, schema %s, with username %s." % (database_name, schema_name, username)) - - connection_data = {} - connection_data["database_name"] = database_name - connection_data["schema"] = schema_name - connection_data["password"] = password - connection_data["host"] = "oracle" - connection_data["secrets"] = {"login" : username, "password" : password} - - return connection_data + """ + Function used to construct connection data dictionaries - internal to framework. + """ + frontier_str_length = len("frontier://") + sqlite_str_length = len("sqlite://") + #sqlite_file_str_length = len("sqlite_file://") + oracle_str_length = len("oracle://") + + if type(connection_data) in [str, str] and connection_data[0:frontier_str_length] == "frontier://": + """ + frontier://database_name/schema + """ + db_name = connection_data[frontier_str_length:].split("/")[0] + schema = connection_data[frontier_str_length:].split("/")[1] + connection_data = {} + connection_data["database_name"] = db_name + connection_data["schema"] = schema + connection_data["host"] = "frontier" + connection_data["secrets"] = None + elif type(connection_data) in [str, str] and connection_data[0:sqlite_str_length] == "sqlite://": + """ + sqlite://database_file_name + """ + # for now, just support "sqlite://" format for sqlite connection strings + db_name = connection_data[sqlite_str_length:] + schema = "" + connection_data = {} + connection_data["database_name"] = os.path.abspath(db_name) + connection_data["schema"] = schema + connection_data["host"] = "sqlite" + connection_data["secrets"] = None + elif type(connection_data) in [str, str] and connection_data[0:oracle_str_length] == "oracle://": + """ + oracle://account:password@database_name + or + oracle://database_name/schema (requires a separate method of authentication - either dictionary or netrc) + """ + new_connection_string = connection_data[oracle_str_length:] + + if ":" in new_connection_string: + # the user has given a password - usually in the case of the db upload service + database_name = new_connection_string[new_connection_string.index("@")+1:] + schema_name = new_connection_string[0:new_connection_string.index(":")] + # set username based on connection string + username = new_connection_string[0:new_connection_string.index(":")] + password = new_connection_string[new_connection_string.index(":")+1:new_connection_string.index("@")] + else: + mode_to_netrc_key_suffix = {"r" : "read", "w" : "write"} + database_name = new_connection_string[0:new_connection_string.index("/")] + schema_name = new_connection_string[new_connection_string.index("/")+1:] + if secrets == None: + username = str(input("Enter the username you want to connect to the schema '%s' with: " % (schema_name))) + password = str(input("Enter the password for the user '%s' in database '%s': " % (username, database_name))) + else: + if type(secrets) == str: + netrc_key = "%s/%s/%s" % (database_name, schema_name, mode_to_netrc_key_suffix[mode]) + netrc_data = _get_netrc_data(secrets, key=netrc_key) + # take the username from the netrc entry corresponding to the mode the database is opened in + # eg, if the user has given mode="read", the database_name/schema_name/read entry will be taken + username = netrc_data["login"] + password = netrc_data["password"] + elif type(secrets) == dict: + username = secrets["user"] + password = secrets["password"] + else: + raise Exception("Invalid type given for secrets. Either an str or a dict must be given.") + + #print("Connected to database %s, schema %s, with username %s." % (database_name, schema_name, username)) + + connection_data = {} + connection_data["database_name"] = database_name + connection_data["schema"] = schema_name + connection_data["password"] = password + connection_data["host"] = "oracle" + connection_data["secrets"] = {"login" : username, "password" : password} + + return connection_data def engine_from_dictionary(dictionary, pooling=True): - if dictionary["host"] != "sqlite": - if dictionary["host"] != "frontier": - # probably oracle - # if not frontier, we have to authenticate - user = dictionary["secrets"]["login"] - pwd = dictionary["secrets"]["password"] - # set max label length for oracle - if pooling: - return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6) - else: - return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6, poolclass=NullPool) - else: - # if frontier, no need to authenticate - # set max label length for frontier - if pooling: - return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6) - else: - return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6, poolclass=NullPool) - else: - # if host is sqlite, making the url is easy - no authentication - return create_engine("sqlite:///%s" % dictionary["database_name"]) + if dictionary["host"] != "sqlite": + if dictionary["host"] != "frontier": + # probably oracle + # if not frontier, we have to authenticate + user = dictionary["secrets"]["login"] + pwd = dictionary["secrets"]["password"] + # set max label length for oracle + if pooling: + return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6) + else: + return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6, poolclass=NullPool) + else: + # if frontier, no need to authenticate + # set max label length for frontier + if pooling: + return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6) + else: + return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6, poolclass=NullPool) + else: + # if host is sqlite, making the url is easy - no authentication + return create_engine("sqlite:///%s" % dictionary["database_name"]) def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True): - """ - Utility method for user - set up a connection object. - """ - con = connection(connection_data=connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling) - con = con.setup() - return con + """ + Utility method for user - set up a connection object. + """ + con = connection(connection_data=connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling) + con = con.setup() + return con \ No newline at end of file diff --git a/CondCore/Utilities/python/CondDBFW/shell.py b/CondCore/Utilities/python/CondDBFW/shell.py index e039f63ad8f0b..a19704dae6176 100644 --- a/CondCore/Utilities/python/CondDBFW/shell.py +++ b/CondCore/Utilities/python/CondDBFW/shell.py @@ -3,8 +3,6 @@ Contains classes for shell part of framework - basically a collection of classes that are designed to be invoked on the command line. """ -from __future__ import print_function -from __future__ import absolute_import from . import querying import sys diff --git a/CondCore/Utilities/python/CondDBFW/uploadConditions.py b/CondCore/Utilities/python/CondDBFW/uploadConditions.py index 5e9b0de06ff2c..17977f42b5e8e 100755 --- a/CondCore/Utilities/python/CondDBFW/uploadConditions.py +++ b/CondCore/Utilities/python/CondDBFW/uploadConditions.py @@ -1,8 +1,11 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 """ - +Primary Author: Joshua Dawes - CERN, CMS - The University of Manchester +Debugging, Integration and Maintenance: +Andres Cardenas - CERN, CMS - Universidad San Francisco + Upload script wrapper - controls the automatic update system. Note: the name of the file follows a different convention to the others because it should be the same as the current upload script name. @@ -15,10 +18,17 @@ 4. Invoke the CondDBFW.uploads module with the arguments given to this script. """ -from __future__ import print_function -import pycurl -from StringIO import StringIO +__version__ = 1 + +#import pycurl +import requests +import urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) +try: + from StringIO import StringIO +except: + pass import traceback import sys import os @@ -28,146 +38,18 @@ import netrc import shutil import getpass +import errno +import sqlite3 -def get_version_info(url): - """ - Queries the server-side for the commit hash it is currently using. - Note: this is the commit hash used by /data/services/common/CondDBFW on the server-side. - """ - request = pycurl.Curl() - request.setopt(request.CONNECTTIMEOUT, 60) - user_agent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" % (sys.version_info[ :3 ] + (pycurl.version_info()[1],)) - request.setopt(request.USERAGENT, user_agent) - # we don't need to verify who signed the certificate or who the host is - request.setopt(request.SSL_VERIFYPEER, 0) - request.setopt(request.SSL_VERIFYHOST, 0) - response_buffer = StringIO() - request.setopt(request.WRITEFUNCTION, response_buffer.write) - request.setopt(request.URL, url + "conddbfw_version/") - request.perform() - return json.loads(response_buffer.getvalue()) - -def get_local_commit_hash(): - """ - Gets the commit hash used by the local repository CondDBFW/.git/. - """ - directory = os.path.abspath("CondDBFW") - - # get the commit hash of the code in `directory` - # by reading the .commit_hash file - try: - commit_hash_file_handle = open(os.path.join(directory, ".commit_hash"), "r") - commit_hash = commit_hash_file_handle.read().strip() - - # validate length of the commit hash - if len(commit_hash) != 40: - print("Commit hash found is not valid. Must be 40 characters long.") - exit() - - #commit_hash = run_in_shell("git --git-dir=%s rev-parse HEAD" % (os.path.join(directory, ".git")), shell=True).strip() - - return commit_hash - except Exception: - return None - -def get_directory_to_pull_to(default_directory, commit_hash): - """ - Finds out which directory we can safely use - either CondDBFW/ or a temporary directory. - """ - # try to write a file (and then delete it) - try: - handle = open(os.path.join(default_directory, "test_file"), "w") - handle.write("test") - handle.close() - os.remove(os.path.join(default_directory, "test_file")) - sys.path.insert(0, default_directory) - return default_directory - except IOError as io: - # cannot write to default directory, so set up a directory in /tmp/ - new_path = os.path.join("tmp", commit_hash[0:10]) - if not(os.path.exists(new_path)): - os.mkdir(new_path) - sys.path.insert(0, new_path) - return new_path - else: - # for now, fail - exit("Can't find anywhere to pull the new code base to.") horizontal_rule = "="*60 -def pull_code_from_git(target_directory, repository_url, hash): - """ - Pulls CondDBFW from the git repository specified by the upload server. - """ - # make directory - target = os.path.abspath(target_directory) - sys.path.append(target) - conddbfw_directory = os.path.join(target, "CondDBFW") - git_directory = os.path.join(conddbfw_directory, ".git") - if not(os.path.exists(conddbfw_directory)): - os.mkdir(conddbfw_directory) - else: - # if the directory exists, it may contain things - prompt the user - force_pull = str(raw_input("CondDBFW directory isn't empty - empty it, and update to new version? [y/n] ")) - if force_pull == "y": - # empty directory and delete it - run_in_shell("rm -rf CondDBFW", shell=True) - # remake the directory - it will be empty - os.mkdir(conddbfw_directory) - - print("Pulling code back from repository...") - print(horizontal_rule) - - run_in_shell("git --git-dir=%s clone %s CondDBFW" % (git_directory, repository_url), shell=True) - # --force makes sure we ignore any conflicts that - # could occur and overwrite everything in the checkout - run_in_shell("cd %s && git checkout --force -b version_used %s" % (conddbfw_directory, hash), shell=True) - - # write the hash to a file in the CondDBFW directory so we can delete the git repository - hash_file_handle = open(os.path.join(conddbfw_directory, ".commit_hash"), "w") - hash_file_handle.write(hash) - hash_file_handle.close() - - # can now delete .git directory - shutil.rmtree(git_directory) - - print(horizontal_rule) - print("Creating local log directories (if required)...") - if not(os.path.exists(os.path.join(target, "upload_logs"))): - os.mkdir(os.path.join(target, "upload_logs")) - if not(os.path.exists(os.path.join(target, "server_side_logs"))): - os.mkdir(os.path.join(target, "server_side_logs")) - print("Finished with log directories.") - print("Update of CondDBFW complete.") - - print(horizontal_rule) - - return True - -def run_in_shell(*popenargs, **kwargs): - """ - Runs string-based commands in the shell and returns the result. - """ - out = subprocess.PIPE if kwargs.get("stdout") == None else kwargs.get("stdout") - new_kwargs = kwargs - if new_kwargs.get("stdout"): - del new_kwargs["stdout"] - process = subprocess.Popen(*popenargs, stdout=out, **new_kwargs) - stdout = process.communicate()[0] - returnCode = process.returncode - cmd = kwargs.get('args') - if cmd is None: - cmd = popenargs[0] - if returnCode: - raise subprocess.CalledProcessError(returnCode, cmd) - return stdout - def run_upload(**parameters): """ Imports CondDBFW.uploads and runs the upload with the upload metadata obtained. """ try: - import CondDBFW.uploads as uploads + import CondCore.Utilities.CondDBFW.uploads as uploads except Exception as e: traceback.print_exc() exit("CondDBFW or one of its dependencies could not be imported.\n"\ @@ -176,6 +58,177 @@ def run_upload(**parameters): uploader = uploads.uploader(**parameters) result = uploader.upload() +def getInput(default, prompt = ''): + '''Like raw_input() but with a default and automatic strip(). + ''' + + answer = raw_input(prompt) + if answer: + return answer.strip() + + return default.strip() + + +def getInputWorkflow(prompt = ''): + '''Like getInput() but tailored to get target workflows (synchronization options). + ''' + + while True: + workflow = getInput(defaultWorkflow, prompt) + + if workflow in frozenset(['offline', 'hlt', 'express', 'prompt', 'pcl']): + return workflow + + print('Please specify one of the allowed workflows. See above for the explanation on each of them.') + + +def getInputChoose(optionsList, default, prompt = ''): + '''Makes the user choose from a list of options. + ''' + + while True: + index = getInput(default, prompt) + + try: + return optionsList[int(index)] + except ValueError: + print('Please specify an index of the list (i.e. integer).') + except IndexError: + print('The index you provided is not in the given list.') + + +def getInputRepeat(prompt = ''): + '''Like raw_input() but repeats if nothing is provided and automatic strip(). + ''' + + while True: + answer = raw_input(prompt) + if answer: + return answer.strip() + + print('You need to provide a value.') + +def runWizard(basename, dataFilename, metadataFilename): + while True: + print('''\nWizard for metadata for %s + +I will ask you some questions to fill the metadata file. For some of the questions there are defaults between square brackets (i.e. []), leave empty (i.e. hit Enter) to use them.''' % basename) + + # Try to get the available inputTags + try: + dataConnection = sqlite3.connect(dataFilename) + dataCursor = dataConnection.cursor() + dataCursor.execute('select name from sqlite_master where type == "table"') + tables = set(zip(*dataCursor.fetchall())[0]) + + # only conddb V2 supported... + if 'TAG' in tables: + dataCursor.execute('select NAME from TAG') + # In any other case, do not try to get the inputTags + else: + raise Exception() + + inputTags = dataCursor.fetchall() + if len(inputTags) == 0: + raise Exception() + inputTags = list(zip(*inputTags))[0] + + except Exception: + inputTags = [] + + if len(inputTags) == 0: + print('\nI could not find any input tag in your data file, but you can still specify one manually.') + + inputTag = getInputRepeat( + '\nWhich is the input tag (i.e. the tag to be read from the SQLite data file)?\ne.g. BeamSpotObject_ByRun\ninputTag: ') + + else: + print('\nI found the following input tags in your SQLite data file:') + for (index, inputTag) in enumerate(inputTags): + print(' %s) %s' % (index, inputTag)) + + inputTag = getInputChoose(inputTags, '0', + '\nWhich is the input tag (i.e. the tag to be read from the SQLite data file)?\ne.g. 0 (you select the first in the list)\ninputTag [0]: ') + + databases = { + 'oraprod': 'oracle://cms_orcon_prod/CMS_CONDITIONS', + 'prod': 'oracle://cms_orcon_prod/CMS_CONDITIONS', + 'oradev': 'oracle://cms_orcoff_prep/CMS_CONDITIONS', + 'prep': 'oracle://cms_orcoff_prep/CMS_CONDITIONS', + } + + destinationDatabase = '' + ntry = 0 + print('\nWhich is the destination database where the tags should be exported?') + print('\n%s) %s' % ('oraprod', databases['oraprod'])) + print('\n%s) %s' % ('oradev', databases['oradev'])) + + while ( destinationDatabase not in databases.values() ): + if ntry==0: + inputMessage = \ + '\nPossible choices: oraprod or oradev \ndestinationDatabase: ' + elif ntry==1: + inputMessage = \ + '\nPlease choose one of the two valid destinations: oraprod or oradev \ndestinationDatabase: ' + else: + raise Exception('No valid destination chosen. Bailing out...') + + databaseInput = getInputRepeat(inputMessage).lower() + if databaseInput in databases.keys(): + destinationDatabase = databases[databaseInput] + ntry += 1 + + while True: + since = getInput('', + '\nWhich is the given since? (if not specified, the one from the SQLite data file will be taken -- note that even if specified, still this may not be the final since, depending on the synchronization options you select later: if the synchronization target is not offline, and the since you give is smaller than the next possible one (i.e. you give a run number earlier than the one which will be started/processed next in prompt/hlt/express), the DropBox will move the since ahead to go to the first safe run instead of the value you gave)\ne.g. 1234\nsince []: ') + if not since: + since = None + break + else: + try: + since = int(since) + break + except ValueError: + print('The since value has to be an integer or empty (null).') + + userText = getInput('', + '\nWrite any comments/text you may want to describe your request\ne.g. Muon alignment scenario for...\nuserText []: ') + + destinationTags = {} + while True: + destinationTag = getInput('', + '\nWhich is the next destination tag to be added (leave empty to stop)?\ne.g. BeamSpotObjects_PCL_byRun_v0_offline\ndestinationTag []: ') + if not destinationTag: + if len(destinationTags) == 0: + print('There must be at least one destination tag.') + continue + break + + if destinationTag in destinationTags: + print( + 'You already added this destination tag. Overwriting the previous one with this new one.') + + destinationTags[destinationTag] = { + } + + metadata = { + 'destinationDatabase': destinationDatabase, + 'destinationTags': destinationTags, + 'inputTag': inputTag, + 'since': since, + 'userText': userText, + } + + metadata = json.dumps(metadata, sort_keys=True, indent=4) + print('\nThis is the generated metadata:\n%s' % metadata) + + if getInput('n', + '\nIs it fine (i.e. save in %s and *upload* the conditions if this is the latest file)?\nAnswer [n]: ' % metadataFilename).lower() == 'y': + break + print('Saving generated metadata in %s...', metadataFilename) + with open(metadataFilename, 'wb') as metadataFile: + metadataFile.write(metadata) + def parse_arguments(): # read in command line arguments, and build metadata dictionary from them parser = argparse.ArgumentParser(prog="cmsDbUpload client", description="CMS Conditions Upload Script in CondDBFW.") @@ -210,13 +263,19 @@ def parse_arguments(): parser.add_argument("--review-options", required=False, action="store_true") + parser.add_argument("--replay-file", required=False) + command_line_data = parser.parse_args() + if command_line_data.replay_file: + dictionary = json.loads("".join(open(command_line_data.replay_file, "r").readlines())) + command_line_data.tier0_response = dictionary["tier0_response"] + # default is the production server, which can point to either database anyway server_alias_to_url = { "prep" : "https://cms-conddb-dev.cern.ch/cmsDbCondUpload/", - "prod" : "https://cms-conddb.cern.ch/cmsDbCondUpload/", - None : "https://cms-conddb.cern.ch/cmsDbCondUpload/" + "dev" : "https://cms-conddb-dev.cern.ch/cmsDbCondUpload/", + "prod" : "https://cms-conddb.cern.ch/cmsDbCondUpload/" } # if prep, prod or None were given, convert to URLs in dictionary server_alias_to_url @@ -224,6 +283,17 @@ def parse_arguments(): if command_line_data.server in server_alias_to_url.keys(): command_line_data.server = server_alias_to_url[command_line_data.server] + # resolve destination databases + database_alias_to_connection = { + "prep": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "dev": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "prod": "oracle://cms_orcon_adg/CMS_CONDITIONS" + } + + if command_line_data.destinationDatabase in database_alias_to_connection.keys(): + command_line_data.destinationDatabase = database_alias_to_connection[command_line_data.destinationDatabase] + + # use netrc to get username and password try: netrc_file = command_line_data.netrc @@ -264,23 +334,63 @@ def parse_arguments(): since these override the options set in the metadata file. """ + + # Hash to use, entirely from command line if command_line_data.hashToUse != None: command_line_data.userText = "" metadata_dictionary = command_line_data.__dict__ elif command_line_data.metadataFile == None: - command_line_data.userText = command_line_data.userText\ - if command_line_data.userText != None\ - else str(raw_input("Tag's description [can be empty]:")) - metadata_dictionary = command_line_data.__dict__ - else: + if command_line_data.sourceDB != None and (command_line_data.inputTag == None or command_line_data.destinationTag == None or command_line_data.destinationDatabase == None): + basepath = command_line_data.sourceDB.rsplit('.db', 1)[0].rsplit('.txt', 1)[0] + basename = os.path.basename(basepath) + dataFilename = '%s.db' % basepath + metadataFilename = '%s.txt' % basepath + # Data file + try: + with open(dataFilename, 'rb') as dataFile: + pass + except IOError as e: + errMsg = 'Impossible to open SQLite data file %s' %dataFilename + print( errMsg ) + ret['status'] = -3 + ret['error'] = errMsg + return ret + + # Metadata file + + try: + with open(metadataFilename, 'rb') as metadataFile: + pass + except IOError as e: + if e.errno != errno.ENOENT: + errMsg = 'Impossible to open file %s (for other reason than not existing)' %metadataFilename + ret = {} + ret['status'] = -4 + ret['error'] = errMsg + exit (ret) + + if getInput('y', '\nIt looks like the metadata file %s does not exist and not enough parameters were received in the command line. Do you want me to create it and help you fill it?\nAnswer [y]: ' % metadataFilename).lower() != 'y': + errMsg = 'Metadata file %s does not exist' %metadataFilename + ret = {} + ret['status'] = -5 + ret['error'] = errMsg + exit(ret) + # Wizard + runWizard(basename, dataFilename, metadataFilename) + command_line_data.metadataFile = metadataFilename + else: + command_line_data.userText = command_line_data.userText\ + if command_line_data.userText != None\ + else str(raw_input("Tag's description [can be empty]:")) + metadata_dictionary = command_line_data.__dict__ + + if command_line_data.metadataFile != None: metadata_dictionary = json.loads("".join(open(os.path.abspath(command_line_data.metadataFile), "r").readlines())) metadata_dictionary["username"] = username metadata_dictionary["password"] = password metadata_dictionary["userText"] = metadata_dictionary.get("userText")\ if metadata_dictionary.get("userText") != None\ else str(raw_input("Tag's description [can be empty]:")) - # set the server to use to be the default one - metadata_dictionary["server"] = server_alias_to_url[None] # go through command line options and, if they are set, overwrite entries for (option_name, option_value) in command_line_data.__dict__.items(): @@ -314,47 +424,51 @@ def parse_arguments(): if raw_input("\nDo you want to continue? [y/n] ") != "y": exit() + if metadata_dictionary["server"] == None: + if metadata_dictionary["destinationDatabase"] == "oracle://cms_orcoff_prep/CMS_CONDITIONS": + metadata_dictionary["server"] = server_alias_to_url["prep"] + else: + metadata_dictionary["server"] = server_alias_to_url["prod"] + return metadata_dictionary +def get_version(url): + return requests.get(url + "script_version/", verify=False) + + if __name__ == "__main__": upload_metadata = parse_arguments() # upload_metadata should be used to decide the service url final_service_url = upload_metadata["server"] + try: + response = get_version(final_service_url) + server_version = response.json() + except Exception as e: + print(horizontal_rule) + print(e) + print("Could not connect to server at %s"%final_service_url) + print("If you specified a server please check it is correct. If that is not the issue please contact the AlcaDB team.") + print(horizontal_rule) + exit(1) - conddbfw_version = get_version_info(final_service_url) - local_version = get_local_commit_hash() + if server_version["version"] != __version__: + print(horizontal_rule) + print("Local upload script is different than server version. Please run the following command to get the latest script.") + print("curl --insecure -o uploadConditions.py %sget_upload_script/ && chmod +x uploadConditions.py;"%final_service_url) + print(horizontal_rule) + exit(1) - """ - Todo - case where we don't have write permission in the current directory (local_version == None and hashes don't match) - """ - # target_directory is only used if we don't find a version of CondDBFW locally, - # but is set here so we can access it later if we need to delete a temporary directory - target_directory = "" - # check if we have a persistent local version of CondDBFW - if local_version != None: - if conddbfw_version["hash"] == local_version: - # no update is required, pass for now - print("No change of version of CondDBFW is required - performing the upload.") - # add CondDBFW to the system paths (local_version != None, so we know it's in this directory) - sys.path.append(os.path.abspath(os.getcwd())) - elif conddbfw_version["hash"] != local_version: - # this is the case where CondDBFW is in the directory working_dir/CondDBFW, but there is an update available - # CondDBFW isn't in this directory, and the local commit hash doesn't match the latest one on the server - print("The server uses a different version of CondDBFW - changing to commit '%s' of CondDBFW." % conddbfw_version["hash"]) - shell_response = pull_code_from_git(os.getcwd(), conddbfw_version["repo"], conddbfw_version["hash"]) - else: - # no CondDBFW version - we should pull the code and start from scratch - # we can't look for temporary versions of it in /tmp/, since we can't guess the hash used to make the directory name - print("No CondDBFW version found locally - pulling one.") - target_directory = get_directory_to_pull_to(os.getcwd(), conddbfw_version["hash"]) - shell_response = pull_code_from_git(target_directory, conddbfw_version["repo"], conddbfw_version["hash"]) - - import CondDBFW.data_sources as data_sources + import CondCore.Utilities.CondDBFW.data_sources as data_sources upload_metadata["sqlite_file"] = upload_metadata.get("sourceDB") - + + try: + os.mkdir('upload_logs') + except OSError as e: + pass + # make new dictionary, and copy over everything except "metadata_source" upload_metadata_argument = {} for (key, value) in upload_metadata.items(): @@ -362,15 +476,15 @@ def parse_arguments(): upload_metadata_argument[key] = value upload_metadata["metadata_source"] = data_sources.json_data_node.make(upload_metadata_argument) - - # pass dictionary as arguments to match keywords - the constructor has a **kwargs parameter to deal with stray arguments - run_upload(**upload_metadata) - - # if the directory was temporary, delete it - if "tmp" in target_directory: + try: + # pass dictionary as arguments to match keywords - the constructor has a **kwargs parameter to deal with stray arguments + run_upload(**upload_metadata) + print(horizontal_rule) + print("Process completed without issues. Please check logs for further details.") + print(horizontal_rule) + except SystemExit as e: + print(horizontal_rule) + print("Process exited abnormally. Please check logs for details.") print(horizontal_rule) - print("Removing directory %s..." % target_directory) - try: - run_in_shell("rm -rf %s" % target_directory, shell=True) - except Exception as e: - print("Couldn't delete the directory %s - try to manually delete it." % target_directory) \ No newline at end of file + exit(1) + exit(0) diff --git a/CondCore/Utilities/python/CondDBFW/uploads.py b/CondCore/Utilities/python/CondDBFW/uploads.py index 2bc8927badfd3..953492d625128 100755 --- a/CondCore/Utilities/python/CondDBFW/uploads.py +++ b/CondCore/Utilities/python/CondDBFW/uploads.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 """ Joshua Dawes - CERN, CMS - The University of Manchester @@ -6,14 +6,12 @@ This module holds classes to help with uploading conditions to the drop box web service, which also uses CondDBFW to read and write data. """ -from __future__ import print_function -from __future__ import absolute_import import os import json import base64 from datetime import datetime -from urllib import urlencode +from urllib.parse import urlencode import math import sys import traceback @@ -42,7 +40,7 @@ def log(file_handle, message): """ Very simple logging function, used by output class. """ - file_handle.write("[%s] %s\n" % (to_timestamp(datetime.now()), message)) + file_handle.write("[%s] %s\n" % (to_timestamp(datetime.utcnow()), message)) def new_log_file_id(): """ @@ -59,38 +57,23 @@ def new_log_file_id(): return new_id class output(): - INFO = 0 - ERROR = 1 - WARNING = 2 - VERBOSE = 3 - DEBUG = 4 - """ Used to control output to the console and to the client-side log. """ - def __init__(self, log_handle=None, verbose=False, debug=False): + def __init__(self, log_handle=None, verbose=False): # first time writing progress bar, don't need to go back along the line self.current_output_length = 0 self._verbose = verbose self._log_handle = log_handle - self._debug = debug - self.labels = ["INFO", "ERROR", "WARNING", "VERBOSE", "DEBUG"] - def write(self, message="", level=INFO): + def write(self, message="", ignore_verbose=False): """ Write to the console and to the log file held by self. """ - message = "[%s] %s: %s"%(datetime.now(), self.labels[level], message) - if self._verbose: - if level == output.DEBUG and self._debug: - print(message) - elif level < output.DEBUG: - print(message) - elif self._debug: - if level == output.DEBUG: - print(message) - elif level <= output.ERROR: + if ignore_verbose: + print(message) + elif self._verbose: print(message) if self._log_handle != None: log(self._log_handle, message) @@ -123,7 +106,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal self._handle = open(self.upload_log_file_name, "a") # set up client-side logging object - self._outputter = output(verbose=verbose, log_handle=self._handle, debug = self._debug) + self._outputter = output(verbose=verbose, log_handle=self._handle) self._outputter.write("Using server instance at '%s'." % self._SERVICE_URL) # expect a CondDBFW data_source object for metadata_source @@ -139,7 +122,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal if self.metadata_source.get("destinationTags") == None: self.exit_upload("No destination Tag was given.") else: - if isinstance(self.metadata_source.get("destinationTags"), dict) and self.metadata_source.get("destinationTags").keys()[0] == None: + if type(self.metadata_source.get("destinationTags")) == dict and list(self.metadata_source.get("destinationTags").keys())[0] == None: self.exit_upload("No destination Tag was given.") # make sure a destination database was given @@ -171,7 +154,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal self.exit_upload("SQLite file '%s' given doesn't exist." % self.sqlite_file_name) sqlite_con = querying.connect("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) - self._outputter.write("Getting Tag and IOVs from SQLite database.", output.VERBOSE) + self._outputter.write("Getting Tag and IOVs from SQLite database.") # query for Tag, check for existence, then convert to dictionary tag = sqlite_con.tag(name=self.input_tag) @@ -184,7 +167,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal if iovs == None: self.exit_upload("No IOVs found in the SQLite file given for Tag '%s'." % self.input_tag) iovs = iovs.as_dicts(convert_timestamps=True) - iovs = [iovs] if not isinstance(iovs, list) else iovs + iovs = [iovs] if type(iovs) != list else iovs """ Finally, get the list of all Payload hashes of IOVs, @@ -210,7 +193,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal # set empty dictionary to contain Tag and IOV data from command line result_dictionary = {} - now = to_timestamp(datetime.now()) + now = to_timestamp(datetime.utcnow()) # tag dictionary will be taken from the server # this does not require any authentication tag = self.get_tag_dictionary() @@ -244,6 +227,17 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal # Tag time_type says IOVs use Runs for sinces, so we convert to Lumi-based for uniform processing self.data_to_send["since"] = self.data_to_send["since"] << 32 + """ + TODO - Settle on a single destination tag format. + """ + # look for deprecated metadata entries - give warnings + # Note - we only really support this format + try: + if type(result_dictionary["destinationTags"]) == dict: + self._outputter.write("WARNING: Multiple destination tags in a single metadata source is deprecated.") + except Exception as e: + self._outputter.write("ERROR: %s" % str(e)) + @check_response(check="json") def get_tag_dictionary(self): url_data = {"tag_name" : self.metadata_source["destinationTag"], "database" : self.metadata_source["destinationDatabase"]} @@ -257,21 +251,21 @@ def check_response_for_error_key(self, response_dict, exit_if_error=True): If it is a dictionary, and one of its keys is "error", the server returned an error """ # if the decoded response data is a dictionary and has an error key in it, we should display an error and its traceback - if isinstance(response_dict, dict) and "error" in response_dict.keys(): + if type(response_dict) == dict and "error" in list(response_dict.keys()): splitter_string = "\n%s\n" % ("-"*50) - self._outputter.write("\nERROR: %s" % splitter_string, output.ERROR) - self._outputter.write(response_dict["error"], output.ERROR) + self._outputter.write("\nERROR: %s" % splitter_string, ignore_verbose=True) + self._outputter.write(response_dict["error"], ignore_verbose=True) # if the user has given the --debug flag, show the traceback as well if self._debug: # suggest to the user to email this to db upload experts - self._outputter.write("\nTRACEBACK (since --debug is set):%s" % splitter_string, output.DEBUG) + self._outputter.write("\nTRACEBACK (since --debug is set):%s" % splitter_string, ignore_verbose=True) if response_dict.get("traceback") != None: - self._outputter.write(response_dict["traceback"], output.DEBUG) + self._outputter.write(response_dict["traceback"], ignore_verbose=True) else: - self._outputter.write("No traceback was returned from the server.", output.DEBUG) + self._outputter.write("No traceback was returned from the server.", ignore_verbose=True) else: - self._outputter.write("Use the --debug option to show the traceback of this error.", output.INFO) + self._outputter.write("Use the --debug option to show the traceback of this error.", ignore_verbose=True) # write server side log to client side (if we have an error from creating an upload session, the log is in its initial state ("")) # if an error has occurred on the server side, a log will have been written @@ -282,9 +276,9 @@ def check_response_for_error_key(self, response_dict, exit_if_error=True): return False else: exit() - elif not("error" in response_dict.keys()) and "log_data" in response_dict.keys(): + elif not("error" in list(response_dict.keys())) and "log_data" in list(response_dict.keys()): # store the log data, if it's there, in memory - this is used if a request times out and we don't get any log data back - self._log_data = response_dict["log_data"][2:-1] + self._log_data = response_dict["log_data"] return True def write_server_side_log(self, log_data): @@ -314,18 +308,12 @@ def write_server_side_log(self, log_data): # tell the user where the log files are # in the next iteration we may just merge the log files and store one log (how it's done in the plotter module) - if self._SERVICE_URL.startswith("https://cms-conddb-dev.cern.ch/cmsDbCondUpload"): - logUrl = "https://cms-conddb.cern.ch/cmsDbBrowser/logs/show_cond_uploader_log/Prep/%s"%self.upload_session_id - else: - logUrl = "https://cms-conddb.cern.ch/cmsDbBrowser/logs/show_cond_uploader_log/Prod/%s"%self.upload_session_id - - print("[%s] INFO: Server log found at %s." % (datetime.now(), logUrl)) if server_log_file_name != None: - print("[%s] INFO: Local copy of server log file at '%s'." % (datetime.now(), server_log_file_name)) + print("Log file from server written to '%s'." % server_log_file_name) else: print("No server log file could be written locally.") - print("[%s] INFO: Local copy of client log file at '%s'." % (datetime.now(), self.upload_log_file_name)) + print("Log file from CondDBFW written to '%s'." % self.upload_log_file_name) def exit_upload(self, message=None): """ @@ -368,14 +356,14 @@ def upload(self): return False self.upload_session_id = upload_session_data["id"] - self._outputter.write("Upload session obtained with token '%s'." % self.upload_session_id, output.DEBUG) + self._outputter.write("Upload session obtained with token '%s'." % self.upload_session_id) self.server_side_log_file = upload_session_data["log_file"] except errors.NoMoreRetriesException as no_more_retries: return self.exit_upload("Ran out of retries opening an upload session, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -403,7 +391,7 @@ def upload(self): return self.exit_upload("Ran out of retries trying to filter IOVs by FCSR from server, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -429,10 +417,10 @@ def upload(self): # finally, check hashes_not_found with hashes not found locally - if there is an intersection, we stop the upload # because if a hash is not found and is not on the server, there is no data to upload - all_hashes = map(lambda iov : iov["payload_hash"], self.data_to_send["iovs"]) + all_hashes = [iov["payload_hash"] for iov in self.data_to_send["iovs"]] hashes_not_found = check_hashes_response["hashes_not_found"] hashes_found = list(set(all_hashes) - set(hashes_not_found)) - self._outputter.write("Checking for IOVs that have no Payload locally or on the server.", output.VERBOSE) + self._outputter.write("Checking for IOVs that have no Payload locally or on the server.") # check if any hashes not found on the server is used in the local SQLite database for hash_not_found in hashes_not_found: if hash_not_found in self.hashes_with_no_local_payload: @@ -440,19 +428,16 @@ def upload(self): for hash_found in hashes_found: if hash_found in self.hashes_with_no_local_payload: - self._outputter.write("Payload with hash %s on server, so can upload IOV." % hash_found, output.VERBOSE) - - self._outputter.write("Found %i Payloads in remote server" % len(hashes_found), output.INFO) - self._outputter.write("Found %i Payloads not in remote server" % len(hashes_not_found), output.INFO) + self._outputter.write("Payload with hash %s on server, so can upload IOV." % hash_found) - self._outputter.write("All IOVs either come with Payloads or point to a Payload already on the server.", output.VERBOSE) + self._outputter.write("All IOVs either come with Payloads or point to a Payload already on the server.") except errors.NoMoreRetriesException as no_more_retries: # for now, just write the log if we get a NoMoreRetriesException return self.exit_upload("Ran out of retries trying to check hashes of payloads to send, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -477,16 +462,10 @@ def upload(self): # note that the response (in send_metadata_response) is already decoded from base64 by the response check decorator send_metadata_response = self.send_metadata(self.upload_session_id) - no_error = self.check_response_for_error_key(send_metadata_response) if not(no_error) and self._testing: return False - try: - self._outputter.write(send_metadata_response["summary"], output.INFO) - except KeyError: - pass - # we have to call this explicitly here since check_response_for_error_key only writes the log file # if an error has occurred, whereas it should always be written here self.write_server_side_log(self._log_data) @@ -495,7 +474,7 @@ def upload(self): return self.exit_upload("Ran out of retries trying to send metadata, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -517,7 +496,7 @@ def get_upload_session_id(self): Open an upload session on the server, and get a unique token back that we can use to authenticate for all future requests, as long as the upload session is still open. """ - self._outputter.write("Getting upload session.", output.VERBOSE) + self._outputter.write("Getting upload session.") # send password in the body so it can be encrypted over https # username and password are taken from the netrc file @@ -525,11 +504,11 @@ def get_upload_session_id(self): # this method's end result is obtaining a token. body_data = base64.b64encode(json.dumps( { - "destinationTag" : self.data_to_send["destinationTags"].keys()[0], + "destinationTag" : list(self.data_to_send["destinationTags"].keys())[0], "username_or_token" : self.data_to_send["username"], "password" : self.data_to_send["password"] } - )) + ).encode('UTF-8')) url_data = {"database" : self.data_to_send["destinationDatabase"]} @@ -557,11 +536,15 @@ def get_fcsr_from_server(self, upload_session_id): Note: we do this in a separate function we so we can do the decoding check for json data with check_response. """ # tiny amount of client-side logic here - all of the work is done on the server + # tier0_response uses get() so if the key isn't present, we default to None + # tier0_response is for replaying uploads from the old upload service, with knowledge of the tier0 response + # when those uploads happened. url_data = { "database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id, - "destinationTag" : self.data_to_send["destinationTags"].keys()[0], - "sourceTagSync" : self.data_to_send["fcsr_filter"] + "destinationTag" : list(self.data_to_send["destinationTags"].keys())[0], + "sourceTagSync" : self.data_to_send["fcsr_filter"], + "tier0_response" : self.data_to_send.get("tier0_response") } query = url_query(url=self._SERVICE_URL + "get_fcsr/", url_data=url_data) result = query.send() @@ -626,7 +609,7 @@ def filter_iovs_by_fcsr(self, upload_session_id): self.data_to_send["iovs"][i]["since"] = self.data_to_send["since"] # modify insertion_time of iovs - new_time = to_timestamp(datetime.now()) + new_time = to_timestamp(datetime.utcnow()) for (i, iov) in enumerate(self.data_to_send["iovs"]): self.data_to_send["iovs"][i]["insertion_time"] = new_time @@ -634,9 +617,8 @@ def get_all_hashes(self): """ Get all the hashes from the dictionary of IOVs we have from the SQLite file. """ - self._outputter.write("\tGetting list of all hashes found in SQLite database.", output.DEBUG) - hashes = map(lambda iov : iov["payload_hash"], self.data_to_send["iovs"]) - self._outputter.write("Found %i local Payload(s) referenced in IOVs"%len(hashes), output.INFO) + self._outputter.write("\tGetting list of all hashes found in SQLite database.") + hashes = [iov["payload_hash"] for iov in self.data_to_send["iovs"]] return hashes @check_response(check="json") @@ -644,7 +626,7 @@ def get_hashes_to_send(self, upload_session_id): """ Get the hashes of the payloads we want to send that the server doesn't have yet. """ - self._outputter.write("Getting list of hashes that the server does not have Payloads for, to send to server.", output.DEBUG) + self._outputter.write("Getting list of hashes that the server does not have Payloads for, to send to server.") post_data = json.dumps(self.get_all_hashes()) url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} query = url_query(url=self._SERVICE_URL + "check_hashes/", url_data=url_data, body=post_data) @@ -658,21 +640,22 @@ def send_payloads(self, hashes, upload_session_id): # if we have no hashes, we can't send anything # but don't exit since it might mean all the Payloads were already on the server if len(hashes) == 0: - self._outputter.write("No payloads to send - moving to IOV upload.") + self._outputter.write("No hashes to send - moving to metadata upload.") return True else: self._outputter.write("Sending payloads of hashes not found:") # construct connection string for local SQLite database file - database = ("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) if isinstance(self.sqlite_file_name, str) else self.sqlite_file_name + database = ("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) if type(self.sqlite_file_name) == str else self.sqlite_file_name # create CondDBFW connection that maps blobs - as we need to query for payload BLOBs (disabled by default in CondDBFW) self._outputter.write("\tConnecting to input SQLite database.") con = querying.connect(database, map_blobs=True) # query for the Payloads self._outputter.write("\tGetting Payloads from SQLite database based on list of hashes.") - payloads = con.payload(hash=hashes) + byte_hashes = [bytes(h, 'utf-8') for h in hashes] + payloads = con.payload(hash=byte_hashes) # if we get a single Payload back, put it in a list and turn it into a json_list - if payloads.__class__ != data_sources.json_list: + if payloads and payloads.__class__ != data_sources.json_list: payloads = data_sources.json_data_node.make([payloads]) # close the session with the SQLite database file - we won't use it again @@ -713,7 +696,7 @@ def send_blob(self, payload, upload_session_id): url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} # construct the data to send in the body and header of the HTTPs request - for key in payload.keys(): + for key in list(payload.keys()): # skip blob if key != "data": if key == "insertion_time": @@ -730,7 +713,7 @@ def send_blob(self, payload, upload_session_id): return request_response except Exception as e: # make sure we don't try again - if a NoMoreRetriesException has been thrown, retries have run out - if isinstance(e, errors.NoMoreRetriesException): + if type(e) == errors.NoMoreRetriesException: self._outputter.write("\t\t\tPayload with hash '%s' was not uploaded because the maximum number of retries was exceeded." % payload["hash"]) self._outputter.write("Payload with hash '%s' was not uploaded because the maximum number of retries was exceeded." % payload["hash"]) return json.dumps({"error" : str(e), "traceback" : traceback.format_exc()}) @@ -744,16 +727,16 @@ def send_metadata(self, upload_session_id): # set user text if it's empty if self.data_to_send["userText"] in ["", None]: - self.data_to_send["userText"] = "Tag '%s' uploaded from CondDBFW client." % self.data_to_send["destinationTags"].keys()[0] + self.data_to_send["userText"] = "Tag '%s' uploaded from CondDBFW client." % list(self.data_to_send["destinationTags"].keys())[0] self._outputter.write("Sending metadata to server - see server_side_log at server_side_logs/upload_log_%s for details on metadata processing on server side."\ - % self.upload_session_id, output.VERBOSE) + % self.upload_session_id) # sent the HTTPs request to the server - url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} + url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id, "tier0_response" : self.data_to_send.get("tier0_response")} request = url_query(url=self._SERVICE_URL + "upload_metadata/", url_data=url_data, body=json.dumps(self.data_to_send)) response = request.send() - self._outputter.write("Response received - conditions upload process complete.", output.VERBOSE) + self._outputter.write("Response received - conditions upload process complete.") return response if __name__ == "__main__": @@ -777,7 +760,7 @@ def send_metadata(self, upload_session_id): # make new dictionary, and copy over everything except "metadata_source" upload_metadata_argument = {} - for (key, value) in upload_metadata.items(): + for (key, value) in list(upload_metadata.items()): if key != "metadata_source": upload_metadata_argument[key] = value diff --git a/CondCore/Utilities/python/CondDBFW/url_query.py b/CondCore/Utilities/python/CondDBFW/url_query.py index 4639eb261800b..e6fab9c9ba55d 100644 --- a/CondCore/Utilities/python/CondDBFW/url_query.py +++ b/CondCore/Utilities/python/CondDBFW/url_query.py @@ -6,20 +6,35 @@ Provides methods for performing/closing the request, as well as getting the request response. Note: user agent string from current version of cmsDbUpload """ -from __future__ import print_function -from __future__ import absolute_import -import pycurl -from StringIO import StringIO -from urllib import urlencode +#import pycurl +import requests +from io import StringIO +from urllib.parse import urlencode import traceback import sys import json from .errors import * from time import sleep +import urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + class url_query(): + def __init__(self, url=None, url_data=None, body=None): + self._url = url + self._url_data = url_data + self._body = body + + def send(self): + if self._body: + return requests.post(self._url, data=self._body, params=self._url_data, verify=False).text + else: + return requests.get(self._url, params=self._url_data, verify=False).text + +"""class url_query(): + def __init__(self, url=None, url_data=None, body=None, response_stream=None, timeout=60): if not(url): return None @@ -38,15 +53,15 @@ def __init__(self, url=None, url_data=None, body=None, response_stream=None, tim self._response = StringIO() if body: - if isinstance(body, dict): + if type(body) == dict: body = urlencode(body) - elif isinstance(body, list): + elif type(body) == list: body = json.dumps(body) self._r.setopt(self._r.POSTFIELDS, body) if url_data: - if isinstance(url_data, dict): + if type(url_data) == dict: url_data = urlencode(url_data) else: exit("URL data '%s' for request to URL '%s' was not valid - should be a dictionary." % (str(url_data), url)) @@ -54,7 +69,7 @@ def __init__(self, url=None, url_data=None, body=None, response_stream=None, tim # set the URL with url parameters if they were given self._r.setopt(self._r.URL, url + (("?%s" % url_data) if url_data else "")) - if response_stream and not isinstance(response_stream, StringIO): + if response_stream and type(response_stream) != StringIO: response_stream = StringIO() # copy reference to instance variable self._response = response_stream @@ -79,7 +94,7 @@ def send(self): attempt += 1 # this catches exceptions that occur with the actual http request # not exceptions sent back from server side - if isinstance(e, pycurl.error) and e[0] in [7, 52]: + if type(e) == pycurl.error and e[0] in [7, 52]: # wait two seconds to retry print("Request failed - waiting 3 seconds to retry.") sleep(3) @@ -89,4 +104,4 @@ def send(self): print("Unforesoon error occurred when sending data to server.") traceback.print_exc() if attempt == max_retries: - raise NoMoreRetriesException(max_retries) \ No newline at end of file + raise NoMoreRetriesException(max_retries)""" \ No newline at end of file diff --git a/CondCore/Utilities/python/CondDBFW/utils.py b/CondCore/Utilities/python/CondDBFW/utils.py index 053dacb0c15d2..277995e824b50 100644 --- a/CondCore/Utilities/python/CondDBFW/utils.py +++ b/CondCore/Utilities/python/CondDBFW/utils.py @@ -7,13 +7,13 @@ def to_timestamp(obj): """ Takes a datetime object and outputs a timestamp string with the format Y-m-d H:m:S.f """ - return obj.strftime('%Y-%m-%d %H:%M:%S.%f') if isinstance(obj, datetime.datetime) else obj + return obj.strftime('%d-%b-%y %I:%M:%S.%f %p') if isinstance(obj, datetime.datetime) else obj def to_datetime(date_string): """ Takes a date string with the format Y-m-d H:m:S.f and gives back a datetime.datetime object """ - return datetime.datetime.strptime(date_string.replace(",", "."), "%Y-%m-%d %H:%M:%S.%f") + return datetime.datetime.strptime(date_string.replace(",", "."), "%d-%b-%y %I:%M:%S.%f %p") def friendly_since(time_type, since): """ From 5cec22960a86aaa42bfdd798531136885968d64e Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 14 Sep 2021 16:58:25 +0200 Subject: [PATCH 590/923] update runTheMatrix following comments --- .../PyReleaseValidation/python/MatrixInjector.py | 14 ++++++++++---- .../PyReleaseValidation/scripts/runTheMatrix.py | 16 +++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index a759a43f32537..8217b351ce366 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -206,11 +206,17 @@ def __init__(self,opt,mode='init',options=''): self.defaultGPUParams={ "GPUMemoryMB": self.GPUMemoryMB, "CUDACapabilities": self.CUDACapabilities, - "CUDARuntime": self.CUDARuntime, - "GPUName": self.GPUName, - "CUDADriverVersion": self.CUDADriverVersion, - "CUDARuntimeVersion": self.CUDARuntimeVersion + "CUDARuntime": self.CUDARuntime } + + self.dictGPUName={"GPUName": self.GPUName} + if self.GPUName: self.defaultGPUParams.update(self.dictGPUName) + + self.dictCUDADriverVersion={"CUDADriverVersion": self.CUDADriverVersion} + if self.CUDADriverVersion: self.defaultGPUParams.update(self.dictCUDADriverVersion) + + self.dictCUDARuntimeVersion={"CUDARuntimeVersion": self.CUDARuntimeVersion} + if self.CUDARuntimeVersion: elf.defaultGPUParams.update(self.dictCUDARuntimeVersion) self.chainDicts={} diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 985fcb31f4051..69bfd9bcab21e 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -334,18 +334,24 @@ def runSelected(opt): default=None, action='store') + parser.add_option('--gpu', + help='Use GPU workflow setup if available', + dest='gpuEnable', + default=False, + action='store_true') + parser.add_option('--RequiresGPU', - help='if GPU is reuired or not: forbidden (default, CPU-only), optional, required. For relvals, the GPU option will be turned off for optional.', + help='if GPU is required or not: forbidden (default, CPU-only), optional, required. For relvals, the GPU option will be turned off for optional.', dest='RequiresGPU', default='forbidden') parser.add_option('--GPUMemoryMB', help='to specify GPU memory. Default = 8000 MB (for RequiresGPU = required).', dest='GPUMemoryMB', - default='8000') + default=8000) parser.add_option('--CUDACapabilities', - help='to specify CUDA capabilities. Default = 7.5 (for RequiresGPU = required). Use comma to identify various CUDACapabilities', + help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (for RequiresGPU = required). Use comma to identify various CUDACapabilities', dest='CUDACapabilities', default='6.0,6.1,6.2,7.0,7.2,7.5') @@ -410,8 +416,6 @@ def stepOrIndex(s): if opt.keep: opt.keep=map(stepOrIndex,opt.keep.split(',')) - - if opt.testList: testList=[] for entry in opt.testList.split(','): @@ -439,6 +443,8 @@ def stepOrIndex(s): if opt.numberEventsInLuminosityBlock: opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock) if opt.memoryOffset: opt.memoryOffset=int(opt.memoryOffset) if opt.memPerCore: opt.memPerCore=int(opt.memPerCore) + if opt.GPUMemoryMB: opt.GPUMemoryMB=int(opt.GPUMemoryMB) + if opt.gpuEnable: opt.RequiresGPU="required" if opt.wmcontrol: performInjectionOptionTest(opt) From 282edcf2248c22d5d70ed2ac30074a26770f354c Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 14 Sep 2021 17:09:22 +0200 Subject: [PATCH 591/923] update lowercase for option --- .../scripts/runTheMatrix.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 69bfd9bcab21e..99c40b2eb77a2 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -335,42 +335,42 @@ def runSelected(opt): action='store') parser.add_option('--gpu', - help='Use GPU workflow setup if available', + help='Use GPU workflow setup if available. It will force --requires-gpu required.', dest='gpuEnable', default=False, action='store_true') - parser.add_option('--RequiresGPU', + parser.add_option('--requires-gpu', help='if GPU is required or not: forbidden (default, CPU-only), optional, required. For relvals, the GPU option will be turned off for optional.', dest='RequiresGPU', default='forbidden') - parser.add_option('--GPUMemoryMB', - help='to specify GPU memory. Default = 8000 MB (for RequiresGPU = required).', + parser.add_option('--gpu-memory-mb', + help='to specify GPU memory. Default = 8000 MB (for --requires-gpu = required).', dest='GPUMemoryMB', default=8000) - parser.add_option('--CUDACapabilities', + parser.add_option('--cuda-capabilities', help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (for RequiresGPU = required). Use comma to identify various CUDACapabilities', dest='CUDACapabilities', default='6.0,6.1,6.2,7.0,7.2,7.5') - parser.add_option('--CUDARuntime', + parser.add_option('--cuda-runtime', help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (for RequiresGPU = required). FIX ME TO MATCH WITH CMSSW.', dest='CUDARuntime', default='11.2') - parser.add_option('--GPUName', + parser.add_option('--gpu-name', help='to specify GPU class. This is an optional parameter.', dest='GPUName', default='') - parser.add_option('--CUDADriverVersion', + parser.add_option('--cuda-driver-version', help='to specify CUDA driver version. This is an optional parameter.', dest='CUDADriverVersion', default='') - parser.add_option('--CUDARuntimeVersion', + parser.add_option('--cuda-runtime-version', help='to specify CUDA runtime version. This is an optional parameter.', dest='CUDARuntimeVersion', default='') From 9ad852cad6ad100d6d2d5de5f5f2a8ddc527d389 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 2 Sep 2021 11:37:18 +0200 Subject: [PATCH 592/923] Merge .cc and .h for CommonTools/ParticleFlow and PileupAlgos plugins --- .../ParticleFlow/plugins/DeltaBetaWeights.cc | 39 ++- .../ParticleFlow/plugins/DeltaBetaWeights.h | 41 --- .../plugins/PFCandIsolatorFromDeposit.cc | 71 ++++- .../plugins/PFCandIsolatorFromDeposit.h | 68 ----- ...cer.h => PFCandidateFromFwdPtrProducer.cc} | 6 + ...h => PFCandidateFwdPtrCollectionFilter.cc} | 4 + ...wdPtrProducer.h => PFJetFwdPtrProducer.cc} | 3 + CommonTools/ParticleFlow/plugins/PFMET.cc | 42 ++- CommonTools/ParticleFlow/plugins/PFMET.h | 45 ---- ...wdPtrProducer.h => PFTauFwdPtrProducer.cc} | 3 + .../ParticleFlow/plugins/SealModule.cc | 21 -- .../ParticleFlow/plugins/TopProjector.cc | 253 +++++++++++++++++- .../ParticleFlow/plugins/TopProjector.h | 252 ----------------- .../PileupAlgos/plugins/PuppiPhoton.cc | 76 ++++-- CommonTools/PileupAlgos/plugins/PuppiPhoton.h | 53 ---- .../PileupAlgos/plugins/PuppiProducer.cc | 102 +++++-- .../PileupAlgos/plugins/PuppiProducer.h | 87 ------ 17 files changed, 527 insertions(+), 639 deletions(-) delete mode 100644 CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h delete mode 100644 CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h rename CommonTools/ParticleFlow/plugins/{PFCandidateFromFwdPtrProducer.h => PFCandidateFromFwdPtrProducer.cc} (60%) rename CommonTools/ParticleFlow/plugins/{PFCandidateFwdPtrCollectionFilter.h => PFCandidateFwdPtrCollectionFilter.cc} (83%) rename CommonTools/ParticleFlow/plugins/{PFJetFwdPtrProducer.h => PFJetFwdPtrProducer.cc} (71%) delete mode 100644 CommonTools/ParticleFlow/plugins/PFMET.h rename CommonTools/ParticleFlow/plugins/{PFTauFwdPtrProducer.h => PFTauFwdPtrProducer.cc} (70%) delete mode 100644 CommonTools/ParticleFlow/plugins/SealModule.cc delete mode 100644 CommonTools/ParticleFlow/plugins/TopProjector.h delete mode 100644 CommonTools/PileupAlgos/plugins/PuppiPhoton.h delete mode 100644 CommonTools/PileupAlgos/plugins/PuppiProducer.h diff --git a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc index b6f8165d64213..f95b194d050c1 100644 --- a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc +++ b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc @@ -1,5 +1,37 @@ -#include "CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h" +// Weight for neutral particles based on distance with charged +// +// Original Author: Michail Bachtis,40 1-B08,+41227678176, +// Created: Mon Dec 9 13:18:05 CET 2013 +// +// edited by Pavel Jez +// + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include + +class DeltaBetaWeights : public edm::EDProducer { +public: + explicit DeltaBetaWeights(const edm::ParameterSet&); + ~DeltaBetaWeights() override; + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + // ----------member data --------------------------- + edm::InputTag src_; + edm::InputTag pfCharged_; + edm::InputTag pfPU_; + + edm::EDGetTokenT > pfCharged_token; + edm::EDGetTokenT > pfPU_token; + edm::EDGetTokenT > src_token; +}; DeltaBetaWeights::DeltaBetaWeights(const edm::ParameterSet& iConfig) : src_(iConfig.getParameter("src")), @@ -21,9 +53,8 @@ DeltaBetaWeights::~DeltaBetaWeights() { // (e.g. close files, deallocate resources etc.) } -// -// member functions -// +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(DeltaBetaWeights); // ------------ method called to produce the data ------------ void DeltaBetaWeights::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h deleted file mode 100644 index 0c92f4b9cfe9d..0000000000000 --- a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h +++ /dev/null @@ -1,41 +0,0 @@ - -// Weight for neutral particles based on distance with charged -// -// Original Author: Michail Bachtis,40 1-B08,+41227678176, -// Created: Mon Dec 9 13:18:05 CET 2013 -// -// edited by Pavel Jez -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" - -// -// class declaration -// - -class DeltaBetaWeights : public edm::EDProducer { -public: - explicit DeltaBetaWeights(const edm::ParameterSet&); - ~DeltaBetaWeights() override; - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - // ----------member data --------------------------- - edm::InputTag src_; - edm::InputTag pfCharged_; - edm::InputTag pfPU_; - - edm::EDGetTokenT > pfCharged_token; - edm::EDGetTokenT > pfPU_token; - edm::EDGetTokenT > src_token; -}; diff --git a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc index 4de7cd12c73c5..9851b3ff68c14 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc +++ b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc @@ -1,17 +1,11 @@ -#include "CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h" - -// Framework -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" - +#include "CommonTools/Utils/interface/StringObjectFunction.h" #include "DataFormats/Candidate/interface/CandAssociation.h" +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/RecoCandidate/interface/IsoDeposit.h" #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" @@ -19,13 +13,64 @@ #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h" #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" #include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.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 +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" +#include #include #include -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" +class PFCandIsolatorFromDeposits : public edm::stream::EDProducer<> { +public: + typedef edm::ValueMap CandDoubleMap; + + enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR }; + PFCandIsolatorFromDeposits(const edm::ParameterSet &); + + ~PFCandIsolatorFromDeposits() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + +private: + class SingleDeposit { + public: + SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); + void cleanup(); + void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); + double compute(const reco::CandidateBaseRef &cand); + const reco::IsoDepositMap &map() { return *hDeps_; } + + private: + Mode mode_; + edm::EDGetTokenT srcToken_; + double deltaR_; + bool usesFunction_; + double weight_; + + StringObjectFunction weightExpr_; + reco::isodeposit::AbsVetos barrelVetos_; + reco::isodeposit::AbsVetos endcapVetos_; + reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! + bool skipDefaultVeto_; + bool usePivotForBarrelEndcaps_; + edm::Handle hDeps_; // transient + + bool isNumber(const std::string &str) const; + double toNumber(const std::string &str) const; + }; + // datamembers + std::vector sources_; +}; using namespace edm; using namespace reco; diff --git a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h deleted file mode 100644 index 77bbc20bde3de..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef PFCandIsolatorFromDeposits_H -#define PFCandIsolatorFromDeposits_H - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" - -#include "DataFormats/Candidate/interface/Candidate.h" -#include "CommonTools/Utils/interface/StringObjectFunction.h" -#include "DataFormats/Common/interface/OwnVector.h" - -#include - -namespace edm { - class Event; -} -namespace edm { - class EventSetup; -} - -class PFCandIsolatorFromDeposits : public edm::stream::EDProducer<> { -public: - typedef edm::ValueMap CandDoubleMap; - - enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR }; - PFCandIsolatorFromDeposits(const edm::ParameterSet &); - - ~PFCandIsolatorFromDeposits() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - class SingleDeposit { - public: - SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); - void cleanup(); - void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); - double compute(const reco::CandidateBaseRef &cand); - const reco::IsoDepositMap &map() { return *hDeps_; } - - private: - Mode mode_; - edm::EDGetTokenT srcToken_; - double deltaR_; - bool usesFunction_; - double weight_; - - StringObjectFunction weightExpr_; - reco::isodeposit::AbsVetos barrelVetos_; - reco::isodeposit::AbsVetos endcapVetos_; - reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! - bool skipDefaultVeto_; - bool usePivotForBarrelEndcaps_; - edm::Handle hDeps_; // transient - - bool isNumber(const std::string &str) const; - double toNumber(const std::string &str) const; - }; - // datamembers - std::vector sources_; -}; -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc similarity index 60% rename from CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc index bf00abfe5c274..2dd5cbb653f16 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc @@ -1,7 +1,13 @@ #include "CommonTools/UtilAlgos/interface/ProductFromFwdPtrProducer.h" +#include "DataFormats/JetReco/interface/PFJet.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "CommonTools/ParticleFlow/interface/PFCandidateWithSrcPtrFactory.h" typedef edm::ProductFromFwdPtrProducer PFCandidateFromFwdPtrProducer; +typedef edm::ProductFromFwdPtrProducer PFJetFromFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFCandidateFromFwdPtrProducer); +DEFINE_FWK_MODULE(PFJetFromFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h b/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc similarity index 83% rename from CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h rename to CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc index 59180562e777f..23d388f1eb890 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h +++ b/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc @@ -11,3 +11,7 @@ typedef edm::FwdPtrCollectionFilter PFCandidateFwdPtrCollectionPdgIdFilter; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionStringFilter); +DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionPdgIdFilter); diff --git a/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc similarity index 71% rename from CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc index baa72c343b8ef..9aa6ea159b46d 100644 --- a/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc @@ -3,3 +3,6 @@ #include "DataFormats/JetReco/interface/PFJetCollection.h" typedef edm::FwdPtrProducer PFJetFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFJetFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/PFMET.cc b/CommonTools/ParticleFlow/plugins/PFMET.cc index cc17a52f91b19..7810cc771598f 100644 --- a/CommonTools/ParticleFlow/plugins/PFMET.cc +++ b/CommonTools/ParticleFlow/plugins/PFMET.cc @@ -1,16 +1,45 @@ -#include "CommonTools/ParticleFlow/plugins/PFMET.h" +/**\class PFMET +\brief Computes the MET from a collection of PFCandidates. HF missing! -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +\todo Add HF energy to the MET calculation (access HF towers) + +\author Colin Bernet +\date february 2008 +*/ +#include "CommonTools/ParticleFlow/interface/PFMETAlgo.h" #include "DataFormats/METReco/interface/MET.h" #include "DataFormats/METReco/interface/METFwd.h" #include "DataFormats/Math/interface/LorentzVector.h" - +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "FWCore/Framework/interface/EDProducer.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 "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EventSetup.h" + +#include +#include + +class PFMET : public edm::EDProducer { +public: + explicit PFMET(const edm::ParameterSet&); + + ~PFMET() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + + void beginJob() override; + +private: + /// Input PFCandidates + edm::InputTag inputTagPFCandidates_; + edm::EDGetTokenT tokenPFCandidates_; + + pf2pat::PFMETAlgo pfMETAlgo_; +}; using namespace std; using namespace edm; @@ -26,6 +55,9 @@ PFMET::PFMET(const edm::ParameterSet& iConfig) : pfMETAlgo_(iConfig) { LogDebug("PFMET") << " input collection : " << inputTagPFCandidates_; } +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFMET); + PFMET::~PFMET() {} void PFMET::beginJob() {} diff --git a/CommonTools/ParticleFlow/plugins/PFMET.h b/CommonTools/ParticleFlow/plugins/PFMET.h deleted file mode 100644 index 5b7f253a61826..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFMET.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef PhysicsTools_PFCandProducer_PFMET_ -#define PhysicsTools_PFCandProducer_PFMET_ - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CommonTools/ParticleFlow/interface/PFMETAlgo.h" - -/**\class PFMET -\brief Computes the MET from a collection of PFCandidates. HF missing! - -\todo Add HF energy to the MET calculation (access HF towers) - -\author Colin Bernet -\date february 2008 -*/ - -class PFMET : public edm::EDProducer { -public: - explicit PFMET(const edm::ParameterSet&); - - ~PFMET() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - - void beginJob() override; - -private: - /// Input PFCandidates - edm::InputTag inputTagPFCandidates_; - edm::EDGetTokenT tokenPFCandidates_; - - pf2pat::PFMETAlgo pfMETAlgo_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc similarity index 70% rename from CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc index b6bf2053c90b4..920402228451a 100644 --- a/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc @@ -3,3 +3,6 @@ #include "DataFormats/TauReco/interface/PFTauFwd.h" typedef edm::FwdPtrProducer PFTauFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFTauFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/SealModule.cc b/CommonTools/ParticleFlow/plugins/SealModule.cc deleted file mode 100644 index 134fee6951bf8..0000000000000 --- a/CommonTools/ParticleFlow/plugins/SealModule.cc +++ /dev/null @@ -1,21 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CommonTools/ParticleFlow/plugins/PFMET.h" -#include "CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h" -#include "CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h" - -DEFINE_FWK_MODULE(PFMET); - -DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionStringFilter); -DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionPdgIdFilter); -DEFINE_FWK_MODULE(PFJetFwdPtrProducer); -DEFINE_FWK_MODULE(PFTauFwdPtrProducer); -DEFINE_FWK_MODULE(PFCandidateFromFwdPtrProducer); - -typedef edm::ProductFromFwdPtrProducer PFJetFromFwdPtrProducer; -DEFINE_FWK_MODULE(PFJetFromFwdPtrProducer); - -DEFINE_FWK_MODULE(DeltaBetaWeights); diff --git a/CommonTools/ParticleFlow/plugins/TopProjector.cc b/CommonTools/ParticleFlow/plugins/TopProjector.cc index 40cba4ecfb171..6b30fd6e4dc1b 100644 --- a/CommonTools/ParticleFlow/plugins/TopProjector.cc +++ b/CommonTools/ParticleFlow/plugins/TopProjector.cc @@ -1,26 +1,250 @@ -#include "CommonTools/ParticleFlow/plugins/TopProjector.h" +/**\class TopProjector +\brief -#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" -#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidateFwd.h" +\author Colin Bernet +\date february 2008 +*/ + +#include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/Candidate/interface/OverlapChecker.h" #include "DataFormats/JetReco/interface/PFJet.h" #include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" +#include "DataFormats/Provenance/interface/ProductID.h" #include "DataFormats/TauReco/interface/PFTau.h" #include "DataFormats/TauReco/interface/PFTauFwd.h" - -//TODO just for testing, remove this #include "DataFormats/TrackReco/interface/Track.h" - #include "FWCore/Framework/interface/ESHandle.h" - -// #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/Math/interface/deltaR.h" +#include +#include +#include -#include "FWCore/Framework/interface/MakerMacros.h" +/// This checks a slew of possible overlaps for FwdPtr and derivatives. +template +class TopProjectorFwdPtrOverlap { +public: + typedef edm::FwdPtr TopFwdPtr; + typedef edm::FwdPtr BottomFwdPtr; + + explicit TopProjectorFwdPtrOverlap() { bottom_ = 0; } + + explicit TopProjectorFwdPtrOverlap(edm::ParameterSet const& iConfig) + : bottom_(nullptr), matchByPtrDirect_(iConfig.getParameter("matchByPtrDirect")) {} + + inline void setBottom(BottomFwdPtr const& bottom) { bottom_ = ⊥ } + + bool operator()(TopFwdPtr const& top) const { + if (std::is_same::value && matchByPtrDirect_) + return top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key(); + bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable(); + bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable(); + bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable(); + bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable(); + + bool matched = (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && + top.ptr().key() == bottom_->ptr().key()) || + (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && + top.ptr().key() == bottom_->backPtr().key()) || + (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && + top.backPtr().key() == bottom_->ptr().key()) || + (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && + top.backPtr().key() == bottom_->backPtr().key()); + if (!matched) { + for (unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource) { + reco::CandidatePtr const& topSrcPtr = top->sourceCandidatePtr(isource); + bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable(); + if ((topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && + topSrcPtr.key() == bottom_->ptr().key()) || + (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && + topSrcPtr.key() == bottom_->backPtr().key())) { + matched = true; + break; + } + } + } + if (!matched) { + for (unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource) { + reco::CandidatePtr const& bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource); + bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable(); + if ((topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() && + bottomSrcPtr.key() == top.ptr().key()) || + (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && + bottomSrcPtr.key() == top.backPtr().key())) { + matched = true; + break; + } + } + } + + return matched; + } + +protected: + BottomFwdPtr const* bottom_; + const bool matchByPtrDirect_ = false; +}; + +/// This checks matching based on delta R +template +class TopProjectorDeltaROverlap { +public: + typedef edm::FwdPtr TopFwdPtr; + typedef edm::FwdPtr BottomFwdPtr; + + explicit TopProjectorDeltaROverlap() { bottom_ = 0; } + explicit TopProjectorDeltaROverlap(edm::ParameterSet const& config) + : deltaR2_(config.getParameter("deltaR")), + bottom_(nullptr), + bottomCPtr_(nullptr), + botEta_(-999.f), + botPhi_(0.f) { + deltaR2_ *= deltaR2_; + } + + inline void setBottom(BottomFwdPtr const& bottom) { + bottom_ = ⊥ + bottomCPtr_ = &**bottom_; + botEta_ = bottomCPtr_->eta(); + botPhi_ = bottomCPtr_->phi(); + } + + bool operator()(TopFwdPtr const& top) const { + const Top& oTop = *top; + float topEta = oTop.eta(); + float topPhi = oTop.phi(); + bool matched = reco::deltaR2(topEta, topPhi, botEta_, botPhi_) < deltaR2_; + return matched; + } + +protected: + double deltaR2_; + BottomFwdPtr const* bottom_; + const Bottom* bottomCPtr_; + float botEta_, botPhi_; +}; + +template > +class TopProjector : public edm::stream::EDProducer<> { +public: + typedef std::vector TopCollection; + typedef edm::FwdPtr TopFwdPtr; + typedef std::vector TopFwdPtrCollection; + + typedef std::vector BottomCollection; + typedef edm::FwdPtr BottomFwdPtr; + typedef std::vector BottomFwdPtrCollection; + + TopProjector(const edm::ParameterSet&); + + ~TopProjector() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + /// Matching method. + Matcher match_; + + /// enable? if not, all candidates in the bottom collection are copied to the output collection + const bool enable_; + + /// name of the top projection + const std::string name_; + + /// input tag for the top (masking) collection + const edm::EDGetTokenT tokenTop_; + + /// input tag for the masked collection. + const edm::EDGetTokenT tokenBottom_; +}; + +template +TopProjector::TopProjector(const edm::ParameterSet& iConfig) + : match_(iConfig), + enable_(iConfig.getParameter("enable")), + name_(iConfig.getUntrackedParameter("name", "No Name")), + tokenTop_(consumes(iConfig.getParameter("topCollection"))), + tokenBottom_(consumes(iConfig.getParameter("bottomCollection"))) { + // will produce a collection of the unmasked candidates in the + // bottom collection + produces(); +} + +template +void TopProjector::fillDescriptions(edm::ConfigurationDescriptions& desc) { + edm::ParameterSetDescription psD; + psD.add("enable"); + if (std::is_same>::value) + psD.add("deltaR"); + psD.addUntracked("name", "No Name"); + psD.add("topCollection"); + psD.add("bottomCollection"); + if (std::is_same>::value) + psD.add("matchByPtrDirect", false)->setComment("fast check by ptr() only"); + desc.addWithDefaultLabel(psD); +} + +template +void TopProjector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // get the various collections + + // Access the masking collection + auto const& tops = iEvent.get(tokenTop_); + std::list topsList; + + for (auto const& top : tops) { + topsList.push_back(top); + } + + // Access the collection to + // be masked by the other ones + auto const& bottoms = iEvent.get(tokenBottom_); + + // output collection of FwdPtrs to objects, + // selected from the Bottom collection + std::unique_ptr pBottomFwdPtrOutput(new BottomFwdPtrCollection); + + LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ "; + + int iB = -1; + for (auto const& bottom : bottoms) { + iB++; + match_.setBottom(bottom); + auto found = topsList.end(); + if (enable_) { + found = std::find_if(topsList.begin(), topsList.end(), match_); + } + + // If this is masked in the top projection, we remove it. + if (found != topsList.end()) { + LogDebug("TopProjection") << "X " << iB << *bottom; + topsList.erase(found); + continue; + } + // otherwise, we keep it. + else { + LogDebug("TopProjection") << "O " << iB << *bottom; + pBottomFwdPtrOutput->push_back(bottom); + } + } + + iEvent.put(std::move(pBottomFwdPtrOutput)); +} using namespace std; using namespace edm; @@ -33,8 +257,9 @@ typedef TopProjector TPIsolatedPFCandidatesOnP typedef TopProjector TPPFCandidatesOnPileUpPFCandidates; typedef TopProjector TPPFTausOnPFJets; -typedef TopProjector > TPPFTausOnPFJetsDeltaR; +typedef TopProjector> TPPFTausOnPFJetsDeltaR; +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(TPPFJetsOnPFCandidates); DEFINE_FWK_MODULE(TPPFCandidatesOnPFCandidates); DEFINE_FWK_MODULE(TPPileUpPFCandidatesOnPFCandidates); diff --git a/CommonTools/ParticleFlow/plugins/TopProjector.h b/CommonTools/ParticleFlow/plugins/TopProjector.h deleted file mode 100644 index 7b4015c2b97cc..0000000000000 --- a/CommonTools/ParticleFlow/plugins/TopProjector.h +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef CommonTools_ParticleFlow_TopProjector_ -#define CommonTools_ParticleFlow_TopProjector_ - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/Provenance/interface/ProductID.h" - -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/TauReco/interface/PFTau.h" -#include "DataFormats/JetReco/interface/PFJet.h" - -#include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "DataFormats/Candidate/interface/OverlapChecker.h" - -#include "DataFormats/Math/interface/deltaR.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -/**\class TopProjector -\brief - -\author Colin Bernet -\date february 2008 -*/ - -#include - -/// This checks a slew of possible overlaps for FwdPtr and derivatives. -template -class TopProjectorFwdPtrOverlap { -public: - typedef edm::FwdPtr TopFwdPtr; - typedef edm::FwdPtr BottomFwdPtr; - - explicit TopProjectorFwdPtrOverlap() { bottom_ = 0; } - - explicit TopProjectorFwdPtrOverlap(edm::ParameterSet const& iConfig) - : bottom_(nullptr), matchByPtrDirect_(iConfig.getParameter("matchByPtrDirect")) {} - - inline void setBottom(BottomFwdPtr const& bottom) { bottom_ = ⊥ } - - bool operator()(TopFwdPtr const& top) const { - if (std::is_same::value && matchByPtrDirect_) - return top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key(); - bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable(); - bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable(); - bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable(); - bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable(); - - bool matched = (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && - top.ptr().key() == bottom_->ptr().key()) || - (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && - top.ptr().key() == bottom_->backPtr().key()) || - (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && - top.backPtr().key() == bottom_->ptr().key()) || - (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && - top.backPtr().key() == bottom_->backPtr().key()); - if (!matched) { - for (unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource) { - reco::CandidatePtr const& topSrcPtr = top->sourceCandidatePtr(isource); - bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable(); - if ((topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && - topSrcPtr.key() == bottom_->ptr().key()) || - (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && - topSrcPtr.key() == bottom_->backPtr().key())) { - matched = true; - break; - } - } - } - if (!matched) { - for (unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource) { - reco::CandidatePtr const& bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource); - bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable(); - if ((topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() && - bottomSrcPtr.key() == top.ptr().key()) || - (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && - bottomSrcPtr.key() == top.backPtr().key())) { - matched = true; - break; - } - } - } - - return matched; - } - -protected: - BottomFwdPtr const* bottom_; - const bool matchByPtrDirect_ = false; -}; - -/// This checks matching based on delta R -template -class TopProjectorDeltaROverlap { -public: - typedef edm::FwdPtr TopFwdPtr; - typedef edm::FwdPtr BottomFwdPtr; - - explicit TopProjectorDeltaROverlap() { bottom_ = 0; } - explicit TopProjectorDeltaROverlap(edm::ParameterSet const& config) - : deltaR2_(config.getParameter("deltaR")), - bottom_(nullptr), - bottomCPtr_(nullptr), - botEta_(-999.f), - botPhi_(0.f) { - deltaR2_ *= deltaR2_; - } - - inline void setBottom(BottomFwdPtr const& bottom) { - bottom_ = ⊥ - bottomCPtr_ = &**bottom_; - botEta_ = bottomCPtr_->eta(); - botPhi_ = bottomCPtr_->phi(); - } - - bool operator()(TopFwdPtr const& top) const { - const Top& oTop = *top; - float topEta = oTop.eta(); - float topPhi = oTop.phi(); - bool matched = reco::deltaR2(topEta, topPhi, botEta_, botPhi_) < deltaR2_; - return matched; - } - -protected: - double deltaR2_; - BottomFwdPtr const* bottom_; - const Bottom* bottomCPtr_; - float botEta_, botPhi_; -}; - -template > -class TopProjector : public edm::stream::EDProducer<> { -public: - typedef std::vector TopCollection; - typedef edm::FwdPtr TopFwdPtr; - typedef std::vector TopFwdPtrCollection; - - typedef std::vector BottomCollection; - typedef edm::FwdPtr BottomFwdPtr; - typedef std::vector BottomFwdPtrCollection; - - TopProjector(const edm::ParameterSet&); - - ~TopProjector() override = default; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - /// Matching method. - Matcher match_; - - /// enable? if not, all candidates in the bottom collection are copied to the output collection - const bool enable_; - - /// name of the top projection - const std::string name_; - - /// input tag for the top (masking) collection - const edm::EDGetTokenT tokenTop_; - - /// input tag for the masked collection. - const edm::EDGetTokenT tokenBottom_; -}; - -template -TopProjector::TopProjector(const edm::ParameterSet& iConfig) - : match_(iConfig), - enable_(iConfig.getParameter("enable")), - name_(iConfig.getUntrackedParameter("name", "No Name")), - tokenTop_(consumes(iConfig.getParameter("topCollection"))), - tokenBottom_(consumes(iConfig.getParameter("bottomCollection"))) { - // will produce a collection of the unmasked candidates in the - // bottom collection - produces(); -} - -template -void TopProjector::fillDescriptions(edm::ConfigurationDescriptions& desc) { - edm::ParameterSetDescription psD; - psD.add("enable"); - if (std::is_same>::value) - psD.add("deltaR"); - psD.addUntracked("name", "No Name"); - psD.add("topCollection"); - psD.add("bottomCollection"); - if (std::is_same>::value) - psD.add("matchByPtrDirect", false)->setComment("fast check by ptr() only"); - desc.addWithDefaultLabel(psD); -} - -template -void TopProjector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // get the various collections - - // Access the masking collection - auto const& tops = iEvent.get(tokenTop_); - std::list topsList; - - for (auto const& top : tops) { - topsList.push_back(top); - } - - // Access the collection to - // be masked by the other ones - auto const& bottoms = iEvent.get(tokenBottom_); - - // output collection of FwdPtrs to objects, - // selected from the Bottom collection - std::unique_ptr pBottomFwdPtrOutput(new BottomFwdPtrCollection); - - LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ "; - - int iB = -1; - for (auto const& bottom : bottoms) { - iB++; - match_.setBottom(bottom); - auto found = topsList.end(); - if (enable_) { - found = std::find_if(topsList.begin(), topsList.end(), match_); - } - - // If this is masked in the top projection, we remove it. - if (found != topsList.end()) { - LogDebug("TopProjection") << "X " << iB << *bottom; - topsList.erase(found); - continue; - } - // otherwise, we keep it. - else { - LogDebug("TopProjection") << "O " << iB << *bottom; - pBottomFwdPtrOutput->push_back(bottom); - } - } - - iEvent.put(std::move(pBottomFwdPtrOutput)); -} - -#endif diff --git a/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc b/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc index 5b9ed019b1b64..d69f0d722d681 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc @@ -1,27 +1,63 @@ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "DataFormats/PatCandidates/interface/Photon.h" -#include "DataFormats/PatCandidates/interface/Electron.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/Common/interface/View.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" -#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Math/interface/PtEtaPhiMass.h" #include "DataFormats/Math/interface/deltaR.h" -//Main File -#include "CommonTools/PileupAlgos/plugins/PuppiPhoton.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/Electron.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/Photon.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.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/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include + +// ------------------------------------------------------------------------------------------ +class PuppiPhoton : public edm::stream::EDProducer<> { +public: + explicit PuppiPhoton(const edm::ParameterSet &); + ~PuppiPhoton() override; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + typedef math::XYZTLorentzVector LorentzVector; + typedef std::vector LorentzVectorCollection; + typedef edm::View CandidateView; + typedef std::vector PFOutputCollection; + typedef edm::View PFView; + +private: + void produce(edm::Event &, const edm::EventSetup &) override; + bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho); + edm::EDGetTokenT tokenPFCandidates_; + edm::EDGetTokenT tokenPuppiCandidates_; + edm::EDGetTokenT tokenPhotonCandidates_; + edm::EDGetTokenT>> reco2pf_; + edm::EDGetTokenT> tokenWeights_; + edm::EDGetTokenT> tokenPhotonId_; + double pt_; + double eta_; + bool usePFRef_; + bool usePFphotons_; + bool runOnMiniAOD_; + bool usePhotonId_; + std::vector dRMatch_; + std::vector pdgIds_; + std::unique_ptr corrCandidates_; + double weight_; + bool useValueMap_; +}; // ------------------------------------------------------------------------------------------ PuppiPhoton::PuppiPhoton(const edm::ParameterSet &iConfig) { diff --git a/CommonTools/PileupAlgos/plugins/PuppiPhoton.h b/CommonTools/PileupAlgos/plugins/PuppiPhoton.h deleted file mode 100644 index 194cc3001fe05..0000000000000 --- a/CommonTools/PileupAlgos/plugins/PuppiPhoton.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef CommonTools_Puppi_PuppiPhoton_h_ -#define CommonTools_Puppi_PuppiPhoton_h_ -// system include files -#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/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Math/interface/PtEtaPhiMass.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/Common/interface/ValueMap.h" - -// ------------------------------------------------------------------------------------------ -class PuppiPhoton : public edm::stream::EDProducer<> { -public: - explicit PuppiPhoton(const edm::ParameterSet &); - ~PuppiPhoton() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - typedef math::XYZTLorentzVector LorentzVector; - typedef std::vector LorentzVectorCollection; - typedef edm::View CandidateView; - typedef std::vector PFOutputCollection; - typedef edm::View PFView; - -private: - void produce(edm::Event &, const edm::EventSetup &) override; - bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho); - edm::EDGetTokenT tokenPFCandidates_; - edm::EDGetTokenT tokenPuppiCandidates_; - edm::EDGetTokenT tokenPhotonCandidates_; - edm::EDGetTokenT > > reco2pf_; - edm::EDGetTokenT > tokenWeights_; - edm::EDGetTokenT > tokenPhotonId_; - double pt_; - double eta_; - bool usePFRef_; - bool usePFphotons_; - bool runOnMiniAOD_; - bool usePhotonId_; - std::vector dRMatch_; - std::vector pdgIds_; - std::unique_ptr corrCandidates_; - double weight_; - bool useValueMap_; -}; -#endif diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index a04967339319e..0d6c3bdfda83b 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -1,23 +1,93 @@ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/View.h" +#include "CommonTools/PileupAlgos/interface/PuppiAlgo.h" +#include "CommonTools/PileupAlgos/interface/PuppiContainer.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/Common/interface/View.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" -#include "DataFormats/Common/interface/Association.h" -//Main File -#include "CommonTools/PileupAlgos/plugins/PuppiProducer.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/Math/interface/PtEtaPhiMass.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.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/Framework/interface/stream/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include + +// ------------------------------------------------------------------------------------------ +class PuppiProducer : public edm::stream::EDProducer<> { +public: + explicit PuppiProducer(const edm::ParameterSet&); + ~PuppiProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + typedef math::XYZTLorentzVector LorentzVector; + typedef std::vector LorentzVectorCollection; + typedef reco::VertexCollection VertexCollection; + typedef edm::View CandidateView; + typedef std::vector PFInputCollection; + typedef std::vector PFOutputCollection; + typedef std::vector PackedOutputCollection; + typedef edm::View PFView; + typedef edm::Association CandToVertex; + +private: + virtual void beginJob(); + void produce(edm::Event&, const edm::EventSetup&) override; + virtual void endJob(); + + edm::EDGetTokenT tokenPFCandidates_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + edm::EDGetTokenT tokenPuppiContainer_; + edm::EDGetTokenT tokenPuppiCandidates_; + edm::EDGetTokenT tokenPackedPuppiCandidates_; + edm::EDGetTokenT puProxyValueToken_; + edm::EDPutTokenT> ptokenPupOut_; + edm::EDPutTokenT> ptokenP4PupOut_; + edm::EDPutTokenT> ptokenValues_; + edm::EDPutTokenT ptokenPackedPuppiCandidates_; + edm::EDPutTokenT ptokenPuppiCandidates_; + edm::EDPutTokenT ptokenNalgos_; + edm::EDPutTokenT> ptokenRawAlphas_; + edm::EDPutTokenT> ptokenAlphas_; + edm::EDPutTokenT> ptokenAlphasMed_; + edm::EDPutTokenT> ptokenAlphasRms_; + std::string fPuppiName; + std::string fPFName; + std::string fPVName; + bool fUseVertexAssociation; + int vertexAssociationQuality_; + bool fPuppiDiagnostics; + bool fPuppiNoLep; + bool fUseFromPVLooseTight; + bool fUseDZ; + double fDZCut; + double fEtaMinUseDZ; + double fPtMaxCharged; + double fEtaMaxCharged; + double fPtMaxPhotons; + double fEtaMaxPhotons; + uint fNumOfPUVtxsForCharged; + double fDZCutForChargedFromPUVtxs; + bool fUseExistingWeights; + bool fClonePackedCands; + int fVtxNdofCut; + double fVtxZCut; + bool fUsePUProxyValue; + std::unique_ptr fPuppiContainer; + std::vector fRecoObjCollection; +}; // ------------------------------------------------------------------------------------------ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.h b/CommonTools/PileupAlgos/plugins/PuppiProducer.h deleted file mode 100644 index bef5c7d797646..0000000000000 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef CommonTools_Puppi_PuppiProducer_h_ -#define CommonTools_Puppi_PuppiProducer_h_ -// system include files -#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/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Math/interface/PtEtaPhiMass.h" -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "CommonTools/PileupAlgos/interface/PuppiContainer.h" -#include "CommonTools/PileupAlgos/interface/PuppiAlgo.h" - -// ------------------------------------------------------------------------------------------ -class PuppiProducer : public edm::stream::EDProducer<> { -public: - explicit PuppiProducer(const edm::ParameterSet&); - ~PuppiProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - typedef math::XYZTLorentzVector LorentzVector; - typedef std::vector LorentzVectorCollection; - typedef reco::VertexCollection VertexCollection; - typedef edm::View CandidateView; - typedef std::vector PFInputCollection; - typedef std::vector PFOutputCollection; - typedef std::vector PackedOutputCollection; - typedef edm::View PFView; - typedef edm::Association CandToVertex; - -private: - virtual void beginJob(); - void produce(edm::Event&, const edm::EventSetup&) override; - virtual void endJob(); - - edm::EDGetTokenT tokenPFCandidates_; - edm::EDGetTokenT tokenVertices_; - edm::EDGetTokenT tokenVertexAssociation_; - edm::EDGetTokenT> tokenVertexAssociationQuality_; - edm::EDGetTokenT tokenPuppiContainer_; - edm::EDGetTokenT tokenPuppiCandidates_; - edm::EDGetTokenT tokenPackedPuppiCandidates_; - edm::EDGetTokenT puProxyValueToken_; - edm::EDPutTokenT> ptokenPupOut_; - edm::EDPutTokenT> ptokenP4PupOut_; - edm::EDPutTokenT> ptokenValues_; - edm::EDPutTokenT ptokenPackedPuppiCandidates_; - edm::EDPutTokenT ptokenPuppiCandidates_; - edm::EDPutTokenT ptokenNalgos_; - edm::EDPutTokenT> ptokenRawAlphas_; - edm::EDPutTokenT> ptokenAlphas_; - edm::EDPutTokenT> ptokenAlphasMed_; - edm::EDPutTokenT> ptokenAlphasRms_; - std::string fPuppiName; - std::string fPFName; - std::string fPVName; - bool fUseVertexAssociation; - int vertexAssociationQuality_; - bool fPuppiDiagnostics; - bool fPuppiNoLep; - bool fUseFromPVLooseTight; - bool fUseDZ; - double fDZCut; - double fEtaMinUseDZ; - double fPtMaxCharged; - double fEtaMaxCharged; - double fPtMaxPhotons; - double fEtaMaxPhotons; - uint fNumOfPUVtxsForCharged; - double fDZCutForChargedFromPUVtxs; - bool fUseExistingWeights; - bool fClonePackedCands; - int fVtxNdofCut; - double fVtxZCut; - bool fUsePUProxyValue; - std::unique_ptr fPuppiContainer; - std::vector fRecoObjCollection; -}; -#endif From d62d750cdfc3980d6e76e3ed651e6d11aa400a84 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Fri, 3 Sep 2021 15:56:47 +0200 Subject: [PATCH 593/923] Move ShallowCloneProducer to RecoAlgos and define typenames in one file --- .../plugins/CaloJetShallowCloneProducer.cc | 8 ----- .../plugins/CaloMETShallowCloneProducer.cc | 10 ------ .../plugins/ElectronShallowCloneProducer.cc | 9 ----- .../plugins/GenJetShallowCloneProducer.cc | 8 ----- .../plugins/GenMETShallowCloneProducer.cc | 9 ----- .../GsfElectronShallowCloneProducer.cc | 9 ----- .../plugins/MuonShallowCloneProducer.cc | 9 ----- .../plugins/ShallowCloneProducer.cc} | 36 ++++++++++++++++--- 8 files changed, 32 insertions(+), 66 deletions(-) delete mode 100644 CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc rename CommonTools/{CandAlgos/interface/ShallowCloneProducer.h => RecoAlgos/plugins/ShallowCloneProducer.cc} (51%) diff --git a/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc deleted file mode 100644 index a6fa0206970cc..0000000000000 --- a/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer CaloJetShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(CaloJetShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc deleted file mode 100644 index 2be9da4048dff..0000000000000 --- a/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" -#include "DataFormats/METReco/interface/CaloMET.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer CaloMETShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(CaloMETShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc deleted file mode 100644 index 8a37e780985f3..0000000000000 --- a/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer ElectronShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(ElectronShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc deleted file mode 100644 index 94e50ddc9b3c2..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "DataFormats/JetReco/interface/GenJet.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer GenJetShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(GenJetShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc deleted file mode 100644 index 1186417dc670b..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/METReco/interface/GenMET.h" -#include "DataFormats/METReco/interface/GenMETCollection.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer GenMETShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(GenMETShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc deleted file mode 100644 index e1dcc23e0c8e0..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer PixelMatchGsfElectronShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(PixelMatchGsfElectronShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc deleted file mode 100644 index 0f4c2456415c9..0000000000000 --- a/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer MuonShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuonShallowCloneProducer); diff --git a/CommonTools/CandAlgos/interface/ShallowCloneProducer.h b/CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc similarity index 51% rename from CommonTools/CandAlgos/interface/ShallowCloneProducer.h rename to CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc index 7deaaf9e38365..900e143d56843 100644 --- a/CommonTools/CandAlgos/interface/ShallowCloneProducer.h +++ b/CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc @@ -1,5 +1,3 @@ -#ifndef CandAlgos_ShallowCloneProducer_h -#define CandAlgos_ShallowCloneProducer_h /** \class ShallowCloneProducer * * Clones a concrete Candidate collection @@ -13,11 +11,12 @@ * - C : Concrete candidate collection type * */ + +#include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" template class ShallowCloneProducer : public edm::EDProducer { @@ -55,4 +54,33 @@ void ShallowCloneProducer::produce(edm::Event& evt, const edm::EventSetup&) { evt.put(std::move(coll)); } -#endif +#include "DataFormats/EgammaCandidates/interface/Electron.h" +#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/METReco/interface/CaloMETCollection.h" +#include "DataFormats/METReco/interface/GenMET.h" +#include "DataFormats/METReco/interface/GenMETCollection.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" + +typedef ShallowCloneProducer GenMETShallowCloneProducer; +typedef ShallowCloneProducer PixelMatchGsfElectronShallowCloneProducer; +typedef ShallowCloneProducer MuonShallowCloneProducer; +typedef ShallowCloneProducer CaloMETShallowCloneProducer; +typedef ShallowCloneProducer ElectronShallowCloneProducer; +typedef ShallowCloneProducer GenJetShallowCloneProducer; +typedef ShallowCloneProducer CaloJetShallowCloneProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(GenMETShallowCloneProducer); +DEFINE_FWK_MODULE(PixelMatchGsfElectronShallowCloneProducer); +DEFINE_FWK_MODULE(MuonShallowCloneProducer); +DEFINE_FWK_MODULE(CaloMETShallowCloneProducer); +DEFINE_FWK_MODULE(ElectronShallowCloneProducer); +DEFINE_FWK_MODULE(GenJetShallowCloneProducer); +DEFINE_FWK_MODULE(CaloJetShallowCloneProducer); From f0766902981ccdaf256127bda6283f9bfc5ac6ec Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sat, 11 Sep 2021 10:38:04 +0200 Subject: [PATCH 594/923] Make CandMatcher and NewCandMatcher aliases and not derived classes --- CommonTools/CandAlgos/interface/CandMatcher.h | 17 ++++------------- .../CandAlgos/interface/NewCandMatcher.h | 15 ++++----------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/CommonTools/CandAlgos/interface/CandMatcher.h b/CommonTools/CandAlgos/interface/CandMatcher.h index 9b1186c3ce691..26e5ca56a9e12 100644 --- a/CommonTools/CandAlgos/interface/CandMatcher.h +++ b/CommonTools/CandAlgos/interface/CandMatcher.h @@ -9,17 +9,8 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "CommonTools/CandUtils/interface/CandMapTrait.h" -namespace reco { - namespace modules { - template > - class CandMatcher - : public Matcher::type> { - public: - CandMatcher(const edm::ParameterSet& cfg) - : Matcher::type>(cfg) {} - ~CandMatcher() override {} - }; - - } // namespace modules -} // namespace reco +namespace reco::modules { + template > + using CandMatcher = Matcher::type>; +} // namespace reco::modules #endif diff --git a/CommonTools/CandAlgos/interface/NewCandMatcher.h b/CommonTools/CandAlgos/interface/NewCandMatcher.h index c087de01c1add..d709d1458dc28 100644 --- a/CommonTools/CandAlgos/interface/NewCandMatcher.h +++ b/CommonTools/CandAlgos/interface/NewCandMatcher.h @@ -8,15 +8,8 @@ #include "CommonTools/UtilAlgos/interface/NewMatcher.h" #include "DataFormats/Candidate/interface/Candidate.h" -namespace reco { - namespace modulesNew { - template > - class CandMatcher : public Matcher { - public: - CandMatcher(const edm::ParameterSet& cfg) : Matcher(cfg) {} - ~CandMatcher() override {} - }; - - } // namespace modulesNew -} // namespace reco +namespace reco::modulesNew { + template > + using CandMatcher = Matcher; +} // namespace reco::modulesNew #endif From ce3f561d2c51b6256e65c19320a248b9459f71de Mon Sep 17 00:00:00 2001 From: Norraphat Date: Tue, 14 Sep 2021 17:15:54 +0200 Subject: [PATCH 595/923] Simplify optional dict --- .../PyReleaseValidation/python/MatrixInjector.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index 8217b351ce366..4fb1c0233f132 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -208,15 +208,9 @@ def __init__(self,opt,mode='init',options=''): "CUDACapabilities": self.CUDACapabilities, "CUDARuntime": self.CUDARuntime } - - self.dictGPUName={"GPUName": self.GPUName} - if self.GPUName: self.defaultGPUParams.update(self.dictGPUName) - - self.dictCUDADriverVersion={"CUDADriverVersion": self.CUDADriverVersion} - if self.CUDADriverVersion: self.defaultGPUParams.update(self.dictCUDADriverVersion) - - self.dictCUDARuntimeVersion={"CUDARuntimeVersion": self.CUDARuntimeVersion} - if self.CUDARuntimeVersion: elf.defaultGPUParams.update(self.dictCUDARuntimeVersion) + if self.GPUName: self.defaultGPUParams.update({"GPUName": self.GPUName}) + if self.CUDADriverVersion: self.defaultGPUParams.update({"CUDADriverVersion": self.CUDADriverVersion}) + if self.CUDARuntimeVersion: self.defaultGPUParams.update({"CUDARuntimeVersion": self.CUDARuntimeVersion}) self.chainDicts={} From bc036a13eceffc80cdae1a1eec31f4aad041c67b Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 14 Sep 2021 18:58:52 +0200 Subject: [PATCH 596/923] Use of ESGetToken in RecoLocalCalo/Castor --- RecoLocalCalo/Castor/src/RecHitCorrector.cc | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index 780d8f48dbaff..bfc866e1e9683 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.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/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -52,9 +51,11 @@ class RecHitCorrector : public edm::stream::EDProducer<> { void produce(edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- + const edm::ESGetToken tokCond_; + const edm::ESGetToken tokChan_; + const double factor_; + const bool doInterCalib_; edm::EDGetTokenT tok_input_; - double factor_; - bool doInterCalib_; }; // @@ -68,8 +69,11 @@ class RecHitCorrector : public edm::stream::EDProducer<> { // // constructors and destructor // -RecHitCorrector::RecHitCorrector(const edm::ParameterSet& iConfig) - : factor_(iConfig.getParameter("revertFactor")), doInterCalib_(iConfig.getParameter("doInterCalib")) { +RecHitCorrector::RecHitCorrector(const edm::ParameterSet& iConfig) : + tokCond_(esConsumes()), + tokChan_(esConsumes()), + factor_(iConfig.getParameter("revertFactor")), + doInterCalib_(iConfig.getParameter("doInterCalib")) { tok_input_ = consumes(iConfig.getParameter("rechitLabel")); //register your products produces(); @@ -94,12 +98,8 @@ void RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) iEvent.getByToken(tok_input_, rechits); // get conditions - edm::ESHandle conditions; - iSetup.get().get(conditions); - - edm::ESHandle p; - iSetup.get().get(p); - CastorChannelQuality* myqual = new CastorChannelQuality(*p.product()); + const CastorDbService* conditions = &iSetup.getData(tokCond_); + const CastorChannelQuality* myqual = &iSetup.getData(tokChan_); if (!rechits.isValid()) edm::LogWarning("CastorRecHitCorrector") << "No valid CastorRecHitCollection found, please check the InputLabel..."; From 707c4b11398a67b8988d858cb3b23fc5137d4a68 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 14 Sep 2021 19:02:48 +0200 Subject: [PATCH 597/923] complete es consumes migration of Alignment/CommonAlignmentProducer --- .../interface/AlignmentTrackSelector.h | 8 +++- .../AlignmentMuonHIPTrajectorySelector.cc | 4 +- .../plugins/GlobalTrackerMuonAlignment.cc | 47 +++++++++---------- .../src/AlignmentTrackSelector.cc | 12 ++--- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h b/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h index 1b215eb534cdd..9aa337f5d6f5e 100644 --- a/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h +++ b/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h @@ -2,12 +2,14 @@ #define Alignment_CommonAlignmentAlgorithm_AlignmentTrackSelector_h #include "DataFormats/Alignment/interface/AliClusterValueMapFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include namespace edm { @@ -60,6 +62,8 @@ class AlignmentTrackSelector { }; ComparePt ptComparator; + edm::ESGetToken tTopoToken_; + const bool applyBasicCuts_, applyNHighestPt_, applyMultiplicityFilter_; const int seedOnlyFromAbove_; const bool applyIsolation_, chargeCheck_; diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc index 417ed047241a4..60298e34112bf 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.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" @@ -51,7 +51,7 @@ // class decleration // -class AlignmentMuonHIPTrajectorySelector : public edm::EDProducer { +class AlignmentMuonHIPTrajectorySelector : public edm::stream::EDProducer<> { public: explicit AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet&); ~AlignmentMuonHIPTrajectorySelector() override; diff --git a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc index b72d7b31cd1c7..6f566743fbbb8 100644 --- a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc +++ b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc @@ -31,7 +31,7 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/Frameworkfwd.h" //#include "FWCore/Framework/interface/EDProducer.h" @@ -106,7 +106,7 @@ using namespace reco; // class declaration // -class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { +class GlobalTrackerMuonAlignment : public edm::one::EDAnalyzer<> { public: explicit GlobalTrackerMuonAlignment(const edm::ParameterSet&); ~GlobalTrackerMuonAlignment() override; @@ -155,6 +155,11 @@ class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { void endJob() override; // ----------member data --------------------------- + edm::ESGetToken m_TkGeometryToken; + edm::ESGetToken m_MagFieldToken; + edm::ESGetToken m_globalPosToken; + edm::ESGetToken m_propToken; + edm::ESGetToken m_ttrhBuilderToken; edm::InputTag trackTags_; // used to select what tracks to read from configuration file edm::InputTag muonTags_; // used to select what standalone muons @@ -270,18 +275,19 @@ class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { // constructors and destructor // GlobalTrackerMuonAlignment::GlobalTrackerMuonAlignment(const edm::ParameterSet& iConfig) - : trackTags_(iConfig.getParameter("tracks")), + : m_TkGeometryToken(esConsumes()), + m_MagFieldToken(esConsumes()), + m_globalPosToken(esConsumes()), + m_propToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("Propagator")))), + m_ttrhBuilderToken(esConsumes(edm::ESInputTag("", "witTrackAngle"))), + trackTags_(iConfig.getParameter("tracks")), muonTags_(iConfig.getParameter("muons")), gmuonTags_(iConfig.getParameter("gmuons")), smuonTags_(iConfig.getParameter("smuons")), - propagator_(iConfig.getParameter("Propagator")), - cosmicMuonMode_(iConfig.getParameter("cosmics")), isolatedMuonMode_(iConfig.getParameter("isolated")), - refitMuon_(iConfig.getParameter("refitmuon")), refitTrack_(iConfig.getParameter("refittrack")), - rootOutFile_(iConfig.getUntrackedParameter("rootOutFile")), txtOutFile_(iConfig.getUntrackedParameter("txtOutFile")), writeDB_(iConfig.getUntrackedParameter("writeDB")), @@ -660,20 +666,17 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con //iSetup.get().get(cscGeometry); if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) { - edm::ESHandle trackingGeometry; - iSetup.get().get(trackingGeometry); + edm::ESHandle trackingGeometry = iSetup.getHandle(m_TkGeometryToken); trackingGeometry_ = &*trackingGeometry; } if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) { - edm::ESHandle magneticField; - iSetup.get().get(magneticField); + edm::ESHandle magneticField = iSetup.getHandle(m_MagFieldToken); magneticField_ = &*magneticField; } if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) { - edm::ESHandle globalPositionRcd; - iSetup.get().get(globalPositionRcd); + edm::ESHandle globalPositionRcd = iSetup.getHandle(m_globalPosToken); globalPositionRcd_ = &*globalPositionRcd; for (std::vector::const_iterator i = globalPositionRcd_->m_align.begin(); i != globalPositionRcd_->m_align.end(); @@ -695,8 +698,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con } } // end of GlobalPositionRcd - ESHandle propagator; - iSetup.get().get(propagator_, propagator); + edm::ESHandle propagator = iSetup.getHandle(m_propToken); SteppingHelixPropagator alongStHePr = SteppingHelixPropagator(magneticField_, alongMomentum); SteppingHelixPropagator oppositeStHePr = SteppingHelixPropagator(magneticField_, oppositeToMomentum); @@ -1339,21 +1341,18 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent //iSetup.get().get(cscGeometry); if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) { - edm::ESHandle trackingGeometry; - iSetup.get().get(trackingGeometry); + edm::ESHandle trackingGeometry = iSetup.getHandle(m_TkGeometryToken); trackingGeometry_ = &*trackingGeometry; theTrackingGeometry = trackingGeometry; } if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) { - edm::ESHandle magneticField; - iSetup.get().get(magneticField); + edm::ESHandle magneticField = iSetup.getHandle(m_MagFieldToken); magneticField_ = &*magneticField; } if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) { - edm::ESHandle globalPositionRcd; - iSetup.get().get(globalPositionRcd); + edm::ESHandle globalPositionRcd = iSetup.getHandle(m_globalPosToken); globalPositionRcd_ = &*globalPositionRcd; for (std::vector::const_iterator i = globalPositionRcd_->m_align.begin(); i != globalPositionRcd_->m_align.end(); @@ -1379,8 +1378,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent } } // end of GlobalPositionRcd - ESHandle propagator; - iSetup.get().get(propagator_, propagator); + edm::ESHandle propagator = iSetup.getHandle(m_propToken); SteppingHelixPropagator alongStHePr = SteppingHelixPropagator(magneticField_, alongMomentum); SteppingHelixPropagator oppositeStHePr = SteppingHelixPropagator(magneticField_, oppositeToMomentum); @@ -1407,8 +1405,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent theFitterOp = new KFTrajectoryFitter(oppositeSmPr, *theUpdator, *theEstimator); theSmootherOp = new KFTrajectorySmoother(oppositeSmPr, *theUpdator, *theEstimator); - edm::ESHandle builder; - iSetup.get().get("WithTrackAngle", builder); + edm::ESHandle builder = iSetup.getHandle(m_ttrhBuilderToken); this->TTRHBuilder = &(*builder); this->MuRHBuilder = new MuonTransientTrackingRecHitBuilder(theTrackingGeometry); if (debug_) { diff --git a/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc b/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc index 59cfb81b812d1..35b1b72f26acc 100644 --- a/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc +++ b/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc @@ -16,12 +16,9 @@ #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Alignment/interface/AliClusterValueMap.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/SiStripDetId/interface/SiStripDetId.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include @@ -31,7 +28,8 @@ const int kFPIX = PixelSubdetector::PixelEndcap; // constructor ---------------------------------------------------------------- AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) - : applyBasicCuts_(cfg.getParameter("applyBasicCuts")), + : tTopoToken_(iC.esConsumes()), + applyBasicCuts_(cfg.getParameter("applyBasicCuts")), applyNHighestPt_(cfg.getParameter("applyNHighestPt")), applyMultiplicityFilter_(cfg.getParameter("applyMultiplicityFilter")), seedOnlyFromAbove_(cfg.getParameter("seedOnlyFrom")), @@ -222,7 +220,7 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet& cfg, edm // destructor ----------------------------------------------------------------- -AlignmentTrackSelector::~AlignmentTrackSelector() {} +AlignmentTrackSelector::~AlignmentTrackSelector() = default; // do selection --------------------------------------------------------------- @@ -321,9 +319,7 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track* trackp, const edm::Event& evt, const edm::EventSetup& eSetup) const { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - eSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &eSetup.getData(tTopoToken_); // checking hit requirements beyond simple number of valid hits From 19facfe8cc751b825e46b5112dc817795c4ab1ce Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 14 Sep 2021 19:34:46 +0200 Subject: [PATCH 598/923] Modernize analyzer codes for CalibCalorimetry/CastorCalib --- .../CastorCalib/interface/CastorLedAnalysis.h | 1 - .../interface/CastorPedestalAnalysis.h | 1 - .../interface/CastorPedestalsAnalysis.h | 113 --------------- .../CastorCalib/plugins/BuildFile.xml | 1 + .../plugins/CastorHardcodeCalibrations.cc | 41 +++++- .../plugins/CastorHardcodeCalibrations.h | 45 ------ .../plugins/CastorPedestalsAnalysis.cc | 134 ++++++++++++++++-- .../plugins/CastorTextCalibrations.cc | 37 ++++- .../plugins/CastorTextCalibrations.h | 57 -------- .../CastorCalib/plugins/SealModule.cc | 8 -- .../test/castor_localrun_pedestals_cfg.py | 3 + 11 files changed, 203 insertions(+), 238 deletions(-) delete mode 100644 CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/SealModule.cc diff --git a/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h index 8171f971a3809..1c679a2b37890 100644 --- a/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h +++ b/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h @@ -2,7 +2,6 @@ #define CastorLedAnalysis_H #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h index 23e7d055ef289..b26a660041eba 100644 --- a/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h +++ b/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h @@ -2,7 +2,6 @@ #define CastorPedestalAnalysis_H #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h deleted file mode 100644 index c2273879efb80..0000000000000 --- a/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef CastorPedestalsAnalysis_H -#define CastorPedestalsAnalysis_H - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" -#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "CondFormats/CastorObjects/interface/CastorPedestals.h" -#include "CondFormats/CastorObjects/interface/CastorPedestalWidths.h" -#include "CondFormats/CastorObjects/interface/CastorQIECoder.h" -#include "CondFormats/CastorObjects/interface/CastorQIEData.h" -#include "CondFormats/CastorObjects/interface/CastorQIEShape.h" -#include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h" -#include "CondFormats/CastorObjects/interface/AllObjects.h" - -#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" -#include "CalibFormats/CastorObjects/interface/CastorDbService.h" -#include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" -#include "CalibFormats/CastorObjects/interface/CastorCalibrationWidths.h" - -// #include "CondTools/Hcal/interface/HcalDbOnline.h" - -#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h" -// #include "CalibCalorimetry/CastorCalib/interface/CastorCondXML.h" -#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" - -#include "TFile.h" -#include "TProfile.h" -#include "TH1.h" -#include "TH2.h" -#include "TCanvas.h" -#include "TStyle.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -struct NewPedBunch { - HcalCastorDetId detid; - bool usedflag; - float cap[4]; - float capfc[4]; - float sig[4][4]; - float sigfc[4][4]; - float prod[4][4]; - float prodfc[4][4]; - int num[4][4]; -}; - -class CastorPedestalsAnalysis : public edm::EDAnalyzer { -public: - //Constructor - CastorPedestalsAnalysis(const edm::ParameterSet &ps); - //Destructor - ~CastorPedestalsAnalysis() override; - //Analysis - void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - //Container for data, 1 per channel - std::vector Bunches; - //Flag for saving histos - bool hiSaveFlag; - bool dumpXML; - bool verboseflag; - int runnum; - int firstTS; - int lastTS; - std::string ROOTfilename; - std::string pedsADCfilename; - std::string pedsfCfilename; - std::string widthsADCfilename; - std::string widthsfCfilename; - std::string XMLfilename; - std::string XMLtag; - std::string ZSfilename; - - edm::ESGetToken tok_cond_; - edm::ESGetToken tok_map_; - - TH1F *CASTORMeans; - TH1F *CASTORWidths; - - // TH2F *dephist[4]; - TH2F *dephist; - - TFile *theFile; - bool firsttime; - - edm::InputTag castorDigiCollectionTag; -}; -#endif diff --git a/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml b/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml index ecd05778404ef..b7f3976ba0c8f 100644 --- a/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml +++ b/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc index ef7426c62de47..0f97bb2751411 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc @@ -1,10 +1,14 @@ // -*- C++ -*- +// ESSource to generate default HCAL/CASTOR calibration objects +// // Original Author: Fedor Ratnikov // Adapted for CASTOR by L. Mundim // -#include #include +#include +#include +#include #include "FWCore/Framework/interface/ValidityInterval.h" #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" @@ -26,7 +30,35 @@ #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CastorHardcodeCalibrations.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "CondFormats/CastorObjects/interface/AllObjects.h" + +class CastorHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CastorHardcodeCalibrations(const edm::ParameterSet&); + ~CastorHardcodeCalibrations() override; + + void produce(){}; + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + + std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); + std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); + std::unique_ptr produceGains(const CastorGainsRcd& rcd); + std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); + std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); + std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); + std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); + std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); + std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); + bool h2mode_; +}; // class declaration // @@ -229,3 +261,8 @@ std::unique_ptr CastorHardcodeCalibrations::produceSatura } return result; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/SourceFactory.h" + +DEFINE_FWK_EVENTSETUP_SOURCE(CastorHardcodeCalibrations); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h deleted file mode 100644 index c7f2e9aff2779..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h +++ /dev/null @@ -1,45 +0,0 @@ -// ESSource to generate default HCAL/CASTOR calibration objects -// -#include -#include - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/CastorObjects/interface/AllObjects.h" -class ParameterSet; - -class CastorPedestalsRcd; -class CastorPedestalWidthsRcd; -class CastorGainsRcd; -class CastorGainWidthsRcd; -class CastorQIEDataRcd; -class CastorChannelQualityRcd; -class CastorElectronicsMapRcd; -class CastorRecoParamsRcd; -class CastorSaturationCorrsRcd; - -class CastorHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - CastorHardcodeCalibrations(const edm::ParameterSet&); - ~CastorHardcodeCalibrations() override; - - void produce(){}; - -protected: - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, - const edm::IOVSyncValue&, - edm::ValidityInterval&) override; - - std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); - std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); - std::unique_ptr produceGains(const CastorGainsRcd& rcd); - std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); - std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); - std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); - std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); - std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); - std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); - bool h2mode_; -}; diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc index 05d5fdf0c9b04..11adf9df15bcf 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc @@ -5,11 +5,118 @@ // This code runs 1000x faster and produces all outputs from a single run // (ADC, fC in .txt plus an .xml file) // + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "CondFormats/CastorObjects/interface/CastorPedestals.h" +#include "CondFormats/CastorObjects/interface/CastorPedestalWidths.h" +#include "CondFormats/CastorObjects/interface/CastorQIECoder.h" +#include "CondFormats/CastorObjects/interface/CastorQIEData.h" +#include "CondFormats/CastorObjects/interface/CastorQIEShape.h" +#include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h" +#include "CondFormats/CastorObjects/interface/AllObjects.h" + +#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" +#include "CalibFormats/CastorObjects/interface/CastorDbService.h" +#include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" +#include "CalibFormats/CastorObjects/interface/CastorCalibrationWidths.h" + +#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h" +#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" + +#include "TProfile.h" +#include "TH1.h" +#include "TH2.h" +#include "TCanvas.h" +#include "TStyle.h" + +#include +#include +#include #include -#include "CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h" +#include +#include +#include +#include + +namespace edm { + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm + +struct NewPedBunch { + HcalCastorDetId detid; + bool usedflag; + float cap[4]; + float capfc[4]; + float sig[4][4]; + float sigfc[4][4]; + float prod[4][4]; + float prodfc[4][4]; + int num[4][4]; +}; + +class CastorPedestalsAnalysis : public edm::one::EDAnalyzer { +public: + //Constructor + CastorPedestalsAnalysis(const edm::ParameterSet &ps); + //Destructor + ~CastorPedestalsAnalysis() override; + //Analysis + void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override; + +private: + //Container for data, 1 per channel + std::vector Bunches; + //Flag for saving histos + bool hiSaveFlag; + bool dumpXML; + bool verboseflag; + int runnum; + int firstTS; + int lastTS; + std::string ROOTfilename; + std::string pedsADCfilename; + std::string pedsfCfilename; + std::string widthsADCfilename; + std::string widthsfCfilename; + std::string XMLfilename; + std::string XMLtag; + std::string ZSfilename; + + edm::ESGetToken tok_cond_; + edm::ESGetToken tok_map_; + + TH1F *CASTORMeans; + TH1F *CASTORWidths; + + // TH2F *dephist[4]; + TH2F *dephist; + + bool firsttime; + + edm::InputTag castorDigiCollectionTag; +}; CastorPedestalsAnalysis::CastorPedestalsAnalysis(const edm::ParameterSet& ps) : castorDigiCollectionTag(ps.getParameter("castorDigiCollectionTag")) { + usesResource(TFileService::kSharedResource); + hiSaveFlag = ps.getUntrackedParameter("hiSaveFlag", false); dumpXML = ps.getUntrackedParameter("dumpXML", false); verboseflag = ps.getUntrackedParameter("verbose", false); @@ -187,6 +294,7 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { // CastorCondXML::dumpObject (outStream5, runnum, runnum, runnum, XMLtag, 1, (*rawPedsItem), (*rawWidthsItem)); } + /* if (hiSaveFlag) { theFile->Write(); } else { @@ -197,6 +305,7 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { } theFile->cd(); dephist->Write(); + */ dephist->SetDrawOption("colz"); dephist->GetXaxis()->SetTitle("module"); dephist->GetYaxis()->SetTitle("sector"); @@ -246,9 +355,11 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { //dephist[3]->SetDrawOption("colz"); c2->SaveAs(name2.c_str()); */ + /* std::cout << "Writing ROOT file... "; theFile->Close(); std::cout << "ROOT file closed.\n"; + */ } // ------------ method called to for each event ------------ @@ -273,20 +384,23 @@ void CastorPedestalsAnalysis::analyze(const edm::Event& e, const edm::EventSetup XMLfilename = runnum_string + "-peds_ADC_complete.xml"; XMLtag = "Castor_pedestals_" + runnum_string; + edm::Service fs; + fs->mkdir("CASTOR"); + /* theFile = new TFile(ROOTfilename.c_str(), "RECREATE"); theFile->cd(); // Create sub-directories theFile->mkdir("CASTOR"); theFile->cd(); - - CASTORMeans = new TH1F("All Ped Means CASTOR", "All Ped Means CASTOR", 100, 0, 9); - CASTORWidths = new TH1F("All Ped Widths CASTOR", "All Ped Widths CASTOR", 100, 0, 3); - - dephist = new TH2F("Pedestals (ADC)", "All Castor", 14, 0., 14.5, 16, .5, 16.5); - // dephist[0] = new TH2F("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5); - // dephist[1] = new TH2F("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5); - // dephist[2] = new TH2F("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5); - // dephist[3] = new TH2F("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5); + */ + CASTORMeans = fs->make("All Ped Means CASTOR", "All Ped Means CASTOR", 100, 0, 9); + CASTORWidths = fs->make("All Ped Widths CASTOR", "All Ped Widths CASTOR", 100, 0, 3); + + dephist = fs->make("Pedestals (ADC)", "All Castor", 14, 0., 14.5, 16, .5, 16.5); + // dephist[0] = fs->make("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5); + // dephist[1] = fs->make("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5); + // dephist[2] = fs->make("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5); + // dephist[3] = fs->make("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5); const CastorElectronicsMap* myRefEMap = &iSetup.getData(tok_map_); std::vector listEMap = myRefEMap->allPrecisionId(); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc index e6dcdab50acbb..0d212c07b78f3 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc @@ -1,9 +1,14 @@ +#include #include #include #include +#include #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" #include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ValidityInterval.h" @@ -27,7 +32,32 @@ #include "CondFormats/DataRecord/interface/CastorRecoParamsRcd.h" #include "CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h" -#include "CastorTextCalibrations.h" + +class CastorTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CastorTextCalibrations(const edm::ParameterSet&); + ~CastorTextCalibrations() override; + + void produce(){}; + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + + std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); + std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); + std::unique_ptr produceGains(const CastorGainsRcd& rcd); + std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); + std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); + std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); + std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); + std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); + std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); + +private: + std::map mInputs; +}; // // class decleration // @@ -144,3 +174,8 @@ std::unique_ptr CastorTextCalibrations::produceSaturation const CastorSaturationCorrsRcd& rcd) { return produce_impl(mInputs["SaturationCorrs"]); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/SourceFactory.h" + +DEFINE_FWK_EVENTSETUP_SOURCE(CastorTextCalibrations); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h deleted file mode 100644 index a8206fcb7cefb..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class ParameterSet; - -class CastorPedestals; -class CastorPedestalWidths; -//class CastorGains; -//class CastorGainWidths; -class CastorQIEData; -//class CastorChannelQuality; -class CastorElectronicsMap; - -class CastorPedestalsRcd; -class CastorPedestalWidthsRcd; -class CastorGainsRcd; -class CastorGainWidthsRcd; -class CastorQIEDataRcd; -class CastorChannelQualityRcd; -class CastorElectronicsMapRcd; -class CastorRecoParamsRcd; -class CastorSaturationCorrsRcd; -class CastorGains; -class CastorGainWidths; -class CastorChannelQuality; -class CastorRecoParams; -class CastorSaturationCorrs; - -class CastorTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - CastorTextCalibrations(const edm::ParameterSet&); - ~CastorTextCalibrations() override; - - void produce(){}; - -protected: - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, - const edm::IOVSyncValue&, - edm::ValidityInterval&) override; - - std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); - std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); - std::unique_ptr produceGains(const CastorGainsRcd& rcd); - std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); - std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); - std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); - std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); - std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); - std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); - -private: - std::map mInputs; -}; diff --git a/CalibCalorimetry/CastorCalib/plugins/SealModule.cc b/CalibCalorimetry/CastorCalib/plugins/SealModule.cc deleted file mode 100644 index db06b3a5e80a6..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/SealModule.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/SourceFactory.h" - -#include "CastorHardcodeCalibrations.h" -#include "CastorTextCalibrations.h" - -DEFINE_FWK_EVENTSETUP_SOURCE(CastorHardcodeCalibrations); -DEFINE_FWK_EVENTSETUP_SOURCE(CastorTextCalibrations); diff --git a/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py b/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py index bf1ad1c0716f3..05d64a21c50b9 100644 --- a/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py +++ b/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py @@ -115,6 +115,9 @@ castorDigiCollectionTag = cms.InputTag('castorDigis') ) +process.TFileService = cms.Service("TFileService", + fileName = cms.string('castorDigis.root') +) process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.enable = False From f12d27d159846e142abb23f423184832a2a195f9 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 14 Sep 2021 19:37:52 +0200 Subject: [PATCH 599/923] Code check --- RecoLocalCalo/Castor/src/RecHitCorrector.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index bfc866e1e9683..66821c68af8d1 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.cc @@ -69,11 +69,11 @@ class RecHitCorrector : public edm::stream::EDProducer<> { // // constructors and destructor // -RecHitCorrector::RecHitCorrector(const edm::ParameterSet& iConfig) : - tokCond_(esConsumes()), - tokChan_(esConsumes()), - factor_(iConfig.getParameter("revertFactor")), - doInterCalib_(iConfig.getParameter("doInterCalib")) { +RecHitCorrector::RecHitCorrector(const edm::ParameterSet& iConfig) + : tokCond_(esConsumes()), + tokChan_(esConsumes()), + factor_(iConfig.getParameter("revertFactor")), + doInterCalib_(iConfig.getParameter("doInterCalib")) { tok_input_ = consumes(iConfig.getParameter("rechitLabel")); //register your products produces(); From 9c75ded9f48f8bad2d1f8af09e185b542ba633c2 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 14 Sep 2021 13:02:46 -0500 Subject: [PATCH 600/923] Use esConsumes in ParticleGun base classes --- IOMC/ParticleGuns/interface/BaseFlatGunProducer.h | 2 ++ IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h | 2 ++ IOMC/ParticleGuns/interface/FlatBaseThetaGunProducer.h | 2 ++ IOMC/ParticleGuns/src/BaseFlatGunProducer.cc | 5 +++-- IOMC/ParticleGuns/src/BaseRandomtXiGunProducer.cc | 5 +++-- IOMC/ParticleGuns/src/FlatBaseThetaGunProducer.cc | 7 +++++-- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/IOMC/ParticleGuns/interface/BaseFlatGunProducer.h b/IOMC/ParticleGuns/interface/BaseFlatGunProducer.h index 4c8d015f1ea15..65010ddc30012 100644 --- a/IOMC/ParticleGuns/interface/BaseFlatGunProducer.h +++ b/IOMC/ParticleGuns/interface/BaseFlatGunProducer.h @@ -32,6 +32,8 @@ namespace edm { void endRunProduce(edm::Run& r, const edm::EventSetup&) override; private: + const ESGetToken fPDGTableToken; + protected: // non-virtuals ! this and only way ! // diff --git a/IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h b/IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h index 1054d63134bad..1804c253bac62 100644 --- a/IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h +++ b/IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h @@ -32,6 +32,8 @@ namespace edm { void endRunProduce(edm::Run& r, const edm::EventSetup&) override; private: + const ESGetToken fPDGTableToken; + protected: // non-virtuals ! this and only way ! // diff --git a/IOMC/ParticleGuns/interface/FlatBaseThetaGunProducer.h b/IOMC/ParticleGuns/interface/FlatBaseThetaGunProducer.h index f3fdd9843c408..409702f65cf7d 100644 --- a/IOMC/ParticleGuns/interface/FlatBaseThetaGunProducer.h +++ b/IOMC/ParticleGuns/interface/FlatBaseThetaGunProducer.h @@ -27,6 +27,8 @@ namespace edm { void endRunProduce(edm::Run& r, const edm::EventSetup&) override; private: + const ESGetToken fPDGTableToken; + protected: // non-virtuals ! this and only way ! // diff --git a/IOMC/ParticleGuns/src/BaseFlatGunProducer.cc b/IOMC/ParticleGuns/src/BaseFlatGunProducer.cc index a8af2b9cc32cb..fdcc95fd1b6de 100644 --- a/IOMC/ParticleGuns/src/BaseFlatGunProducer.cc +++ b/IOMC/ParticleGuns/src/BaseFlatGunProducer.cc @@ -27,7 +27,8 @@ using namespace std; using namespace CLHEP; BaseFlatGunProducer::BaseFlatGunProducer(const ParameterSet& pset) - : fEvt(nullptr) + : fPDGTableToken(esConsumes()), + fEvt(nullptr) // fPDGTable( new DefaultConfig::ParticleDataTable("PDG Table") ) { Service rng; @@ -84,7 +85,7 @@ BaseFlatGunProducer::~BaseFlatGunProducer() { } void BaseFlatGunProducer::beginRun(const edm::Run& r, const EventSetup& es) { - es.getData(fPDGTable); + fPDGTable = es.getHandle(fPDGTableToken); return; } void BaseFlatGunProducer::endRun(const Run& run, const EventSetup& es) {} diff --git a/IOMC/ParticleGuns/src/BaseRandomtXiGunProducer.cc b/IOMC/ParticleGuns/src/BaseRandomtXiGunProducer.cc index 0fa6e9c1b1e82..07cffa59df250 100644 --- a/IOMC/ParticleGuns/src/BaseRandomtXiGunProducer.cc +++ b/IOMC/ParticleGuns/src/BaseRandomtXiGunProducer.cc @@ -28,7 +28,8 @@ using namespace edm; using namespace std; using namespace CLHEP; -BaseRandomtXiGunProducer::BaseRandomtXiGunProducer(const edm::ParameterSet& pset) : fEvt(nullptr) { +BaseRandomtXiGunProducer::BaseRandomtXiGunProducer(const edm::ParameterSet& pset) + : fPDGTableToken(esConsumes()), fEvt(nullptr) { Service rng; if (!rng.isAvailable()) { throw cms::Exception("Configuration") @@ -60,7 +61,7 @@ BaseRandomtXiGunProducer::BaseRandomtXiGunProducer(const edm::ParameterSet& pset BaseRandomtXiGunProducer::~BaseRandomtXiGunProducer() {} void BaseRandomtXiGunProducer::beginRun(const edm::Run& r, const EventSetup& es) { - es.getData(fPDGTable); + fPDGTable = es.getHandle(fPDGTableToken); return; } diff --git a/IOMC/ParticleGuns/src/FlatBaseThetaGunProducer.cc b/IOMC/ParticleGuns/src/FlatBaseThetaGunProducer.cc index 2ad0291ab3de2..8c01613cb8175 100644 --- a/IOMC/ParticleGuns/src/FlatBaseThetaGunProducer.cc +++ b/IOMC/ParticleGuns/src/FlatBaseThetaGunProducer.cc @@ -16,7 +16,8 @@ using namespace edm; -FlatBaseThetaGunProducer::FlatBaseThetaGunProducer(const edm::ParameterSet& pset) : fEvt(nullptr) { +FlatBaseThetaGunProducer::FlatBaseThetaGunProducer(const edm::ParameterSet& pset) + : fPDGTableToken(esConsumes()), fEvt(nullptr) { edm::ParameterSet pgun_params = pset.getParameter("PGunParameters"); fPartIDs = pgun_params.getParameter >("PartID"); @@ -41,7 +42,9 @@ FlatBaseThetaGunProducer::FlatBaseThetaGunProducer(const edm::ParameterSet& pset FlatBaseThetaGunProducer::~FlatBaseThetaGunProducer() {} -void FlatBaseThetaGunProducer::beginRun(const edm::Run& r, const edm::EventSetup& es) { es.getData(fPDGTable); } +void FlatBaseThetaGunProducer::beginRun(const edm::Run& r, const edm::EventSetup& es) { + fPDGTable = es.getHandle(fPDGTableToken); +} void FlatBaseThetaGunProducer::endRun(const Run& run, const EventSetup& es) {} void FlatBaseThetaGunProducer::endRunProduce(Run& run, const EventSetup& es) { From 0212d1d0fc668ccd9c6646ad41c1b118710876d1 Mon Sep 17 00:00:00 2001 From: bainbrid Date: Tue, 14 Sep 2021 19:02:55 +0100 Subject: [PATCH 601/923] Slava review Co-authored-by: Slava Krutelyov --- .../EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc index 8a947f2bda6e0..b8336b04e3243 100644 --- a/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc +++ b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc @@ -174,10 +174,6 @@ namespace lowptgsfeleid { eid_trk_p = tk->p(); eid_trk_nhits = tk->found(); eid_trk_chi2red = tk->normalizedChi2(); - TVector3 trkTV3(0, 0, 0); - trkTV3.SetPtEtaPhi(tk->pt(), tk->eta(), tk->phi()); - TVector3 eleTV3(0, 0, 0); - eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi()); trk_dr = reco::deltaR(*tk, ele); } From 68cc39c9b538e497072168ec67d9b9489ae167c7 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 14 Sep 2021 20:12:01 +0200 Subject: [PATCH 602/923] Code check --- .../CastorCalib/plugins/CastorPedestalsAnalysis.cc | 10 +++++----- .../CastorCalib/plugins/CastorTextCalibrations.cc | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc index 11adf9df15bcf..9494e7af17f4e 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc @@ -74,11 +74,11 @@ struct NewPedBunch { class CastorPedestalsAnalysis : public edm::one::EDAnalyzer { public: //Constructor - CastorPedestalsAnalysis(const edm::ParameterSet &ps); + CastorPedestalsAnalysis(const edm::ParameterSet& ps); //Destructor ~CastorPedestalsAnalysis() override; //Analysis - void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override; + void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override; private: //Container for data, 1 per channel @@ -102,11 +102,11 @@ class CastorPedestalsAnalysis : public edm::one::EDAnalyzer tok_cond_; edm::ESGetToken tok_map_; - TH1F *CASTORMeans; - TH1F *CASTORWidths; + TH1F* CASTORMeans; + TH1F* CASTORWidths; // TH2F *dephist[4]; - TH2F *dephist; + TH2F* dephist; bool firsttime; diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc index 0d212c07b78f3..cf6b8e1651a8b 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc @@ -32,7 +32,6 @@ #include "CondFormats/DataRecord/interface/CastorRecoParamsRcd.h" #include "CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h" - class CastorTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { public: CastorTextCalibrations(const edm::ParameterSet&); From ffdea773fff2fa13ea576e76213d92d553bac26a Mon Sep 17 00:00:00 2001 From: Oz Amram Date: Tue, 14 Sep 2021 14:39:26 -0500 Subject: [PATCH 603/923] copy_to_buffer return right away if range empty --- .../SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc index 26b9a64ea3a52..433eefe720030 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc @@ -222,6 +222,11 @@ void PixelThresholdClusterizer::copy_to_buffer(DigiIterator begin, DigiIterator // std::cout << (doMissCalibrate ? "VI from db" : "VI linear") << std::endl; } #endif + + //avoid undefined behavior + if (end <= begin) + return; + int electron[end - begin]; // pixel charge in electrons memset(electron, 0, (end - begin) * sizeof(int)); From 7f4bf2aa0c38232e2c510c732b770b6cd9e91cf8 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 14 Sep 2021 14:55:17 -0500 Subject: [PATCH 604/923] removed EventSetup usage from reco::writeSpecific Calling code now must pass in any needed data --- RecoJets/JetProducers/interface/JetSpecific.h | 18 ++++---- .../plugins/CompoundJetProducer.cc | 13 +++++- .../plugins/FastjetJetProducer.cc | 3 +- .../plugins/SubEventGenJetProducer.cc | 2 +- .../plugins/SubjetFilterJetProducer.cc | 13 +++++- .../plugins/VirtualJetProducer.cc | 41 +++++++++++++++---- RecoJets/JetProducers/src/JetSpecific.cc | 31 ++++++-------- 7 files changed, 78 insertions(+), 43 deletions(-) diff --git a/RecoJets/JetProducers/interface/JetSpecific.h b/RecoJets/JetProducers/interface/JetSpecific.h index 16aa325650492..e660b3e1c071c 100644 --- a/RecoJets/JetProducers/interface/JetSpecific.h +++ b/RecoJets/JetProducers/interface/JetSpecific.h @@ -9,10 +9,10 @@ #include "DataFormats/JetReco/interface/PFClusterJet.h" #include "DataFormats/JetReco/interface/BasicJet.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" class CaloSubdetectorGeometry; +class CaloGeometry; namespace reco { @@ -29,7 +29,8 @@ namespace reco { reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, std::vector const& constituents, - edm::EventSetup const& c); + CaloGeometry const& geometry, + HcalTopology const& topology); /// Make PFlowJet specifics. Assumes PseudoJet is made from ParticleFlowCandidates bool makeSpecific(std::vector const& particles, @@ -40,7 +41,6 @@ namespace reco { reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, std::vector const& constituents, - edm::EventSetup const& c, edm::ValueMap const* weights = nullptr); /// Make GenJet specifics. Assumes PseudoJet is made from HepMCCandidate @@ -49,29 +49,25 @@ namespace reco { void writeSpecific(reco::GenJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c); + std::vector const& constituents); /// Make TrackJet. Assumes constituents point to tracks, through RecoChargedCandidates. void writeSpecific(reco::TrackJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c); + std::vector const& constituents); /// Make PFClusterJet. Assumes PseudoJet is made from PFCluster void writeSpecific(reco::PFClusterJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c); + std::vector const& constituents); /// Make BasicJet. Assumes nothing about the jet. void writeSpecific(reco::BasicJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c); + std::vector const& constituents); /// converts eta to the corresponding HCAL subdetector. HcalSubdetector hcalSubdetector(int iEta, const HcalTopology& topology); diff --git a/RecoJets/JetProducers/plugins/CompoundJetProducer.cc b/RecoJets/JetProducers/plugins/CompoundJetProducer.cc index a9dfedaf38459..e53e682f55a1e 100644 --- a/RecoJets/JetProducers/plugins/CompoundJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CompoundJetProducer.cc @@ -3,6 +3,8 @@ #include "RecoJets/JetProducers/plugins/CompoundJetProducer.h" #include "FWCore/Utilities/interface/Exception.h" #include "RecoJets/JetProducers/interface/JetSpecific.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" using namespace std; using namespace reco; @@ -94,7 +96,16 @@ void CompoundJetProducer::writeCompoundJets(edm::Event& iEvent, edm::EventSetup // Add the concrete subjet type to the subjet list to write to event record T jet; - reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, iSetup); + if constexpr (std::is_same_v) { + edm::ESHandle geometry; + iSetup.get().get(geometry); + edm::ESHandle topology; + iSetup.get().get(topology); + + reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, *geometry, *topology); + } else { + reco::writeSpecific(jet, p4Subjet, point, subjetConstituents); + } jet.setJetArea(itSubJet->subjetArea()); subjetCollection->push_back(jet); } diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc index 1d9efbe04ced5..193a7c6c04f58 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc @@ -306,8 +306,7 @@ void FastjetJetProducer::produceTrackJets(edm::Event& iEvent, const edm::EventSe jet, reco::Particle::LorentzVector(fjJets_[ijet].px(), fjJets_[ijet].py(), fjJets_[ijet].pz(), fjJets_[ijet].E()), vertex_, - constituents, - iSetup); + constituents); jet.setJetArea(0); jet.setPileup(0); jet.setPrimaryVertex(edm::Ref(pvCollection, (int)(itVtx - pvCollection->begin()))); diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index 4289753cf43ce..ca4e8701fa126 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -147,7 +147,7 @@ void SubEventGenJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup co double jetArea = 0.0; double pu = 0.; - writeSpecific(jet, Particle::LorentzVector(px, py, pz, E), vertex_, constituents, iSetup); + writeSpecific(jet, Particle::LorentzVector(px, py, pz, E), vertex_, constituents); jet.setJetArea(jetArea); jet.setPileup(pu); diff --git a/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc b/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc index 3eeaa565cd2ff..37704b501d2da 100644 --- a/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc @@ -28,6 +28,8 @@ #include "RecoJets/JetProducers/interface/JetSpecific.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" using namespace std; //////////////////////////////////////////////////////////////////////////////// @@ -150,7 +152,16 @@ void SubjetFilterJetProducer::writeCompoundJets(edm::Event& iEvent, const edm::E subJetConstituents.push_back(inputs_[*itIndex]); T subJet; - reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents, iSetup); + if constexpr (std::is_same_v) { + edm::ESHandle geometry; + iSetup.get().get(geometry); + edm::ESHandle topology; + iSetup.get().get(topology); + + reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents, *geometry, *topology); + } else { + reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents); + } subJet.setJetArea(itSub->subjetArea()); if (subJetIndex < 2) { diff --git a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc index 9aa180052b604..05ac3e4a8a80c 100644 --- a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc +++ b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc @@ -40,6 +40,9 @@ #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" + #include "fastjet/SISConePlugin.hh" #include "fastjet/CMSIterativeConePlugin.hh" #include "fastjet/ATLASConePlugin.hh" @@ -707,11 +710,25 @@ void VirtualJetProducer::writeJets(edm::Event& iEvent, edm::EventSetup const& iS Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents, - iSetup, &weights_); - else - writeSpecific( - jet, Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents, iSetup); + else { + if constexpr (std::is_same_v) { + edm::ESHandle geometry; + iSetup.get().get(geometry); + edm::ESHandle topology; + iSetup.get().get(topology); + + writeSpecific(jet, + Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), + vertex_, + constituents, + *geometry, + *topology); + } else { + writeSpecific( + jet, Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents); + } + } phiJ[ijet] = jet.phi(); etaJ[ijet] = jet.eta(); jet.setIsWeighted(applyWeight_); @@ -861,9 +878,17 @@ void VirtualJetProducer::writeCompoundJets(edm::Event& iEvent, edm::EventSetup c subjetCollection->push_back(*std::make_unique()); auto& jet = subjetCollection->back(); if ((applyWeight_) && (makePFJet(jetTypeE))) - reco::writeSpecific(dynamic_cast(jet), p4Subjet, point, constituents, iSetup, &weights_); - else - reco::writeSpecific(jet, p4Subjet, point, constituents, iSetup); + reco::writeSpecific(dynamic_cast(jet), p4Subjet, point, constituents, &weights_); + else if constexpr (std::is_same_v) { + edm::ESHandle geometry; + iSetup.get().get(geometry); + edm::ESHandle topology; + iSetup.get().get(topology); + + reco::writeSpecific(jet, p4Subjet, point, constituents, *geometry, *topology); + } else { + reco::writeSpecific(jet, p4Subjet, point, constituents); + } jet.setIsWeighted(applyWeight_); double subjetArea = 0.0; if (doAreaFastjet_ && itSubJet->has_area()) { @@ -990,7 +1015,7 @@ void VirtualJetProducer::writeJetsWithConstituents(edm::Event& iEvent, edm::Even if (!i_jetConstituents.empty()) { //only keep jets which have constituents after subtraction reco::Particle::Point point(0, 0, 0); reco::PFJet jet; - reco::writeSpecific(jet, *ip4, point, i_jetConstituents, iSetup); + reco::writeSpecific(jet, *ip4, point, i_jetConstituents); jet.setJetArea(area_Jets[ip4 - ip4Begin]); jetCollection->emplace_back(jet); } diff --git a/RecoJets/JetProducers/src/JetSpecific.cc b/RecoJets/JetProducers/src/JetSpecific.cc index c9ff5cb5c1345..6da08eb13adc0 100644 --- a/RecoJets/JetProducers/src/JetSpecific.cc +++ b/RecoJets/JetProducers/src/JetSpecific.cc @@ -17,9 +17,7 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include @@ -35,19 +33,19 @@ void reco::writeSpecific(reco::CaloJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, std::vector const& constituents, - edm::EventSetup const& c) { + CaloGeometry const& geometry, + HcalTopology const& topology) { // Get geometry - edm::ESHandle geometry; - c.get().get(geometry); - const CaloSubdetectorGeometry* towerGeometry = - geometry->getSubdetectorGeometry(DetId::Calo, CaloTowerDetId::SubdetId); + //edm::ESHandle geometry; + //c.get().get(geometry); + const CaloSubdetectorGeometry* towerGeometry = geometry.getSubdetectorGeometry(DetId::Calo, CaloTowerDetId::SubdetId); - edm::ESHandle topology; - c.get().get(topology); + //edm::ESHandle topology; + //c.get().get(topology); // Make the specific reco::CaloJet::Specific specific; - makeSpecific(constituents, towerGeometry, &specific, *topology); + makeSpecific(constituents, towerGeometry, &specific, topology); // Set the calo jet jet = reco::CaloJet(p4, point, specific, constituents); } @@ -56,8 +54,7 @@ void reco::writeSpecific(reco::CaloJet& jet, void reco::writeSpecific(reco::BasicJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c) { + std::vector const& constituents) { jet = reco::BasicJet(p4, point, constituents); } @@ -65,8 +62,7 @@ void reco::writeSpecific(reco::BasicJet& jet, void reco::writeSpecific(reco::GenJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c) { + std::vector const& constituents) { // Make the specific reco::GenJet::Specific specific; makeSpecific(constituents, &specific); @@ -79,7 +75,6 @@ void reco::writeSpecific(reco::PFJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, std::vector const& constituents, - edm::EventSetup const& c, edm::ValueMap const* weights) { // Make the specific reco::PFJet::Specific specific; @@ -100,8 +95,7 @@ void reco::writeSpecific(reco::PFJet& jet, void reco::writeSpecific(reco::TrackJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c) { + std::vector const& constituents) { jet = reco::TrackJet(p4, point, constituents); } @@ -109,8 +103,7 @@ void reco::writeSpecific(reco::TrackJet& jet, void reco::writeSpecific(reco::PFClusterJet& jet, reco::Particle::LorentzVector const& p4, reco::Particle::Point const& point, - std::vector const& constituents, - edm::EventSetup const& c) { + std::vector const& constituents) { jet = reco::PFClusterJet(p4, point, constituents); } From 3c011ebbd6642058e680c6b3a8d0304d451c0caa Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 14 Sep 2021 15:56:47 -0500 Subject: [PATCH 605/923] Use esConsumes in VirtualJetProducer classes --- .../plugins/CompoundJetProducer.cc | 14 ++++---- .../plugins/SubjetFilterJetProducer.cc | 14 ++++---- .../plugins/VirtualJetProducer.cc | 36 ++++++++++++------- .../JetProducers/plugins/VirtualJetProducer.h | 11 ++++++ 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/RecoJets/JetProducers/plugins/CompoundJetProducer.cc b/RecoJets/JetProducers/plugins/CompoundJetProducer.cc index e53e682f55a1e..f97d06597fa2a 100644 --- a/RecoJets/JetProducers/plugins/CompoundJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CompoundJetProducer.cc @@ -59,6 +59,13 @@ void CompoundJetProducer::writeCompoundJets(edm::Event& iEvent, edm::EventSetup // this is the hardjet areas std::vector area_hardJets; + [[maybe_unused]] const CaloGeometry* pGeometry = nullptr; + [[maybe_unused]] const HcalTopology* pTopology = nullptr; + if constexpr (std::is_same_v) { + pGeometry = &getGeometry(iSetup); + pTopology = &getTopology(iSetup); + } + // Loop over the hard jets std::vector::const_iterator it = fjCompoundJets_.begin(), iEnd = fjCompoundJets_.end(), iBegin = fjCompoundJets_.begin(); @@ -97,12 +104,7 @@ void CompoundJetProducer::writeCompoundJets(edm::Event& iEvent, edm::EventSetup // Add the concrete subjet type to the subjet list to write to event record T jet; if constexpr (std::is_same_v) { - edm::ESHandle geometry; - iSetup.get().get(geometry); - edm::ESHandle topology; - iSetup.get().get(topology); - - reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, *geometry, *topology); + reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, *pGeometry, *pTopology); } else { reco::writeSpecific(jet, p4Subjet, point, subjetConstituents); } diff --git a/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc b/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc index 37704b501d2da..798f43cac3eb8 100644 --- a/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubjetFilterJetProducer.cc @@ -126,6 +126,13 @@ void SubjetFilterJetProducer::writeCompoundJets(edm::Event& iEvent, const edm::E vector::const_iterator itEnd(fjCompoundJets_.end()); vector::const_iterator it(itBegin); + [[maybe_unused]] const CaloGeometry* pGeometry = nullptr; + [[maybe_unused]] const HcalTopology* pTopology = nullptr; + if constexpr (std::is_same_v) { + pGeometry = &getGeometry(iSetup); + pTopology = &getTopology(iSetup); + } + for (; it != itEnd; ++it) { int jetIndex = it - itBegin; fastjet::PseudoJet fatJet = it->hardJet(); @@ -153,12 +160,7 @@ void SubjetFilterJetProducer::writeCompoundJets(edm::Event& iEvent, const edm::E T subJet; if constexpr (std::is_same_v) { - edm::ESHandle geometry; - iSetup.get().get(geometry); - edm::ESHandle topology; - iSetup.get().get(topology); - - reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents, *geometry, *topology); + reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents, *pGeometry, *pTopology); } else { reco::writeSpecific(subJet, p4SubJet, point, subJetConstituents); } diff --git a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc index 05ac3e4a8a80c..175e2fbb4b9a1 100644 --- a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc +++ b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc @@ -214,6 +214,11 @@ VirtualJetProducer::VirtualJetProducer(const edm::ParameterSet& iConfig) { jetTypeE = JetType::byName(jetType_); + if (JetType::CaloJet == jetTypeE) { + geometry_token_ = esConsumes(); + topology_token_ = esConsumes(); + } + if (doPUOffsetCorr_) { if (puSubtractorName_.empty()) { LogWarning("VirtualJetProducer") @@ -692,6 +697,12 @@ void VirtualJetProducer::writeJets(edm::Event& iEvent, edm::EventSetup const& iS auto orParam_ = 1. / rParam_; // fill jets + [[maybe_unused]] const CaloGeometry* pGeometry = nullptr; + [[maybe_unused]] const HcalTopology* pTopology = nullptr; + if constexpr (std::is_same_v) { + pGeometry = &getGeometry(iSetup); + pTopology = &getTopology(iSetup); + } for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) { auto& jet = (*jets)[ijet]; @@ -713,17 +724,12 @@ void VirtualJetProducer::writeJets(edm::Event& iEvent, edm::EventSetup const& iS &weights_); else { if constexpr (std::is_same_v) { - edm::ESHandle geometry; - iSetup.get().get(geometry); - edm::ESHandle topology; - iSetup.get().get(topology); - writeSpecific(jet, Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents, - *geometry, - *topology); + *pGeometry, + *pTopology); } else { writeSpecific( jet, Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents); @@ -880,12 +886,8 @@ void VirtualJetProducer::writeCompoundJets(edm::Event& iEvent, edm::EventSetup c if ((applyWeight_) && (makePFJet(jetTypeE))) reco::writeSpecific(dynamic_cast(jet), p4Subjet, point, constituents, &weights_); else if constexpr (std::is_same_v) { - edm::ESHandle geometry; - iSetup.get().get(geometry); - edm::ESHandle topology; - iSetup.get().get(topology); - - reco::writeSpecific(jet, p4Subjet, point, constituents, *geometry, *topology); + reco::writeSpecific( + jet, p4Subjet, point, constituents, iSetup.getData(geometry_token_), iSetup.getData(topology_token_)); } else { reco::writeSpecific(jet, p4Subjet, point, constituents); } @@ -1025,6 +1027,14 @@ void VirtualJetProducer::writeJetsWithConstituents(edm::Event& iEvent, edm::Even iEvent.put(std::move(jetCollection)); } +CaloGeometry const& VirtualJetProducer::getGeometry(edm::EventSetup const& iSetup) const { + return iSetup.getData(geometry_token_); +} + +HcalTopology const& VirtualJetProducer::getTopology(edm::EventSetup const& iSetup) const { + return iSetup.getData(topology_token_); +} + // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void VirtualJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; diff --git a/RecoJets/JetProducers/plugins/VirtualJetProducer.h b/RecoJets/JetProducers/plugins/VirtualJetProducer.h index 570eaea1b5682..6fcbb6c44f944 100644 --- a/RecoJets/JetProducers/plugins/VirtualJetProducer.h +++ b/RecoJets/JetProducers/plugins/VirtualJetProducer.h @@ -32,6 +32,9 @@ #include #include +class CaloGeometryRecord; +class HcalRecNumberingRecord; + class dso_hidden VirtualJetProducer : public edm::stream::EDProducer<> { protected: // @@ -140,6 +143,10 @@ class dso_hidden VirtualJetProducer : public edm::stream::EDProducer<> { // to an output of CandidatePtr's. virtual std::vector getConstituents(const std::vector& fjConstituents); + //These are only valid if we are dealing with CaloJets + CaloGeometry const& getGeometry(edm::EventSetup const&) const; + HcalTopology const& getTopology(edm::EventSetup const&) const; + // // member data // @@ -210,6 +217,10 @@ class dso_hidden VirtualJetProducer : public edm::stream::EDProducer<> { edm::ValueMap weights_; // weights per particle (e.g. from PUPPI) private: + //These are only initialized if we are dealing with CaloJets + edm::ESGetToken geometry_token_; + edm::ESGetToken topology_token_; + std::unique_ptr anomalousTowerDef_; // anomalous tower definition // tokens for the data access From 5bb86edd063f0c63991a0133935d15f39f6943dd Mon Sep 17 00:00:00 2001 From: Tamas Vami Date: Tue, 14 Sep 2021 18:49:01 -0400 Subject: [PATCH 606/923] Include new geometry tags in Run-3 MC GTs --- Configuration/AlCa/python/autoCond.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index e3f0aa5379f0c..0d6947023a23c 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -66,17 +66,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' : '121X_mcRun3_2021_design_v1', # GT containing design conditions for Phase1 2021 + 'phase1_2021_design' : '121X_mcRun3_2021_design_v2', # GT containing design conditions for Phase1 2021 # GlobalTag for MC production with realistic conditions for Phase1 2021 - 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v2', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v3', # 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' : '121X_mcRun3_2021cosmics_realistic_deco_v2', + 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v3', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v2', + 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v3', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v1', # GT containing realistic conditions for Phase1 2023 + 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v2', # GT containing realistic conditions for Phase1 2023 # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v1', # GT containing realistic conditions for Phase1 2024 + 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v2', # GT containing realistic conditions for Phase1 2024 # GlobalTag for MC production with realistic conditions for Phase2 'phase2_realistic' : '113X_mcRun4_realistic_v7' } From fbe9ce6786af8d1d8ca710bf5f03217e2e07fd8e Mon Sep 17 00:00:00 2001 From: Tamas Date: Wed, 15 Sep 2021 02:10:12 +0200 Subject: [PATCH 607/923] Change Geometry_cff to GeometryDB_cff Bla --- Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py | 2 +- Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py | 2 +- Alignment/MuonAlignment/test/test_sanityCheck_cfg.py | 2 +- .../scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl | 2 +- .../scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl | 2 +- .../scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl | 2 +- .../scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl | 2 +- .../CSCCalibration/test/testNewCalibConstants_global_cfg.py | 2 +- CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py | 2 +- .../SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py | 2 +- .../SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py | 2 +- .../SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py | 2 +- CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py | 2 +- .../EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py | 2 +- Calibration/HcalAlCaRecoProducers/test/di_cfg.py | 2 +- Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py | 2 +- Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh | 2 +- Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh | 2 +- Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh | 2 +- Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py | 2 +- CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py | 2 +- CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py | 2 +- CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py | 2 +- CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py | 2 +- CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py | 2 +- CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py | 2 +- .../test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py | 2 +- CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py | 2 +- CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py | 2 +- CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py b/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py index a16db8aba4d6a..fd55fb96fea33 100644 --- a/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py +++ b/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py @@ -9,7 +9,7 @@ # include default services, like RandomNumberGenerator process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py b/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py index 1648c91913181..330fcf7c86b98 100644 --- a/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py +++ b/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py @@ -4,7 +4,7 @@ process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.MuonGeometrySVGTemplate = cms.EDAnalyzer("MuonGeometrySVGTemplate", wheelTemplateName = cms.string("wheel_template.svg")) diff --git a/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py b/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py index 5ca932fe0cb7d..8556076b92212 100644 --- a/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py +++ b/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py @@ -6,7 +6,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = "MC_36Y_V10::All" -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") from Alignment.MuonAlignment.MuonGeometrySanityCheck_cfi import * process.MuonGeometrySanityCheck = MuonGeometrySanityCheck.clone() diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl index e3e8616fadd48..6f1443cbe25cd 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl @@ -34,7 +34,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl index 2f1765fc34c7c..8b5562aeefa9b 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl @@ -33,7 +33,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl index 9376ae38c35ef..ed1cc857e7676 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl @@ -35,7 +35,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl index e157808836d61..eef73c524aa22 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl @@ -34,7 +34,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py b/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py index 131b5c034f37f..0ebe197348b06 100644 --- a/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py +++ b/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("TEST") # Standard stuff needed for the unpacking and local reco -process.load("Configuration/StandardSequences/Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") process.load("Configuration/StandardSequences/RawToDigi_Data_cff") diff --git a/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py b/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py index 5890e7fa8b821..bc1f7d57e186d 100644 --- a/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py +++ b/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("TEST") -process.load("Configuration/StandardSequences/Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") # for Beam diff --git a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py index 2720fb38a2c02..622bec599f117 100644 --- a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py +++ b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("MapWriter") process.load("CondCore.DBCommon.CondDBCommon_cfi") -#process.load("Configuration.StandardSequences.Geometry_cff") +#process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py index 02327a0895e6f..e42aa66e1e3a4 100644 --- a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py +++ b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_38T_cff") process.load("Configuration.StandardSequences.ReconstructionCosmics_cff") diff --git a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py index 3f40eab89988f..016b2f17c6e2b 100644 --- a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py +++ b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.Services_cff") -#process.load("Configuration.StandardSequences.Geometry_cff") +#process.load("Configuration.StandardSequences.GeometryDB_cff") process.load('Configuration/StandardSequences/GeometryExtended_cff') process.load('Configuration.StandardSequences.MagneticField_cff') diff --git a/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py b/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py index d67f208006f2d..a39d3607cfb1d 100644 --- a/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py +++ b/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("APVGAIN") -process.load('Configuration.StandardSequences.Geometry_cff') +process.load('Configuration.StandardSequences.GeometryDB_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") diff --git a/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py b/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py index fc99782e80542..3a10b2e7867c3 100644 --- a/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py +++ b/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("AlCaElectronsProduction") process.load("FWCore.MessageLogger.MessageLogger_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = cms.string('GR_R_52_V7::All') process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Calibration/HcalAlCaRecoProducers/test/di_cfg.py b/Calibration/HcalAlCaRecoProducers/test/di_cfg.py index 0c1ad62b0fac9..4a65cc9b38ce3 100644 --- a/Calibration/HcalAlCaRecoProducers/test/di_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/di_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("DIJETS") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.maxEvents = cms.untracked.PSet( diff --git a/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py b/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py index a27e15e08809c..e3df22946ff96 100644 --- a/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("PHISYM") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.maxEvents = cms.untracked.PSet( diff --git a/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh b/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh index 57493a4edd130..5327c61bab855 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh @@ -24,7 +24,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = 'MC_31X_V5::All' process.load("Configuration.StandardSequences.Reconstruction_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.StandardSequences.VtxSmearedBetafuncEarlyCollision_cff") diff --git a/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh b/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh index 7e827ca8c006b..c3fac8d3949b2 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh @@ -33,7 +33,7 @@ process.prefer("GlobalTag") process.load("Configuration.StandardSequences.VtxSmearedBetafuncEarlyCollision_cff") process.load("Configuration.StandardSequences.Generator_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrk_cff") process.load("Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkNoHLT_cff") diff --git a/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh b/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh index ee0eb1d1953e4..5e718237d889d 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh @@ -23,7 +23,7 @@ import FWCore.ParameterSet.Config as cms process = cms.Process("HcalPFCorrsCulculation") process.load("Configuration.StandardSequences.MagneticField_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.Services_cff") process.load("Configuration.StandardSequences.Reconstruction_cff") diff --git a/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py b/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py index 37c18def6cccf..f8c5d1b9b3ff0 100644 --- a/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py +++ b/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py @@ -52,7 +52,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = 'GR_R_38X_V9::All' #'GR_R_35X_V8::All' -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") ## reco PV diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py index 3ecf4c4834144..c3b611ffe6539 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py index d812254bdd31a..6d9e0f0c3d9e4 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py index 5d341f082810e..2dfdac01d9d95 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py index 9a3efdd0f22ee..263f12884c334 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py index 25c43578d3957..00a988dd5a5a8 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py index 7d168952c8e2e..92865be54bbc4 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("test") process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py b/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py index 0f8286118a90d..8532973109332 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("test") process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py index 6d8c5cade745f..c33cd43c3f7aa 100644 --- a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py @@ -31,7 +31,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.prod = cms.EDAnalyzer("SiStripDetVOffFakeBuilder") diff --git a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py index e5c0d47c76984..fd1b07788723e 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py @@ -35,7 +35,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", diff --git a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py index 7b5c4bcb10cc2..3c7f757284db1 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py @@ -33,7 +33,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", From e31dff61289573c1c347ce7cb80d286d7c53be83 Mon Sep 17 00:00:00 2001 From: Tamas Date: Wed, 15 Sep 2021 02:59:37 +0200 Subject: [PATCH 608/923] Remove commented out line --- .../SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py | 1 - 1 file changed, 1 deletion(-) diff --git a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py index 622bec599f117..0be7eb390f9f9 100644 --- a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py +++ b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py @@ -3,7 +3,6 @@ process = cms.Process("MapWriter") process.load("CondCore.DBCommon.CondDBCommon_cfi") -#process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") From 0ef460e980f1c454ad03758b6688772b6b99b8bf Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 15 Sep 2021 10:58:18 +0200 Subject: [PATCH 609/923] finalize migration of TrackerOfflineValidationSummary --- .../TrackerOfflineValidationSummary.cc | 63 +++++++------------ 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc b/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc index 72182c759dbf6..51f7e40025717 100644 --- a/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc +++ b/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc @@ -55,7 +55,7 @@ // class decleration // -class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { +class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer { public: typedef dqm::legacy::DQMStore DQMStore; explicit TrackerOfflineValidationSummary(const edm::ParameterSet&); @@ -63,7 +63,7 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { private: const edm::ESGetToken geomToken_; - const edm::ESGetToken topoToken_; + const edm::ESGetToken tTopoToken_; struct ModuleHistos { ModuleHistos() @@ -96,7 +96,9 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { HarvestingHistos harvestingHistos; }; + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override{}; void analyze(const edm::Event& evt, const edm::EventSetup&) override; + void endRun(const edm::Run&, const edm::EventSetup& iSetup) override; void endJob() override; void fillTree(TTree& tree, @@ -123,6 +125,7 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { const edm::ParameterSet parSet_; edm::ESHandle tkGeom_; + std::unique_ptr tTopo_; // parameters from cfg to steer const std::string moduleDirectory_; @@ -140,47 +143,31 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { std::map mTecResiduals_; std::vector vHarvestingHierarchy_; - - const edm::EventSetup* lastSetup_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // TrackerOfflineValidationSummary::TrackerOfflineValidationSummary(const edm::ParameterSet& iConfig) - : //geomToken_(esConsumes()), # this does not work - topoToken_(esConsumes()), + : geomToken_(esConsumes()), + tTopoToken_(esConsumes()), parSet_(iConfig), + tTopo_(nullptr), moduleDirectory_(parSet_.getParameter("moduleDirectoryInOutput")), useFit_(parSet_.getParameter("useFit")), dbe_(nullptr), - moduleMapsInitialized(false), - lastSetup_(nullptr) { + moduleMapsInitialized(false) { //now do what ever initialization is needed dbe_ = edm::Service().operator->(); } -TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - +TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary() = default; // // member functions // // ------------ method called to for each event ------------ void TrackerOfflineValidationSummary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - lastSetup_ = &iSetup; - // Access of EventSetup is needed to get the list of silicon-modules and their IDs // Since they do not change, it is accessed only once if (moduleMapsInitialized) @@ -215,18 +202,16 @@ void TrackerOfflineValidationSummary::analyze(const edm::Event& iEvent, const ed moduleMapsInitialized = true; } +// ------------ method called at each end of Run ------------ +void TrackerOfflineValidationSummary::endRun(const edm::Run&, const edm::EventSetup& iSetup) { + if (!tTopo_) { + tTopo_ = std::make_unique(iSetup.getData(tTopoToken_)); + } +} + // ------------ method called once each job just after ending the event loop ------------ void TrackerOfflineValidationSummary::endJob() { - //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - lastSetup_->get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); - - // do not know how to set the transition - //edm::ESHandle tTopoHandle = lastSetup_->getHandle(topoToken_); - //const TrackerTopology *const tTopo = tTopoHandle.product(); - - AlignableTracker aliTracker(&(*tkGeom_), tTopo); + AlignableTracker aliTracker(&(*tkGeom_), tTopo_.get()); TTree* tree = new TTree("TkOffVal", "TkOffVal"); @@ -239,12 +224,12 @@ void TrackerOfflineValidationSummary::endJob() { std::map* substructureName = new std::map; tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero - this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); + this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); //dbe_->save("dqmOut.root"); From b7862c5bcb7b714c8f22380ec274006a01cf2021 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 11:06:28 +0200 Subject: [PATCH 610/923] migrate to argparse --- .../python/MatrixInjector.py | 11 +- .../scripts/runTheMatrix.py | 517 +++++++++--------- 2 files changed, 252 insertions(+), 276 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index 4fb1c0233f132..e22ef7efaed56 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -69,13 +69,14 @@ def __init__(self,opt,mode='init',options=''): # Checking and setting up GPU attributes #################################### # Mendatory - self.RequiresGPU = opt.RequiresGPU + self.RequiresGPU='forbidden' + if opt.gpu: self.RequiresGPU=opt.gpu if self.RequiresGPU not in ('forbidden','optional','required'): - print('RequiresGPU must be forbidden, optional, required. Now, set to forbidden.') - self.RequiresGPU = 'forbidden' - if self.RequiresGPU == 'optional': - print('Optional GPU is turned off for RelVals. Now, changing it to forbidden') + print("'--gpu option' you provided are not 'forbidden', 'optional', 'required'. Now, set to forbidden.") self.RequiresGPU = 'forbidden' + #if self.RequiresGPU == 'optional': + #print("Optional GPU is turned off for RelVals. Now, changing it to forbidden") + #self.RequiresGPU = 'forbidden' self.GPUMemoryMB = opt.GPUMemoryMB self.CUDACapabilities = opt.CUDACapabilities.split(',') self.CUDARuntime = opt.CUDARuntime diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 99c40b2eb77a2..93c802a3180ba 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -104,278 +104,254 @@ def runSelected(opt): } - import optparse + import argparse usage = 'usage: runTheMatrix.py --show -s ' - parser = optparse.OptionParser(usage) - - parser.add_option('-b','--batchName', - help='relval batch: suffix to be appended to Campaign name', - dest='batchName', - default='' - ) - - parser.add_option('-m','--memoryOffset', - help='memory of the wf for single core', - dest='memoryOffset', - default=3000 - ) - - parser.add_option('--addMemPerCore', - help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', - dest='memPerCore', - default=1500 - ) - - parser.add_option('-j','--nproc', - help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', - dest='nProcs', - default=4 - ) - - parser.add_option('-t','--nThreads', - help='number of threads per process to use in cmsRun.', - dest='nThreads', - default=1 - ) - - parser.add_option('--nStreams', - help='number of streams to use in cmsRun.', - dest='nStreams', - default=0 - ) - - parser.add_option('--numberEventsInLuminosityBlock', - help='number of events in a luminosity block', - dest='numberEventsInLuminosityBlock', - default=-1 - ) - - parser.add_option('-n','--showMatrix', - help='Only show the worflows. Use --ext to show more', - dest='show', - default=False, - action='store_true' - ) - - parser.add_option('-e','--extended', - help='Show details of workflows, used with --show', - dest='extended', - default=False, - action='store_true' - ) - - parser.add_option('-s','--selected', - help='Run a pre-defined selected matrix of wf. Deprecated, please use -l limited', - dest='restricted', - default=False, - action='store_true' - ) - - parser.add_option('-l','--list', - help='Comma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', - dest='testList', - default=None - ) - - parser.add_option('-r','--raw', - help='Temporary dump the .txt needed for prodAgent interface. To be discontinued soon. Argument must be the name of the set (standard, pileup,...)', - dest='raw' - ) - - parser.add_option('-i','--useInput', - help='Use recyling where available. Either all, or a comma separated list of wf number.', - dest='useInput', - default=None - ) - - parser.add_option('-w','--what', - help='Specify the set to be used. Argument must be the name of a set (standard, pileup,...) or multiple sets separated by commas (--what standard,pileup )', - dest='what', - default='all' - ) - - parser.add_option('--step1', - help='Used with --raw. Limit the production to step1', - dest='step1Only', - default=False - ) - - parser.add_option('--maxSteps', - help='Only run maximum on maxSteps. Used when we are only interested in first n steps.', - dest='maxSteps', - default=9999, - type="int" - ) - - parser.add_option('--fromScratch', - help='Comma separated list of wf to be run without recycling. all is not supported as default.', - dest='fromScratch', - default=None - ) - - parser.add_option('--refRelease', - help='Allow to modify the recycling dataset version', - dest='refRel', - default=None - ) - - parser.add_option('--wmcontrol', - help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', - choices=['init','test','submit','force'], - dest='wmcontrol', - default=None, - ) - - parser.add_option('--revertDqmio', - help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', - choices=['yes','no'], - dest='revertDqmio', - default='no', - ) - - parser.add_option('--optionswm', - help='Specify a few things for wm injection', - default='', - dest='wmoptions') - - parser.add_option('--keep', - help='allow to specify for which comma separated steps the output is needed', - default=None) - - parser.add_option('--label', - help='allow to give a special label to the output dataset name', - default='') - - parser.add_option('--command', - help='provide a way to add additional command to all of the cmsDriver commands in the matrix', - dest='command', - action='append', - default=None - ) - - parser.add_option('--apply', - help='allow to use the --command only for 1 comma separeated', - dest='apply', - default=None) - - parser.add_option('--workflow', - help='define a workflow to be created or altered from the matrix', - action='append', - dest='workflow', - default=None - ) - - parser.add_option('--dryRun', - help='do not run the wf at all', - action='store_true', - dest='dryRun', - default=False - ) - - parser.add_option('--testbed', - help='workflow injection to cmswebtest (you need dedicated rqmgr account)', - dest='testbed', - default=False, - action='store_true' - ) - - parser.add_option('--noCafVeto', - help='Run from any source, ignoring the CAF label', - dest='cafVeto', - default=True, - action='store_false' - ) - - parser.add_option('--overWrite', - help='Change the content of a step for another. List of pairs.', - dest='overWrite', - default=None - ) - - parser.add_option('--noRun', - help='Remove all run list selection from wfs', - dest='noRun', - default=False, - action='store_true') - - parser.add_option('--das-options', - help='Options to be passed to dasgoclient.', - dest='dasOptions', - default="--limit 0", - action='store') - - parser.add_option('--job-reports', - help='Dump framework job reports', - dest='jobReports', - default=False, - action='store_true') - - parser.add_option('--ibeos', - help='Use IB EOS site configuration', - dest='IBEos', - default=False, - action='store_true') - - parser.add_option('--sites', - help='Run DAS query to get data from a specific site (default is T2_CH_CERN). Set it to empty string to search all sites.', - dest='dasSites', - default='T2_CH_CERN', - action='store') - - parser.add_option('--interactive', - help="Open the Matrix interactive shell", - action='store_true', - default=False) - - parser.add_option('--dbs-url', - help='Overwrite DbsUrl value in JSON submitted to ReqMgr2', - dest='dbsUrl', - default=None, - action='store') - - parser.add_option('--gpu', - help='Use GPU workflow setup if available. It will force --requires-gpu required.', - dest='gpuEnable', - default=False, - action='store_true') - - parser.add_option('--requires-gpu', - help='if GPU is required or not: forbidden (default, CPU-only), optional, required. For relvals, the GPU option will be turned off for optional.', - dest='RequiresGPU', - default='forbidden') - - parser.add_option('--gpu-memory-mb', - help='to specify GPU memory. Default = 8000 MB (for --requires-gpu = required).', - dest='GPUMemoryMB', - default=8000) - - parser.add_option('--cuda-capabilities', - help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (for RequiresGPU = required). Use comma to identify various CUDACapabilities', - dest='CUDACapabilities', - default='6.0,6.1,6.2,7.0,7.2,7.5') - - parser.add_option('--cuda-runtime', - help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (for RequiresGPU = required). FIX ME TO MATCH WITH CMSSW.', - dest='CUDARuntime', - default='11.2') - - parser.add_option('--gpu-name', - help='to specify GPU class. This is an optional parameter.', - dest='GPUName', - default='') - - parser.add_option('--cuda-driver-version', - help='to specify CUDA driver version. This is an optional parameter.', - dest='CUDADriverVersion', - default='') - - parser.add_option('--cuda-runtime-version', - help='to specify CUDA runtime version. This is an optional parameter.', - dest='CUDARuntimeVersion', - default='') - - opt,args = parser.parse_args() + parser = argparse.ArgumentParser(usage) + + parser.add_argument('-b','--batchName', + help='relval batch: suffix to be appended to Campaign name', + dest='batchName', + default='') + + parser.add_argument('-m','--memoryOffset', + help='memory of the wf for single core', + dest='memoryOffset', + default=3000) + + parser.add_argument('--addMemPerCore', + help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', + dest='memPerCore', + default=1500) + + parser.add_argument('-j','--nproc', + help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', + dest='nProcs', + default=4) + + parser.add_argument('-t','--nThreads', + help='number of threads per process to use in cmsRun.', + dest='nThreads', + default=1) + + parser.add_argument('--nStreams', + help='number of streams to use in cmsRun.', + dest='nStreams', + default=0) + + parser.add_argument('--numberEventsInLuminosityBlock', + help='number of events in a luminosity block', + dest='numberEventsInLuminosityBlock', + default=-1) + + parser.add_argument('-n','--showMatrix', + help='Only show the worflows. Use --ext to show more', + dest='show', + default=False, + action='store_true') + + parser.add_argument('-e','--extended', + help='Show details of workflows, used with --show', + dest='extended', + default=False, + action='store_true') + + parser.add_argument('-s','--selected', + help='Run a pre-defined selected matrix of wf. Deprecated, please use -l limited', + dest='restricted', + default=False, + action='store_true') + + parser.add_argument('-l','--list', + help='Comma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', + dest='testList', + default=None) + + parser.add_argument('-r','--raw', + help='Temporary dump the .txt needed for prodAgent interface. To be discontinued soon. Argument must be the name of the set (standard, pileup,...)', + dest='raw') + + parser.add_argument('-i','--useInput', + help='Use recyling where available. Either all, or a comma separated list of wf number.', + dest='useInput', + default=None) + + parser.add_argument('-w','--what', + help='Specify the set to be used. Argument must be the name of a set (standard, pileup,...) or multiple sets separated by commas (--what standard,pileup )', + dest='what', + default='all') + + parser.add_argument('--step1', + help='Used with --raw. Limit the production to step1', + dest='step1Only', + default=False) + + parser.add_argument('--maxSteps', + help='Only run maximum on maxSteps. Used when we are only interested in first n steps.', + dest='maxSteps', + default=9999, + type=int) + + parser.add_argument('--fromScratch', + help='Comma separated list of wf to be run without recycling. all is not supported as default.', + dest='fromScratch', + default=None) + + parser.add_argument('--refRelease', + help='Allow to modify the recycling dataset version', + dest='refRel', + default=None) + + parser.add_argument('--wmcontrol', + help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', + choices=['init','test','submit','force'], + dest='wmcontrol', + default='test', + const='test', + nargs='?') + + parser.add_argument('--revertDqmio', + help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', + choices=['yes','no'], + dest='revertDqmio', + default='no', + const='no', + nargs='?') + + parser.add_argument('--optionswm', + help='Specify a few things for wm injection', + default='', + dest='wmoptions') + + parser.add_argument('--keep', + help='allow to specify for which comma separated steps the output is needed', + default=None) + + parser.add_argument('--label', + help='allow to give a special label to the output dataset name', + default='') + + parser.add_argument('--command', + help='provide a way to add additional command to all of the cmsDriver commands in the matrix', + dest='command', + action='append', + default=None) + + parser.add_argument('--apply', + help='allow to use the --command only for 1 comma separeated', + dest='apply', + default=None) + + parser.add_argument('--workflow', + help='define a workflow to be created or altered from the matrix', + action='append', + dest='workflow', + default=None) + + parser.add_argument('--dryRun', + help='do not run the wf at all', + action='store_true', + dest='dryRun', + default=False) + + parser.add_argument('--testbed', + help='workflow injection to cmswebtest (you need dedicated rqmgr account)', + dest='testbed', + default=False, + action='store_true') + + parser.add_argument('--noCafVeto', + help='Run from any source, ignoring the CAF label', + dest='cafVeto', + default=True, + action='store_false') + + parser.add_argument('--overWrite', + help='Change the content of a step for another. List of pairs.', + dest='overWrite', + default=None) + + parser.add_argument('--noRun', + help='Remove all run list selection from wfs', + dest='noRun', + default=False, + action='store_true') + + parser.add_argument('--das-options', + help='Options to be passed to dasgoclient.', + dest='dasOptions', + default="--limit 0", + action='store') + + parser.add_argument('--job-reports', + help='Dump framework job reports', + dest='jobReports', + default=False, + action='store_true') + + parser.add_argument('--ibeos', + help='Use IB EOS site configuration', + dest='IBEos', + default=False, + action='store_true') + + parser.add_argument('--sites', + help='Run DAS query to get data from a specific site (default is T2_CH_CERN). Set it to empty string to search all sites.', + dest='dasSites', + default='T2_CH_CERN', + action='store') + + parser.add_argument('--interactive', + help="Open the Matrix interactive shell", + action='store_true', + default=False) + + parser.add_argument('--dbs-url', + help='Overwrite DbsUrl value in JSON submitted to ReqMgr2', + dest='dbsUrl', + default=None, + action='store') + + parser.add_argument('--gpu','--requires-gpu', + help='Enable GPU workflows. Possible options are "forbidden" (default), "required" (implied if no argument is given), or "optional".', + dest='gpu', + choices=['forbidden', 'optional', 'required'], + nargs='?', + const='required', + default='forbidden', + action='store') + + parser.add_argument('--gpu-memory-mb', + help='to specify GPU memory. Default = 8000 MB (with --gpu).', + dest='GPUMemoryMB', + default=8000) + + parser.add_argument('--cuda-capabilities', + help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (with --gpu). Use comma to identify various CUDACapabilities', + dest='CUDACapabilities', + default='6.0,6.1,6.2,7.0,7.2,7.5') + + parser.add_argument('--cuda-runtime', + help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (with --gpu). FIX ME TO MATCH WITH CMSSW.', + dest='CUDARuntime', + default='11.2') + + parser.add_argument('--gpu-name', + help='to specify GPU class. This is an optional parameter.', + dest='GPUName', + default='') + + parser.add_argument('--cuda-driver-version', + help='to specify CUDA driver version. This is an optional parameter.', + dest='CUDADriverVersion', + default='') + + parser.add_argument('--cuda-runtime-version', + help='to specify CUDA runtime version. This is an optional parameter.', + dest='CUDARuntimeVersion', + default='') + + opt = parser.parse_args() if opt.command: opt.command = ' '.join(opt.command) os.environ["CMSSW_DAS_QUERY_SITES"]=opt.dasSites if opt.IBEos: @@ -444,7 +420,6 @@ def stepOrIndex(s): if opt.memoryOffset: opt.memoryOffset=int(opt.memoryOffset) if opt.memPerCore: opt.memPerCore=int(opt.memPerCore) if opt.GPUMemoryMB: opt.GPUMemoryMB=int(opt.GPUMemoryMB) - if opt.gpuEnable: opt.RequiresGPU="required" if opt.wmcontrol: performInjectionOptionTest(opt) From 7f17b26509225a45b4c6489550f0efbab270f3ec Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 11:29:09 +0200 Subject: [PATCH 611/923] add branch --- .../scripts/runTheMatrix.py | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 93c802a3180ba..3e223f0c9c0d6 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -312,44 +312,46 @@ def runSelected(opt): default=None, action='store') - parser.add_argument('--gpu','--requires-gpu', - help='Enable GPU workflows. Possible options are "forbidden" (default), "required" (implied if no argument is given), or "optional".', - dest='gpu', - choices=['forbidden', 'optional', 'required'], - nargs='?', - const='required', - default='forbidden', - action='store') - - parser.add_argument('--gpu-memory-mb', - help='to specify GPU memory. Default = 8000 MB (with --gpu).', - dest='GPUMemoryMB', - default=8000) - - parser.add_argument('--cuda-capabilities', - help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (with --gpu). Use comma to identify various CUDACapabilities', - dest='CUDACapabilities', - default='6.0,6.1,6.2,7.0,7.2,7.5') - - parser.add_argument('--cuda-runtime', - help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (with --gpu). FIX ME TO MATCH WITH CMSSW.', - dest='CUDARuntime', - default='11.2') - - parser.add_argument('--gpu-name', - help='to specify GPU class. This is an optional parameter.', - dest='GPUName', - default='') - - parser.add_argument('--cuda-driver-version', - help='to specify CUDA driver version. This is an optional parameter.', - dest='CUDADriverVersion', - default='') - - parser.add_argument('--cuda-runtime-version', - help='to specify CUDA runtime version. This is an optional parameter.', - dest='CUDARuntimeVersion', - default='') + gpugroup = parser.add_argument_group('GPU-related options','These options are only meaningful when --gpu is used, and is not set to forbidden.') + + gpugroup.add_argument('--gpu','--requires-gpu', + help='Enable GPU workflows. Possible options are "forbidden" (default), "required" (implied if no argument is given), or "optional".', + dest='gpu', + choices=['forbidden', 'optional', 'required'], + nargs='?', + const='required', + default='forbidden', + action='store') + + gpugroup.add_argument('--gpu-memory-mb', + help='to specify GPU memory. Default = 8000 MB (with --gpu).', + dest='GPUMemoryMB', + default=8000) + + gpugroup.add_argument('--cuda-capabilities', + help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (with --gpu). Use comma to identify various CUDACapabilities', + dest='CUDACapabilities', + default='6.0,6.1,6.2,7.0,7.2,7.5') + + gpugroup.add_argument('--cuda-runtime', + help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (with --gpu). FIX ME TO MATCH WITH CMSSW.', + dest='CUDARuntime', + default='11.2') + + gpugroup.add_argument('--force-gpu-name', + help='to specify GPU class. This is an optional parameter.', + dest='GPUName', + default='') + + gpugroup.add_argument('--force-cuda-driver-version', + help='to specify CUDA driver version. This is an optional parameter.', + dest='CUDADriverVersion', + default='') + + gpugroup.add_argument('--force-cuda-runtime-version', + help='to specify CUDA runtime version. This is an optional parameter.', + dest='CUDARuntimeVersion', + default='') opt = parser.parse_args() if opt.command: opt.command = ' '.join(opt.command) From 96bd131e2ab4e695eb6dac3ca85a806022bc5915 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 15 Sep 2021 13:27:10 +0200 Subject: [PATCH 612/923] Bug fix to 2 classes --- .../HcalCalibAlgos/plugins/HOCalibAnalyzer.cc | 17 +++++++++-------- .../plugins/HcalIsoTrkAnalyzer.cc | 13 +++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc index c444f1fae63de..a96cdc6cfecb2 100644 --- a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc @@ -70,19 +70,20 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override {} - int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } - int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } - - int mypow_2[31]; - static const int netamx = 30; - static const int nphimx = 72; - static const int ringmx = 5; - static const int ncut = 14; + static constexpr int netamx = 30; + static constexpr int nphimx = 72; + static constexpr int ringmx = 5; + static constexpr int ncut = 14; const char* varcrit[3] = {"All", "steps", "n-1"}; // or opposite const double elosfact = (14.9 + 0.96 * fabs(log(8 * 2.8)) + 0.033 * 8 * (1.0 - pow(8, -0.33))); + int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } + int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } + + int mypow_2[31]; + bool m_cosmic; bool m_zeroField; int m_bins; diff --git a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc index 3e344c698b64b..7c7912a00a3e4 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc @@ -937,9 +937,13 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectortrkItr)); math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); + t_p = pTrack->p(); + t_pt = pTrack->pt(); + t_phi = pTrack->phi(); + #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << t_pt << "|" + << pTrack->eta() << "|" << t_phi << "|" << t_p; #endif t_mindR2 = 999; for (unsigned int k = 0; k < vecL3.size(); ++k) { @@ -952,6 +956,7 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectorokHCAL) { HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL); @@ -1207,10 +1212,6 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectorp(); - t_pt = pTrack->pt(); - t_phi = pTrack->phi(); - #ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << t_pt << "|" << pTrack->eta() << "|" << t_phi << "|" << t_p << " Generator Level p " From f6d32fa99bc1b46c87c1e108b952f8fb4190f195 Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Fri, 10 Sep 2021 17:13:42 +0200 Subject: [PATCH 613/923] add fix --- .../SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc index 7b29719e398dd..ee1762950f29a 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc @@ -81,7 +81,7 @@ void SiPixelDigisClustersFromSoA::produce(edm::StreamID, edm::Event& iEvent, con edm::DetSet* detDigis = nullptr; uint32_t detId = 0; for (uint32_t i = 0; i < nDigis; i++) { - if (digis.pdigi(i) == 0) + if (digis.rawIdArr(i) == 0) continue; detId = digis.rawIdArr(i); if (storeDigis_) { @@ -134,7 +134,7 @@ void SiPixelDigisClustersFromSoA::produce(edm::StreamID, edm::Event& iEvent, con }; for (uint32_t i = 0; i < nDigis; i++) { - if (digis.pdigi(i) == 0) + if (digis.rawIdArr(i) == 0) continue; if (digis.clus(i) > 9000) continue; // not in cluster; TODO add an assert for the size From 613578229fcb0a0bf5c5ac083195941005bbaea3 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 15:22:01 +0200 Subject: [PATCH 614/923] update --- .../python/MatrixInjector.py | 15 ++----- .../scripts/runTheMatrix.py | 41 +++++++++++-------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index e22ef7efaed56..0561195d28926 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -69,16 +69,9 @@ def __init__(self,opt,mode='init',options=''): # Checking and setting up GPU attributes #################################### # Mendatory - self.RequiresGPU='forbidden' - if opt.gpu: self.RequiresGPU=opt.gpu - if self.RequiresGPU not in ('forbidden','optional','required'): - print("'--gpu option' you provided are not 'forbidden', 'optional', 'required'. Now, set to forbidden.") - self.RequiresGPU = 'forbidden' - #if self.RequiresGPU == 'optional': - #print("Optional GPU is turned off for RelVals. Now, changing it to forbidden") - #self.RequiresGPU = 'forbidden' + self.RequiresGPU = opt.gpu self.GPUMemoryMB = opt.GPUMemoryMB - self.CUDACapabilities = opt.CUDACapabilities.split(',') + self.CUDACapabilities = opt.CUDACapabilities self.CUDARuntime = opt.CUDARuntime # optional self.GPUName = opt.GPUName @@ -438,7 +431,7 @@ def prepare(self, mReader, directories, mode='init'): if setPrimaryDs: chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs nextHasDSInput=None - if 'GPU' in step and self.RequiresGPU == 'required': + if 'GPU' in step and self.RequiresGPU != 'forbidden': chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) else: @@ -453,7 +446,7 @@ def prepare(self, mReader, directories, mode='init'): chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf if step in wmsplit: chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step] - if 'GPU' in step and self.RequiresGPU == 'required': + if 'GPU' in step and self.RequiresGPU != 'forbidden': chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 3e223f0c9c0d6..3718e26d5048d 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -117,31 +117,37 @@ def runSelected(opt): parser.add_argument('-m','--memoryOffset', help='memory of the wf for single core', dest='memoryOffset', + type=int, default=3000) parser.add_argument('--addMemPerCore', help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', dest='memPerCore', + type=int, default=1500) parser.add_argument('-j','--nproc', help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', dest='nProcs', + type=int, default=4) parser.add_argument('-t','--nThreads', help='number of threads per process to use in cmsRun.', dest='nThreads', + type=int, default=1) parser.add_argument('--nStreams', help='number of streams to use in cmsRun.', dest='nStreams', + type=int, default=0) parser.add_argument('--numberEventsInLuminosityBlock', help='number of events in a luminosity block', dest='numberEventsInLuminosityBlock', + type=int, default=-1) parser.add_argument('-n','--showMatrix', @@ -323,33 +329,40 @@ def runSelected(opt): default='forbidden', action='store') - gpugroup.add_argument('--gpu-memory-mb', - help='to specify GPU memory. Default = 8000 MB (with --gpu).', + gpugroup.add_argument('--gpu-memory', + help='Specify the minimum amount of GPU memory required by the job, in MB (default: %(default)d MB)', dest='GPUMemoryMB', + type=int, default=8000) gpugroup.add_argument('--cuda-capabilities', - help='to specify CUDA capabilities. Default = 6.0,6.1,6.2,7.0,7.2,7.5 (with --gpu). Use comma to identify various CUDACapabilities', + help='Specify a comma-separated list of CUDA "compute capabilities", or GPU hardware architectures, that the job can use (default: %(default)s).', dest='CUDACapabilities', - default='6.0,6.1,6.2,7.0,7.2,7.5') - + default='6.0,6.1,6.2,7.0,7.2,7.5,8.0,8.6') + + # read the CUDA runtime version included in CMSSW + cudart_version = None + libcudart = os.path.realpath(os.path.expandvars('$CMSSW_RELEASE_BASE/external/$SCRAM_ARCH/lib/libcudart.so')) + if os.path.isfile(libcudart): + cudart_basename = os.path.basename(libcudart) + cudart_version = '.'.join(cudart_basename.split('.')[2:4]) gpugroup.add_argument('--cuda-runtime', - help='to specify major and minor CUDA runtime used to build the application. Default = 11.2 (with --gpu). FIX ME TO MATCH WITH CMSSW.', + help='Specify major and minor version of the CUDA runtime used to build the application (default: %(default)s).', dest='CUDARuntime', - default='11.2') + default=cudart_version) gpugroup.add_argument('--force-gpu-name', - help='to specify GPU class. This is an optional parameter.', + help='Request a specific GPU model, e.g. "Tesla T4" or "NVIDIA GeForce RTX 2080" (default: none). The default behaviour is to accept any supported GPU.', dest='GPUName', default='') gpugroup.add_argument('--force-cuda-driver-version', - help='to specify CUDA driver version. This is an optional parameter.', + help='Request a specific CUDA driver version, e.g. 470.57.02 (default: none). The default behaviour is to accept any supported CUDA driver version.', dest='CUDADriverVersion', default='') gpugroup.add_argument('--force-cuda-runtime-version', - help='to specify CUDA runtime version. This is an optional parameter.', + help='Request a specific CUDA runtime version, e.g. 11.4 (default: none). The default behaviour is to accept any supported CUDA runtime version.', dest='CUDARuntimeVersion', default='') @@ -415,13 +428,7 @@ def stepOrIndex(s): if opt.useInput: opt.useInput = opt.useInput.split(',') if opt.fromScratch: opt.fromScratch = opt.fromScratch.split(',') - if opt.nProcs: opt.nProcs=int(opt.nProcs) - if opt.nThreads: opt.nThreads=int(opt.nThreads) - if opt.nStreams: opt.nStreams=int(opt.nStreams) - if opt.numberEventsInLuminosityBlock: opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock) - if opt.memoryOffset: opt.memoryOffset=int(opt.memoryOffset) - if opt.memPerCore: opt.memPerCore=int(opt.memPerCore) - if opt.GPUMemoryMB: opt.GPUMemoryMB=int(opt.GPUMemoryMB) + if opt.CUDACapabilities: opt.CUDACapabilities = opt.CUDACapabilities.split(',') if opt.wmcontrol: performInjectionOptionTest(opt) From 69f81ede9d2469d9433363818cf397744b5a2c3a Mon Sep 17 00:00:00 2001 From: iarspider Date: Wed, 15 Sep 2021 15:28:25 +0200 Subject: [PATCH 615/923] Update HcalDDDRecConstants.cc Possibly missing #include --- Geometry/HcalCommonData/src/HcalDDDRecConstants.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc index 5f3abf37f5ea1..aacc352ce8d51 100644 --- a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc @@ -5,6 +5,7 @@ #include "DataFormats/Math/interface/GeantUnits.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" +#include #include //#define EDM_ML_DEBUG From f6145935528010710d0310d7bdbe71dcb306d98d Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 15 Sep 2021 15:45:34 +0200 Subject: [PATCH 616/923] Disable G4GammaGeneralProcess --- SimG4Core/Application/python/g4SimHits_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimG4Core/Application/python/g4SimHits_cfi.py b/SimG4Core/Application/python/g4SimHits_cfi.py index 3470d96382c59..d967100c70f3f 100644 --- a/SimG4Core/Application/python/g4SimHits_cfi.py +++ b/SimG4Core/Application/python/g4SimHits_cfi.py @@ -176,7 +176,7 @@ G4MscSafetyFactor = cms.double(0.6), G4MscLambdaLimit = cms.double(1.0), # mm G4MscStepLimit = cms.string("UseSafety"), - G4GeneralProcess = cms.bool(True), + G4GeneralProcess = cms.bool(False), ReadMuonData = cms.bool(False), Verbosity = cms.untracked.int32(0), # 1 will print cuts as they get set from DD From 673103f5650e438244ce2489f6628365eae790dd Mon Sep 17 00:00:00 2001 From: "Ian J. Watson" Date: Wed, 15 Sep 2021 23:23:52 +0900 Subject: [PATCH 617/923] Fix buffer underflow with HitPattern::getMuonStation() --- DataFormats/TrackReco/src/HitPattern.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DataFormats/TrackReco/src/HitPattern.cc b/DataFormats/TrackReco/src/HitPattern.cc index 6431408cfd4e9..18a5d33bfc5d2 100644 --- a/DataFormats/TrackReco/src/HitPattern.cc +++ b/DataFormats/TrackReco/src/HitPattern.cc @@ -882,16 +882,16 @@ uint16_t HitPattern::isStereo(DetId i, const TrackerTopology& ttopo) { } int HitPattern::muonStations(int subdet, int hitType) const { - int stations[4] = {0, 0, 0, 0}; + int stations[5] = {0, 0, 0, 0, 0}; for (int i = beginTrackHits; i < endTrackHits; ++i) { uint16_t pattern = getHitPatternByAbsoluteIndex(i); if (muonHitFilter(pattern) && (subdet == 0 || int(getSubStructure(pattern)) == subdet) && (hitType == -1 || int(getHitType(pattern)) == hitType)) { - stations[getMuonStation(pattern) - 1] = 1; + stations[getMuonStation(pattern)] = 1; } } - return stations[0] + stations[1] + stations[2] + stations[3]; + return stations[0] + stations[1] + stations[2] + stations[3] + stations[4]; } int HitPattern::innermostMuonStationWithHits(int hitType) const { From 0be62b8658ff91c487b2ad86feb5afb18459baf9 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 09:27:00 -0500 Subject: [PATCH 618/923] Update code to new reco::writeSpecifics API --- RecoJets/FFTJetProducers/plugins/FFTJetProducer.cc | 12 +++++++++++- .../TopEventProducers/src/PseudoTopProducer.cc | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/RecoJets/FFTJetProducers/plugins/FFTJetProducer.cc b/RecoJets/FFTJetProducers/plugins/FFTJetProducer.cc index 1630f23aec963..3ce2ca1163b3b 100644 --- a/RecoJets/FFTJetProducers/plugins/FFTJetProducer.cc +++ b/RecoJets/FFTJetProducers/plugins/FFTJetProducer.cc @@ -38,6 +38,8 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "RecoJets/JetProducers/interface/JetSpecific.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" // Loader for the lookup tables #include "JetMETCorrections/FFTJetObjects/interface/FFTJetLookupTableSequenceLoader.h" @@ -565,7 +567,15 @@ void FFTJetProducer::writeJets(edm::Event& iEvent, const edm::EventSetup& iSetup // vertex, constituents). These are overridden functions that will // call the appropriate specific code. T jet; - writeSpecific(jet, jet4vec, vertexUsed(), constituents[ijet + 1], iSetup); + if constexpr (std::is_same_v) { + edm::ESHandle geometry; + iSetup.get().get(geometry); + edm::ESHandle topology; + iSetup.get().get(topology); + writeSpecific(jet, jet4vec, vertexUsed(), constituents[ijet + 1], *geometry, *topology); + } else { + writeSpecific(jet, jet4vec, vertexUsed(), constituents[ijet + 1]); + } // calcuate the jet area double ncells = myjet.ncells(); diff --git a/TopQuarkAnalysis/TopEventProducers/src/PseudoTopProducer.cc b/TopQuarkAnalysis/TopEventProducers/src/PseudoTopProducer.cc index 1782742406d1b..78927e6cc0d76 100644 --- a/TopQuarkAnalysis/TopEventProducers/src/PseudoTopProducer.cc +++ b/TopQuarkAnalysis/TopEventProducers/src/PseudoTopProducer.cc @@ -150,7 +150,7 @@ void PseudoTopProducer::produce(edm::Event& event, const edm::EventSetup& eventS const LorentzVector jetP4(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()); reco::GenJet lepJet; - reco::writeSpecific(lepJet, jetP4, genVertex_, constituents, eventSetup); + reco::writeSpecific(lepJet, jetP4, genVertex_, constituents); lepJet.setPdgId(lepCand->pdgId()); lepJet.setCharge(lepCand->charge()); @@ -226,7 +226,7 @@ void PseudoTopProducer::produce(edm::Event& event, const edm::EventSetup& eventS const LorentzVector jetP4(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()); reco::GenJet genJet; - reco::writeSpecific(genJet, jetP4, genVertex_, constituents, eventSetup); + reco::writeSpecific(genJet, jetP4, genVertex_, constituents); const double jetArea = fjJet.has_area() ? fjJet.area() : 0; genJet.setJetArea(jetArea); From 1734e7f3c40872bbb1394999ab78c22d21cf29f7 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 16:44:07 +0200 Subject: [PATCH 619/923] bring back wmcontrol default --- Configuration/PyReleaseValidation/scripts/runTheMatrix.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 3718e26d5048d..8e88a66f799c9 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -212,9 +212,7 @@ def runSelected(opt): help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', choices=['init','test','submit','force'], dest='wmcontrol', - default='test', - const='test', - nargs='?') + default=None) parser.add_argument('--revertDqmio', help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', From 6707ba0684e443bd6776d8bcd417122b60feab95 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 16:48:47 +0200 Subject: [PATCH 620/923] remove unnecessary const,nargs from revertDqmio --- Configuration/PyReleaseValidation/scripts/runTheMatrix.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 8e88a66f799c9..94084d51ff024 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -218,9 +218,7 @@ def runSelected(opt): help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', choices=['yes','no'], dest='revertDqmio', - default='no', - const='no', - nargs='?') + default='no') parser.add_argument('--optionswm', help='Specify a few things for wm injection', From a86a0ca2d07692959974242c0bb41a05f195f844 Mon Sep 17 00:00:00 2001 From: Daniele Trocino Date: Wed, 15 Sep 2021 17:30:54 +0200 Subject: [PATCH 621/923] fix issue 35036 in MuonIdProducer --- RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h | 1 + RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h b/RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h index 99491ab78b6e8..91457ff495330 100644 --- a/RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h +++ b/RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h @@ -46,6 +46,7 @@ class MuonShowerDigiFiller { public: + MuonShowerDigiFiller() {} MuonShowerDigiFiller(const edm::ParameterSet&, edm::ConsumesCollector&& iC); void getES(const edm::EventSetup& iSetup); diff --git a/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc b/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc index 7901e86d6c6aa..68bc441d54a28 100644 --- a/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc +++ b/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc @@ -90,6 +90,9 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig) edm::ParameterSet showerDigiParameters = iConfig.getParameter("ShowerDigiFillerParameters"); theShowerDigiFiller_ = std::make_unique(showerDigiParameters, consumesCollector()); } + else { + theShowerDigiFiller_ = std::make_unique(); // to be used to call fillDefault only + } if (fillCaloCompatibility_) { // Load MuonCaloCompatibility parameters @@ -888,7 +891,7 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent, matchedChamber.id = chamber.id; - if (fillShowerDigis_) { + if (fillShowerDigis_ && fillMatching_) { theShowerDigiFiller_->fill(matchedChamber); } else { theShowerDigiFiller_->fillDefault(matchedChamber); From bfdc4282d8048dbfd7dc1a1f2fb10643afe5bfe1 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 17:40:46 +0200 Subject: [PATCH 622/923] code clean up --- .../scripts/runTheMatrix.py | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 94084d51ff024..b20d67cf1414a 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -107,7 +107,7 @@ def runSelected(opt): import argparse usage = 'usage: runTheMatrix.py --show -s ' - parser = argparse.ArgumentParser(usage) + parser = argparse.ArgumentParser(usage,formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-b','--batchName', help='relval batch: suffix to be appended to Campaign name', @@ -180,6 +180,7 @@ def runSelected(opt): parser.add_argument('-i','--useInput', help='Use recyling where available. Either all, or a comma separated list of wf number.', dest='useInput', + type=lambda x: x.split(','), default=None) parser.add_argument('-w','--what', @@ -201,6 +202,7 @@ def runSelected(opt): parser.add_argument('--fromScratch', help='Comma separated list of wf to be run without recycling. all is not supported as default.', dest='fromScratch', + type=lambda x: x.split(','), default=None) parser.add_argument('--refRelease', @@ -326,14 +328,15 @@ def runSelected(opt): action='store') gpugroup.add_argument('--gpu-memory', - help='Specify the minimum amount of GPU memory required by the job, in MB (default: %(default)d MB)', + help='Specify the minimum amount of GPU memory required by the job, in MB.', dest='GPUMemoryMB', type=int, default=8000) gpugroup.add_argument('--cuda-capabilities', - help='Specify a comma-separated list of CUDA "compute capabilities", or GPU hardware architectures, that the job can use (default: %(default)s).', + help='Specify a comma-separated list of CUDA "compute capabilities", or GPU hardware architectures, that the job can use.', dest='CUDACapabilities', + type=lambda x: x.split(','), default='6.0,6.1,6.2,7.0,7.2,7.5,8.0,8.6') # read the CUDA runtime version included in CMSSW @@ -343,22 +346,22 @@ def runSelected(opt): cudart_basename = os.path.basename(libcudart) cudart_version = '.'.join(cudart_basename.split('.')[2:4]) gpugroup.add_argument('--cuda-runtime', - help='Specify major and minor version of the CUDA runtime used to build the application (default: %(default)s).', + help='Specify major and minor version of the CUDA runtime used to build the application.', dest='CUDARuntime', default=cudart_version) gpugroup.add_argument('--force-gpu-name', - help='Request a specific GPU model, e.g. "Tesla T4" or "NVIDIA GeForce RTX 2080" (default: none). The default behaviour is to accept any supported GPU.', + help='Request a specific GPU model, e.g. "Tesla T4" or "NVIDIA GeForce RTX 2080". The default behaviour is to accept any supported GPU.', dest='GPUName', default='') gpugroup.add_argument('--force-cuda-driver-version', - help='Request a specific CUDA driver version, e.g. 470.57.02 (default: none). The default behaviour is to accept any supported CUDA driver version.', + help='Request a specific CUDA driver version, e.g. 470.57.02. The default behaviour is to accept any supported CUDA driver version.', dest='CUDADriverVersion', default='') gpugroup.add_argument('--force-cuda-runtime-version', - help='Request a specific CUDA runtime version, e.g. 11.4 (default: none). The default behaviour is to accept any supported CUDA runtime version.', + help='Request a specific CUDA runtime version, e.g. 11.4. The default behaviour is to accept any supported CUDA runtime version.', dest='CUDARuntimeVersion', default='') @@ -420,12 +423,7 @@ def stepOrIndex(s): print(entry,'is not a possible selected entry') opt.testList = list(set(testList)) - - - if opt.useInput: opt.useInput = opt.useInput.split(',') - if opt.fromScratch: opt.fromScratch = opt.fromScratch.split(',') - if opt.CUDACapabilities: opt.CUDACapabilities = opt.CUDACapabilities.split(',') - + if opt.wmcontrol: performInjectionOptionTest(opt) if opt.overWrite: From 1444e50135f468a310e7b2abde7df9c665aa598d Mon Sep 17 00:00:00 2001 From: Angela Czirkos Date: Wed, 15 Sep 2021 14:35:28 +0200 Subject: [PATCH 623/923] update fix and add comments - move printf in calibDigis --- .../SiPixelCluster/interface/gpuClusteringConstants.h | 1 + .../plugins/SiPixelDigisClustersFromSoA.cc | 10 ++++++++++ .../SiPixelClusterizer/plugins/gpuCalibPixel.h | 2 +- .../SiPixelClusterizer/plugins/gpuClustering.h | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h index 77cf567dca681..c0df6cad9bf39 100644 --- a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h +++ b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h @@ -18,6 +18,7 @@ namespace gpuClustering { constexpr uint16_t maxNumModules = 2000; constexpr int32_t maxNumClustersPerModules = maxHitsInModule(); constexpr uint16_t invalidModuleId = std::numeric_limits::max() - 1; + constexpr int invalidClusterId = -9999; static_assert(invalidModuleId > maxNumModules); // invalidModuleId must be > maxNumModules } // namespace gpuClustering diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc index ee1762950f29a..e9a82775c1959 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoA.cc @@ -81,8 +81,14 @@ void SiPixelDigisClustersFromSoA::produce(edm::StreamID, edm::Event& iEvent, con edm::DetSet* detDigis = nullptr; uint32_t detId = 0; for (uint32_t i = 0; i < nDigis; i++) { + // check for uninitialized digis + // this is set in RawToDigi_kernel in SiPixelRawToClusterGPUKernel.cu if (digis.rawIdArr(i) == 0) continue; + // check for noisy/dead pixels (electrons set to 0) + if (digis.adc(i) == 0) + continue; + detId = digis.rawIdArr(i); if (storeDigis_) { detDigis = &collection->find_or_insert(detId); @@ -134,8 +140,12 @@ void SiPixelDigisClustersFromSoA::produce(edm::StreamID, edm::Event& iEvent, con }; for (uint32_t i = 0; i < nDigis; i++) { + // check for uninitialized digis if (digis.rawIdArr(i) == 0) continue; + // check for noisy/dead pixels (electrons set to 0) + if (digis.adc(i) == 0) + continue; if (digis.clus(i) > 9000) continue; // not in cluster; TODO add an assert for the size #ifdef EDM_ML_DEBUG diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuCalibPixel.h b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuCalibPixel.h index c21c792f39c30..5fa9f1dd62445 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuCalibPixel.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuCalibPixel.h @@ -54,9 +54,9 @@ namespace gpuCalibPixel { float gain = ret.second; // float pedestal = 0; float gain = 1.; if (isDeadColumn | isNoisyColumn) { + printf("bad pixel at %d in %d\n", i, id[i]); id[i] = invalidModuleId; adc[i] = 0; - printf("bad pixel at %d in %d\n", i, id[i]); } else { float vcal = adc[i] * gain - pedestal * gain; adc[i] = std::max(100, int(vcal * conversionFactor + offset)); diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h index 8f3977db5c6d6..b266f2f2a997e 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClustering.h @@ -276,7 +276,7 @@ namespace gpuClustering { // adjust the cluster id to be a positive value starting from 0 for (int i = first; i < msize; i += blockDim.x) { if (id[i] == invalidModuleId) { // skip invalid pixels - clusterId[i] = -9999; + clusterId[i] = invalidClusterId; continue; } clusterId[i] = -clusterId[i] - 1; From de6a246d4b0e6a61d243677475da026f14cf3f9a Mon Sep 17 00:00:00 2001 From: Norraphat Date: Wed, 15 Sep 2021 17:49:31 +0200 Subject: [PATCH 624/923] small clean up on default value --- Configuration/PyReleaseValidation/scripts/runTheMatrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index b20d67cf1414a..b4d23ca3d52a0 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -300,7 +300,7 @@ def runSelected(opt): action='store_true') parser.add_argument('--sites', - help='Run DAS query to get data from a specific site (default is T2_CH_CERN). Set it to empty string to search all sites.', + help='Run DAS query to get data from a specific site. Set it to empty string to search all sites.', dest='dasSites', default='T2_CH_CERN', action='store') From a1208494b4f5c725c99d3f57a7a055b54b8fbfc9 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 10:53:56 -0500 Subject: [PATCH 625/923] Pass ConsumesCollector by value This allows multiple components to properly use the object --- SimTracker/TrackHistory/interface/VertexHistory.h | 2 +- SimTracker/TrackHistory/src/VertexHistory.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SimTracker/TrackHistory/interface/VertexHistory.h b/SimTracker/TrackHistory/interface/VertexHistory.h index ae224e8e40ef9..fa33e39dc79b7 100644 --- a/SimTracker/TrackHistory/interface/VertexHistory.h +++ b/SimTracker/TrackHistory/interface/VertexHistory.h @@ -22,7 +22,7 @@ class VertexHistory : public HistoryBase { /param[in] config with the configuration values */ - VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector &&); + VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector); //! Pre-process event information (for accessing reconstruction information) void newEvent(const edm::Event &, const edm::EventSetup &); diff --git a/SimTracker/TrackHistory/src/VertexHistory.cc b/SimTracker/TrackHistory/src/VertexHistory.cc index ff9ed6cabf9fa..083231f297b12 100644 --- a/SimTracker/TrackHistory/src/VertexHistory.cc +++ b/SimTracker/TrackHistory/src/VertexHistory.cc @@ -3,7 +3,7 @@ #include "SimDataFormats/Associations/interface/VertexToTrackingVertexAssociator.h" #include "SimTracker/TrackHistory/interface/VertexHistory.h" -VertexHistory::VertexHistory(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) : HistoryBase() { +VertexHistory::VertexHistory(const edm::ParameterSet &config, edm::ConsumesCollector collector) : HistoryBase() { // Name of the track collection vertexProducer_ = config.getUntrackedParameter("vertexProducer"); From 465154149197bea2e9993028bd04ae611bbfa65c Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 10:54:38 -0500 Subject: [PATCH 626/923] Added esConsumes to VertexClassifier --- SimTracker/TrackHistory/interface/VertexClassifier.h | 3 ++- SimTracker/TrackHistory/src/VertexClassifier.cc | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/SimTracker/TrackHistory/interface/VertexClassifier.h b/SimTracker/TrackHistory/interface/VertexClassifier.h index c8a295bfde16a..43a170c4e31d6 100644 --- a/SimTracker/TrackHistory/interface/VertexClassifier.h +++ b/SimTracker/TrackHistory/interface/VertexClassifier.h @@ -21,7 +21,7 @@ class VertexClassifier : public VertexCategories { typedef VertexCategories Categories; //! Constructor by ParameterSet - VertexClassifier(edm::ParameterSet const &pset, edm::ConsumesCollector &&); + VertexClassifier(edm::ParameterSet const &pset, edm::ConsumesCollector); virtual ~VertexClassifier() {} @@ -53,6 +53,7 @@ class VertexClassifier : public VertexCategories { edm::Handle mcInformation_; edm::ESHandle particleDataTable_; + edm::ESGetToken particleDataTableToken_; //! Get reconstruction information void reconstructionInformation(reco::TrackBaseRef const &); diff --git a/SimTracker/TrackHistory/src/VertexClassifier.cc b/SimTracker/TrackHistory/src/VertexClassifier.cc index c4b134f78d179..326b3f94a8eb9 100644 --- a/SimTracker/TrackHistory/src/VertexClassifier.cc +++ b/SimTracker/TrackHistory/src/VertexClassifier.cc @@ -15,10 +15,11 @@ (a) = (a) | (b); \ } while (0) -VertexClassifier::VertexClassifier(edm::ParameterSet const &config, edm::ConsumesCollector &&collector) +VertexClassifier::VertexClassifier(edm::ParameterSet const &config, edm::ConsumesCollector collector) : VertexCategories(), - tracer_(config, std::move(collector)), - hepMCLabel_(config.getUntrackedParameter("hepMC")) { + tracer_(config, collector), + hepMCLabel_(config.getUntrackedParameter("hepMC")), + particleDataTableToken_(collector.esConsumes()) { collector.consumes(hepMCLabel_); // Set the history depth after hadronization tracer_.depth(-2); @@ -38,7 +39,7 @@ void VertexClassifier::newEvent(edm::Event const &event, edm::EventSetup const & event.getByLabel(hepMCLabel_, mcInformation_); // Get the partivle data table - setup.getData(particleDataTable_); + particleDataTable_ = setup.getHandle(particleDataTableToken_); // Create the list of primary vertices associated to the event genPrimaryVertices(); From a565857ffa1eeb4c5422b56fbd6054780f6d1770 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 15 Sep 2021 19:21:53 +0200 Subject: [PATCH 627/923] Modify the run3 scenarios with the modified material xml files --- .../Geometry/python/dict2021Geometry.py | 10 +- .../Geometry/python/dict2026Geometry.py | 2 +- .../data/dd4hep/cmsExtendedGeometry2021.xml | 10 +- .../dd4hep/cmsExtendedGeometry2026D86.xml | 2 +- .../python/cmsExtendedGeometry2021XML_cfi.py | 10 +- .../cmsExtendedGeometry2026D86XML_cfi.py | 2 +- .../data/tecmaterial/2021/v2/tecmaterial.xml | 1093 ----------------- .../python/cmsExtendedGeometry2021XML_cfi.py | 2 +- 8 files changed, 19 insertions(+), 1112 deletions(-) delete mode 100644 Geometry/TrackerCommonData/data/tecmaterial/2021/v2/tecmaterial.xml diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 5b26a5f5a45ac..0ea1374d7e778 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -146,7 +146,7 @@ "O6" : { 1 : [ 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', @@ -613,8 +613,8 @@ '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/tibtidcommonmaterial/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial/2021/v2/tibmaterial.xml', 'Geometry/TrackerCommonData/data/tibmodpar.xml', 'Geometry/TrackerCommonData/data/tibmodule0.xml', 'Geometry/TrackerCommonData/data/tibmodule0a.xml', @@ -647,7 +647,7 @@ '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/tidmaterial/2021/v2/tidmaterial.xml', 'Geometry/TrackerCommonData/data/tidmodpar.xml', 'Geometry/TrackerCommonData/data/tidmodule0.xml', 'Geometry/TrackerCommonData/data/tidmodule0r.xml', @@ -670,7 +670,7 @@ '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/tobmaterial/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/tobmodpar.xml', 'Geometry/TrackerCommonData/data/tobmodule0.xml', 'Geometry/TrackerCommonData/data/tobmodule2.xml', diff --git a/Configuration/Geometry/python/dict2026Geometry.py b/Configuration/Geometry/python/dict2026Geometry.py index d450ab5c3b596..1812e975e7491 100644 --- a/Configuration/Geometry/python/dict2026Geometry.py +++ b/Configuration/Geometry/python/dict2026Geometry.py @@ -978,7 +978,7 @@ 1 : [ 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', - 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v2/ectkcablemat.xml', 'Geometry/EcalCommonData/data/ebalgo.xml', 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/ebrot.xml', diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml index e4f8afe1ef8e4..739123843dce2 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -5,7 +5,7 @@ - + @@ -53,8 +53,8 @@ - - + + @@ -87,7 +87,7 @@ - + @@ -110,7 +110,7 @@ - + diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D86.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D86.xml index feda0018c382c..d014f9a63c8f8 100644 --- a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D86.xml +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D86.xml @@ -44,7 +44,7 @@ - + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py index e5b7bdb572d2d..b9882cdacf1ea 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -6,7 +6,7 @@ XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', @@ -54,8 +54,8 @@ '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/tibtidcommonmaterial/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial/2021/v2/tibmaterial.xml', 'Geometry/TrackerCommonData/data/tibmodpar.xml', 'Geometry/TrackerCommonData/data/tibmodule0.xml', 'Geometry/TrackerCommonData/data/tibmodule0a.xml', @@ -88,7 +88,7 @@ '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/tidmaterial/2021/v2/tidmaterial.xml', 'Geometry/TrackerCommonData/data/tidmodpar.xml', 'Geometry/TrackerCommonData/data/tidmodule0.xml', 'Geometry/TrackerCommonData/data/tidmodule0r.xml', @@ -111,7 +111,7 @@ '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/tobmaterial/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/tobmodpar.xml', 'Geometry/TrackerCommonData/data/tobmodule0.xml', 'Geometry/TrackerCommonData/data/tobmodule2.xml', diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D86XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D86XML_cfi.py index aaed012b14ef0..965b77ff33df9 100644 --- a/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D86XML_cfi.py +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometry2026D86XML_cfi.py @@ -45,7 +45,7 @@ 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', 'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml', 'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml', - 'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2026/v2/ectkcablemat.xml', 'Geometry/EcalCommonData/data/ebalgo.xml', 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/ebrot.xml', diff --git a/Geometry/TrackerCommonData/data/tecmaterial/2021/v2/tecmaterial.xml b/Geometry/TrackerCommonData/data/tecmaterial/2021/v2/tecmaterial.xml deleted file mode 100644 index 72cda28a1df89..0000000000000 --- a/Geometry/TrackerCommonData/data/tecmaterial/2021/v2/tecmaterial.xml +++ /dev/null @@ -1,1093 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py index 74e3b80025565..f036c8be47612 100644 --- a/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py +++ b/Geometry/TrackerCommonData/python/cmsExtendedGeometry2021XML_cfi.py @@ -136,7 +136,7 @@ 'Geometry/TrackerCommonData/data/tobrod5h.xml', 'Geometry/TrackerCommonData/data/tobrod5.xml', 'Geometry/TrackerCommonData/data/tob/v3/tob.xml', - 'Geometry/TrackerCommonData/data/tecmaterial/2021/v2/tecmaterial.xml', + 'Geometry/TrackerCommonData/data/tecmaterial/2021/v1/tecmaterial.xml', 'Geometry/TrackerCommonData/data/tecmodpar.xml', 'Geometry/TrackerCommonData/data/tecmodule0.xml', 'Geometry/TrackerCommonData/data/tecmodule0r.xml', From bbb1345c78b296b1223e8c74c0e7c1a888f54e54 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 14:02:02 -0500 Subject: [PATCH 628/923] Addes esConsumes to TauDiscriminationAgainstCaloMuon --- .../plugins/TauDiscriminationAgainstCaloMuon.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/TauDiscriminationAgainstCaloMuon.cc b/RecoTauTag/RecoTau/plugins/TauDiscriminationAgainstCaloMuon.cc index 71781232b69c4..ad41537b2dbfb 100644 --- a/RecoTauTag/RecoTau/plugins/TauDiscriminationAgainstCaloMuon.cc +++ b/RecoTauTag/RecoTau/plugins/TauDiscriminationAgainstCaloMuon.cc @@ -112,6 +112,8 @@ namespace { const TransientTrackBuilder* trackBuilder_; const CaloGeometry* caloGeometry_; + const edm::ESGetToken trackBuilderToken_; + const edm::ESGetToken caloGeometryToken_; TauLeadTrackExtractor leadTrackExtractor_; @@ -130,7 +132,9 @@ namespace { template TauDiscriminationAgainstCaloMuon::TauDiscriminationAgainstCaloMuon( const edm::ParameterSet& cfg) - : TauDiscriminationProducerBase(cfg) { + : TauDiscriminationProducerBase(cfg), + trackBuilderToken_(this->esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + caloGeometryToken_(this->esConsumes()) { srcEcalRecHitsBarrel_ = cfg.getParameter("srcEcalRecHitsBarrel"); srcEcalRecHitsEndcap_ = cfg.getParameter("srcEcalRecHitsEndcap"); srcHcalRecHits_ = cfg.getParameter("srcHcalRecHits"); @@ -156,16 +160,12 @@ namespace { evt.getByLabel(srcEcalRecHitsEndcap_, eeRecHits_); evt.getByLabel(srcHcalRecHits_, hbheRecHits_); - edm::ESHandle trackBuilderHandle; - evtSetup.get().get("TransientTrackBuilder", trackBuilderHandle); - trackBuilder_ = trackBuilderHandle.product(); + trackBuilder_ = &evtSetup.getData(trackBuilderToken_); if (!trackBuilder_) { edm::LogError("TauDiscriminationAgainstCaloMuon::discriminate") << " Failed to access TransientTrackBuilder !!"; } - edm::ESHandle caloGeometryHandle; - evtSetup.get().get(caloGeometryHandle); - caloGeometry_ = caloGeometryHandle.product(); + caloGeometry_ = &evtSetup.getData(caloGeometryToken_); if (!caloGeometry_) { edm::LogError("TauDiscriminationAgainstCaloMuon::discriminate") << " Failed to access CaloGeometry !!"; } From 3b3c46de9ee9f818410becba6d0f4bc9894041d2 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 15:05:47 -0500 Subject: [PATCH 629/923] Added esConsumes to photonIsolationHIProducer Removed EventSetup dependency from Calculators --- .../interface/EcalClusterIsoCalculator.h | 10 +--------- .../interface/HcalRechitIsoCalculator.h | 3 +-- .../plugins/photonIsolationHIProducer.cc | 12 ++++++++++-- RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc | 4 +--- RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc | 12 ++---------- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h b/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h index b3080c9994752..8a6866b5dddfd 100644 --- a/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h +++ b/RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h @@ -1,20 +1,12 @@ #ifndef HiEgammaAlgos_EcalClusterIsoCalculator_h #define HiEgammaAlgos_EcalClusterIsoCalculator_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 "DataFormats/EgammaReco/interface/BasicClusterFwd.h" #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" class EcalClusterIsoCalculator { public: - EcalClusterIsoCalculator(const edm::Event &iEvent, - const edm::EventSetup &iSetup, - const edm::Handle barrel, + EcalClusterIsoCalculator(const edm::Handle barrel, const edm::Handle endcap); /// Return the ecal cluster energy in a cone around the SC diff --git a/RecoHI/HiEgammaAlgos/interface/HcalRechitIsoCalculator.h b/RecoHI/HiEgammaAlgos/interface/HcalRechitIsoCalculator.h index 418e28c5b0ead..41c5692724016 100644 --- a/RecoHI/HiEgammaAlgos/interface/HcalRechitIsoCalculator.h +++ b/RecoHI/HiEgammaAlgos/interface/HcalRechitIsoCalculator.h @@ -18,8 +18,7 @@ class HcalRechitIsoCalculator { public: - HcalRechitIsoCalculator(const edm::Event &iEvent, - const edm::EventSetup &iSetup, + HcalRechitIsoCalculator(const CaloGeometry *geometry, const edm::Handle hbhe, const edm::Handle hfLabel, const edm::Handle hoLabel); diff --git a/RecoHI/HiEgammaAlgos/plugins/photonIsolationHIProducer.cc b/RecoHI/HiEgammaAlgos/plugins/photonIsolationHIProducer.cc index f3d2525f6a1a9..db957b157b9c2 100644 --- a/RecoHI/HiEgammaAlgos/plugins/photonIsolationHIProducer.cc +++ b/RecoHI/HiEgammaAlgos/plugins/photonIsolationHIProducer.cc @@ -4,6 +4,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #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 "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -39,6 +40,7 @@ class photonIsolationHIProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT tracks_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; + const edm::ESGetToken geometryToken_; std::string trackQuality_; }; @@ -54,6 +56,7 @@ photonIsolationHIProducer::photonIsolationHIProducer(const edm::ParameterSet& co endcapClusters_(consumes(config.getParameter("basicClusterEndcap"))), tracks_(consumes(config.getParameter("trackCollection"))), ecalClusterToolsESGetTokens_{consumesCollector()}, + geometryToken_{esConsumes()}, trackQuality_(config.getParameter("trackQuality")) { produces(); } @@ -82,8 +85,13 @@ void photonIsolationHIProducer::produce(edm::Event& evt, const edm::EventSetup& reco::HIPhotonIsolationMap::Filler filler(*outputMap); std::vector isoVector; - EcalClusterIsoCalculator CxC(evt, es, barrelClusters, endcapClusters); - HcalRechitIsoCalculator RxC(evt, es, hbhe, hf, ho); + EcalClusterIsoCalculator CxC(barrelClusters, endcapClusters); + edm::ESHandle geometryHandle = es.getHandle(geometryToken_); + const CaloGeometry* geometry = nullptr; + if (geometryHandle.isValid()) { + geometry = geometryHandle.product(); + } + HcalRechitIsoCalculator RxC(geometry, hbhe, hf, ho); TrackIsoCalculator TxC(*trackCollection, trackQuality_); EcalClusterLazyTools lazyTool(evt, ecalClusterToolsESGetTokens_.get(es), barrelEcalHits_, endcapEcalHits_); diff --git a/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc b/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc index 782cbb350da24..65df08d3bdded 100644 --- a/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc +++ b/RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc @@ -14,9 +14,7 @@ using namespace edm; using namespace reco; using namespace std; -EcalClusterIsoCalculator::EcalClusterIsoCalculator(const edm::Event &iEvent, - const edm::EventSetup &iSetup, - const edm::Handle pEBclusters, +EcalClusterIsoCalculator::EcalClusterIsoCalculator(const edm::Handle pEBclusters, const edm::Handle pEEclusters) { if (pEBclusters.isValid()) fEBclusters_ = pEBclusters.product(); diff --git a/RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc b/RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc index 1a7cc8db35078..b1fc1a7f49d7a 100644 --- a/RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc +++ b/RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc @@ -2,8 +2,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "DataFormats/Common/interface/Handle.h" @@ -13,8 +11,7 @@ using namespace edm; using namespace reco; -HcalRechitIsoCalculator::HcalRechitIsoCalculator(const edm::Event &iEvent, - const edm::EventSetup &iSetup, +HcalRechitIsoCalculator::HcalRechitIsoCalculator(const CaloGeometry *geometry, const edm::Handle hbhe, const edm::Handle hf, const edm::Handle ho) { @@ -33,12 +30,7 @@ HcalRechitIsoCalculator::HcalRechitIsoCalculator(const edm::Event &iEvent, else fHBHERecHits_ = nullptr; - ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - if (geometryHandle.isValid()) - geometry_ = geometryHandle.product(); - else - geometry_ = nullptr; + geometry_ = geometry; } double HcalRechitIsoCalculator::getHcalRechitIso(const reco::SuperClusterRef cluster, From b378b533f41362e5477b1ce9fa206a7035523c3b Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 18 Aug 2021 20:34:35 +0200 Subject: [PATCH 630/923] Migrate PixelFitterByConformalMappingAndLineProducer to esConsumes() --- ...FitterByConformalMappingAndLineProducer.cc | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc index 5a1c9f69a95a3..ad9f319a71742 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc @@ -4,7 +4,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/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -21,15 +20,16 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProducer<> { public: explicit PixelFitterByConformalMappingAndLineProducer(const edm::ParameterSet& iConfig) - : theTTRHBuilderName(iConfig.getParameter("TTRHBuilder")), + : theTTRHBuilderToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("TTRHBuilder")))), + theTrackerToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()), theFixImpactParameter(0), theUseFixImpactParameter(false) { if (iConfig.getParameter("useFixImpactParameter")) { theFixImpactParameter = iConfig.getParameter("fixImpactParameter"); theUseFixImpactParameter = true; } - - produces(); } ~PixelFitterByConformalMappingAndLineProducer() override {} @@ -45,7 +45,10 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProdu private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - std::string theTTRHBuilderName; + const edm::ESGetToken theTTRHBuilderToken; + const edm::ESGetToken theTrackerToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; double theFixImpactParameter; bool theUseFixImpactParameter; }; @@ -53,19 +56,12 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProdu void PixelFitterByConformalMappingAndLineProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle ttrhBuilder; - iSetup.get().get(theTTRHBuilderName, ttrhBuilder); - - edm::ESHandle tracker; - iSetup.get().get(tracker); - - edm::ESHandle field; - iSetup.get().get(field); - - auto impl = std::make_unique( - ttrhBuilder.product(), tracker.product(), field.product(), theFixImpactParameter, theUseFixImpactParameter); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace(thePutToken, + std::make_unique(&iSetup.getData(theTTRHBuilderToken), + &iSetup.getData(theTrackerToken), + &iSetup.getData(theFieldToken), + theFixImpactParameter, + theUseFixImpactParameter)); } DEFINE_FWK_MODULE(PixelFitterByConformalMappingAndLineProducer); From 50c11b1622f0b0ccc95a1d416588e3216125738a Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Wed, 15 Sep 2021 15:15:21 -0500 Subject: [PATCH 631/923] Add a unit test for correctionlib external Following the update at cms-sw/cmsdist#7301 --- PhysicsTools/Utilities/test/BuildFile.xml | 3 +- PhysicsTools/Utilities/test/corrections.json | 60 +++++++++++++++++++ .../Utilities/test/test_correctionlib.cc | 27 +++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 PhysicsTools/Utilities/test/corrections.json create mode 100644 PhysicsTools/Utilities/test/test_correctionlib.cc diff --git a/PhysicsTools/Utilities/test/BuildFile.xml b/PhysicsTools/Utilities/test/BuildFile.xml index 1c355e4a4a7b7..2d68b9ec24fcf 100644 --- a/PhysicsTools/Utilities/test/BuildFile.xml +++ b/PhysicsTools/Utilities/test/BuildFile.xml @@ -1,6 +1,7 @@ - + + diff --git a/PhysicsTools/Utilities/test/corrections.json b/PhysicsTools/Utilities/test/corrections.json new file mode 100644 index 0000000000000..fd45ad1b1d8f9 --- /dev/null +++ b/PhysicsTools/Utilities/test/corrections.json @@ -0,0 +1,60 @@ +{ + "schema_version": 2, + "description": "A few test corrections", + "corrections": [ + { "name": "test corr", + "description": null, + "version": 2, + "inputs": [ + { "name": "pt", + "type": "real", + "description": null + }, + { "name": "syst", + "type": "string", + "description": null + } + ], + "output": { + "name": "a scale", + "type": "real", + "description": null + }, + "generic_formulas": null, + "data": { + "nodetype": "binning", + "input": "pt", + "edges": [ 0.0, 20.0, 40.0, Infinity ], + "content": [ + { "nodetype": "category", + "input": "syst", + "content": [ + { "key": "blah", "value": 1.1 }, + { "key": "blah2", "value": 2.2 } + ], + "default": null + }, + { "nodetype": "category", + "input": "syst", + "content": [ + { "key": "blah2", "value": 1.3 }, + { "key": "blah3", + "value": { + "nodetype": "formula", + "expression": "0.25*x + exp([0])", + "parser": "TFormula", + "variables": [ "pt" ], + "parameters": [ 3.1 ] + } + } + ], + "default": null + }, + 1.0 + ], + "flow": "error" + } + } + ], + "compound_corrections": null +} diff --git a/PhysicsTools/Utilities/test/test_correctionlib.cc b/PhysicsTools/Utilities/test/test_correctionlib.cc new file mode 100644 index 0000000000000..bd6b752fa040d --- /dev/null +++ b/PhysicsTools/Utilities/test/test_correctionlib.cc @@ -0,0 +1,27 @@ +#include +#include +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "correction.h" + +class test_correctionlib : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(test_correctionlib); + CPPUNIT_TEST(checkAll); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp() {} + void tearDown() {} + void checkAll(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(test_correctionlib); + +void test_correctionlib::checkAll() { + edm::FileInPath testfile("PhysicsTools/Utilities/test/corrections.json"); + auto cset = correction::CorrectionSet::from_file(testfile.fullPath()); + CPPUNIT_ASSERT(cset->at("test corr")); + CPPUNIT_ASSERT_THROW(cset->at("nonexistent"), std::out_of_range); + auto corr = cset->at("test corr"); + CPPUNIT_ASSERT(corr->evaluate({12.0, "blah"}) == 1.1); + CPPUNIT_ASSERT(corr->evaluate({31.0, "blah3"}) == 0.25 * 31.0 + std::exp(3.1)); +} From a5c930aebef887f1e7973b878a9341a07ef01c89 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 15 Sep 2021 15:36:44 -0500 Subject: [PATCH 632/923] Added esConsumes to HIMultiTrackSelector --- RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc | 7 ++++--- RecoHI/HiTracking/plugins/HIMultiTrackSelector.h | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc b/RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc index 0fd4d8dc85d7a..ea0a9df4858db 100644 --- a/RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc +++ b/RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc @@ -160,6 +160,9 @@ HIMultiTrackSelector::HIMultiTrackSelector(const edm::ParameterSet &cfg) } mvaType_ = type; } + if (useForestFromDB_) { + forestToken_ = esConsumes(edm::ESInputTag("", forestLabel_)); + } std::vector trkSelectors(cfg.getParameter>("trackSelectors")); qualityToSet_.reserve(trkSelectors.size()); vtxNumber_.reserve(trkSelectors.size()); @@ -730,9 +733,7 @@ void HIMultiTrackSelector::processMVA(edm::Event &evt, GBRForest const *forest = forest_; if (useForestFromDB_) { - edm::ESHandle forestHandle; - es.get().get(forestLabel_, forestHandle); - forest = forestHandle.product(); + forest = &es.getData(forestToken_); } auto gbrVal = forest->GetClassifier(&gbrValues[0]); diff --git a/RecoHI/HiTracking/plugins/HIMultiTrackSelector.h b/RecoHI/HiTracking/plugins/HIMultiTrackSelector.h index c0d861a6fc1f2..2d4bcc1f1bd32 100644 --- a/RecoHI/HiTracking/plugins/HIMultiTrackSelector.h +++ b/RecoHI/HiTracking/plugins/HIMultiTrackSelector.h @@ -50,6 +50,8 @@ enum MVAVARIABLES { etaerror = 14 }; +class GBRWrapperRcd; + class dso_hidden HIMultiTrackSelector : public edm::stream::EDProducer<> { private: public: @@ -175,6 +177,7 @@ class dso_hidden HIMultiTrackSelector : public edm::stream::EDProducer<> { std::string forestLabel_; std::vector forestVars_; GBRForest *forest_; + edm::ESGetToken forestToken_; bool useForestFromDB_; std::string dbFileName_; }; From 53e9aaf6a818a4d1743b29439a6d7d655ae6139d Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 18 Aug 2021 20:41:45 +0200 Subject: [PATCH 633/923] Migrate PixelFitterByHelixProjectionsProducer to esConsumes --- .../interface/PixelFitterByHelixProjections.h | 5 ++-- .../PixelFitterByHelixProjectionsProducer.cc | 27 ++++++++++--------- .../PixelFitterByConformalMappingAndLine.cc | 1 - .../src/PixelFitterByHelixProjections.cc | 10 ++----- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h index 1b9633e436630..e2b39a27f3783 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -14,7 +13,7 @@ class TrackerTopology; class PixelFitterByHelixProjections final : public PixelFitterBase { public: - explicit PixelFitterByHelixProjections(const edm::EventSetup *es, + explicit PixelFitterByHelixProjections(const TrackerTopology *ttopo, const MagneticField *field, bool scaleErrorsForBPix1, float scaleFactor); @@ -24,9 +23,9 @@ class PixelFitterByHelixProjections final : public PixelFitterBase { const edm::EventSetup &setup) const override; private: + const TrackerTopology *theTopo; const MagneticField *theField; const bool thescaleErrorsForBPix1; const float thescaleFactor; - TrackerTopology const *theTopo = nullptr; }; #endif diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc index 5cf2b36b27cab..1755f911f4207 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc @@ -4,7 +4,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/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -15,14 +14,17 @@ #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { public: explicit PixelFitterByHelixProjectionsProducer(const edm::ParameterSet& iConfig) - : thescaleErrorsForBPix1(iConfig.getParameter("scaleErrorsForBPix1")), - thescaleFactor(iConfig.getParameter("scaleFactor")) { - produces(); - } + : theTopoToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()), + thescaleErrorsForBPix1(iConfig.getParameter("scaleErrorsForBPix1")), + thescaleFactor(iConfig.getParameter("scaleFactor")) {} ~PixelFitterByHelixProjectionsProducer() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -34,6 +36,10 @@ class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + + const edm::ESGetToken theTopoToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; const bool thescaleErrorsForBPix1; const float thescaleFactor; }; @@ -41,13 +47,10 @@ class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { void PixelFitterByHelixProjectionsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle fieldESH; - iSetup.get().get(fieldESH); - - auto impl = std::make_unique( - &iSetup, fieldESH.product(), thescaleErrorsForBPix1, thescaleFactor); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace( + thePutToken, + std::make_unique( + &iSetup.getData(theTopoToken), &iSetup.getData(theFieldToken), thescaleErrorsForBPix1, thescaleFactor)); } DEFINE_FWK_MODULE(PixelFitterByHelixProjectionsProducer); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc index b25bfd7ae8ff4..63b06050a1ae6 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc @@ -1,7 +1,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc index 050d36c977adc..0338a381d5b39 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc @@ -30,7 +30,6 @@ #include "DataFormats/GeometryVector/interface/Pi.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "CommonTools/Utils/interface/DynArray.h" @@ -88,16 +87,11 @@ namespace { } } // namespace -PixelFitterByHelixProjections::PixelFitterByHelixProjections(const edm::EventSetup* es, +PixelFitterByHelixProjections::PixelFitterByHelixProjections(const TrackerTopology* ttopo, const MagneticField* field, bool scaleErrorsForBPix1, float scaleFactor) - : theField(field), thescaleErrorsForBPix1(scaleErrorsForBPix1), thescaleFactor(scaleFactor) { - //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - es->get().get(tTopo); - theTopo = tTopo.product(); -} + : theTopo(ttopo), theField(field), thescaleErrorsForBPix1(scaleErrorsForBPix1), thescaleFactor(scaleFactor) {} std::unique_ptr PixelFitterByHelixProjections::run(const std::vector& hits, const TrackingRegion& region, From a7acd32a08328c10f6e2afa0c7f32ac89ced37ac Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Wed, 15 Sep 2021 22:49:03 +0200 Subject: [PATCH 634/923] Remove EventSetup parameter from PixelFitterBase::run() --- FastSimulation/Tracking/plugins/PixelTracksProducer.cc | 2 +- .../PixelLowPtUtilities/interface/TrackFitter.h | 4 +--- RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc | 3 +-- .../PixelTrackFitting/interface/KFBasedPixelFitter.h | 6 +----- .../PixelTrackFitting/interface/PixelFitter.h | 6 ++---- .../PixelTrackFitting/interface/PixelFitterBase.h | 6 +----- .../interface/PixelFitterByConformalMappingAndLine.h | 4 +--- .../interface/PixelFitterByHelixProjections.h | 3 +-- .../PixelTrackFitting/interface/PixelNtupletsFitter.h | 4 +--- .../PixelTrackFitting/src/KFBasedPixelFitter.cc | 3 +-- .../src/PixelFitterByConformalMappingAndLine.cc | 5 +---- .../PixelTrackFitting/src/PixelFitterByHelixProjections.cc | 3 +-- .../PixelTrackFitting/src/PixelNtupletsFitter.cc | 4 +--- .../PixelTrackFitting/src/PixelTrackReconstruction.cc | 2 +- 14 files changed, 15 insertions(+), 40 deletions(-) diff --git a/FastSimulation/Tracking/plugins/PixelTracksProducer.cc b/FastSimulation/Tracking/plugins/PixelTracksProducer.cc index 3692c8a4d4bd8..fbb59edd8c4a3 100644 --- a/FastSimulation/Tracking/plugins/PixelTracksProducer.cc +++ b/FastSimulation/Tracking/plugins/PixelTracksProducer.cc @@ -107,7 +107,7 @@ void PixelTracksProducer::produce(edm::Event& e, const edm::EventSetup& es) { } // fitting the triplet - std::unique_ptr track = fitter.run(TripletHits, region, es); + std::unique_ptr track = fitter.run(TripletHits, region); // decide if track should be skipped according to filter if (!theFilter(track.get(), TripletHits)) { diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h index eb6d6fce0039a..11046390f5d43 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -23,8 +22,7 @@ class TrackFitter : public PixelFitterBase { ~TrackFitter() override {} std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const override; + const TrackingRegion& region) const override; private: float getCotThetaAndUpdateZip( diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc index b40d79aa499ca..32bcadeb7478e 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc @@ -39,8 +39,7 @@ namespace { /*****************************************************************************/ std::unique_ptr TrackFitter::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { + const TrackingRegion& region) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h index 8bc3a414a3072..2f64047386149 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h @@ -7,9 +7,6 @@ #include -namespace edm { - class EventSetup; -} namespace reco { class Track; class BeamSpot; @@ -33,8 +30,7 @@ class KFBasedPixelFitter : public PixelFitterBase { ~KFBasedPixelFitter() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: //this two simple classes are copied from Alignment/ReferenceTrajectories in order to avoid dependencies diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h index dcb4bc4e03c34..dfc6b5cc19140 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h @@ -12,10 +12,8 @@ class PixelFitter { void swap(PixelFitter& o) { std::swap(fitter_, o.fitter_); } - std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { - return fitter_->run(hits, region, setup); + std::unique_ptr run(const std::vector& hits, const TrackingRegion& region) const { + return fitter_->run(hits, region); } private: diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h index aaa99ec666bb3..4125d59ea93f2 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h @@ -6,9 +6,6 @@ #include #include -namespace edm { - class EventSetup; -} class TrackingRegion; class TrackingRecHit; @@ -17,7 +14,6 @@ class PixelFitterBase { virtual ~PixelFitterBase() {} virtual std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const = 0; + const TrackingRegion& region) const = 0; }; #endif diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h index 6e32766ce3193..4e2e94398203c 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" class TrackerGeometry; @@ -20,8 +19,7 @@ class PixelFitterByConformalMappingAndLine : public PixelFitterBase { bool useFixImpactParameter); ~PixelFitterByConformalMappingAndLine() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: const TransientTrackingRecHitBuilder *theTTRHBuilder; diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h index e2b39a27f3783..ab84d268f036f 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h @@ -19,8 +19,7 @@ class PixelFitterByHelixProjections final : public PixelFitterBase { float scaleFactor); ~PixelFitterByHelixProjections() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: const TrackerTopology *theTopo; diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h index 9fb8843589669..28d83745bfc2e 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h @@ -5,7 +5,6 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" @@ -15,8 +14,7 @@ class PixelNtupletsFitter final : public PixelFitterBase { explicit PixelNtupletsFitter(float nominalB, const MagneticField* field, bool useRiemannFit); ~PixelNtupletsFitter() override = default; std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const override; + const TrackingRegion& region) const override; private: float nominalB_; diff --git a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc index c3f7a9885b7e7..e58dfa0efbf0a 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc @@ -66,8 +66,7 @@ KFBasedPixelFitter::KFBasedPixelFitter(const Propagator *propagator, theBeamSpot(beamSpot) {} std::unique_ptr KFBasedPixelFitter::run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const { + const TrackingRegion ®ion) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc index 63b06050a1ae6..f4bc223207620 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc @@ -1,7 +1,5 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h" -#include "FWCore/Framework/interface/EventSetup.h" - #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h" @@ -44,8 +42,7 @@ PixelFitterByConformalMappingAndLine::PixelFitterByConformalMappingAndLine( theUseFixImpactParameter(useFixImpactParameter) {} std::unique_ptr PixelFitterByConformalMappingAndLine::run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const { + const TrackingRegion ®ion) const { int nhits = hits.size(); vector points; diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc index 0338a381d5b39..10205acb77d7e 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc @@ -94,8 +94,7 @@ PixelFitterByHelixProjections::PixelFitterByHelixProjections(const TrackerTopolo : theTopo(ttopo), theField(field), thescaleErrorsForBPix1(scaleErrorsForBPix1), thescaleFactor(scaleFactor) {} std::unique_ptr PixelFitterByHelixProjections::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { + const TrackingRegion& region) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc index 96f5d5fe03448..9bc1663ff041d 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc @@ -5,7 +5,6 @@ #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/Pi.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" @@ -24,8 +23,7 @@ PixelNtupletsFitter::PixelNtupletsFitter(float nominalB, const MagneticField* fi : nominalB_(nominalB), field_(field), useRiemannFit_(useRiemannFit) {} std::unique_ptr PixelNtupletsFitter::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup&) const { + const TrackingRegion& region) const { using namespace riemannFit; std::unique_ptr ret; diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc index 065fdfe2b25a0..8a7fd579f6eb1 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc @@ -68,7 +68,7 @@ void PixelTrackReconstruction::run(TracksWithTTRHs& tracks, edm::Event& ev, cons hits[iHit] = tuplet[iHit]; // fitting - std::unique_ptr track = fitter.run(hits, region, es); + std::unique_ptr track = fitter.run(hits, region); if (!track) continue; From 2fd71aa5ceda21e9c7acfffd1ebbb0908a18a686 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Thu, 16 Sep 2021 00:01:06 +0200 Subject: [PATCH 635/923] Improve precision of rotation matching --- DetectorDescription/DDCMS/src/DDNamespace.cc | 19 ++++- .../src/DDCoreToDDXMLOutput.cc | 80 +++++++++++-------- 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/DetectorDescription/DDCMS/src/DDNamespace.cc b/DetectorDescription/DDCMS/src/DDNamespace.cc index e71aab1b3429c..1a624db1936cf 100644 --- a/DetectorDescription/DDCMS/src/DDNamespace.cc +++ b/DetectorDescription/DDCMS/src/DDNamespace.cc @@ -6,6 +6,8 @@ #include "XML/XML.h" #include +#include +#include #include #include @@ -14,7 +16,7 @@ using namespace cms; double cms::rotation_utils::roundBinary(double value) { value = cms_rounding::roundIfNear0(value); - static constexpr double roundingVal = 1 << 14; + static constexpr double roundingVal = 1 << 24; value = (round(value * roundingVal) / roundingVal); // Set -0 to 0 return (cms_rounding::roundIfNear0(value)); @@ -24,7 +26,10 @@ std::string cms::rotation_utils::rotHash(const Double_t* rot) { std::string hashVal; for (int row = 0; row <= 2; ++row) { for (int col = 0; col <= 2; ++col) { - hashVal += std::to_string(roundBinary(rot[(3 * row) + col])); + std::ostringstream numStream; + numStream << std::fixed << std::setprecision(7); + numStream << roundBinary(rot[(3 * row) + col]); + hashVal += numStream.str(); } } return (hashVal); @@ -36,7 +41,10 @@ std::string cms::rotation_utils::rotHash(const dd4hep::Rotation3D& rot) { matrix.assign(9, 0.); rot.GetComponents(matrix.begin()); for (double val : matrix) { - hashVal += std::to_string(roundBinary(val)); + std::ostringstream numStream; + numStream << std::fixed << std::setprecision(7); + numStream << roundBinary(val); + hashVal += numStream.str(); } return (hashVal); } @@ -152,7 +160,10 @@ void DDNamespace::addRotation(const string& name, const dd4hep::Rotation3D& rot) m_context->rotations[n] = rot; if (m_context->makePayload) { string hashVal = cms::rotation_utils::rotHash(rot); - m_context->rotRevMap[hashVal] = n; + if (m_context->rotRevMap.find(hashVal) == m_context->rotRevMap.end()) { + // Only set a rotation that is not already in the map + m_context->rotRevMap[hashVal] = n; + } } } diff --git a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc index 273d807ef0040..422d6605e4b86 100644 --- a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc +++ b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc @@ -39,6 +39,9 @@ static inline constexpr NumType convertGPerCcToMgPerCc(NumType gPerCc) // g/cm^ return (gPerCc * 1000.); } +static constexpr double tol0 = 1.e-11; // Tiny values to be considered equal to 0 +static constexpr double reflectTol = 1.0e-3; // Tolerance for recognizing reflections; Geant4-compatible + namespace cms::rotation_utils { /* For debugging static double determinant(const dd4hep::Rotation3D &rot) { @@ -51,7 +54,8 @@ namespace cms::rotation_utils { } */ - static const std::string identityHash("1.0000000.0000000.0000000.0000001.0000000.0000000.0000000.0000001.000000"); + static const std::string identityHash( + "1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000"); static void addRotWithNewName(cms::DDNamespace& ns, std::string& name, const dd4hep::Rotation3D& rot) { const dd4hep::Rotation3D& rot2 = rot; @@ -61,15 +65,15 @@ namespace cms::rotation_utils { static void addRotWithNewName(cms::DDNamespace& ns, std::string& name, const Double_t* rot) { using namespace cms_rounding; - dd4hep::Rotation3D rot2(roundIfNear0(rot[0]), - roundIfNear0(rot[1]), - roundIfNear0(rot[2]), - roundIfNear0(rot[3]), - roundIfNear0(rot[4]), - roundIfNear0(rot[5]), - roundIfNear0(rot[6]), - roundIfNear0(rot[7]), - roundIfNear0(rot[8])); + dd4hep::Rotation3D rot2(roundIfNear0(rot[0], tol0), + roundIfNear0(rot[1], tol0), + roundIfNear0(rot[2], tol0), + roundIfNear0(rot[3], tol0), + roundIfNear0(rot[4], tol0), + roundIfNear0(rot[5], tol0), + roundIfNear0(rot[6], tol0), + roundIfNear0(rot[7], tol0), + roundIfNear0(rot[8], tol0)); addRotWithNewName(ns, name, rot2); } @@ -115,8 +119,12 @@ void DDCoreToDDXMLOutput::solid(const dd4hep::Solid& solid, const cms::DDParsing xos << " y=\"" << trans[1] << "*mm\""; xos << " z=\"" << trans[2] << "*mm\""; xos << "/>" << std::endl; - std::string rotNameStr = cms::rotation_utils::rotName(rs.rightMatrix()->GetRotationMatrix(), context); - xos << "" << std::endl; + auto rot = rs.rightMatrix()->GetRotationMatrix(); + // The identity rotation can be omitted. + if (cms::rotation_utils::rotHash(rot) != cms::rotation_utils::identityHash) { + std::string rotNameStr = cms::rotation_utils::rotName(rot, context); + xos << "" << std::endl; + } if (shape == cms::DDSolidShape::ddunion) { xos << "" << std::endl; } else if (shape == cms::DDSolidShape::ddsubtraction) { @@ -654,19 +662,21 @@ void DDCoreToDDXMLOutput::element(const TGeoMaterial* material, std::ostream& xo } void DDCoreToDDXMLOutput::rotation(const DDRotation& rotation, std::ostream& xos, const std::string& rotn) { - double tol = 1.0e-3; // Geant4 compatible DD3Vector x, y, z; rotation.rotation().GetComponents(x, y, z); double a, b, c; x.GetCoordinates(a, b, c); - x.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + x.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); y.GetCoordinates(a, b, c); - y.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + y.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); z.GetCoordinates(a, b, c); - z.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + z.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system // this must be -1 - bool reflection((1. - check) > tol); + bool reflection((1. - check) > reflectTol); std::string rotName = rotation.toString(); if (rotName == ":") { if (!rotn.empty()) { @@ -685,31 +695,33 @@ void DDCoreToDDXMLOutput::rotation(const DDRotation& rotation, std::ostream& xos } using namespace cms_rounding; xos << "name=\"" << rotName << "\"" - << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), 4.e-4) << "*deg\"" - << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), 4.e-4) << "*deg\"" - << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), 4.e-4) << "*deg\"" - << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), 4.e-4) << "*deg\"" - << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), 4.e-4) << "*deg\"" - << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), 4.e-4) << "*deg\"/>" << std::endl; + << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\"" + << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\"" + << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\"" + << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\"" + << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\"" + << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl; } void DDCoreToDDXMLOutput::rotation(const dd4hep::Rotation3D& rotation, std::ostream& xos, const cms::DDParsingContext& context, const std::string& rotn) { - double tol = 1.0e-3; // Geant4 compatible ROOT::Math::XYZVector x, y, z; rotation.GetComponents(x, y, z); double a, b, c; x.GetCoordinates(a, b, c); - x.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + x.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); y.GetCoordinates(a, b, c); - y.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + y.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); z.GetCoordinates(a, b, c); - z.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + z.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system // this must be -1 - bool reflection((1. - check) > tol); + bool reflection((1. - check) > reflectTol); if (!reflection) { xos << "" << std::endl; + << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\"" + << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\"" + << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\"" + << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\"" + << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\"" + << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl; } void DDCoreToDDXMLOutput::logicalPart(const DDLogicalPart& lp, std::ostream& xos) { From 27f31531d237ffb57212132c47a8ddf9063a76b8 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 16 Sep 2021 01:21:39 +0200 Subject: [PATCH 636/923] Migrate KFBasedPixelFitterProducer to esConsumes() --- .../plugins/KFBasedPixelFitterProducer.cc | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc index 6357a09597e92..483708cefc5cd 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc @@ -4,7 +4,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/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -30,21 +29,25 @@ class KFBasedPixelFitterProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - std::string thePropagatorLabel; - std::string thePropagatorOppositeLabel; - std::string theTTRHBuilderName; edm::EDGetTokenT theBeamSpotToken; + const edm::ESGetToken theTTRHBuilderToken; + const edm::ESGetToken thePropagatorToken; + const edm::ESGetToken thePropagatorOppositeToken; + const edm::ESGetToken theTrackerToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; }; KFBasedPixelFitterProducer::KFBasedPixelFitterProducer(const edm::ParameterSet& iConfig) - : thePropagatorLabel(iConfig.getParameter("propagator")), - thePropagatorOppositeLabel(iConfig.getParameter("propagator")), - theTTRHBuilderName(iConfig.getParameter("TTRHBuilder")) { + : theTTRHBuilderToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("TTRHBuilder")))), + thePropagatorToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("propagator")))), + thePropagatorOppositeToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("propagator")))), + theTrackerToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()) { if (iConfig.getParameter("useBeamSpotConstraint")) { theBeamSpotToken = consumes(iConfig.getParameter("beamSpotConstraint")); } - - produces(); } void KFBasedPixelFitterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -60,21 +63,6 @@ void KFBasedPixelFitterProducer::fillDescriptions(edm::ConfigurationDescriptions } void KFBasedPixelFitterProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle ttrhb; - iSetup.get().get(theTTRHBuilderName, ttrhb); - - edm::ESHandle propagator; - iSetup.get().get(thePropagatorLabel, propagator); - - edm::ESHandle opropagator; - iSetup.get().get(thePropagatorOppositeLabel, opropagator); - - edm::ESHandle tracker; - iSetup.get().get(tracker); - - edm::ESHandle field; - iSetup.get().get(field); - const reco::BeamSpot* beamspot = nullptr; if (!theBeamSpotToken.isUninitialized()) { edm::Handle hbs; @@ -82,10 +70,13 @@ void KFBasedPixelFitterProducer::produce(edm::StreamID, edm::Event& iEvent, cons beamspot = hbs.product(); } - auto impl = std::make_unique( - propagator.product(), opropagator.product(), ttrhb.product(), tracker.product(), field.product(), beamspot); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace(thePutToken, + std::make_unique(&iSetup.getData(thePropagatorToken), + &iSetup.getData(thePropagatorOppositeToken), + &iSetup.getData(theTTRHBuilderToken), + &iSetup.getData(theTrackerToken), + &iSetup.getData(theFieldToken), + beamspot)); } DEFINE_FWK_MODULE(KFBasedPixelFitterProducer); From 8c93c02d4c88a46a4048e9145f9c998c8425ec24 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 16 Sep 2021 02:34:06 +0200 Subject: [PATCH 637/923] Remove logic for setting nConcurrentLumis in favor of similar logic now in cmsRun --- Configuration/Applications/python/cmsDriverOptions.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Configuration/Applications/python/cmsDriverOptions.py b/Configuration/Applications/python/cmsDriverOptions.py index 6d3643231cdb5..ba8fc6e6442ed 100755 --- a/Configuration/Applications/python/cmsDriverOptions.py +++ b/Configuration/Applications/python/cmsDriverOptions.py @@ -72,13 +72,6 @@ def OptionsFromItems(items): #now adjust the given parameters before passing it to the ConfigBuilder - # concurrency options - nStreams = options.nStreams if options.nStreams != '0' else options.nThreads - if options.nConcurrentLumis == '0': - options.nConcurrentLumis = '1' if nStreams == '1' else '2' - if options.nConcurrentIOVs == '0': - options.nConcurrentIOVs = options.nConcurrentLumis - #trail a "/" to dirin and dirout if options.dirin!='' and (not options.dirin.endswith('/')): options.dirin+='/' if options.dirout!='' and (not options.dirout.endswith('/')): options.dirout+='/' From 78122f6bba32ecc7cb7420bde9147e6fedb9567b Mon Sep 17 00:00:00 2001 From: JeongEun Lee Date: Thu, 16 Sep 2021 11:24:51 +0900 Subject: [PATCH 638/923] fix typo --- RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py index 7c8faaa93df05..4c30bd0764a42 100644 --- a/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py +++ b/RecoTracker/IterativeTracking/python/MixedTripletStep_cff.py @@ -31,7 +31,7 @@ # SEEDING LAYERS from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import * from RecoTracker.IterativeTracking.DetachedTripletStep_cff import detachedTripletStepSeedLayers -from RecoTracker.TkSeedingLayers.seedingLayersEDProducer_cfi as _seedmod +import RecoTracker.TkSeedingLayers.seedingLayersEDProducer_cfi as _seedmod mixedTripletStepSeedLayersA = _seedmod.seedingLayersEDProducer.clone( layerList = ['BPix2+FPix1_pos+FPix2_pos', 'BPix2+FPix1_neg+FPix2_neg'], # layerList = ['BPix1+BPix2+BPix3', From 5d162869ea76ff9368d0117666a0a7d45c2d4636 Mon Sep 17 00:00:00 2001 From: Nicola Amapane Date: Mon, 13 Sep 2021 16:08:27 +0200 Subject: [PATCH 639/923] Migrate a few EDProducers/EDAnalyzers --- CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc | 4 ++-- .../DTCalibration/plugins/DTTTrigCalibration.h | 4 ++-- .../DTCalibration/plugins/DTVDriftCalibration.h | 4 ++-- .../DTCalibration/test/DBTools/DumpDBToFile.h | 14 ++++++++------ .../DTCalibration/test/DBTools/DumpFileToDB.h | 15 ++++++++------- .../src/DTRecSegment2DExtendedProducer.h | 4 ++-- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc index e056c2affac2b..3356d9f06cd8a 100644 --- a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc +++ b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc @@ -3,7 +3,7 @@ * \author A. Vilela Pereira */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -19,7 +19,7 @@ class DTGeometry; class DTTTrigBaseSync; class TFile; -class DTTPAnalyzer : public edm::EDAnalyzer { +class DTTPAnalyzer : public edm::one::EDAnalyzer<> { public: DTTPAnalyzer(const edm::ParameterSet&); ~DTTPAnalyzer() override; diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h index 22ca87e57c0bc..b3ebea14e5145 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h @@ -9,7 +9,7 @@ * \author G. Cerminara - INFN Torino */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h" #include "DataFormats/MuonDetId/interface/DTLayerId.h" @@ -30,7 +30,7 @@ class DTTtrig; class DTStatusFlag; class DTStatusFlagRcd; -class DTTTrigCalibration : public edm::EDAnalyzer { +class DTTTrigCalibration : public edm::one::EDAnalyzer<> { public: /// Constructor DTTTrigCalibration(const edm::ParameterSet& pset); diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h index 5c2ad90476189..361365868827d 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h @@ -7,7 +7,7 @@ * \author M. Giunta */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" @@ -32,7 +32,7 @@ class DTMeanTimerFitter; class DTGeometry; class MuonGeometryRecord; -class DTVDriftCalibration : public edm::EDAnalyzer { +class DTVDriftCalibration : public edm::one::EDAnalyzer<> { public: /// Constructor DTVDriftCalibration(const edm::ParameterSet& pset); diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h index 8af468bf9d11e..a460295c2f5ba 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h +++ b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h @@ -10,7 +10,7 @@ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include @@ -23,20 +23,22 @@ class DTCalibrationMap; class DTReadOutMapping; class DTRecoConditions; -class DumpDBToFile : public edm::EDAnalyzer { +class DumpDBToFile : public edm::one::EDAnalyzer { public: /// Constructor DumpDBToFile(const edm::ParameterSet &pset); /// Destructor - virtual ~DumpDBToFile(); + ~DumpDBToFile() override; // Operations - virtual void beginRun(const edm::Run &run, const edm::EventSetup &setup); + void beginRun(const edm::Run &run, const edm::EventSetup &setup) override; - virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) {} + void endRun(const edm::Run &run, const edm::EventSetup &setup) override {} - virtual void endJob(); + void analyze(const edm::Event &event, const edm::EventSetup &setup) override {} + + void endJob() override; protected: private: diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h index 82dc157111db3..caf00c5652085 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h +++ b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h @@ -10,7 +10,7 @@ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include #include @@ -19,21 +19,22 @@ class DTCalibrationMap; class DTTtrig; -class DumpFileToDB : public edm::EDAnalyzer { +class DumpFileToDB : public edm::one::EDAnalyzer { public: /// Constructor DumpFileToDB(const edm::ParameterSet& pset); /// Destructor - virtual ~DumpFileToDB(); + ~DumpFileToDB() override; // Operations - // Operations - virtual void beginRun(const edm::Run& run, const edm::EventSetup& setup); + void beginRun(const edm::Run& run, const edm::EventSetup& setup) override; + + void endRun(const edm::Run& run, const edm::EventSetup& setup) override {} - virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) {} + void analyze(const edm::Event& event, const edm::EventSetup& setup) override {} - virtual void endJob(); + void endJob() override; protected: private: diff --git a/RecoLocalMuon/DTSegment/src/DTRecSegment2DExtendedProducer.h b/RecoLocalMuon/DTSegment/src/DTRecSegment2DExtendedProducer.h index ae3ae38166c3b..fc7bcecdc3693 100644 --- a/RecoLocalMuon/DTSegment/src/DTRecSegment2DExtendedProducer.h +++ b/RecoLocalMuon/DTSegment/src/DTRecSegment2DExtendedProducer.h @@ -11,7 +11,7 @@ */ /* Base Class Headers */ -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h" #include "DataFormats/DTRecHit/interface/DTRecClusterCollection.h" @@ -31,7 +31,7 @@ class MuonGeometryRecord; /* Class DTRecSegment2DExtendedProducer Interface */ -class DTRecSegment2DExtendedProducer : public edm::EDProducer { +class DTRecSegment2DExtendedProducer : public edm::stream::EDProducer<> { public: /// Constructor DTRecSegment2DExtendedProducer(const edm::ParameterSet&); From 44e249b5fbeed7f8e3878d5c4980b941aaace664 Mon Sep 17 00:00:00 2001 From: Nicola Amapane Date: Mon, 13 Sep 2021 16:52:53 +0200 Subject: [PATCH 640/923] consumes migration for DumpDBToFile te --- .../test/DBTools/DumpDBToFile.cc | 78 ++++++++----------- .../DTCalibration/test/DBTools/DumpDBToFile.h | 34 ++++++-- .../DTCalibration/test/DumpDBToFile_cfg.py | 58 ++++++++++++-- 3 files changed, 112 insertions(+), 58 deletions(-) diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc index f146d99d53b18..aba5fa193fde8 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc @@ -15,22 +15,6 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/DTObjects/interface/DTMtime.h" -#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" -#include "CondFormats/DTObjects/interface/DTTtrig.h" -#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" -#include "CondFormats/DTObjects/interface/DTT0.h" -#include "CondFormats/DataRecord/interface/DTT0Rcd.h" -#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTStatusFlag.h" -#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTDeadFlag.h" -#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" -#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" -#include "CondFormats/DTObjects/interface/DTRecoConditions.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsTtrigRcd.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsUncertRcd.h" #include #include #include @@ -53,6 +37,30 @@ DumpDBToFile::DumpDBToFile(const ParameterSet& pset) { if (format != "Legacy" && format != "DTRecoConditions") throw cms::Exception("IncorrectSetup") << "Parameter format is not valid, check the cfg file" << endl; + + if (dbToDump == "VDriftDB") { + if (format == "Legacy") { + mTimeMapToken_ = esConsumes(); + } else { + vDriftToken_ = esConsumes(); + } + } else if (dbToDump == "TTrigDB") { + if (format == "Legacy") { + tTrigMapToken_ = esConsumes(); + } else { + tTrigToken_ = esConsumes(); + } + } else if (dbToDump == "TZeroDB") { + t0MapToken_ = esConsumes(); + } else if (dbToDump == "NoiseDB") { + statusMapToken_ = esConsumes(); + } else if (dbToDump == "DeadDB") { + deadMapToken_ = esConsumes(); + } else if (dbToDump == "ChannelsDB") { + readOutMapToken_ = esConsumes(); + } else if (dbToDump == "RecoUncertDB") { + uncertToken_ = esConsumes(); + } } DumpDBToFile::~DumpDBToFile() {} @@ -61,44 +69,26 @@ void DumpDBToFile::beginRun(const edm::Run&, const EventSetup& setup) { // Read the right DB accordingly to the parameter dbToDump if (dbToDump == "VDriftDB") { if (format == "Legacy") { - ESHandle mTime; - setup.get().get(mTime); - mTimeMap = &*mTime; + mTimeMap = &setup.getData(mTimeMapToken_); } else if (format == "DTRecoConditions") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; + rconds = &setup.getData(vDriftToken_); } } else if (dbToDump == "TTrigDB") { if (format == "Legacy") { - ESHandle tTrig; - setup.get().get(dbLabel, tTrig); - tTrigMap = &*tTrig; + tTrigMap = &setup.getData(tTrigMapToken_); } else if (format == "DTRecoConditions") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; + rconds = &setup.getData(tTrigToken_); } } else if (dbToDump == "TZeroDB") { - ESHandle t0; - setup.get().get(t0); - tZeroMap = &*t0; + tZeroMap = &setup.getData(t0MapToken_); } else if (dbToDump == "NoiseDB") { - ESHandle status; - setup.get().get(status); - statusMap = &*status; + statusMap = &setup.getData(statusMapToken_); } else if (dbToDump == "DeadDB") { - ESHandle dead; - setup.get().get(dead); - deadMap = &*dead; + deadMap = &setup.getData(deadMapToken_); } else if (dbToDump == "ChannelsDB") { - ESHandle channels; - setup.get().get(channels); - channelsMap = &*channels; + channelsMap = &setup.getData(readOutMapToken_); } else if (dbToDump == "RecoUncertDB") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; + rconds = &setup.getData(uncertToken_); } } @@ -237,7 +227,7 @@ void DumpDBToFile::endJob() { float t0rms; // t0s and rms are TDC counts tZeroMap->get(wireId, t0mean, t0rms, DTTimeUnits::counts); - cout << wireId << " TZero mean (TDC counts): " << t0mean << " TZero RMS (TDC counts): " << t0rms << endl; + // cout << wireId << " TZero mean (TDC counts): " << t0mean << " TZero RMS (TDC counts): " << t0rms << endl; vector consts; consts.push_back(-1); consts.push_back(-1); diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h index a460295c2f5ba..c71f3088c4671 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h +++ b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h @@ -12,16 +12,26 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "CondFormats/DTObjects/interface/DTMtime.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTTtrig.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTStatusFlag.h" +#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTDeadFlag.h" +#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" +#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsTtrigRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsUncertRcd.h" + #include -class DTMtime; -class DTTtrig; -class DTT0; -class DTStatusFlag; -class DTDeadFlag; class DTCalibrationMap; -class DTReadOutMapping; -class DTRecoConditions; class DumpDBToFile : public edm::one::EDAnalyzer { public: @@ -42,6 +52,16 @@ class DumpDBToFile : public edm::one::EDAnalyzer { protected: private: + edm::ESGetToken mTimeMapToken_; + edm::ESGetToken tTrigMapToken_; + edm::ESGetToken t0MapToken_; + edm::ESGetToken statusMapToken_; + edm::ESGetToken deadMapToken_; + edm::ESGetToken readOutMapToken_; + edm::ESGetToken tTrigToken_; + edm::ESGetToken vDriftToken_; + edm::ESGetToken uncertToken_; + const DTMtime *mTimeMap; const DTTtrig *tTrigMap; const DTT0 *tZeroMap; diff --git a/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py b/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py index beac69b901e1e..fa3076bb38774 100644 --- a/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py +++ b/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py @@ -14,7 +14,7 @@ 'TTrigDB', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Database to read: 'TZeroDB', 'TTrigDB', 'VDriftDB', or 'UncertDB'") + "Database to read: 'TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB', 'NoiseDB', 'DeadDB', 'ChannelsDB'") options.register('GT', 'auto:run2_data', #default value @@ -58,7 +58,7 @@ print('\nERROR: invalid value for dbformat: ', DBFORMAT,'\n') exit() -if TYPE not in ['TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB'] : +if TYPE not in ['TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB', 'NoiseDB', 'DeadDB', 'ChannelsDB'] : print('\nERROR: invalid value for type: ', TYPE,'\n') exit() @@ -73,7 +73,10 @@ ofExt = {'TZeroDB' : '_t0.txt', 'TTrigDB' : '_ttrig.txt', 'VDriftDB' : '_vdrift.txt', - 'UncertDB' : '_uncert.txt'} + 'UncertDB' : '_uncert.txt', + 'NoiseDB' : '_noise.txt', + 'DeadDB' : '_dead.txt', + 'ChannelsDB' : '_channels.txt'} if INPUTFILE!="": @@ -102,6 +105,10 @@ if TYPE=="UncertDB" : RECORD = "DTRecoConditionsUncertRcd" +if TYPE == 'NoiseDB' : RECORD = 'DTStatusFlagRcd' +elif TYPE == 'DeadDB' : RECORD = 'DTDeadFlagRcd' +elif TYPE == 'ChannelsDB' : RECORD = 'DTReadOutMappingRcd' + process = cms.Process("DumpDBToFile") process.load("CondCore.CondDB.CondDB_cfi") @@ -203,10 +210,47 @@ outputFileName = cms.untracked.string(OUTPUTFILE) ) +process.dumpNoiseToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('NoiseDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + +process.dumpDeadToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('DeadDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + +process.dumpChannelsToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('ChannelsDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + + -if TYPE=="TZeroDB" : process.p2 = cms.Path(process.dumpT0ToFile) -if TYPE=="TTrigDB" : process.p2 = cms.Path(process.dumpTTrigToFile) -if TYPE=="VDriftDB" : process.p2 = cms.Path(process.dumpVdToFile) -if TYPE=="UncertDB": process.p2 = cms.Path(process.dumpUncertToFile) +if TYPE=="TZeroDB" : process.p2 = cms.Path(process.dumpT0ToFile) +elif TYPE=="TTrigDB" : process.p2 = cms.Path(process.dumpTTrigToFile) +elif TYPE=="VDriftDB" : process.p2 = cms.Path(process.dumpVdToFile) +elif TYPE=="UncertDB": process.p2 = cms.Path(process.dumpUncertToFile) +elif TYPE=='NoiseDB' : process.p2 = cms.Path(process.dumpNoiseToFile) +elif TYPE=='DeadDB' : process.p2 = cms.Path(process.dumpDeadToFile) +elif TYPE=='ChannelsDB' : process.p2 = cms.Path(process.dumpChannelsToFile) From 2577c56ef6b7e0a8806b0e73480e7bd93f141e15 Mon Sep 17 00:00:00 2001 From: Daniele Trocino Date: Thu, 16 Sep 2021 11:11:26 +0200 Subject: [PATCH 641/923] fix issue 35036 in MuonIdProducer: code-checks patch --- RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc b/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc index 68bc441d54a28..39f87e9fe1f7f 100644 --- a/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc +++ b/RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc @@ -89,9 +89,8 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig) if (fillShowerDigis_ && fillMatching_) { edm::ParameterSet showerDigiParameters = iConfig.getParameter("ShowerDigiFillerParameters"); theShowerDigiFiller_ = std::make_unique(showerDigiParameters, consumesCollector()); - } - else { - theShowerDigiFiller_ = std::make_unique(); // to be used to call fillDefault only + } else { + theShowerDigiFiller_ = std::make_unique(); // to be used to call fillDefault only } if (fillCaloCompatibility_) { From 4cb5eebdc32ccd1e6169d7876c971268a8bc0663 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 16 Sep 2021 16:23:02 +0200 Subject: [PATCH 642/923] Protection against missing discriminators for offline taus in L1 DQM --- DQMOffline/L1Trigger/src/L1TTauOffline.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DQMOffline/L1Trigger/src/L1TTauOffline.cc b/DQMOffline/L1Trigger/src/L1TTauOffline.cc index 62838b5956894..417c6fa91edb2 100644 --- a/DQMOffline/L1Trigger/src/L1TTauOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TTauOffline.cc @@ -704,6 +704,19 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, TLorentzVector mytau; mytau.SetPtEtaPhiE(tauIt->pt(), tauIt->eta(), tauIt->phi(), tauIt->energy()); + if ((*antimu)[tauCandidate].workingPoints.empty()) { + LogWarning("This offline tau has no antimu discriminator, skipping"); + continue; + } + if ((*antiele)[tauCandidate].workingPoints.empty()) { + LogWarning("This offline tau has no antiele discriminator, skipping"); + continue; + } + if ((*comb3T)[tauCandidate].workingPoints.empty()) { + LogWarning("This offline tau has no comb3T discriminator, skipping"); + continue; + } + if (fabs(tauIt->charge()) == 1 && fabs(tauIt->eta()) < 2.1 && tauIt->pt() > 20 && (*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] && (*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_] && (*dmf)[tauCandidate] > 0.5 && From 3b6aea1d94ecd3ea35b406d5bbad30223ba935d4 Mon Sep 17 00:00:00 2001 From: Joscha Knolle Date: Thu, 16 Sep 2021 17:15:09 +0200 Subject: [PATCH 643/923] Added pileup profile for UL 2017 5TeV --- .../StandardSequences/python/Mixing.py | 1 + ...ix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 SimGeneral/MixingModule/python/mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py diff --git a/Configuration/StandardSequences/python/Mixing.py b/Configuration/StandardSequences/python/Mixing.py index 792d4259773df..dfd619fd64425 100644 --- a/Configuration/StandardSequences/python/Mixing.py +++ b/Configuration/StandardSequences/python/Mixing.py @@ -118,6 +118,7 @@ def addMixingScenario(label,dict): addMixingScenario("mix_2016_PoissonOOTPU_HighPUTrains_Fill5412",{'file': 'SimGeneral.MixingModule.mix_2016_PoissonOOTPU_HighPUTrains_Fill5412_cfi'}) addMixingScenario("2017_25ns_WinterMC_PUScenarioV1_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_25ns_WinterMC_PUScenarioV1_PoissonOOTPU_cfi'}) addMixingScenario("2017_25ns_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_25ns_UltraLegacy_PoissonOOTPU_cfi'}) +addMixingScenario("2017_5TeV_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_ProjectedPileup_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_ProjectedPileup_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_JuneProjectionFull18_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_JuneProjectionFull18_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_UltraLegacy_PoissonOOTPU_cfi'}) diff --git a/SimGeneral/MixingModule/python/mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py b/SimGeneral/MixingModule/python/mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py new file mode 100644 index 0000000000000..66427ec3b8b01 --- /dev/null +++ b/SimGeneral/MixingModule/python/mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms +from SimGeneral.MixingModule.mix_probFunction_25ns_PoissonOOTPU_cfi import * +mix.input.nbPileupEvents.probFunctionVariable = cms.vint32( + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28 + ) + +mix.input.nbPileupEvents.probValue = cms.vdouble( + 0.191452846727, 0.352881149019, 0.353135299622, 0.100289548466, 0.00224108424297, + 7.19230424545e-08, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0 + ) + From 069dc6c49da3fca2578c64485b11967c958fe893 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 16 Sep 2021 13:53:56 -0500 Subject: [PATCH 644/923] Better handling of commented out code --- .../TkHitPairs/interface/CosmicLayerPairs.h | 3 +- .../CosmicHitPairGeneratorFromLayerPair.cc | 41 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h b/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h index 325f127300438..d816cbe7a9978 100644 --- a/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h +++ b/RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h @@ -26,7 +26,7 @@ class CosmicLayerPairs : public SeedLayerPairs { const TrackerTopology &ttopo) : _geometry(geometry) { init(collrphi, collmatched, track, ttopo); - }; //:isFirstCall(true){}; + }; ~CosmicLayerPairs() override; std::vector operator()() override; @@ -37,7 +37,6 @@ class CosmicLayerPairs : public SeedLayerPairs { const GeometricSearchTracker &, const TrackerTopology &); - //bool isFirstCall; std::string _geometry; std::vector bl; diff --git a/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc b/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc index 56c6cbe504b1f..cbe3726ca0ae2 100644 --- a/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc +++ b/RecoTracker/TkHitPairs/src/CosmicHitPairGeneratorFromLayerPair.cc @@ -12,19 +12,10 @@ using namespace std; // typedef TransientTrackingRecHit::ConstRecHitPointer TkHitPairsCachedHit; -CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair( - const LayerWithHits* inner, - const LayerWithHits* outer, - // LayerCacheType* layerCache, - const TrackerGeometry& geom) - : trackerGeometry(&geom), - //theLayerCache(*layerCache), - theOuterLayer(outer), - theInnerLayer(inner) { - //edm::ESHandle tracker; - //iSetup.get().get(tracker); - //trackerGeometry = tracker.product(); -} +CosmicHitPairGeneratorFromLayerPair::CosmicHitPairGeneratorFromLayerPair(const LayerWithHits* inner, + const LayerWithHits* outer, + const TrackerGeometry& geom) + : trackerGeometry(&geom), theOuterLayer(outer), theInnerLayer(inner) {} CosmicHitPairGeneratorFromLayerPair::~CosmicHitPairGeneratorFromLayerPair() {} void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, OrderedHitPairs& result) { @@ -103,6 +94,7 @@ void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, } /* + // uncomment if the sort operation below needs to be called class CompareHitPairsY { public: CompareHitPairsY(const TrackerGeometry& t): tracker{&t} {} @@ -126,15 +118,16 @@ void CosmicHitPairGeneratorFromLayerPair::hitPairs(const TrackingRegion& region, private: const TrackerGeometry* tracker; - }; */ - // stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(*trackerGeometry)); - // //Seed from overlaps are saved only if - // //no others have been saved - - // if (allthepairs.size()>0) { - // if (seedfromoverlaps) { - // if (result.size()==0) result.push_back(allthepairs[0]); - // } - // else result.push_back(allthepairs[0]); - // } + }; + stable_sort(allthepairs.begin(),allthepairs.end(),CompareHitPairsY(*trackerGeometry)); + //Seed from overlaps are saved only if + //no others have been saved + + if (allthepairs.size()>0) { + if (seedfromoverlaps) { + if (result.size()==0) result.push_back(allthepairs[0]); + } + else result.push_back(allthepairs[0]); + } +*/ } From d9cf86036da2d412e73fb66bb7ff848af4c887fe Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 16 Sep 2021 21:00:51 +0200 Subject: [PATCH 645/923] Fixing LogWarning message --- DQMOffline/L1Trigger/src/L1TTauOffline.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQMOffline/L1Trigger/src/L1TTauOffline.cc b/DQMOffline/L1Trigger/src/L1TTauOffline.cc index 417c6fa91edb2..5faf7ef570bf1 100644 --- a/DQMOffline/L1Trigger/src/L1TTauOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TTauOffline.cc @@ -705,15 +705,15 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, mytau.SetPtEtaPhiE(tauIt->pt(), tauIt->eta(), tauIt->phi(), tauIt->energy()); if ((*antimu)[tauCandidate].workingPoints.empty()) { - LogWarning("This offline tau has no antimu discriminator, skipping"); + edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping" << std::endl; continue; } if ((*antiele)[tauCandidate].workingPoints.empty()) { - LogWarning("This offline tau has no antiele discriminator, skipping"); + edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping" << std::endl; continue; } if ((*comb3T)[tauCandidate].workingPoints.empty()) { - LogWarning("This offline tau has no comb3T discriminator, skipping"); + edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping" << std::endl; continue; } From e2caca0439205cedf5572179ca1c38b89a0d835b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 16 Sep 2021 14:39:10 -0500 Subject: [PATCH 646/923] Added more esConsumes to L1MuDTExtrapolationUnit Helper classes no longer depend on EventSetup --- L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc | 27 ++++++++----------- L1Trigger/DTTrackFinder/src/L1MuDTEUX.h | 12 ++++----- .../src/L1MuDTExtrapolationUnit.cc | 15 ++++++----- .../src/L1MuDTExtrapolationUnit.h | 9 ++++--- L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc | 4 +-- L1Trigger/DTTrackFinder/src/L1MuDTSEU.h | 4 ++- 6 files changed, 35 insertions(+), 36 deletions(-) diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc index 0d16a83cf4632..d28aa4b3d1e02 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc @@ -34,9 +34,7 @@ #include "L1Trigger/DTTrackFinder/src/L1MuDTSEU.h" #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "CondFormats/L1TObjects/interface/L1MuDTExtLut.h" -#include "CondFormats/DataRecord/interface/L1MuDTExtLutRcd.h" #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h" -#include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h" using namespace std; @@ -89,10 +87,7 @@ bool L1MuDTEUX::operator==(const L1MuDTEUX& eux) const { // // run EUX // -void L1MuDTEUX::run(const edm::EventSetup& c) { - c.get().get(theExtLUTs); - c.get().get(pars); - +void L1MuDTEUX::run(const L1MuDTExtLut& extLUTs, const L1MuDTTFParameters& pars) { const bool debug4 = m_sp.tf().config()->Debug(4); if (debug4) cout << "Run EUX " << m_id << endl; @@ -138,19 +133,19 @@ void L1MuDTEUX::run(const edm::EventSetup& c) { // Extrapolation TS quality filter int qcut = 0; if (m_seu.ext() == EX12) - qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX13) - qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX14) - qcut = pars->get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st1(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX21) - qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX23) - qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX24) - qcut = pars->get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st2(m_sp.id().wheel(), m_sp.id().sector()); if (m_seu.ext() == EX34) - qcut = pars->get_soc_qcut_st4(m_sp.id().wheel(), m_sp.id().sector()); + qcut = pars.get_soc_qcut_st4(m_sp.id().wheel(), m_sp.id().sector()); if (m_start->quality() < qcut) return; @@ -172,8 +167,8 @@ void L1MuDTEUX::run(const edm::EventSetup& c) { // and add offset (30 degrees ) for extrapolation to adjacent sector int offset = -2144 >> sh_phi; offset *= sec_mod(sector_ta - sector_st); - int low = theExtLUTs->getLow(lut_idx, phib_start); - int high = theExtLUTs->getHigh(lut_idx, phib_start); + int low = extLUTs.getLow(lut_idx, phib_start); + int high = extLUTs.getHigh(lut_idx, phib_start); if (low < 0) low += (1 << sh_phi) - 1; if (high < 0) @@ -190,7 +185,7 @@ void L1MuDTEUX::run(const edm::EventSetup& c) { return; // is phi-difference within the extrapolation window? - bool openlut = pars->get_soc_openlut_extr(m_sp.id().wheel(), m_sp.id().sector()); + bool openlut = pars.get_soc_openlut_extr(m_sp.id().wheel(), m_sp.id().sector()); if ((diff >= low && diff <= high) || m_sp.tf().config()->getopenLUTs() || openlut) { m_result = true; int qual_st = m_start->quality(); diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h index 86116bd73c544..5929238eba468 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTEUX.h @@ -39,6 +39,7 @@ class L1MuDTSectorProcessor; class L1MuDTSEU; class L1MuDTExtLut; class L1MuDTTFParameters; +class L1MuDTExtLut; // --------------------- // -- Class Interface -- @@ -56,7 +57,7 @@ class L1MuDTEUX { bool operator==(const L1MuDTEUX&) const; /// run Extrapolator - void run(const edm::EventSetup& c); + void run(const L1MuDTExtLut& extLUTs, const L1MuDTTFParameters& pars); /// reset Extrapolator void reset(); @@ -113,12 +114,9 @@ class L1MuDTEUX { const L1MuDTTrackSegPhi* m_start; // start track segment const L1MuDTTrackSegPhi* m_target; // target track segment - edm::ESHandle theExtLUTs; // extrapolation look-up tables - int const theExtFilter = 1; // extrapolation quality filter - unsigned short const nbit_phi = 12; // number of bits used for phi - unsigned short const nbit_phib = 10; // number of bits used for phib - - edm::ESHandle pars; + int const theExtFilter = 1; // extrapolation quality filter + unsigned short const nbit_phi = 12; // number of bits used for phi + unsigned short const nbit_phib = 10; // number of bits used for phib }; #endif diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc index b0aec58e6629e..279ba1673e700 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.cc @@ -41,6 +41,7 @@ #include "L1Trigger/DTTrackFinder/interface/L1MuDTTrackSegPhi.h" #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h" #include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h" +#include "CondFormats/DataRecord/interface/L1MuDTExtLutRcd.h" using namespace std; @@ -53,7 +54,7 @@ using namespace std; //---------------- L1MuDTExtrapolationUnit::L1MuDTExtrapolationUnit(const L1MuDTSectorProcessor& sp, edm::ConsumesCollector iC) - : m_sp(sp), m_SEUs(), m_parsToken(iC.esConsumes()) { + : m_sp(sp), m_SEUs(), m_parsToken(iC.esConsumes()), m_extLUTsToken(iC.esConsumes()) { for (int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++) { Extrapolation ext = static_cast(ext_idx); @@ -93,7 +94,9 @@ L1MuDTExtrapolationUnit::~L1MuDTExtrapolationUnit() { // run Extrapolation Unit // void L1MuDTExtrapolationUnit::run(const edm::EventSetup& c) { - pars = c.getHandle(m_parsToken); + auto const& pars = c.getData(m_parsToken); + + L1MuDTExtLut const& extLUTs = c.getData(m_extLUTsToken); SEUmap::const_iterator iter; for (iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++) { @@ -107,14 +110,14 @@ void L1MuDTExtrapolationUnit::run(const edm::EventSetup& c) { if (ts != nullptr && !ts->empty()) { ((*iter).second)->load(ts); - ((*iter).second)->run(c); + ((*iter).second)->run(extLUTs, pars); } } // // use EX21 to cross-check EX12 // - bool run_21 = pars->get_soc_run_21(m_sp.id().wheel(), m_sp.id().sector()); + bool run_21 = pars.get_soc_run_21(m_sp.id().wheel(), m_sp.id().sector()); if (m_sp.tf().config()->getUseEX21() || run_21) { // search for EX12 + EX21 single extrapolation units for (unsigned int startAdr = 0; startAdr < 2; startAdr++) { @@ -214,7 +217,7 @@ const bitset<12>& L1MuDTExtrapolationUnit::getEXTable(Extrapolation ext, unsigne // assert( startAdr >= 0 && startAdr <= 3 ); SEUId seuid = make_pair(ext, startAdr); - return m_SEUs[seuid]->exTable(); + return m_SEUs.find(seuid)->second->exTable(); } // @@ -227,7 +230,7 @@ const bitset<12>& L1MuDTExtrapolationUnit::getQSTable(Extrapolation ext, unsigne // assert( startAdr >= 0 && startAdr <= 3 ); SEUId seuid = make_pair(ext, startAdr); - return m_SEUs[seuid]->qsTable(); + return m_SEUs.find(seuid)->second->qsTable(); } // diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h index 48880dd7f211e..cce6ac4bcca5e 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTExtrapolationUnit.h @@ -45,7 +45,8 @@ class L1MuDTSectorProcessor; class L1MuDTSEU; class L1MuDTTFParameters; class L1MuDTTFParametersRcd; - +class L1MuDTExtLut; +class L1MuDTExtLutRcd; // --------------------- // -- Class Interface -- // --------------------- @@ -94,10 +95,10 @@ class L1MuDTExtrapolationUnit { private: const L1MuDTSectorProcessor& m_sp; // reference to Sector Processor - mutable SEUmap m_SEUs; // Single Extrapolation Units + SEUmap m_SEUs; // Single Extrapolation Units - edm::ESGetToken m_parsToken; - edm::ESHandle pars; + const edm::ESGetToken m_parsToken; + const edm::ESGetToken m_extLUTsToken; }; #endif diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc index 897a2c65aebf3..f0e902292175c 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc @@ -82,7 +82,7 @@ L1MuDTSEU::~L1MuDTSEU() { // // run SEU // -void L1MuDTSEU::run(const edm::EventSetup& c) { +void L1MuDTSEU::run(const L1MuDTExtLut& extLUTs, const L1MuDTTFParameters& pars) { if (L1MuDTTFConfig::Debug(3)) cout << "Run SEU " << m_ext << " " << m_startTS_Id << endl; @@ -121,7 +121,7 @@ void L1MuDTSEU::run(const edm::EventSetup& c) { const L1MuDTTrackSegPhi* target_ts = m_sp.data()->getTSphi(target, reladr); if (target_ts && !target_ts->empty()) { m_EUXs[reladr]->load(m_startTS, target_ts); - m_EUXs[reladr]->run(c); + m_EUXs[reladr]->run(extLUTs, pars); if (m_EUXs[reladr]->result()) m_EXtable.set(reladr); } diff --git a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h index 6be71448bcafe..0a222edd8df7a 100644 --- a/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h +++ b/L1Trigger/DTTrackFinder/src/L1MuDTSEU.h @@ -38,6 +38,8 @@ class L1MuDTSectorProcessor; class L1MuDTTrackSegPhi; class L1MuDTEUX; class L1MuDTERS; +class L1MuDTExtLut; +class L1MuDTTFParameters; // --------------------- // -- Class Interface -- @@ -52,7 +54,7 @@ class L1MuDTSEU { ~L1MuDTSEU(); /// run SEU - void run(const edm::EventSetup& c); + void run(const L1MuDTExtLut& extLUTs, const L1MuDTTFParameters& pars); /// reset SEU void reset(); From ca1d049f84d771a4fa110c9d02415450b387a5df Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 15 Sep 2021 14:37:54 +0200 Subject: [PATCH 647/923] modernize CalibTracker/SiStripDCS --- .../SiStripDCS/plugins/FilterTrackerOn.cc | 67 +++++++++++++++---- .../SiStripDCS/plugins/FilterTrackerOn.h | 45 ------------- .../SiStripDCS/plugins/SealModules.cc | 4 -- .../plugins/SiStripDetVOffHandler.cc | 6 +- .../plugins/SiStripDetVOffPrinter.cc | 2 +- .../plugins/SiStripDetVOffTkMapPlotter.cc | 9 +-- .../plugins/SiStripDetVOffTrendPlotter.cc | 7 +- .../SiStripDCS/plugins/TkVoltageMapCreator.cc | 9 +-- 8 files changed, 67 insertions(+), 82 deletions(-) delete mode 100644 CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h diff --git a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc index 7f490897bdf12..7c8d1ed6c6cb3 100644 --- a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc +++ b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc @@ -1,31 +1,74 @@ -#include "CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h" +// -*- C++ -*- +// +// Package: CalibTracker/SiStripDCS/plugins +// Class: FilterTrackerOn +// +/**\class FilterTrackerOn FilterTrackerOn.cc -#include "FWCore/Framework/interface/EventSetup.h" + Description: EDFilter returning true when the number of modules with HV on in the Tracker is + above a given threshold. + +*/ +// +// Original Author: Marco DE MATTIA +// Created: 2010/03/10 10:51:00 +// +// +// system include files +#include #include #include +// user include files +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.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/Framework/interface/stream/EDFilter.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +class FilterTrackerOn : public edm::stream::EDFilter<> { +public: + explicit FilterTrackerOn(const edm::ParameterSet&); + static void fillDescriptions(edm::ConfigurationDescriptions&); + ~FilterTrackerOn() override; + +private: + bool filter(edm::Event&, const edm::EventSetup&) override; + + int minModulesWithHVoff_; + edm::ESGetToken detVOffToken_; +}; + FilterTrackerOn::FilterTrackerOn(const edm::ParameterSet& iConfig) : minModulesWithHVoff_(iConfig.getParameter("MinModulesWithHVoff")), detVOffToken_(esConsumes()) {} -FilterTrackerOn::~FilterTrackerOn() {} +FilterTrackerOn::~FilterTrackerOn() = default; + +void FilterTrackerOn::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Filters out events in which at least a fraction of Tracker is DCS ON"); + desc.addUntracked("MinModulesWithHVoff", 0); + descriptions.addWithDefaultLabel(desc); +} bool FilterTrackerOn::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - const auto& detVOff = iSetup.getData(detVOffToken_); - // std::cout << "detVOff.getHVoffCounts() = " << detVOff.getHVoffCounts() << " < " << minModulesWithHVoff_; + LogDebug("FilterTrackerOn") << "detVOff.getHVoffCounts() = " << detVOff.getHVoffCounts() << " < " + << minModulesWithHVoff_; if (detVOff.getHVoffCounts() > minModulesWithHVoff_) { - // std::cout << " skipping event" << std::endl; + LogDebug("FilterTrackerOn") << " skipping event"; return false; } - // cout << " keeping event" << endl; + LogDebug("FilterTrackerOn") << " keeping event"; return true; } -// ------------ method called once each job just before starting event loop ------------ -void FilterTrackerOn::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void FilterTrackerOn::endJob() {} +// EDFilter on the max number of modules with HV off +DEFINE_FWK_MODULE(FilterTrackerOn); diff --git a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h deleted file mode 100644 index 8dec5dd9d7269..0000000000000 --- a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- -// -// Package: CalibTracker/SiStripDCS/plugins -// Class: SyncDCSO2O -// -/**\class FilterTrackerOn FilterTrackerOn.cc - - Description: EDFilter returning true when the number of modules with HV on in the Tracker is - above a given threshold. - -*/ -// -// Original Author: Marco DE MATTIA -// Created: 2010/03/10 10:51:00 -// -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" - -class FilterTrackerOn : public edm::EDFilter { -public: - explicit FilterTrackerOn(const edm::ParameterSet&); - ~FilterTrackerOn() override; - -private: - void beginJob() override; - bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - int minModulesWithHVoff_; - edm::ESGetToken detVOffToken_; -}; diff --git a/CalibTracker/SiStripDCS/plugins/SealModules.cc b/CalibTracker/SiStripDCS/plugins/SealModules.cc index b1a302e87c57b..8affcebcffd82 100644 --- a/CalibTracker/SiStripDCS/plugins/SealModules.cc +++ b/CalibTracker/SiStripDCS/plugins/SealModules.cc @@ -4,7 +4,3 @@ #include "FWCore/ServiceRegistry/interface/ServiceMaker.h" #include "CalibTracker/SiStripDCS/interface/SiStripDetVOffBuilder.h" DEFINE_FWK_SERVICE(SiStripDetVOffBuilder); - -// EDFilter on the max number of modules with HV off -#include "CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h" -DEFINE_FWK_MODULE(FilterTrackerOn); diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc index 226ff86079b6f..2c5079f695aa2 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -11,7 +11,7 @@ #include "CalibTracker/SiStripDCS/interface/SiStripDetVOffBuilder.h" -class SiStripDetVOffHandler : public edm::EDAnalyzer { +class SiStripDetVOffHandler : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffHandler(const edm::ParameterSet& iConfig); ~SiStripDetVOffHandler() override; @@ -43,7 +43,7 @@ SiStripDetVOffHandler::SiStripDetVOffHandler(const edm::ParameterSet& iConfig) m_condDb = m_localCondDbFile; } -SiStripDetVOffHandler::~SiStripDetVOffHandler() {} +SiStripDetVOffHandler::~SiStripDetVOffHandler() = default; void SiStripDetVOffHandler::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { // get last payload from condDb diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc index cc80302fa0594..86a17d6c149db 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc @@ -60,7 +60,7 @@ SiStripDetVOffPrinter::SiStripDetVOffPrinter(const edm::ParameterSet& iConfig) m_connectionPool.configure(); } -SiStripDetVOffPrinter::~SiStripDetVOffPrinter() {} +SiStripDetVOffPrinter::~SiStripDetVOffPrinter() = default; void SiStripDetVOffPrinter::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { // use start and end time from config file diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc index 52ccc3ac514ea..bfaa543608797 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -19,12 +19,11 @@ #include "DQM/SiStripCommon/interface/TkHistoMap.h" #include "CommonTools/TrackerMap/interface/TrackerMap.h" -class SiStripDetVOffTkMapPlotter : public edm::EDAnalyzer { +class SiStripDetVOffTkMapPlotter : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffTkMapPlotter(const edm::ParameterSet& iConfig); ~SiStripDetVOffTkMapPlotter() override; void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; - void endJob() override; private: std::string formatIOV(cond::Time_t iov, std::string format = "%Y-%m-%d__%H_%M_%S"); @@ -60,7 +59,7 @@ SiStripDetVOffTkMapPlotter::SiStripDetVOffTkMapPlotter(const edm::ParameterSet& m_connectionPool.configure(); } -SiStripDetVOffTkMapPlotter::~SiStripDetVOffTkMapPlotter() {} +SiStripDetVOffTkMapPlotter::~SiStripDetVOffTkMapPlotter() = default; void SiStripDetVOffTkMapPlotter::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { cond::Time_t theIov = 0; @@ -121,8 +120,6 @@ void SiStripDetVOffTkMapPlotter::analyze(const edm::Event& evt, const edm::Event } } -void SiStripDetVOffTkMapPlotter::endJob() {} - std::string SiStripDetVOffTkMapPlotter::formatIOV(cond::Time_t iov, std::string format) { auto facet = new boost::posix_time::time_facet(format.c_str()); std::ostringstream stream; diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc index 5565d22c58fd3..e55053925de2c 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -26,14 +26,13 @@ #include #include -class SiStripDetVOffTrendPlotter : public edm::EDAnalyzer { +class SiStripDetVOffTrendPlotter : public edm::one::EDAnalyzer<> { public: const std::vector PLOT_COLORS{kRed, kBlue, kBlack, kOrange, kMagenta}; explicit SiStripDetVOffTrendPlotter(const edm::ParameterSet &iConfig); ~SiStripDetVOffTrendPlotter() override; void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override; - void endJob() override; private: std::string formatIOV(cond::Time_t iov, std::string format = "%Y-%m-%d__%H_%M_%S"); @@ -212,8 +211,6 @@ void SiStripDetVOffTrendPlotter::analyze(const edm::Event &evt, const edm::Event } } -void SiStripDetVOffTrendPlotter::endJob() {} - std::string SiStripDetVOffTrendPlotter::formatIOV(cond::Time_t iov, std::string format) { auto facet = new boost::posix_time::time_facet(format.c_str()); std::ostringstream stream; diff --git a/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc b/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc index 1b79296cbe9e7..c479acc1b5231 100644 --- a/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc +++ b/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc @@ -11,7 +11,7 @@ #include #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" @@ -29,7 +29,7 @@ // class decleration // -class TkVoltageMapCreator : public edm::EDAnalyzer { +class TkVoltageMapCreator : public edm::one::EDAnalyzer { public: explicit TkVoltageMapCreator(const edm::ParameterSet&); ~TkVoltageMapCreator() override; @@ -73,10 +73,7 @@ TkVoltageMapCreator::TkVoltageMapCreator(const edm::ParameterSet& iConfig) //now do what ever initialization is needed } -TkVoltageMapCreator::~TkVoltageMapCreator() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +TkVoltageMapCreator::~TkVoltageMapCreator() = default; // // member functions From 2c79af8fdf5f6652fc393441f8a96942d15b0b43 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 16 Sep 2021 15:52:04 -0500 Subject: [PATCH 648/923] Added esConsumes to L1MuBMSectorProcessor Removed EventSetup dependencies from L1MuBMAssignmentUnit --- .../L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc | 18 ++++++------------ .../L1TMuonBarrel/src/L1MuBMAssignmentUnit.h | 7 +++---- .../L1TMuonBarrel/src/L1MuBMSectorProcessor.cc | 7 +++++-- .../L1TMuonBarrel/src/L1MuBMSectorProcessor.h | 3 +++ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc index 60af67357a524..4633f4aba66f3 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc @@ -72,7 +72,7 @@ L1MuBMAssignmentUnit::~L1MuBMAssignmentUnit() {} // // run Assignment Unit // -void L1MuBMAssignmentUnit::run(const edm::EventSetup& c) { +void L1MuBMAssignmentUnit::run(const L1TMuonBarrelParams& bmtfParams) { // enable track candidate m_sp.track(m_id)->enable(); m_sp.tracK(m_id)->enable(); @@ -99,10 +99,10 @@ void L1MuBMAssignmentUnit::run(const edm::EventSetup& c) { m_sp.tracK(m_id)->setBx(bx); // assign phi - PhiAU(c); + PhiAU(bmtfParams); // assign pt and charge - PtAU(c); + PtAU(bmtfParams); // assign quality QuaAU(); @@ -120,10 +120,7 @@ void L1MuBMAssignmentUnit::reset() { // // assign phi with 8 bit precision // -void L1MuBMAssignmentUnit::PhiAU(const edm::EventSetup& c) { - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product(); +void L1MuBMAssignmentUnit::PhiAU(const L1TMuonBarrelParams& bmtfParams) { thePhiLUTs = new L1MuBMLUTHandler(bmtfParams); ///< phi-assignment look-up tables //thePhiLUTs->print(); // calculate phi at station 2 using 8 bits (precision = 0.625 degrees) @@ -198,11 +195,8 @@ void L1MuBMAssignmentUnit::PhiAU(const edm::EventSetup& c) { // // assign pt with 5 bit precision // -void L1MuBMAssignmentUnit::PtAU(const edm::EventSetup& c) { - const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get(); - bmtfParamsRcd.get(bmtfParamsHandle); - const L1TMuonBarrelParams& bmtfParams1 = *bmtfParamsHandle.product(); - const L1TMuonBarrelParamsAllPublic& bmtfParams = L1TMuonBarrelParamsAllPublic(bmtfParams1); +void L1MuBMAssignmentUnit::PtAU(const L1TMuonBarrelParams& bmtfParams1) { + const L1TMuonBarrelParamsAllPublic bmtfParams(bmtfParams1); thePtaLUTs = new L1MuBMLUTHandler(bmtfParams); ///< pt-assignment look-up tables //thePtaLUTs->print(); // get pt-assignment method as function of track class and TS phib values diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h index eef6078495c4d..da67e913ccd89 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h @@ -57,16 +57,16 @@ class L1MuBMAssignmentUnit { ~L1MuBMAssignmentUnit(); /// run Assignment Unit - void run(const edm::EventSetup& c); + void run(const L1TMuonBarrelParams& mbtfParams); /// reset Assignment Unit void reset(); /// assign phi - void PhiAU(const edm::EventSetup& c); + void PhiAU(const L1TMuonBarrelParams&); /// assign pt and charge - void PtAU(const edm::EventSetup& c); + void PtAU(const L1TMuonBarrelParams&); /// assign quality void QuaAU(); @@ -109,7 +109,6 @@ class L1MuBMAssignmentUnit { std::vector m_TSphi; L1MuBMLUTHandler::PtAssMethod m_ptAssMethod; - edm::ESHandle bmtfParamsHandle; L1MuBMLUTHandler* thePtaLUTs; ///< pt-assignment look-up tables L1MuBMLUTHandler* thePhiLUTs; ///< phi-assignment look-up tables static unsigned short nbit_phi; ///< # of bits used for pt-assignment diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc index 6af6a9ff3a6a2..98a1533058c0a 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.cc @@ -62,6 +62,7 @@ L1MuBMSectorProcessor::L1MuBMSectorProcessor(const L1MuBMTrackFinder& tf, m_DataBuffer(new L1MuBMDataBuffer(*this)), m_EU(new L1MuBMExtrapolationUnit(*this, iC)), m_TA(new L1MuBMTrackAssembler(*this)), + m_bmtfParamsToken(iC.esConsumes()), m_AUs(), m_TrackCands(), m_TracKCands() { @@ -139,11 +140,13 @@ void L1MuBMSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSet m_TA->print(); } + L1TMuonBarrelParams const& bmtfParams = c.getData(m_bmtfParamsToken); + // assign pt, eta, phi and quality if (m_AUs[0] && !m_TA->isEmpty(0)) - m_AUs[0]->run(c); + m_AUs[0]->run(bmtfParams); if (m_AUs[1] && !m_TA->isEmpty(1)) - m_AUs[1]->run(c); + m_AUs[1]->run(bmtfParams); if (m_spid.wheel() == -1) { if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2) > 3 && diff --git a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.h b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.h index 2ecd9589ac2a8..afcd6f5fda539 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.h +++ b/L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.h @@ -46,6 +46,8 @@ class L1MuBMTrackAssembler; class L1MuBMAssignmentUnit; class L1MuBMTrackFinder; class L1MuBMTrack; +class L1TMuonBarrelParams; +class L1TMuonBarrelParamsRcd; // --------------------- // -- Class Interface -- @@ -114,6 +116,7 @@ class L1MuBMSectorProcessor { L1MuBMDataBuffer* m_DataBuffer; L1MuBMExtrapolationUnit* m_EU; L1MuBMTrackAssembler* m_TA; + const edm::ESGetToken m_bmtfParamsToken; std::vector m_AUs; std::vector m_TrackCands; From 863711608f7fa5177e0e7f59c2e531711e90bd34 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 09:06:30 +0200 Subject: [PATCH 649/923] Do not abort on failed cudaDeviceGetLimit after cudaDeviceSetLimit --- HeterogeneousCore/CUDAServices/src/CUDAService.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HeterogeneousCore/CUDAServices/src/CUDAService.cc b/HeterogeneousCore/CUDAServices/src/CUDAService.cc index d7f194829d159..c68d1a22a2c1d 100644 --- a/HeterogeneousCore/CUDAServices/src/CUDAService.cc +++ b/HeterogeneousCore/CUDAServices/src/CUDAService.cc @@ -30,7 +30,7 @@ void setCudaLimit(cudaLimit limit, const char* name, size_t request) { } // read back the limit value size_t value; - cudaCheck(cudaDeviceGetLimit(&value, limit)); + result = cudaDeviceGetLimit(&value, limit); if (cudaSuccess != result) { edm::LogWarning("CUDAService") << "CUDA device " << device << ": failed to set limit \"" << name << "\" to " << request << ", current value is " << value; From 22b9df86a6ad7a72cc4b9755a75642d38e938d56 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 02:09:45 +0200 Subject: [PATCH 650/923] Make the CUDAService less verbose by default Add a "verbose" option (disabled by default) to choose between a terse message and the full details. --- .../CUDAServices/interface/CUDAService.h | 1 + .../CUDAServices/src/CUDAService.cc | 211 ++++++++++-------- .../CUDAServices/test/testCUDAService.py | 9 +- 3 files changed, 126 insertions(+), 95 deletions(-) diff --git a/HeterogeneousCore/CUDAServices/interface/CUDAService.h b/HeterogeneousCore/CUDAServices/interface/CUDAService.h index 5295af75513b0..d24571b8e48ce 100644 --- a/HeterogeneousCore/CUDAServices/interface/CUDAService.h +++ b/HeterogeneousCore/CUDAServices/interface/CUDAService.h @@ -33,6 +33,7 @@ class CUDAService { int numberOfDevices_ = 0; std::vector> computeCapabilities_; bool enabled_ = false; + bool verbose_ = false; }; #endif diff --git a/HeterogeneousCore/CUDAServices/src/CUDAService.cc b/HeterogeneousCore/CUDAServices/src/CUDAService.cc index c68d1a22a2c1d..85a1a96ec95fe 100644 --- a/HeterogeneousCore/CUDAServices/src/CUDAService.cc +++ b/HeterogeneousCore/CUDAServices/src/CUDAService.cc @@ -118,7 +118,7 @@ namespace { } // namespace /// Constructor -CUDAService::CUDAService(edm::ParameterSet const& config) { +CUDAService::CUDAService(edm::ParameterSet const& config) : verbose_(config.getUntrackedParameter("verbose")) { bool configEnabled = config.getUntrackedParameter("enabled"); if (not configEnabled) { edm::LogInfo("CUDAService") << "CUDAService disabled by configuration"; @@ -131,9 +131,12 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { << "Disabling the CUDAService."; return; } - edm::LogInfo log("CUDAService"); computeCapabilities_.reserve(numberOfDevices_); - log << "CUDA runtime successfully initialised, found " << numberOfDevices_ << " compute devices.\n\n"; + edm::LogInfo log("CUDAService"); + log << "CUDA runtime successfully initialised, found " << numberOfDevices_ << " compute devices.\n"; + if (verbose_) { + log << '\n'; + } auto const& limits = config.getUntrackedParameter("limits"); auto printfFifoSize = limits.getUntrackedParameter("cudaLimitPrintfFifoSize"); @@ -147,16 +150,24 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { // see the documentation of cudaGetDeviceProperties() for more information. cudaDeviceProp properties; cudaCheck(cudaGetDeviceProperties(&properties, i)); - log << "CUDA device " << i << ": " << properties.name << '\n'; + log << "CUDA device " << i << ": " << properties.name; + if (verbose_) { + log << '\n'; + } // compute capabilities - log << " compute capability: " << properties.major << "." << properties.minor << " (sm_" - << properties.major << properties.minor << ")\n"; computeCapabilities_.emplace_back(properties.major, properties.minor); - log << " streaming multiprocessors: " << std::setw(13) << properties.multiProcessorCount << '\n'; - log << " CUDA cores: " << std::setw(28) - << properties.multiProcessorCount * getCudaCoresPerSM(properties.major, properties.minor) << '\n'; - log << " single to double performance: " << std::setw(8) << properties.singleToDoublePrecisionPerfRatio << ":1\n"; + if (verbose_) { + log << " compute capability: " << properties.major << "." << properties.minor; + } + log << " (sm_" << properties.major << properties.minor << ")\n"; + if (verbose_) { + log << " streaming multiprocessors: " << std::setw(13) << properties.multiProcessorCount << '\n'; + log << " CUDA cores: " << std::setw(28) + << properties.multiProcessorCount * getCudaCoresPerSM(properties.major, properties.minor) << '\n'; + log << " single to double performance: " << std::setw(8) << properties.singleToDoublePrecisionPerfRatio + << ":1\n"; + } // compute mode static constexpr const char* computeModeDescription[] = { @@ -165,10 +176,12 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { "prohibited", // cudaComputeModeProhibited "exclusive (single process)", // cudaComputeModeExclusiveProcess "unknown"}; - log << " compute mode:" << std::right << std::setw(27) - << computeModeDescription[std::min(properties.computeMode, - static_cast(std::size(computeModeDescription)) - 1)] - << '\n'; + if (verbose_) { + log << " compute mode:" << std::right << std::setw(27) + << computeModeDescription[std::min(properties.computeMode, + static_cast(std::size(computeModeDescription)) - 1)] + << '\n'; + } // TODO if a device is in exclusive use, skip it and remove it from the list, instead of failing with abort() cudaCheck(cudaSetDevice(i)); @@ -176,76 +189,82 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { // read the free and total amount of memory available for allocation by the device, in bytes. // see the documentation of cudaMemGetInfo() for more information. - size_t freeMemory, totalMemory; - cudaCheck(cudaMemGetInfo(&freeMemory, &totalMemory)); - log << " memory: " << std::setw(6) << freeMemory / (1 << 20) << " MB free / " << std::setw(6) - << totalMemory / (1 << 20) << " MB total\n"; - log << " constant memory: " << std::setw(6) << properties.totalConstMem / (1 << 10) << " kB\n"; - log << " L2 cache size: " << std::setw(6) << properties.l2CacheSize / (1 << 10) << " kB\n"; + if (verbose_) { + size_t freeMemory, totalMemory; + cudaCheck(cudaMemGetInfo(&freeMemory, &totalMemory)); + log << " memory: " << std::setw(6) << freeMemory / (1 << 20) << " MB free / " << std::setw(6) + << totalMemory / (1 << 20) << " MB total\n"; + log << " constant memory: " << std::setw(6) << properties.totalConstMem / (1 << 10) << " kB\n"; + log << " L2 cache size: " << std::setw(6) << properties.l2CacheSize / (1 << 10) << " kB\n"; + } // L1 cache behaviour - static constexpr const char* l1CacheModeDescription[] = { - "unknown", "local memory", "global memory", "local and global memory"}; - int l1CacheMode = properties.localL1CacheSupported + 2 * properties.globalL1CacheSupported; - log << " L1 cache mode:" << std::setw(26) << std::right << l1CacheModeDescription[l1CacheMode] << '\n'; - log << '\n'; - - log << "Other capabilities\n"; - log << " " << (properties.canMapHostMemory ? "can" : "cannot") - << " map host memory into the CUDA address space for use with cudaHostAlloc()/cudaHostGetDevicePointer()\n"; - log << " " << (properties.pageableMemoryAccess ? "supports" : "does not support") - << " coherently accessing pageable memory without calling cudaHostRegister() on it\n"; - log << " " << (properties.pageableMemoryAccessUsesHostPageTables ? "can" : "cannot") - << " access pageable memory via the host's page tables\n"; - log << " " << (properties.canUseHostPointerForRegisteredMem ? "can" : "cannot") - << " access host registered memory at the same virtual address as the host\n"; - log << " " << (properties.unifiedAddressing ? "shares" : "does not share") - << " a unified address space with the host\n"; - log << " " << (properties.managedMemory ? "supports" : "does not support") - << " allocating managed memory on this system\n"; - log << " " << (properties.concurrentManagedAccess ? "can" : "cannot") - << " coherently access managed memory concurrently with the host\n"; - log << " " - << "the host " << (properties.directManagedMemAccessFromHost ? "can" : "cannot") - << " directly access managed memory on the device without migration\n"; - log << " " << (properties.cooperativeLaunch ? "supports" : "does not support") - << " launching cooperative kernels via cudaLaunchCooperativeKernel()\n"; - log << " " << (properties.cooperativeMultiDeviceLaunch ? "supports" : "does not support") - << " launching cooperative kernels via cudaLaunchCooperativeKernelMultiDevice()\n"; - log << '\n'; + if (verbose_) { + static constexpr const char* l1CacheModeDescription[] = { + "unknown", "local memory", "global memory", "local and global memory"}; + int l1CacheMode = properties.localL1CacheSupported + 2 * properties.globalL1CacheSupported; + log << " L1 cache mode:" << std::setw(26) << std::right << l1CacheModeDescription[l1CacheMode] << '\n'; + log << '\n'; + + log << "Other capabilities\n"; + log << " " << (properties.canMapHostMemory ? "can" : "cannot") + << " map host memory into the CUDA address space for use with cudaHostAlloc()/cudaHostGetDevicePointer()\n"; + log << " " << (properties.pageableMemoryAccess ? "supports" : "does not support") + << " coherently accessing pageable memory without calling cudaHostRegister() on it\n"; + log << " " << (properties.pageableMemoryAccessUsesHostPageTables ? "can" : "cannot") + << " access pageable memory via the host's page tables\n"; + log << " " << (properties.canUseHostPointerForRegisteredMem ? "can" : "cannot") + << " access host registered memory at the same virtual address as the host\n"; + log << " " << (properties.unifiedAddressing ? "shares" : "does not share") + << " a unified address space with the host\n"; + log << " " << (properties.managedMemory ? "supports" : "does not support") + << " allocating managed memory on this system\n"; + log << " " << (properties.concurrentManagedAccess ? "can" : "cannot") + << " coherently access managed memory concurrently with the host\n"; + log << " " + << "the host " << (properties.directManagedMemAccessFromHost ? "can" : "cannot") + << " directly access managed memory on the device without migration\n"; + log << " " << (properties.cooperativeLaunch ? "supports" : "does not support") + << " launching cooperative kernels via cudaLaunchCooperativeKernel()\n"; + log << " " << (properties.cooperativeMultiDeviceLaunch ? "supports" : "does not support") + << " launching cooperative kernels via cudaLaunchCooperativeKernelMultiDevice()\n"; + log << '\n'; + } // set and read the CUDA device flags. // see the documentation of cudaSetDeviceFlags and cudaGetDeviceFlags for more information. - log << "CUDA flags\n"; - unsigned int flags; - cudaCheck(cudaGetDeviceFlags(&flags)); - switch (flags & cudaDeviceScheduleMask) { - case cudaDeviceScheduleAuto: - log << " thread policy: default\n"; - break; - case cudaDeviceScheduleSpin: - log << " thread policy: spin\n"; - break; - case cudaDeviceScheduleYield: - log << " thread policy: yield\n"; - break; - case cudaDeviceScheduleBlockingSync: - log << " thread policy: blocking sync\n"; - break; - default: - log << " thread policy: undefined\n"; - } - if (flags & cudaDeviceMapHost) { - log << " pinned host memory allocations: enabled\n"; - } else { - log << " pinned host memory allocations: disabled\n"; - } - if (flags & cudaDeviceLmemResizeToMax) { - log << " kernel host memory reuse: enabled\n"; - } else { - log << " kernel host memory reuse: disabled\n"; + if (verbose_) { + log << "CUDA flags\n"; + unsigned int flags; + cudaCheck(cudaGetDeviceFlags(&flags)); + switch (flags & cudaDeviceScheduleMask) { + case cudaDeviceScheduleAuto: + log << " thread policy: default\n"; + break; + case cudaDeviceScheduleSpin: + log << " thread policy: spin\n"; + break; + case cudaDeviceScheduleYield: + log << " thread policy: yield\n"; + break; + case cudaDeviceScheduleBlockingSync: + log << " thread policy: blocking sync\n"; + break; + default: + log << " thread policy: undefined\n"; + } + if (flags & cudaDeviceMapHost) { + log << " pinned host memory allocations: enabled\n"; + } else { + log << " pinned host memory allocations: disabled\n"; + } + if (flags & cudaDeviceLmemResizeToMax) { + log << " kernel host memory reuse: enabled\n"; + } else { + log << " kernel host memory reuse: disabled\n"; + } + log << '\n'; } - log << '\n'; // set and read the CUDA resource limits. // see the documentation of cudaDeviceSetLimit() for more information. @@ -279,23 +298,24 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { } } - size_t value; - log << "CUDA limits\n"; - cudaCheck(cudaDeviceGetLimit(&value, cudaLimitPrintfFifoSize)); - log << " printf buffer size: " << std::setw(10) << value / (1 << 20) << " MB\n"; - cudaCheck(cudaDeviceGetLimit(&value, cudaLimitStackSize)); - log << " stack size: " << std::setw(10) << value / (1 << 10) << " kB\n"; - cudaCheck(cudaDeviceGetLimit(&value, cudaLimitMallocHeapSize)); - log << " malloc heap size: " << std::setw(10) << value / (1 << 20) << " MB\n"; - if ((properties.major > 3) or (properties.major == 3 and properties.minor >= 5)) { - cudaCheck(cudaDeviceGetLimit(&value, cudaLimitDevRuntimeSyncDepth)); - log << " runtime sync depth: " << std::setw(10) << value << '\n'; - cudaCheck(cudaDeviceGetLimit(&value, cudaLimitDevRuntimePendingLaunchCount)); - log << " runtime pending launch count: " << std::setw(10) << value << '\n'; + if (verbose_) { + size_t value; + log << "CUDA limits\n"; + cudaCheck(cudaDeviceGetLimit(&value, cudaLimitPrintfFifoSize)); + log << " printf buffer size: " << std::setw(10) << value / (1 << 20) << " MB\n"; + cudaCheck(cudaDeviceGetLimit(&value, cudaLimitStackSize)); + log << " stack size: " << std::setw(10) << value / (1 << 10) << " kB\n"; + cudaCheck(cudaDeviceGetLimit(&value, cudaLimitMallocHeapSize)); + log << " malloc heap size: " << std::setw(10) << value / (1 << 20) << " MB\n"; + if ((properties.major > 3) or (properties.major == 3 and properties.minor >= 5)) { + cudaCheck(cudaDeviceGetLimit(&value, cudaLimitDevRuntimeSyncDepth)); + log << " runtime sync depth: " << std::setw(10) << value << '\n'; + cudaCheck(cudaDeviceGetLimit(&value, cudaLimitDevRuntimePendingLaunchCount)); + log << " runtime pending launch count: " << std::setw(10) << value << '\n'; + } + log << '\n'; } - log << '\n'; } - log << "\n"; // Make sure the caching allocators and stream/event caches are constructed before declaring successful construction if constexpr (cms::cuda::allocator::useCaching) { @@ -304,7 +324,9 @@ CUDAService::CUDAService(edm::ParameterSet const& config) { cms::cuda::getEventCache().clear(); cms::cuda::getStreamCache().clear(); - log << "CUDAService fully initialized"; + if (verbose_) { + log << "CUDAService fully initialized"; + } enabled_ = true; // Preallocate buffers if asked to @@ -336,6 +358,7 @@ CUDAService::~CUDAService() { void CUDAService::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("enabled", true); + desc.addUntracked("verbose", false); edm::ParameterSetDescription limits; limits.addUntracked("cudaLimitPrintfFifoSize", -1) diff --git a/HeterogeneousCore/CUDAServices/test/testCUDAService.py b/HeterogeneousCore/CUDAServices/test/testCUDAService.py index 8c634a9e260bd..b7058925da288 100644 --- a/HeterogeneousCore/CUDAServices/test/testCUDAService.py +++ b/HeterogeneousCore/CUDAServices/test/testCUDAService.py @@ -2,9 +2,16 @@ process = cms.Process( "TEST" ) +process.options = cms.untracked.PSet( + numberOfThreads = cms.untracked.uint32( 4 ), + numberOfStreams = cms.untracked.uint32( 0 ), +) + process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.CUDAService = {} + process.load('HeterogeneousCore.CUDAServices.CUDAService_cfi') -process.MessageLogger.CUDAService=dict() +process.CUDAService.verbose = True process.source = cms.Source("EmptySource") From 80ac72e32cb01d3f8e2c54a350cd813af3736edd Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 02:10:32 +0200 Subject: [PATCH 651/923] Enable the CUDAService in the MessageLogger by default --- Configuration/StandardSequences/python/Services_cff.py | 4 +++- HLTrigger/Configuration/python/customizeHLTforPatatrack.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Configuration/StandardSequences/python/Services_cff.py b/Configuration/StandardSequences/python/Services_cff.py index 0949c7b8d4972..f68e2e399e9e9 100644 --- a/Configuration/StandardSequences/python/Services_cff.py +++ b/Configuration/StandardSequences/python/Services_cff.py @@ -10,7 +10,9 @@ # load CUDA services when the "gpu" or "pixelNtupletFit" modifiers are enabled def _addCUDAServices(process): - process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + process.load("FWCore.MessageService.MessageLogger_cfi") + process.MessageLogger.CUDAService = cms.untracked.PSet() from Configuration.ProcessModifiers.gpu_cff import gpu from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit diff --git a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py index 89987dd8320f9..d133b2978f46b 100644 --- a/HLTrigger/Configuration/python/customizeHLTforPatatrack.py +++ b/HLTrigger/Configuration/python/customizeHLTforPatatrack.py @@ -24,8 +24,10 @@ def customiseCommon(process): # Services process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + if 'MessageLogger' in process.__dict__: + process.MessageLogger.CUDAService = cms.untracked.PSet() - # NVProfilerService is broken in CMSSW 12.0,x and later + # NVProfilerService is broken in CMSSW 12.0.x and later #process.load("HeterogeneousCore.CUDAServices.NVProfilerService_cfi") From 23dd46be710d20a76dae1a89aad0da7326f1b2cf Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 10:41:45 +0200 Subject: [PATCH 652/923] Add nvmlCheck macro to validate NVIDIA Management Library (NVML) calls --- HeterogeneousCore/CUDAUtilities/BuildFile.xml | 1 + .../CUDAUtilities/interface/nvmlCheck.h | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h diff --git a/HeterogeneousCore/CUDAUtilities/BuildFile.xml b/HeterogeneousCore/CUDAUtilities/BuildFile.xml index e7193e1ccfd87..4286d0d104dcd 100644 --- a/HeterogeneousCore/CUDAUtilities/BuildFile.xml +++ b/HeterogeneousCore/CUDAUtilities/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h b/HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h new file mode 100644 index 0000000000000..8802bb29e699d --- /dev/null +++ b/HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h @@ -0,0 +1,54 @@ +#ifndef HeterogeneousCore_CUDAUtilities_nvmlCheck_h +#define HeterogeneousCore_CUDAUtilities_nvmlCheck_h + +// C++ standard headers +#include +#include +#include +#include +#include + +// CUDA headers +#include + +// CMSSW headers +#include "FWCore/Utilities/interface/Likely.h" + +namespace cms { + namespace cuda { + + [[noreturn]] inline void abortOnNvmlError(const char* file, + int line, + const char* cmd, + const char* error, + const char* message, + std::string_view description = std::string_view()) { + std::ostringstream out; + out << "\n"; + out << file << ", line " << line << ":\n"; + out << "nvmlCheck(" << cmd << ");\n"; + out << error << ": " << message << "\n"; + if (!description.empty()) + out << description << "\n"; + throw std::runtime_error(out.str()); + } + + inline bool nvmlCheck_(const char* file, + int line, + const char* cmd, + nvmlReturn_t result, + std::string_view description = std::string_view()) { + if (LIKELY(result == NVML_SUCCESS)) + return true; + + std::string error = "NVML Error " + std::to_string(result); + const char* message = nvmlErrorString(result); + abortOnNvmlError(file, line, cmd, error.c_str(), message, description); + return false; + } + } // namespace cuda +} // namespace cms + +#define nvmlCheck(ARG, ...) (cms::cuda::nvmlCheck_(__FILE__, __LINE__, #ARG, (ARG), ##__VA_ARGS__)) + +#endif // HeterogeneousCore_CUDAUtilities_nvmlCheck_h From 7e865900e4ca114969eb66231793612c8efda196 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 2 Sep 2021 10:42:17 +0200 Subject: [PATCH 653/923] Print the NVIDIA and CUDA driver and library versions --- HeterogeneousCore/CUDAServices/BuildFile.xml | 1 + .../CUDAServices/src/CUDAService.cc | 49 +++++++++++++++---- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/HeterogeneousCore/CUDAServices/BuildFile.xml b/HeterogeneousCore/CUDAServices/BuildFile.xml index 5fcaf5e5527b0..a48e1c639eaf3 100644 --- a/HeterogeneousCore/CUDAServices/BuildFile.xml +++ b/HeterogeneousCore/CUDAServices/BuildFile.xml @@ -5,6 +5,7 @@ + diff --git a/HeterogeneousCore/CUDAServices/src/CUDAService.cc b/HeterogeneousCore/CUDAServices/src/CUDAService.cc index 85a1a96ec95fe..03ae240fc902b 100644 --- a/HeterogeneousCore/CUDAServices/src/CUDAService.cc +++ b/HeterogeneousCore/CUDAServices/src/CUDAService.cc @@ -3,6 +3,8 @@ #include #include +#include +#include #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -10,13 +12,14 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/ReusableObjectHolder.h" #include "HeterogeneousCore/CUDAServices/interface/CUDAService.h" -#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" #include "HeterogeneousCore/CUDAUtilities/interface/EventCache.h" #include "HeterogeneousCore/CUDAUtilities/interface/StreamCache.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cachingAllocators.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" +#include "HeterogeneousCore/CUDAUtilities/interface/currentDevice.h" #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/interface/cachingAllocators.h" +#include "HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h" void setCudaLimit(cudaLimit limit, const char* name, size_t request) { // read the current device @@ -83,6 +86,10 @@ constexpr unsigned int getCudaCoresPerSM(unsigned int major, unsigned int minor) } } +std::string decodeVersion(int version) { + return std::to_string(version / 1000) + '.' + std::to_string(version % 1000 / 10); +} + namespace { template